Skip to content

ui-server: pin missing and errored trust refresh lock fallbacks #4407

Open

Description

@schlessera

Out of scope

No production fast-path or lock-order changes; the reviewed code is correct. No widening of trust authority or change to the hosted ten-second admission bound.

Context

Review of PR #4405 at bcbc515 found two unpinned clauses in live.refresh (live, packages/ui-server/src/brain/trust-settings.ts:160-171; the row-existence check is line 166 and the fast-path condition with row.error === null is line 167). Deleting either the durable-row existence check or row.error === null leaves the complete trust-settings file green. The review explicitly deferred this proof-only gap so the red-main admission fix can land. Related implementation: #3609; incident: #4406.

Scope

Add deterministic lock-counter tests in packages/ui-server/tests/trust-settings.test.ts for the two fallback cases, using the real durable projection and held BRAIN_LOCK_KEY fixture. Model them on the existing lock-counter tests "unchanged durable trust refresh does not queue the held brain lock" and "diverged trust refresh queues the held brain lock…" (packages/ui-server/tests/trust-settings.test.ts:525, packages/ui-server/tests/trust-settings.test.ts:542).

Acceptance criteria

  • An errored durable row whose policy hash equals the verified disk hash queues the brain lock on live.refresh, even though the hash matches.
  • With no durable projection row and no policy file, live.refresh queues the brain lock rather than treating the synthetic empty projection as durable evidence.
  • Each case asserts the withLock counter while the holder remains held, and completes the ordinary refresh after release. No sleep race proves queue entry.
  • Deleting row.error === null makes its named test fail; deleting the row-existence condition independently makes the other named test fail. Restore both mutations and prove the full file passes.

Verification

Run the complete trust-settings file and preserve both assertion-specific mutation receipts. No installed native runtime is needed for these projection/lock tests.

Contract impact

None; these tests pin the existing documented locked fallback.

2026-11-23 triage at main a3395c4: re-verified both clauses are still unpinned (no test covers an errored row or a missing row with the lock counter) and refreshed the drifted citation by anchor. Scope and criteria unchanged.

Activity

  1. added
    type: test
    area: ui-server
    priority: p2
    on Nov 21, 2026
  2. added this to the 0.45.0 milestone on Nov 21, 2026
  3. added
    agent-ready
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: ui-serverpriority: p2type: test

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions