Skip to content

CONTRACT: feat(ui-server): bind managed references and metadata recipients - #4000

Merged
schlessera merged 9 commits into
mainfrom
feat/3613-qualified-reference-20261114
Nov 14, 2026
Merged

schlessera merged 9 commits into
mainfrom
feat/3613-qualified-reference-20261114

Conversation

@schlessera

@schlessera schlessera commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Refs #3613

What changed

Managed acquisition refuses a ref that moves between resolution and fetch, ambiguous branch/tag names, raw refs/object IDs, and malformed or foreign advertisements. Invalid resolution gives an actionable source refusal before private fallback. Owners can separately grant the fixed https://api.github.com metadata credential recipient through the existing reference-grant API; legacy grants retain their original recipient authority. Data-only GitHub metadata validation binds canonical names/transport and exact stable repository/owner IDs, without asserting source trust.

Why this shape

This completes the first guard and grant-storage slice of the selected managed-only qualification. The existing API, shared FULL SQLite writer and live grant/principal lifecycle own the additional permission. There is no new worker-facing authenticated relay or production trust exemption. A minor changeset and the HTTP/MCP contracts accompany the changes.

Proof

Head 8cab65afcb542b32bcecdd9347bfbf3b20d4c9a5; independently read main/base faa480e8c864d547cd8b4eb75965b7d609284770. Exact selected hosted candidate and automatic-main qualification remain pending. The current synthetic merge c5695c330326651ef83c5e1de390544daa0297a4 has the independently verified parents above and tree 0328b25b4dae9666d63295c7a0e46d9c45b39bf6; actual hosted job checkouts remain to be verified.

  • Focused source/transport parsing, identity, grant, owner HTTP, migration/restart and real FULL-writer composition: 79 tests / 393 assertions / five files pass. Queued owner revocation refuses new API permission.
  • Meaningful failing-first assertions include REFERENCE_MOVED_REF_NOT_PUBLISHED, REFERENCE_API_RECIPIENT_EXPLICITLY_PERSISTED, REFERENCE_API_RECIPIENT_BOUNDARY, REFERENCE_AMBIGUOUS_REF_NEVER_SELECTED, REFERENCE_ADVERTISED_REF_EXACT, REFERENCE_RAW_REF_NOT_DISPATCHED and REFERENCE_AMBIGUOUS_SOURCE_ACTIONABLE_REFUSAL. Ten source mutations fail at their named assertions and restored controls pass. Each receipt retains its original execution head/source identity.
  • Strict typecheck passes with Node's command-scoped 6144 MiB heap; subsequent edits update citations only. The default-heap OOM diagnostic is retained separately.
  • The new actual-Git ambiguity case is selected for hosted proof. Its local attempt stopped before the assertion at unshare: write failed /proc/self/uid_map: Operation not permitted; it is not failing-first/runtime qualification. Both installed-backend history guards and relevant native proof are hosted obligations for this candidate.
bun run test ./packages/ui-server/tests/github-reference-identity.test.ts ./packages/ui-server/tests/reference-ref-validation.test.ts ./packages/ui-server/tests/reference-source.test.ts ./packages/ui-server/tests/reference-grants.test.ts ./packages/ui-server/tests/account-writes-offloop.test.ts
NODE_OPTIONS=--max-old-space-size=6144 bun run typecheck
NODE_OPTIONS=--max-old-space-size=6144 bun run check:pr --base origin/main
{"version":1,"kind":"brain-check-pr-receipt","head":"8cab65afcb542b32bcecdd9347bfbf3b20d4c9a5","base":"origin/main","mode":"focused","startedAt":"2026-11-14T15:16:58.573Z","finishedAt":"2026-11-14T15:18:04.928Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":12225.655087000001},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":102.86729000000196},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":69.27510099999927},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":20.013091999997414},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":53920.84819399999}]}

The guards restrict one invalid source selection or one unapproved credential recipient. An ambiguous or moved target cannot authorize a new publication; existing separately validated stale-source behavior remains bounded by its original authority window. No safe narrower selection exists for an ambiguous ref. Omitted API permission preserves anonymous/no-API-credential behavior. Only explicit owner permission adds the API recipient. Source refusal clears on an unambiguous retry, with no global latch; changing recipient authority requires the owner to revoke/recreate that grant. Tool refusals expose the scoped cause; owner create/list receipts expose the explicit recipient. The source refusal/recovery case and principal/repository-bound grant cases prove isolation.

Collision scan at head 8cab65afcb542b32bcecdd9347bfbf3b20d4c9a5: textual overlaps with #3464 in docs/decisions/managed-worktrees.md (this PR refreshes citations only there) and downstream #3622 in docs/http-api.md. Closure overlap with #3056, #3059, #3069, #3116, #3393, #3437, #3581 and #3806 is recorded. No other branch is rewritten or taken over; #3622 will refresh after its repository resolver prerequisite is delivered.

Checklist

  • Complete selected hosted candidate and automatic-main proof passed with actual checkout evidence.
  • This slice's scope is implemented; remaining ui-server: bind trusted Git reads to the qualified host acquisition transport #3613 work is named below.
  • PR and advanced issue retain release milestone 0.45.0 (published version checked as 0.44.0).
  • Minor changeset, authoritative HTTP/MCP contracts and documentation are updated.
  • Leakage gates pass; moved source citations are refreshed.
  • Changed guards are scoped, expose their cause and have failing/restored controls.
  • Actual provider-history guards pass for this candidate.

Anything left open

#3613 remains open with all five original acceptance criteria. Fixed live metadata dispatch/recipient rechecks, actual operation/turn wire-byte accounting, immutable regular-blob/range/digest acquisition evidence, stable-owner/rename/transfer enforcement and the complete supported-host real-Git/native/both-backend qualification remain. The data parser and stored permission enable none of those capabilities by themselves. #3622 remains downstream. This PR uses Refs, not a closing keyword.

@schlessera schlessera added this to the 0.45.0 milestone Nov 14, 2026
@schlessera schlessera added type: feat A new capability or a change in user-visible behaviour. area: ui-server Hono app factory: turn coordinator, auth, session catalog, routes, cron. contract Touches the integration contract: CONTRACT: commit, contract doc updated in the same commit. labels Nov 14, 2026
@schlessera
schlessera marked this pull request as ready for review November 14, 2026 15:23
@schlessera
schlessera merged commit 03805ba into main Nov 14, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ui-server Hono app factory: turn coordinator, auth, session catalog, routes, cron. contract Touches the integration contract: CONTRACT: commit, contract doc updated in the same commit. type: feat A new capability or a change in user-visible behaviour.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant