Skip to content

refactor(broker): delete duplicate broker core, unify governance floor onto exec-broker (reconciliation R4) - #311

Merged
sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a
Jul 10, 2026
Merged

sandstream merged 1 commit into
mainfrom
claude/web-kit-status-sync-p6fg9a

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Reconciliation R4 — one broker

Deletes the parallel scope core (src/broker/{scope,decide,needs}.ts + their tests) that shadowed the canonical src/exec-broker/, and routes the last consumers onto the canonical, signed provider.

What changed

  • New src/exec-broker/scope-needs.ts — the governance-floor scope check (withGovernance.scopeNeeds) reimplemented on the SAME signed source the PreToolUse gates use (profileBrokerPolicy) + the shared pure decisions (checkEgress/checkFsWrite) + policyFsRoots. Same signature, same denial messages, same fail-closed semantics (none → advisory unchanged; declared-but-unsigned/tampered → deny; verified → per-need check).
  • governance-middleware.ts — imports checkScopeNeeds/ScopeNeeds from the new module instead of broker/needs.js.
  • doctor.ts — the exec-broker scope posture row now reads profileBrokerPolicy, preserving the honest warn(unsigned)/fail(invalid·revoked·malformed) split via a guarded verifyProfileSignature.
  • Deleted src/broker/scope.ts, src/broker/decide.ts, src/broker/needs.ts and their tests; broker/needs.test.ts → exec-broker/scope-needs.test.ts.
  • Kept src/broker/extract.ts (conservative host extraction) — still the gate's URL parser.

Result

One broker: src/exec-broker/* — canonical pure decisions + the signed profile-policy provider. On top of it sit the PreToolUse gates (R3), the governance-floor scope check, the kit doctor posture row, and the host-extractor. No behavior change for users.

Verification

  • tsc --noEmit clean · eslint src 0 errors (pre-existing complexity warnings only) · npm run build clean
  • Full suite 2698 pass / 0 fail

Follow-up: R5 updates pillar3-exec-broker-5.0.md / the North Star notes to describe the unified module.

Still deferred (separate product decision, flagged in kit-research #32): whether runBrokered should consume the signed profile scope for the MCP runtime — requires the governed MCP ops to declare their effects first, which would otherwise fail-closed-deny them (breaking).

🤖 Generated with Claude Code

https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2


Generated by Claude Code

…r onto exec-broker (reconciliation R4)

Removes the parallel scope core (src/broker/{scope,decide,needs}.ts) that
shadowed the canonical src/exec-broker/. The governance-floor scope check
(withGovernance.scopeNeeds) now reads the SAME signed source as the PreToolUse
gates — profileBrokerPolicy — via the new exec-broker/scope-needs.ts, using the
shared pure decisions (checkEgress/checkFsWrite) and policyFsRoots. kit doctor's
exec-broker posture row is likewise sourced from profileBrokerPolicy, preserving
the honest warn(unsigned)/fail(invalid/revoked/malformed) split via
verifyProfileSignature.

Behavior preserved (same denial messages, same fail-closed semantics). Leaves one
broker: src/exec-broker/* (canonical decisions + signed profile-policy provider),
with the gates, governance-floor scope check, kit doctor row, and host-extractor
(src/broker/extract.ts, kept) as the surfaces on top. Full suite 2698 pass / 0 fail.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbF4MFePXWNCd4dxBQvqH2
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 71dd302 into main Jul 10, 2026
18 checks passed
@sandstream
sandstream deleted the claude/web-kit-status-sync-p6fg9a branch July 10, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants