Problem
cabd_additions.csv rows carry barrier_ind = t, but they are structurally incapable of becoming barriers. The US placeholder dams — Grand Coulee, Chief Joseph, Ross — are in the CSV precisely so the model knows the Columbia is blocked downstream, and they do nothing.
Mechanism
.lnk_pipeline_prep_dams()'s usa CTE (R/lnk_pipeline_prepare.R, the cabd_additions branch) hardcodes:
NULL::integer AS passability_status_code
.lnk_crossings_union() then maps that code to barrier_status:
CASE
WHEN d.passability_status_code = 1 THEN 'BARRIER'
WHEN d.passability_status_code = 2 THEN 'POTENTIAL'
...
END AS barrier_status
There is no NULL arm, so barrier_status is NULL, and every downstream consumer filters barrier_status IN ('BARRIER','POTENTIAL'). The rows are dropped.
Verified
SELECT count(*) FROM fresh.barriers WHERE id_barrier ~ '^12000';
-- 0
(usa synthesises dam_id as row_number() + 1200000000, so ^12000 selects exactly the additions.)
Why it matters
The CSV column says these are barriers and the model says they are not. Anyone reading cabd_additions.csv reasonably concludes the Columbia is modelled as blocked at the border. It is not.
It also constrains link#227's downstream guard, which must mirror this behaviour exactly — a guard that treated the additions as blocking would demand an override for every Columbia watershed group. That is pinned by a test (test-lnk_pipeline_prepare.R, "applies the cabd_additions psc-NULL rule") so a fix here is deliberate rather than incidental.
Options
- Map
barrier_ind → passability_status_code in the usa CTE (t → 1). Makes the additions behave as the CSV advertises; changes access results for Columbia groups, so it needs a parity check.
- Add a
WHEN ... IS NULL THEN 'BARRIER' arm to the CASE — narrower, same effect for additions only.
- Decide the additions are documentation-only and rename the column so it stops implying otherwise.
Worth settling deliberately: (1) and (2) change modelled access in the Columbia; (3) changes nothing but stops the file misleading readers.
Refs
- Found during link#227 (downstream-state guard); pinned by the test above.
RUNBOOK.md §8c documents the guard's mirroring of this rule.
Problem
cabd_additions.csvrows carrybarrier_ind = t, but they are structurally incapable of becoming barriers. The US placeholder dams — Grand Coulee, Chief Joseph, Ross — are in the CSV precisely so the model knows the Columbia is blocked downstream, and they do nothing.Mechanism
.lnk_pipeline_prep_dams()'susaCTE (R/lnk_pipeline_prepare.R, thecabd_additionsbranch) hardcodes:.lnk_crossings_union()then maps that code tobarrier_status:There is no
NULLarm, sobarrier_statusis NULL, and every downstream consumer filtersbarrier_status IN ('BARRIER','POTENTIAL'). The rows are dropped.Verified
(
usasynthesisesdam_idasrow_number() + 1200000000, so^12000selects exactly the additions.)Why it matters
The CSV column says these are barriers and the model says they are not. Anyone reading
cabd_additions.csvreasonably concludes the Columbia is modelled as blocked at the border. It is not.It also constrains link#227's downstream guard, which must mirror this behaviour exactly — a guard that treated the additions as blocking would demand an override for every Columbia watershed group. That is pinned by a test (
test-lnk_pipeline_prepare.R, "applies the cabd_additions psc-NULL rule") so a fix here is deliberate rather than incidental.Options
barrier_ind→passability_status_codein theusaCTE (t→ 1). Makes the additions behave as the CSV advertises; changes access results for Columbia groups, so it needs a parity check.WHEN ... IS NULL THEN 'BARRIER'arm to the CASE — narrower, same effect for additions only.Worth settling deliberately: (1) and (2) change modelled access in the Columbia; (3) changes nothing but stops the file misleading readers.
Refs
RUNBOOK.md§8c documents the guard's mirroring of this rule.