Skip to content

test(backend): pin the legacy internal trust passthrough when no mode is declared (TASK-111) - #1837

Merged
lilyshen0722 merged 1 commit into
mainfrom
kai/broker-legacy-trust-no-mode
Sep 23, 2026
Merged

lilyshen0722 merged 1 commit into
mainfrom
kai/broker-legacy-trust-no-mode

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

A test-only addition, requested in the pod, closing a real coverage gap in the grant-broker confinement predicate.

The gap. effectiveSandboxTrust maps the legacy internal trust to public via LEGACY_SANDBOX_TRUST. Every existing case that exercises it pairs it with a declared mode ({ mode: 'workspace', trust: 'internal' } in both the table and the binding test), so the mode check carries those assertions on its own. With no mode declared, the mapping is the only gate on the record — and { trust: 'internal' } must pass the broker through, because an absent mode is the daemon's input: it derives the mode per host. Remove or misread the mapping and a seat the daemon will confine silently loses the broker.

What this adds.

  • the table row a legacy internal trust with no declared mode — the mapping is the only gate, expecting no refusal;
  • a focused test asserting both halves: { trust: 'internal' } passes, and the neighbouring { trust: 'private' } still refuses as sandbox_trust_not_public, so the passthrough cannot be satisfied by dropping the trust check altogether.

Why it belongs beside TASK-111. That row's fix has to refuse an absent sandbox on a seat with no daemon guaranteeing confinement. This case is the boundary it must not cross while doing so: an absent mode on a legacy record is not an absent sandbox, and refusing it would take the broker away from seats a daemon will confine anyway.

Verification. Mutation-proved 3/3 (/tmp/kai111-ledger.py): the mapping removed; an absent mode made a refusal; the trust check dropped — each reddens the test that owns it. Clean-tree baseline: 0 failure lines, 43/43 passed, exit 0. Full backend suite 421 suites passed (6 skipped), 3853 passed, 3877 total, exit 0; lint:ts 0 errors (1210 warnings, the standing count). Backend-only, so no version slot.

@samxu01
samxu01 force-pushed the kai/broker-legacy-trust-no-mode branch from ea04efb to 1a0424d Compare September 23, 2026 09:12
…de is declared (TASK-111)

The confinement predicate's legacy mapping (`internal` -> `public`) was only
ever exercised beside a declared mode, so in every existing case a mode check
could carry the assertion on its own. With no mode declared the mapping is the
ONLY gate on the record: `{ sandbox: { trust: 'internal' } }` must let the
broker through, because the daemon derives the mode per host. That makes it the
easiest part of the predicate to break silently.

Adds the table row, plus a focused test that asserts the passthrough AND the
neighbouring `private` refusal, so the case cannot be satisfied by dropping the
trust check altogether.

It is also the regression guard TASK-111's fix has to preserve: refusing an
absent sandbox on a non-daemon seat must not start refusing a legacy record
that a daemon will confine.

Mutation-proved 3/3 (/tmp/kai111-ledger.py): mapping removed; absent mode made
a refusal; trust check dropped. Clean tree: 0 failure lines, 43/43. Full
backend suite 421 suites / 3853 passed; lint:ts 0 errors.
@lilyshen0722
lilyshen0722 force-pushed the kai/broker-legacy-trust-no-mode branch from 1a0424d to ea3c42b Compare September 23, 2026 09:33
@lilyshen0722
lilyshen0722 merged commit a2fc1a0 into main Sep 23, 2026
14 checks passed
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.

1 participant