refactor: single-source node wire interface from Rust + reserved-handle consts#84
Merged
Merged
Conversation
The executor decided Port vs Internal Event vs Hardware Callback by bare '_'-prefix checks and "_pin_change"/"_i2c_reply" string literals spread across the emit, match, and test sites. Hoist them into a `reserved_handles` module so the reserved set lives in one place; routing keeps its deep generic catch-all (`other => dispatch_internal(&other[1..])`). No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ored catalog mirror Ports/emits were authored twice — as compile-checked Rust consts and again by hand in node-components.json — reconciled only by the parity test. Make Rust the single source: the Catalog Parity Guard now generates wire-interface.generated.json from ComponentRegistry::declared() under BLESS_WIRE_INTERFACE=1, else asserts the committed file is current; codegen reads the sidecar; impls[].ports/emits are removed from the catalog. Generated TS is byte-identical (doc-only diff). `bun run catalog:sync` blesses + re-codegens in one step. CONTEXT.md refreshed (incl. the now-deleted build.rs codegen and the reserved_handles consts). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Records the decision to keep the desired→live subscription diff per-host (it operates on host-local broker state, rumqttc vs mqtt.js) while winner-selection stays core policy — so future architecture reviews don't re-suggest hoisting the diff into core. Formalizes the existing rationale at subscriptions.rs:13. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Follow-through on an architecture review: two deepenings + one recorded "no".
C1 — node wire interface single-sourced from Rust
refactor(web)Ports/emits were authored twice — compile-checked Rust consts and hand-typed in
node-components.json— reconciled only by the parity test. Now Rust is the single source:apps/web/wire-interface.generated.jsonfromComponentRegistry::declared()underBLESS_WIRE_INTERFACE=1, otherwise asserts the committed file is current (a stale mirror fails CI).impls[].ports/emitsare removed from the catalog.bun run catalog:syncblesses + re-codegens in one step.C3 — reserved runtime handle names as consts
refactor(core)The executor's Port / Internal Event / Hardware Callback routing used bare
'_'-prefix checks and"_pin_change"/"_i2c_reply"literals across emit, match, and test sites. Hoisted into areserved_handlesmodule so the reserved set lives in one place; routing keeps its deep generic catch-all (other => dispatch_internal(&other[1..])). No behavior change.C2 — not done; recorded as ADR-0010
docs(adr)The review's top pick — hoisting the desired→live subscription diff into core — contradicts the explicit per-host rationale at
subscriptions.rs:13: the diff operates on host-local broker state (rumqttcvsmqtt.js), while the drift-dangerous winner-selection (reconcile_desired) is already shared. Recorded as ADR-0010 so future reviews don't re-suggest it.Verification
cargo test --workspace— core 381 +catalog_parity2, green.cargo clippy --workspace -- -D warnings -W clippy::pedantic— clean.tsc --noEmitclean;bun run codegenoutput unchanged (values identical).New developer loop
Edit Rust
ports()/emits()→bun run catalog:sync. No more hand-editing the catalog mirror.🤖 Generated with Claude Code