Skip to content

v0.40.1: lnk_pipeline_run mapping_code uses active_species (#192) - #193

Merged
NewGraphEnvironment merged 3 commits into
mainfrom
192-pipeline-run-mapping-code-bundle-species
May 19, 2026
Merged

NewGraphEnvironment merged 3 commits into
mainfrom
192-pipeline-run-mapping-code-bundle-species

Conversation

@NewGraphEnvironment

Copy link
Copy Markdown
Owner

Summary

v0.40.0 hotfix. lnk_pipeline_run(mapping_code = TRUE) hardcoded the bcfp 8-species set instead of using the bundle's active_species → working streams_access column shape mismatched persist streams_access (created with bundle species) → INSERT errored on every non-bcfp bundle. Closes #192.

Live smoke verified the fix: lnk_pipeline_run(aoi="PARS", cfg=lnk_config("default"), mapping_code=TRUE) against fresh_default → 48559 rows in fresh_default.streams_mapping_code for PARS, populated mapping_code_bt / _gr / _ko / _rb with valid ACCESS/SPAWN/REAR token distributions. Wall: 213.1s.

Fix

In R/lnk_pipeline_run.R mapping_code phase:

  • lnk_barriers_views(species = active_species, ...) — was using bcfp 8 default
  • lnk_pipeline_access(barriers_per_sp = setNames(..., active_species)) — was hardcoded bcfp 8
  • lnk_mapping_code(species_resident = ..., species_anadromous = ..., species_spawn_only = ...) — intersection of bcfp residence defaults with active_species; species in active_species not in any bcfp category (e.g. GR/KO/RB) fall through to species_resident. Placeholder until Data-drive species residence (species_resident/anadromous/spawn_only) from dimensions.csv #189 data-drives this from dimensions.csv.

How this got past v0.40.0

The pre-merge code-check rounds caught the bcfp-naming-leakage in lnk_compare_wsg (Phase 5) and the param shadowing (Phase 6). What they couldn't catch: the species-set assumption baked into pipeline_run's mapping_code phase, because the existing 1119 tests don't exercise that branch with a non-bcfp bundle. The default-bundle smoke (Phase 7) was deferred. #191 tracks the test catch-up that would have caught this.

Test plan

  • /code-check round 1 caught a misleading comment in the fix (claimed lnk_barriers_views still creates 8 views with caller picking subset; actually creates only active_species views). Fixed in commit 2.
  • Live smoke (default bundle, PARS, end-to-end pipeline_run → persist) — 48559 rows in streams_mapping_code with all 4 species populated
  • No regression in bcfishpass-bundle path (active_species = full bcfp 8 → identical behavior to v0.40.0)
  • devtools::test() 1119 PASS / 0 FAIL — covered by pre-existing suite

Related

NewGraphEnvironment and others added 3 commits May 19, 2026 08:33
…ed bcfp 8 (#192)

v0.40.0 hardcoded sp_set = c("bt","ch","cm","co","pk","sk","st","wct") and
called lnk_barriers_views without a species arg (defaults to bcfp 8).
Working streams_access got 8-species cols; persist streams_access (created
by lnk_persist_init with active_species = bundle species) had the bundle
subset. Persist INSERT projection failed with
  ERROR: column a.has_barriers_ko_dnstr does not exist
for any bundle that wasn't the full bcfishpass 8.

Fix:
- lnk_barriers_views(species = active_species)
- lnk_pipeline_access barriers_per_sp keyed by active_species
- lnk_mapping_code species_<role> args = intersection of bcfp residence
  defaults with active_species. Species in active_species not in any
  bcfp residence category (GR/KO/RB in default bundle) fall through to
  species_resident (placeholder until #189 data-drives this from
  dimensions.csv).

Verified by live smoke: lnk_pipeline_run(aoi="PARS", cfg=lnk_config("default"),
mapping_code=TRUE) → fresh_default.streams_mapping_code has 48559 rows for
PARS with mapping_code_bt / _gr / _ko / _rb columns populated with valid
ACCESS/SPAWN/REAR token distributions. Wall: 213.1s.

No regression in bcfishpass-bundle path (active_species = full bcfp 8 →
identical behavior to v0.40.0).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The Phase 2 comment in pipeline_run's mapping_code block (post-#192 fix)
claimed lnk_barriers_views still created views for all 8 bcfp species and
the access call picked a subset. Actually the fix passes
`species = active_species` to lnk_barriers_views — views are created only
for active species. Comment reworded to match.

No functional change. Caught by code-check on the v0.40.1 PR before merge.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@NewGraphEnvironment
NewGraphEnvironment merged commit 47f6e26 into main May 19, 2026
1 check passed
@NewGraphEnvironment
NewGraphEnvironment deleted the 192-pipeline-run-mapping-code-bundle-species branch May 19, 2026 15:50
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.

lnk_pipeline_run: mapping_code phase hardcodes bcfp 8 species → fails on non-bcfp bundles

1 participant