Skip to content

Keep one copy of 25 duplicated helpers, in R/ (part of #10) - #11

Merged
wolski merged 1 commit into
mainfrom
dedup-pure-helpers
Nov 3, 2026
Merged

wolski merged 1 commit into
mainfrom
dedup-pure-helpers

Conversation

@wolski

@wolski wolski commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Part of #10. First of two steps; the 6 helpers that read server-scope reactives follow in a second PR.

Why

  • The app sources R/ and then server-*.R into the server scope, so a helper defined in both ran the server copy in the app and the R/ copy in the tests
  • 13 pairs had drifted; e.g. test-ordination.R asserted step_log2(..., "TPM") while the app passes lowercase assay keys

Changes

  • Server copies deleted, R/ copy kept (identical code, 15): batch_correction_design, collapse_guides_to_genes, is_url, parse_gene_text, select_genes_by_sd, plot_ordination_samples, step_batch_correction, step_group_subset, step_top_n_sd, buildCitationsList, detectDEMethod, formatRefBuild, generateMethodsText, getFastpVersion, getPackageVersions
  • Server copies deleted, R/ copy kept (differed only in pkg:: prefixes, 7): apply_batch_correction, calculate_pca, calculate_pcoa, calculate_glmpca, prepare_biplot_data, dataSummary, detectAligner
  • App version moved into R/, server copy deleted, tests updated (3): step_log2 (lowercase assay keys), step_peptide_filter (takes the DE table, checks for nrPeptides), plot_ordination_biplot (arrow labels from a label column, falling back to gene)
  • inst/app/input_example.R deleted: never sourced, held 7 more old copies
  • New guard test test-no_duplicate_helpers.R: app files must not redefine package functions (6 pending helpers allowlisted)

Behaviour: none for the app. Every helper now runs the code the app ran before; the 3 drifted ones keep the app's version.

Deployment: prod sources exploreDE/R from the same checkout (app.R, ../../R), so a git pull ships R/ and inst/app/ together; no base-image change.

Verified locally

  • Full test suite: 1133 pass; 3 failures in test-prolfquapp_h5ad.R, identical on unchanged main (local prolfquapp 2.11.1 writes h5ad varm the reader rejects), unrelated
  • Guard test fails when the old server-summary.R is restored (names the 7 helpers), passes after reverting
  • App smoke run from this branch with the demo dataset: Methods text, Ordination (PCA, biplot, PCoA, NMDS, GLM-PCA), Heatmaps, Boxplot + Barplot (features from the DE table), Correlations, Replicability, DE QC: no errors on page or in the R log
  • Not exercised in the app (tests only): batch correction, CountQC/CRISPR-only helpers, URL loading

Prepared with the assistance of an AI coding agent.

The app sources R/ and then server-*.R into the server scope, so a helper
defined in both places always ran the server copy while the tests ran the
R/ copy, and 13 pairs had drifted.

- Delete the server copies of 15 identical helpers and of 7 that differed
  only in pkg:: prefixes; the R/ versions are now the ones the app runs
- step_log2, step_peptide_filter, plot_ordination_biplot: move the app's
  version into R/ and update their tests (lowercase assay keys, DE table
  instead of seqAnnoList, label column for biplot arrows)
- Delete inst/app/input_example.R: never sourced, held 7 more old copies
- Add a guard test: app files must not redefine package functions; the
  6 helpers that read server-scope reactives are still allowlisted

Assisted-by: AI coding agent
@wolski
wolski merged commit 293f30c into main Nov 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant