Migrate pipeline probes to manifest-driven gating (#46)#50
Merged
NewGraphEnvironment merged 2 commits intomainfrom Apr 23, 2026
Merged
Migrate pipeline probes to manifest-driven gating (#46)#50NewGraphEnvironment merged 2 commits intomainfrom
NewGraphEnvironment merged 2 commits intomainfrom
Conversation
Pure refactor — no behavior change. Two `information_schema.tables` probes in `R/lnk_pipeline_prepare.R` replaced with direct checks of the `lnk_config` manifest: - `.lnk_pipeline_prep_gradient()` gains a `cfg` parameter. The probe for `<schema>.barriers_definite_control` before the gradient-barrier DELETE is now `!is.null(cfg$overrides$barriers_definite_control)`. Caller in `lnk_pipeline_prepare()` updated to pass `cfg`. - `.lnk_pipeline_prep_overrides()` probe for `<schema>.user_habitat_classification` replaced with `!is.null(cfg$habitat_classification)`. Rationale: the config manifest is the declarative contract for which capabilities a pipeline variant activates. The probes worked because `.lnk_pipeline_prep_load_aux()` writes each table exactly when the manifest declares the key, but that indirection made empty-table edge cases easier to miss (see the asymmetric-gating bug fixed in #44, rooted in the same seam). Manifest-key gating is consistent with the per-capability pattern introduced in #44 for the barrier-override control wiring. Code-check round-1 surfaced a matching asymmetry on the habitat side: the new manifest gate at prep_overrides would return non-NULL for a degenerate (header-only) habitat CSV, but `.lnk_pipeline_prep_load_aux()` wrote no table in that case, so `lnk_barrier_overrides()` would error on SELECT from a missing relation. Fixed by mirroring the `barriers_definite_control` pattern: always create a schema-valid `user_habitat_classification` table when the manifest declares the key, empty or populated. Now the manifest key is the true contract. Tests (`test-lnk_pipeline_prepare.R`): - Replaced DBI::dbGetQuery mocks in prep_gradient tests with `cfg` stubs that either include or omit the manifest key. Two tests cover both branches (no-key → no DELETE emitted; key-present → DELETE emitted). - Added two new tests for prep_overrides' habitat gate — manifest declares → `habitat = "<schema>.user_habitat_classification"`; manifest omits → `habitat = NULL`. Verification: - `devtools::test()` 282 PASS 0 FAIL. - `tar_destroy + tar_make` produces rollup with digest `50908d234e2131fc0842dc3ab653ae78` (46 rows) — bit-identical to the post-#48 baseline. Second rebuild after the empty-stub fix also bit-identical. No behavior drift on the bcfishpass config. Fixes #46
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
Pure refactor — no behavior change. Two
information_schema.tablesprobes inR/lnk_pipeline_prepare.Rreplaced with direct checks against thelnk_configmanifest:.lnk_pipeline_prep_gradient()gains acfgparameter. The probe for<schema>.barriers_definite_controlbefore the gradient-barrierDELETEis now!is.null(cfg$overrides$barriers_definite_control). Caller inlnk_pipeline_prepare()updated..lnk_pipeline_prep_overrides()probe for<schema>.user_habitat_classificationreplaced with!is.null(cfg$habitat_classification).Rationale: the config manifest is the declarative contract for which capabilities a pipeline variant activates. The old probes worked because
.lnk_pipeline_prep_load_aux()writes each table exactly when the manifest declares the key, but that indirection made empty-table edge cases easier to miss — the asymmetric-gating bug fixed in #44 was rooted in this exact seam. Manifest-key gating is consistent with the per-capability pattern introduced in #44 for the barrier-override control wiring.Secondary fix (surfaced by code-check)
Round 1 of
/code-checkcaught a matching asymmetry on the habitat side: the new manifest gate atprep_overrideswould return non-NULL for a degenerate (header-only)habitat_classificationCSV, but.lnk_pipeline_prep_load_aux()wrote no table in that case, solnk_barrier_overrides()would error onSELECTfrom a missing relation. Fixed by mirroring thebarriers_definite_controlpattern: always create a schema-validuser_habitat_classificationtable when the manifest declares the key (empty or populated). The manifest key is now the true contract on both sides.Verification
devtools::test()— 282 PASS, 0 FAIL.tar_destroy + tar_makeproduce rollup with digest50908d234e2131fc0842dc3ab653ae78(46 rows) — bit-identical to the post-user_barriers_definite bypasses override in bcfishpass but is eligible in link #48 baseline./code-checkround 1 clean on the original 4 checks; flagged the empty-stub asymmetry which was fixed before commit.DBI::dbGetQuerymocks inprep_gradienttests withcfgstubs; added two new tests covering theprep_overrideshabitat gate (declared/omitted).Fixes #46
Relates to NewGraphEnvironment/sred-2025-2026#24
🤖 Generated with Claude Code