Repository navigation
docs(architecture): substrate doctrine + proof discipline (task #240) - #1584
Merged
Merged
Conversation
Two load-bearing architecture docs that capture the meta-principle the substrate is being built around: 1. SUBSTRATE-DOCTRINE-ORGANIC-FLOW.md — the WHY behind every primitive decision. The engine-on-the-OS framing (substrate primitives = precisely-engineered engine block, cognition/persona = organic body on top, OS + hardware = the road system). The meta-principle: "take analogies literally" — the brain and the substrate solve the same hardware problems (limited fast memory, parallel processors, triage of sensory input, demand-driven activation). When a brain mechanism maps cleanly to an existing OS primitive, USE the OS primitive — don't recreate the brain, don't invent a metaphor, find the closest hardware-shaped analog. CBAR did this with CV; same shape here scaled to cognition. Covers: flow not RPC (geometric vs linear scaling), demand not FIFO (consumer-pull, salience, afterthought as first-class), scorers everywhere gated by VDD (every junction potentially ML), federated not singleton (alignment is structural, not policy). Migration path from heuristic stand-ins to literal analogs. Forbidden-moves list for the reflex patterns the model keeps coding under amnesia. 2. PROVING-THE-DOCTRINE.md — the HOW WE VERIFY companion. Names the five proof shapes (unit invariant, property-based, benchmark-with-assertions, adversarial/chaos, build-graph constraint), lays out the doctrine-clause × proof-shape matrix (starting snapshot, ~15 clauses, ~5 covered), and pins the review discipline that keeps the matrix honest. Slogan: prove it as we build it. New principles ship with proofs. Proofs are tagged `// proves: <clause>` so the matrix is self-auditing via `git grep`. The organism's reliability at any moment is the union of green cells; red cells are visible debt. Task #240 tracks building out the architecture-test matrix — each red cell is its own PR. Neither doc is the substrate's API reference or implementation guide; the 56 existing architecture docs handle those. These two are the doctrine layer underneath, which the others now have something concrete to cite. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Merged
4 of 5 tasks
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
… stub comment + test PR ref Adversarial reviewer's three non-blocking nits on PR #1585: 1. command_executor.rs module-level doc comment (lines 1-21) still described "TypeScript commands: Routed via Unix socket to CommandRouterServer" as if the implicit chain crossed the bridge. After the no-fallbacks fix that's misleading; operators read top-down and would believe the wrong contract. Updated to describe the implicit chain as Rust-only and call out the explicit execute_ts* public API as the documented escape hatch. 2. chat/mod.rs:494-497 comment said the staged-migration stubs reach the back-compat TS impl "through the existing CommandRouterServer bridge". Post-PR the chat module owns its prefixes and emits a deterministic typed error; the bridge is no longer in this dispatch path. Updated to reflect: chat owns the prefix, callers who need the TS surface go through the explicit execute_ts_json API per [[no-fallbacks-ever]]. 3. The regression test comment at command_executor.rs:835 referenced "Pre-PR #1584" as the predecessor — that's the docs PR, not this one. Changed to "Pre-PR #1585" to match. All three are documentation tightenings. No behavior change. Build clean; targeted tests pass. Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
…xecutor (task #219) (#1585) * fix(runtime): no-fallbacks — refuse silent TS fallthrough in CommandExecutor (task #219) Per the substrate's [[no-fallbacks-ever]] doctrine: when no Rust module owns a command, the executor previously routed silently to the TS bridge at `/tmp/jtag-command-router.sock`. In headless mode this surfaced as a confusing "Failed to connect to CommandRouterServer" error; in hybrid-host mode it silently delegated to TS, breaking the mental model that "the substrate is Rust." Both failure modes were visible after task #224 deleted GLOBAL_EXECUTOR and the rest of the TS-migration campaign (#225/#226/#227 etc.) shrunk what the bridge served. This commit kills the implicit fallthrough. After this change: 1. Interceptor chain runs first (airc, grid, future transports) — unchanged. 2. Rust module registry tries next — unchanged. 3. If no interceptor handled and no module matched: typed Err naming the missing command + the explicit escape hatch. Callers that EXPLICITLY want the TS bridge use `CommandExecutor::execute_ts` or `execute_ts_json` directly — those public methods stay live for the documented TS-only call sites (sentinel steps for web_research/command/llm/coding_agent, grid connection's unmigrated-command fallthrough, ai_provider's cloud- adapter fallthrough pending task #229). The substrate just no longer SILENTLY routes there. ## Files touched - `runtime/command_executor.rs`: - Doctrine docstring updated: "TypeScript via Unix socket" item becomes "No silent TS fallthrough" with the explicit-API escape hatch named. - `execute_inner` step 3: silent `execute_ts_command(...)` call replaced with typed Err that names the command and points at the explicit API. - Updated existing test `airc_interceptor_declines_when_no_airc_target_params` to assert the new error shape (registry miss, NOT the airc interceptor short-circuiting). - Added regression test `unknown_command_returns_typed_no_fallback_error_not_ts_attempt` that pins the contract: error must NOT mention TS socket, MUST name the missing command, MUST point at the explicit API. - Renamed `ts_bridge_failure_still_emits_completed_event` → `no_rust_module_failure_still_emits_completed_event` to reflect the new terminal-state name. Telemetry coverage of the failure path preserved. - `routing/command_handler.rs`: - Updated comment on the gate-recorded-caller test to reference [[no-fallbacks-ever]] task #219 instead of the now-dead TS-bridge fallthrough. ## Architecture-proof linkage This PR adds a **shape-1 (unit-level invariant)** proof for the "No silent TS fallthrough" clause in `docs/architecture/SUBSTRATE-DOCTRINE-ORGANIC-FLOW.md`. The matrix in `docs/architecture/PROVING-THE-DOCTRINE.md` flips this clause from 🟡 to ✅. The test is tagged with the comment `// what this catches:` per the established convention; the future `// proves: no-fallback` tag convention (introduced in the proof discipline doc) will be backfilled in a sweep PR alongside the first architecture-tests addition. ## Test plan - [x] `cargo check -p continuum-core --lib --features metal,accelerate` clean - [x] `cargo test runtime::command_executor` — 86/86 pass - [x] `cargo test routing::command_handler modules::grid` — pass - [x] Full lib suite: 4324/4325 pass; 1 unrelated flake (`routing::uri_layer::tests::no_subscriber_returns_empty_chain`, the known global tracing subscriber pollution from task #203). Confirmed passes in isolation: `cargo test no_subscriber_returns_empty_chain` green standalone. - [ ] Adversarial reviewer on canary ## Doctrine alignment - `[[no-fallbacks-ever]]` — implicit fallthrough was the textbook violation; this commit closes it. - `[[rust-is-the-core-node-is-the-shell]]` — substrate dispatch ends at the Rust registry. TS is an explicit-API destination, not a silent dependency. - `[[headless-rust-must-work-soon]]` — headless boot no longer appears broken just because no TS host is around. Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs(runtime,chat): no-fallbacks review nits — top-of-file doc + chat stub comment + test PR ref Adversarial reviewer's three non-blocking nits on PR #1585: 1. command_executor.rs module-level doc comment (lines 1-21) still described "TypeScript commands: Routed via Unix socket to CommandRouterServer" as if the implicit chain crossed the bridge. After the no-fallbacks fix that's misleading; operators read top-down and would believe the wrong contract. Updated to describe the implicit chain as Rust-only and call out the explicit execute_ts* public API as the documented escape hatch. 2. chat/mod.rs:494-497 comment said the staged-migration stubs reach the back-compat TS impl "through the existing CommandRouterServer bridge". Post-PR the chat module owns its prefixes and emits a deterministic typed error; the bridge is no longer in this dispatch path. Updated to reflect: chat owns the prefix, callers who need the TS surface go through the explicit execute_ts_json API per [[no-fallbacks-ever]]. 3. The regression test comment at command_executor.rs:835 referenced "Pre-PR #1584" as the predecessor — that's the docs PR, not this one. Changed to "Pre-PR #1585" to match. All three are documentation tightenings. No behavior change. Build clean; targeted tests pass. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
This was referenced Jun 9, 2026
joelteply
added a commit
that referenced
this pull request
Jun 9, 2026
… (task #240) (#1588) Establishes `core/continuum-core/tests/architecture_no_fallbacks.rs` as the first integration-tier proof in the architecture-test matrix that landed alongside the substrate doctrine docs (#1584). Validates the proof-discipline doc by flipping the matrix's first row from unit-only to unit + integration. ## What this PR ships 1. **`architecture_no_fallbacks.rs`** — three integration tests that prove the no-fallbacks doctrine clause from outside the runtime module: - `unknown_command_returns_typed_no_fallback_error` — basic CommandNotFound contract via the public `CommandExecutor::new` + `execute` API. Catches the class of bug where the in-module unit test passes via private access but the integration boundary is broken. - `no_fallback_error_is_structural_across_command_shapes` — same contract holds for 7 unrelated command shapes (single-token, slash-separated, deeply-nested, dashed, UPPER, n0/spec1al, empty). Catches partial-fallthrough regressions where only some prefixes silently route to TS. - `registered_command_still_dispatches` — registered Rust modules STILL dispatch successfully. Pins the positive path so that future no-fallback-strengthening doesn't over-shoot into breaking real dispatch. 2. **`PROVING-THE-DOCTRINE.md` matrix update** — flips the "No silent TS fallthrough" row to include the new integration test alongside the existing in-module unit test. ## Why this matters Per the proof-discipline doc: "prove it as we build it." The matrix is meant to be self-auditing via `git grep '// proves:'`. The no-fallbacks clause was previously covered by a single in-module unit test in `runtime/command_executor.rs::tests`. That unit test passes because the test mod has access to the executor's internals; this PR proves the SAME contract through the same public API a real substrate caller uses. The slogan: ship the abstract recipe AND the literal instantiation together. The proof-discipline doc was the recipe; this is the first literal instantiation in the matrix. ## Test plan - [x] `cargo test -p continuum-core --test architecture_no_fallbacks --features metal,accelerate` — 3/3 pass - [x] Tests live in standard integration-tier location (`core/continuum-core/tests/`) - [x] `// proves: no-fallback fallthrough` tag convention applied per [PROVING-THE-DOCTRINE.md](docs/architecture/PROVING-THE-DOCTRINE.md) ## Doctrine alignment - [[no-fallbacks-ever]] — the clause being proven - Substrate doctrine "Prove it as we build it" — each PR that advances a doctrine clause SHOULD include the proof - [[abstract-into-literal-design-principle]] — the proof matrix (abstract) ships with the first literal proof file ## Related - Task #240 (this PR opens it; subsequent PRs fill the other matrix rows) - Builds on #1584 (substrate doctrine + proof discipline docs) - Builds on #1585 (no-fallbacks fix in CommandExecutor) - Tracked under CANARY-ALPHA-EXECUTION-ROADMAP.md Group B (architecture-test matrix first proofs) Co-authored-by: Claude Opus 4.7 <[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
Two load-bearing architecture docs that capture the meta-principle the substrate is being built around. Worked out during the post-#1583 architecture conversation where Joel articulated "take analogies literally" as the engineering doctrine.
Doc 1 —
SUBSTRATE-DOCTRINE-ORGANIC-FLOW.mdThe WHY behind every primitive decision. The engine-on-the-OS framing:
Meta-principle: when a brain mechanism maps cleanly to an existing OS primitive, USE the OS primitive — don't recreate the brain, don't invent a metaphor. CBAR did this with CV; same shape here scaled to cognition.
Covers:
Doc 2 —
PROVING-THE-DOCTRINE.mdThe HOW WE VERIFY companion. Names the five proof shapes:
Includes the doctrine-clause × proof-shape matrix (starting snapshot, ~15 clauses, ~5 already covered by existing tests). Pins the review discipline: proofs are tagged
// proves: <clause>so the matrix is self-auditing viagit grep.Slogan: prove it as we build it. New principles ship with proofs in the same PR. Red cells in the matrix are visible debt. The organism's reliability at any moment is the union of green cells.
What's already proven (from existing tests)
What's red (next architecture-test PRs, tracked in task #240)
Why these are docs-only
No code changes. These are the lighthouse + scoreboard that subsequent architecture-test PRs will reference. Ships independently of any feature work so we can cite it.
Test plan
gh pr view— markdown checks🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.7 [email protected]