Fold subsurfaceflow into natural barriers for per-species obs/habitat lift#89
Merged
Merged
Conversation
Baseline planning files: task_plan, findings, progress. Relates to #88
Subsurfaceflow positions (FWA edge_type 1410/1425) are unioned into fresh.streams_breaks with label 'blocked' but never entered <schema>.natural_barriers. lnk_barrier_overrides() runs on natural_barriers, so the per-species observation/habitat-upstream lift never fired for subsurfaceflow — every position hard-blocked all species, even where bcfishpass lifts it. bcfishpass model_access_bt.sql + model_access_ch_cm_co_pk_sk.sql define the natural-barrier set as gradient + falls + subsurfaceflow + user_definite. .lnk_pipeline_prep_natural already implemented three of those four; the missing entry was the bug. Folds the standalone .lnk_pipeline_prep_subsurfaceflow body into .lnk_pipeline_prep_natural, gated on cfg$pipeline$break_order containing "subsurfaceflow". Default-bundle off-switch preserved verbatim (no entry, no code path, default rollup bit-identical). Six prep helpers, five now. Verification (15-WSG tar_make, bcfishpass-bundle parity): - HARR CH/CO/ST rearing_stream: -14.8/-13.3/-11.6% to within +/- 0.32% - HARR BT rearing_stream: -10.4% to -4.19% (residual separate mechanism) - LFRA CH/CO/ST: closed to within +/- 0.6% - HARR blkey 356286055: BT credits 6.509 km (was 0) - Default-bundle bit-identical (0 of 581 rows changed) - HORS rearing_stream unchanged (-7.68%), follow-up needed Fixes #88 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- task_plan: tick Phases 2-5 except reproducibility (running) - progress: code change, code-check, pre-flight, 15-WSG outcome - verification logs: - 20260430_11_preflight_harr_link88.txt (HARR single-WSG, 89.5s) - 20260430_12_tar_make_15wsg_link88.txt (full 15-WSG, 53m 2.2s, 33/33) - 20260430_1802_rollup_full_post88.csv - 20260430_1802_parity_post88.csv - 20260430_1802_methodology_post88.csv Relates to #88
Second tar_make landed byte-identical to first: - 33/33 targets, 52m 55s - 0 of 1057 link_value rows differ - digest of link_value vector: 5a641892b82604259b0ba168ea093661 (matches first run) Closes verification phase. Ready to PR. Relates to #88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Subsurfaceflow positions (FWA
edge_type IN (1410, 1425)) were unioned intofresh.streams_breakswith labelblockedbut never entered<schema>.natural_barriers.lnk_barrier_overrides()runs onnatural_barriers, so the per-species observation/habitat-upstream lift never fired for subsurfaceflow — every position hard-blocked all species, even where bcfishpass lifts it.Folds the standalone
.lnk_pipeline_prep_subsurfaceflowbody into.lnk_pipeline_prep_natural, gated oncfg$pipeline$break_ordercontaining"subsurfaceflow". bcfishpass's source-of-truth (model_access_bt.sql,model_access_ch_cm_co_pk_sk.sql) defines the natural-barrier set asgradient + falls + subsurfaceflow + user_definite.prep_naturalalready implemented three of those four — the missing entry was the bug.Six prep helpers → five.
Behaviour
natural_barriers→ per-species lift applies → bcfp parity restored on Lower-Fraser/coastal WSGs.break_order): early-return insideprep_naturalskips the entire subsurfaceflow code path. No<schema>.barriers_subsurfaceflowtable, nonatural_barriersrows, nostreams_breaksrows downstream. Verified bit-identical default rollup (0 of 581 rows changed).Verification (15-WSG
tar_make)Distribution: 162 → 171 within ±5%, 123 within ±1%. Per-WSG
n_over_5: HARR 11→4, LFRA 6→4, HORS unchanged.Reproducibility: Second
tar_makebyte-identical to first. 0 of 1057link_valuerows differ.digest::digest(link_value)matches across runs (5a641892b82604259b0ba168ea093661).Test plan
devtools::test(filter = "lnk_pipeline_prepare")— 44/44 pass/code-check— 3 rounds, fragile cross-statement regex tightened to per-statement matchtar_make— 53m 2s, 33/33 targetsArchitecture note
.lnk_pipeline_prep_subsurfaceflow(added in #82) treated subsurfaceflow as a parallel pipeline phase needing its own helper.prep_naturalwas always the right home — bcfp's natural-barrier union is gradient + falls + subsurfaceflow, andprep_naturalalready built the first two. Folding back keeps a single function responsible for "natural barriers in bcfp's sense."Follow-ups (out of scope)
barrier/potentiallabels for crossings still don't gate by default.Fixes #88
Relates to NewGraphEnvironment/sred-2025-2026#24