feat(totlib): activate eq->tr BPSD verify rule on mono (#208 Phase 2c PR-B)#214
Merged
Conversation
Populates TotPipeline._MONO_ONLY_RULES with a single verify-kind
CouplingRule that wraps Trlib.check_bpsd_pull(). The rule fires
when TotPipeline.run_pipeline([("eq",...),("tr",...)]) is invoked
against the mono image (_detect_mono() == True after PR-A's
MONO_LIB_PATH routing); it stays dormant on the default per-module
image via the existing _build_active_rules() overlay.
The rule body is a named module-level callable
(_eq_to_tr_bpsd_check) per spec §4 D-2 so pipeline error messages
show a meaningful __qualname__ instead of `<lambda>`.
Spec §4 D-4 empirical resolution: `eq_init -> eq_run(1) -> tr_init
-> tr_check_bpsd_pull` returns ok=1 on the mono image; tr_init
does NOT clear the bpsd broker slots that eq just pushed. This is
the ordering TotPipeline.run_pipeline exercises with no prior
tr-side set_param.
First Layer-D test
(test_mono_pipeline_coupling.py::TestEqToTrPipelineCoupling) drives
the full pipeline through eq -> tr on mono and asserts the rule
appears in result.last("tr").coupling_applied. Negative test
follows in the next commit.
Also adds monkeypatch.setattr("totlib.pipeline._MONO_ONLY_RULES", {})
to test_pipeline_verify.py::test_verify_true_records_rule_in_applied
so that unit test is not affected by MONO_LIB_PATH presence; the
mono overlay behaviour is now covered by the new Layer-D test.
Spec: docs/superpowers/specs/2026-05-26-l7b-ii-phase-2c-prb-rule-activation-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…PR-B)
Adds TestEqToTrRuleDormantOnDefault to
python/totlib/tests/test_mono_pipeline_coupling.py. Asserts the
inverse contract to the happy-path test in the prior commit:
when MONO_LIB_PATH is unset, TotPipeline.run_pipeline([("eq",..),
("tr",..)]) completes without the ("eq","tr") verify rule firing.
Pipeline succeeds because the rule stays dormant via the Phase 2b
overlay mechanism (_detect_mono() returns False on the default
per-module image).
Skip-gate is _default_per_module_so_present() — checks the actual
.so paths eqlib/trlib/totlib will load via priority-2 repo
defaults. Per Codex 2026-05-26 spec round-3 review, TOTLIB_PATH
env var is NOT in the gate (eqlib/trlib don't honor it).
Pin for Codex 2026-05-26 design review MED-6: if a future refactor
of _detect_mono() / _build_active_rules() silently activates the
overlay on non-mono, this test catches it at the user-facing
TotPipeline entry point.
Spec: docs/superpowers/specs/2026-05-26-l7b-ii-phase-2c-prb-rule-activation-design.md
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extends the mono build (Linux libtotapi_mono.so) job to run python/totlib/tests/test_mono_pipeline_coupling.py with both MONO_LIB_PATH and TOTLIB_PATH set so both test classes execute. The default libtotapi.so and per-module .so files are already built earlier in this job; PR-B reuses them. Step is added directly after PR #212's "Mono routing sanity" step in the same job. Spec: docs/superpowers/specs/2026-05-26-l7b-ii-phase-2c-prb-rule-activation-design.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Appends a one-paragraph note to the existing Mono routing section that PR #212 added. Documents that the eq -> tr BPSD coupling rule now fires through TotPipeline.run_pipeline when MONO_LIB_PATH is set, and stays dormant on the default per-module image. No code or behavior changes — pure documentation. Spec: docs/superpowers/specs/2026-05-26-l7b-ii-phase-2c-prb-rule-activation-design.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Addresses Codex 2026-05-26 cumulative PR-B review:
LOW-1: TestEqToTrRuleDormantOnDefault.test_eq_to_tr_rule_dormant_on_default
only popped MONO_LIB_PATH. Inherited EQLIB_PATH / TRLIB_PATH
could route the wrappers away from the repo-default per-module
.so files the test asserted exist. Now pop+restore all three.
LOW-2: test_pipeline_verify.test_mixed_transfer_then_verify_fires_in_order
patched COUPLING_RULES but not _MONO_ONLY_RULES. Under
MONO_LIB_PATH it would silently fire the real ("eq","tr") mono
rule alongside the mock rules and break the exact-order
assertion. Apply the same _MONO_ONLY_RULES = {} isolation
that test_verify_true_records_rule_in_applied got in Task 1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 65c354d. Configure here.
This was referenced May 26, 2026
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
Closes #208 (Phase 2c umbrella) and #201 (Phase 2 umbrella).
Activates the
(\"eq\",\"tr\")BPSD coupling rule inTotPipeline._MONO_ONLY_RULES— now possible after PR-A'sMONO_LIB_PATHplumbing landed (#212). Adds a Layer-Dintegration test that drives
TotPipeline.run_pipeline([(eq, ...), (tr, ...)])on the mono image AND asserts the rule staysdormant on the default per-module image.
What's in this PR (5 commits)
feat(totlib): activate (\"eq\",\"tr\") BPSD verify rule on mono— populates_MONO_ONLY_RULESwith the verify rule; named module-level callable (_eq_to_tr_bpsd_check) so error-message__qualname__is meaningful; Layer-D happy-path test.test(totlib): negative path — rule dormant on default per-module— adds the inverse contract test pinning Codex MED-6.ci(python-tests): mono pipeline coupling step— extends mono-build job to run the new test with both env vars set.docs(totlib): note (\"eq\",\"tr\") rule activation in README— 1-paragraph note appended to PR-A's mono routing section.test(totlib): isolate env vars + _MONO_ONLY_RULES— Codex cumulative review LOW fixups (defensive env-var popping in negative test + monkeypatch isolation in test_pipeline_verify).Acceptance (spec §11)
_MONO_ONLY_RULES[(\"eq\",\"tr\")]populated per §6.test_mono_pipeline_coupling.pywith 2 cases per §7.pytest --forked.test_equivalence.pyuntouched).test_mono_routing.pystays green (9 tests)._build_active_rules()/_detect_mono()untouched — verified by diff.Tests
python/totlib/tests/test_mono_pipeline_coupling.py: 2 tests, both pass locally + viapytest --forked(mono happy + dormant on default).ExceptionGroupfailure intest_close_raises_exception_group_when_multiple_modules_failis the same as develop baseline since PR fix(tot): cascade eq_api_init in tot_init (#209) #211, unrelated).test_pipeline_verify.pytwo tests received minimal_MONO_ONLY_RULES = {}monkeypatch isolation since the populated mono rule would otherwise pollute their controlledcoupling_appliedlists when MONO_LIB_PATH is set.Out of scope
_MONO_ONLY_RULESfor per-rule activation conditions.Spec + Plan
Process notes
Subagent-driven implementation per superpowers:subagent-driven-development. Plan tasks 1-4 dispatched as fresh implementer subagents with two-stage review (spec + code quality) per task. Task 1 implementer flagged a non-plan modification to test_pipeline_verify.py to isolate it from the new global rule state — accepted by spec compliance review as minimal+necessary. Cumulative review by Codex surfaced 2 LOW (env-var isolation + sister-test pollution) — both addressed in commit 5.
Every plan command used `git -C ` or explicit `cd` per feedback_codex_worktree_sharing.md to defuse the recurring 'subagent commits on main checkout' failure class (incidents: 2026-04-23 Codex, 2026-05-26 PR-A Task 5). Controller-side tripwire confirmed main checkout develop = origin/develop pre-push.
Test plan
🤖 Generated with Claude Code
Note
Medium Risk
Changes multi-module pipeline coupling behavior when MONO_LIB_PATH is set (verify can fail pipelines if BPSD round-trip breaks); default per-module path is explicitly tested to stay unchanged.
Overview
Phase 2c PR-B turns on the
("eq","tr")verify coupling inTotPipeline._MONO_ONLY_RULES, gated by the existing mono overlay (_detect_mono()/_build_active_rules()unchanged). The check delegates toTrlib.check_bpsd_pull()via a named_eq_to_tr_bpsd_checkso failures surface a clear__qualname__.On the mono image (with
MONO_LIB_PATHfrom PR-A),run_pipeline([("eq", …), ("tr", …)])records eq → tr BPSD broker round-trip inPipelineResult.last("tr").coupling_applied. On the default per-module.solayout the same rule stays dormant so pipelines do not fail on private, non-shared BPSD storage.New Layer-D tests in
test_mono_pipeline_coupling.pycover both behaviors (pytest.mark.forked). The mono-build CI job runs them alongside existing mono routing/smoke steps.test_pipeline_verify.pyclears_MONO_ONLY_RULESunder monkeypatch so unit tests stay isolated whenMONO_LIB_PATHis set. README notes the behavioral change.Reviewed by Cursor Bugbot for commit 65c354d. Bugbot is set up for automated code reviews on this repo. Configure here.