You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Modelling stands on its own. The link pipeline produces the BC freshwater network model — PG fresh.* tables. That's the deliverable. It must be runnable end-to-end without any comparison framework attached.
Comparison is separate. Parity vs bcfishpass (or any future reference: federal data, regression-against-previous-run, etc.) is a diagnostic overlay on top of the canonical model. It reads from PG, produces side artifacts (RDS, annotated CSV), and never gates whether the model itself ran.
Today these are coupled — modelling and comparison live inside one function (compare_bcfishpass_wsg.R) called from one loop (run_provincial_parity.R). The loop's resume-check uses RDS existence (the comparison artifact), not PG state (the model). Result: a stale comparison RDS silently skips re-running the model, even when PG never received the model output.
Concrete reproduction (2026-05-14)
While running a 16-WSG --no-cyphers integration test on the #172 branch, the dispatch reported 16 OK, 0 errors but only 12 of 16 WSGs actually populated fresh_default.streams. Four WSGs (FINA, CRKD on M4; INGR, MESI on M1) had stale RDS files from earlier failed attempts. The cache-skip in run_provincial_parity.R:200-205 saw the RDS and skipped them:
lnk_compare_one() is reference-agnostic via the reference arg — "bcfishpass" today, future references plug in without naming changes.
Today's lnk_compare_wsg() becomes a thin convenience wrapper that calls both (for backwards-compat with operators who want the bundled behavior). New code uses the two split functions.
Split into the two concerns. wsg_compare.R is reference-agnostic, not bcfp-specific.
The other 8 script renames (trifecta_provincial.sh → wsgs_dispatch.sh etc.) stay in #172, which builds the autonomy CLI surface on top of this decoupled foundation.
PG is the canonical state. RDS is a diagnostic side-artifact. Operator can drop PG rows to force re-model, or delete RDS to force re-compare — independently.
--force flag
Operator-friendly opt-out of all caching for a re-dispatch:
Principle
Modelling stands on its own. The link pipeline produces the BC freshwater network model — PG
fresh.*tables. That's the deliverable. It must be runnable end-to-end without any comparison framework attached.Comparison is separate. Parity vs bcfishpass (or any future reference: federal data, regression-against-previous-run, etc.) is a diagnostic overlay on top of the canonical model. It reads from PG, produces side artifacts (RDS, annotated CSV), and never gates whether the model itself ran.
Today these are coupled — modelling and comparison live inside one function (
compare_bcfishpass_wsg.R) called from one loop (run_provincial_parity.R). The loop's resume-check uses RDS existence (the comparison artifact), not PG state (the model). Result: a stale comparison RDS silently skips re-running the model, even when PG never received the model output.Concrete reproduction (2026-05-14)
While running a 16-WSG
--no-cyphersintegration test on the #172 branch, the dispatch reported16 OK, 0 errorsbut only 12 of 16 WSGs actually populatedfresh_default.streams. Four WSGs (FINA,CRKDon M4;INGR,MESIon M1) had stale RDS files from earlier failed attempts. The cache-skip inrun_provincial_parity.R:200-205saw the RDS and skipped them:Reference run:
data-raw/logs/202605141122_trifecta_provincial_orchestrator.txt.Proposed: decoupled architecture
Two independent functions
lnk_pipeline_run(conn, wsg, cfg, ...)lnk_pipeline_*chain end-to-endfresh.streams,fresh.streams_habitat_<sp>,fresh.barriersfor this WSGlnk_compare_one(conn, conn_ref, wsg, cfg, reference, ...)lnk_compare_one()is reference-agnostic via thereferencearg —"bcfishpass"today, future references plug in without naming changes.Today's
lnk_compare_wsg()becomes a thin convenience wrapper that calls both (for backwards-compat with operators who want the bundled behavior). New code uses the two split functions.data-raw/companions, renamed for honestydata-raw/compare_bcfishpass_wsg.Rdata-raw/wsg_pipeline_run.R+data-raw/wsg_compare.Rwsg_compare.Ris reference-agnostic, not bcfp-specific.The other 8 script renames (
trifecta_provincial.sh→wsgs_dispatch.shetc.) stay in #172, which builds the autonomy CLI surface on top of this decoupled foundation.Resume-check uses PG, not the filesystem
PG is the canonical state. RDS is a diagnostic side-artifact. Operator can drop PG rows to force re-model, or delete RDS to force re-compare — independently.
--forceflagOperator-friendly opt-out of all caching for a re-dispatch:
--forceignores both PG presence and RDS presence; re-runs both pipeline and compare.Acceptance
R/lnk_pipeline_run.Rexported: runs link pipeline for one WSG, writes to PG, returns invisibly.R/lnk_compare_one.Rexported: runs comparison query for one WSG, returns tibble. Reference-agnostic.R/lnk_compare_wsg.Rbecomes a thin convenience wrapper calling both (deprecation note in docs but kept for compat).data-raw/compare_bcfishpass_wsg.Rdeleted;data-raw/wsg_pipeline_run.R+data-raw/wsg_compare.Radded.data-raw/run_provincial_parity.Rupdated to use PG-state resume check + the two new functions. (Rename towsgs_run_host.Rstays in Provincial run autonomy: rename scripts to noun_verb + single 'approve once, builds end-to-end' wrapper #172.)--forcere-runs both regardless of cache state.devtools::test()passes.Out of scope (separate issues)
lnk_persist_initsimplification waits for rtj#145.Cross-ref
data-raw/logs/202605141122_trifecta_provincial_orchestrator.txt