Repository navigation
test(arch): ban CommandExecutor calls inside cognition via shape-5 ratchet (task #240) - #1592
Merged
Merged
Conversation
…ratchet (task #240 — fourth proof shape) Fourth proof in the architecture-test matrix. Pins the "module compose-by-event" doctrine clause — substrate-internal modules compose via the event substrate (MessageBus subscribe/emit) or via pre-bound handles, not by imperative `CommandExecutor::execute_*` round-trips through the outer command interface inside the cognition hot path. ## What ships `core/continuum-core/tests/architecture_compose_by_event.rs` — two integration tests: 1. `cognition_command_executor_calls_ratchet` — scans every `.rs` file under `core/continuum-core/src/cognition/`, finds lines matching `.execute_json(`, `.execute_with_caller(`, `.execute_ts(`, `.execute_ts_json(`, asserts the count doesn't grow beyond the current grandfathered budget of **1**. NEW calls BLOCK; the existing one is tracked under #112-#114 (route persona response / should_respond / validate through inference handle). Bare `.execute(` is intentionally NOT in the forbidden list — it would generate false positives across futures, queues, and other APIs. If a typed `executor.execute(typed_args)` pattern appears inside cognition in a future refactor, extend the list. Test mods (`#[cfg(test)] mod ... { ... }`) are exempted via the same brace-depth parser as the singleton-ban test, with inline `#[cfg(test)] mod tests {` handling. Line comments (`//` lines) are skipped so doc comments quoting the very pattern being banned don't trip the scanner — this matters for cognition module top-of-file docs that reference `Commands.execute('cognition/...')` as the TS-side caller contract. 2. `command_executor_remains_the_outer_boundary` — positive pin: `runtime/command_executor.rs` exists, declares `pub struct CommandExecutor`, exposes `pub async fn execute_json`. If the type is renamed or `execute_json` moves, the test is loud, not silent — and the FORBIDDEN list in this test file needs updating to match. ## The 1 grandfathered violation `cognition/vision_describe.rs::describe_image_via_ai_generate` calls `executor.execute_json("ai/generate", ...)`. The clean fix is a pre-bound `InferenceHandle` (cf. tasks #107-#108), called directly the same way `airc_chat_demo` already does. Migration tracked under #112-#114 (the inference-command-routing campaign) and #106 (ai/* namespace consolidation). ## Why ratchet (not strict) Same reason as engine-OS layering and singleton-ban: the single existing violation needs a considered migration (which `InferenceHandle` to pre-bind, where to wire the lifecycle), not a sed sweep. NEW violations BLOCK at PR time; the ratchet count graduates to ✅ when #112-#114 land. ## Matrix update `PROVING-THE-DOCTRINE.md` row for "Module compose-by-event" flips from 🔴 (no proof) to 🟡 (ratchet active, target ✅ when count = 0). ## Test plan - [x] `cargo test -p continuum-core --test architecture_compose_by_event --features metal,accelerate` — 2/2 pass; grandfathered count = 1 (exact match) - [x] `// proves: module compose-by-event` tag applied - [x] Ratchet logic verified (both grow-detection and shrink-detection paths via inspection) - [x] Line-comment skip verified — the two pre-existing `Commands.execute(...)` doc references in `vision_describe.rs` and `rate_proposals/mod.rs` do NOT trip the scanner ## Doctrine alignment - Substrate doctrine § "Module compose-by-event" — cognition composes via event substrate or pre-bound handles, not imperative request-response round-trips - [[no-fallbacks-ever]] — the ratchet IS the no-fallback equivalent for the cognition→command-executor coupling at build-graph layer ## Related - Task #240 — architecture-test matrix, fourth proof - Builds on PR #1589 (ratchet pattern) and PR #1591 (singleton ban — same scanner shape) - Migration follow-up: tasks #112-#114 (#113 is currently in_progress) → ratchet count goes 1 → 0 → strict Co-Authored-By: Claude Opus 4.7 <[email protected]>
Merged
3 tasks done
joelteply
added a commit
that referenced
this pull request
Oct 21, 2026
…pen special cases (card f878fb9a) Serves the residents directly (plan: order of work, "every fast-path miss loud" / the act gate): a card reopened under its holder left her holding work the board showed Open. Atlas and 4c9bb8d9 on the M5 renewed claims on SWE cards she could not act on (card 12afbb2f). airc #1598 fixes the owner: its projection now ends the claim on any transition to Open, so continuum stops patching around it. - airc pin 44478af -> 2666f36 (#1592, #1594-#1598; the Cargo.toml note lists each). Cargo.lock changes only the rev; `cargo metadata` resolved with no other change. - work_create: delete release_live_claim_on_reopen. Its release is now a no-op on the projection (the claim already ended). The bench round's settled mark is still cleared on reopen. - work_focus::actionable: revert #5248's Open arm and its test. An Open card can no longer be in her held set, because the held set is the board's live claims. - release_live_claim_on_reopen.rs held four verbs after the #5245 split. Each moves to its own file, as a pure move (checked with a multiset diff: the only lines without a match are the deleted function, the deleted call and its comment, the mod/use wiring, and one `use super::*;` per new file): work_note.rs, work_heartbeat.rs, work_list.rs; the work/similar types join their impl in work_similar.rs (644 lines). - identity/mod.rs: the loose-card-id allowlist names the new files. - card_holder: the comment says Open no longer carries a claim. Net: 397 lines removed, 332 added (git --numstat). Git reads the move as a rename, release_live_claim_on_reopen.rs -> work_list.rs, plus the new files; the real deletions are the release function (~45 lines) and #5248's Open arm and test (29). source-hygiene 43/43 on IntelMac. The core isn't compiled here (serving node); CI compiles it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
added a commit
that referenced
this pull request
Oct 21, 2026
…pen special cases (card f878fb9a) (#5256) Serves the residents directly (plan: order of work, "every fast-path miss loud" / the act gate): a card reopened under its holder left her holding work the board showed Open. Atlas and 4c9bb8d9 on the M5 renewed claims on SWE cards she could not act on (card 12afbb2f). airc #1598 fixes the owner: its projection now ends the claim on any transition to Open, so continuum stops patching around it. - airc pin 44478af -> 2666f36 (#1592, #1594-#1598; the Cargo.toml note lists each). Cargo.lock changes only the rev; `cargo metadata` resolved with no other change. - work_create: delete release_live_claim_on_reopen. Its release is now a no-op on the projection (the claim already ended). The bench round's settled mark is still cleared on reopen. - work_focus::actionable: revert #5248's Open arm and its test. An Open card can no longer be in her held set, because the held set is the board's live claims. - release_live_claim_on_reopen.rs held four verbs after the #5245 split. Each moves to its own file, as a pure move (checked with a multiset diff: the only lines without a match are the deleted function, the deleted call and its comment, the mod/use wiring, and one `use super::*;` per new file): work_note.rs, work_heartbeat.rs, work_list.rs; the work/similar types join their impl in work_similar.rs (644 lines). - identity/mod.rs: the loose-card-id allowlist names the new files. - card_holder: the comment says Open no longer carries a claim. Net: 397 lines removed, 332 added (git --numstat). Git reads the move as a rename, release_live_claim_on_reopen.rs -> work_list.rs, plus the new files; the real deletions are the release function (~45 lines) and #5248's Open arm and test (29). source-hygiene 43/43 on IntelMac. The core isn't compiled here (serving node); CI compiles it. Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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
Fourth proof in the architecture-test matrix. Shape-5 build-graph ratchet pinning the "module compose-by-event" doctrine clause — bans new
CommandExecutor::execute_*calls insidecognition/*.core/continuum-core/tests/architecture_compose_by_event.rscognition/vision_describe.rs::describe_image_via_ai_generateinvokesexecutor.execute_json("ai/generate", ...)..execute_json(,.execute_with_caller(,.execute_ts(,.execute_ts_json(. Bare.execute(intentionally NOT in the list (false positives on futures, queues, etc).Commands.execute('cognition/vision-describe', ...)don't trip the scanner.command_executor_remains_the_outer_boundaryassertsruntime/command_executor.rsexists, declarespub struct CommandExecutor, exposesexecute_json. Rename → loud, not silent.Why ratchet (not strict)
The single existing call needs a considered migration (
InferenceHandlepre-binding, lifecycle wiring), not a sed sweep. The doctrine clause graduates to ✅ when the inference-routing campaign (#112-#114) lands.Matrix update
PROVING-THE-DOCTRINE.mdrow for "Module compose-by-event" flips from 🔴 (no proof) to 🟡 (ratchet active).Test plan
cargo test -p continuum-core --test architecture_compose_by_event --features metal,accelerate— 2/2 pass// proves: module compose-by-eventtag appliedDoctrine alignment
[[no-fallbacks-ever]]— ratchet IS the no-fallback equivalent for cognition↔command-executor coupling at build-graph layerRelated
🤖 Generated with Claude Code