Skip to content

CONTRACT: reject ambiguous proposed policy frontmatter - #4016

Merged
schlessera merged 5 commits into
mainfrom
feat/3666-strict-policy-frontmatter
Nov 15, 2026
Merged

schlessera merged 5 commits into
mainfrom
feat/3666-strict-policy-frontmatter

Conversation

@schlessera

@schlessera schlessera commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #3666

What changed

Hosted propose_policy_change rejects unclosed or suffixed proposed frontmatter before requesting approval or persisting an actionable review. Standalone fences preserve BOM, LF/CRLF, trailing spaces/tabs, EOF closers and exact publication bytes. Valid replacements can repair old ambiguous policies with parser-aligned review.

Why this shape

The maintainer approved this pre-1.0 breaking input narrowing for 0.45.0 in #3666. The proposal service inspects only frontmatterBlock offsets, leaving shared parser semantics and old-file review intact. Schema and strict boundary validation run together initially and at publication. The minor changeset includes migration guidance.

Proof

  • Failing first: bun run test packages/ui-server/tests/policy-proposal.test.ts failed five named rejection cases with “Expected promise that rejects / Received promise that resolved.” Both real-service bridge cases also failed on that assertion before implementation.
  • Mutation: bypassing proposalBoundaryError caused eight failures: the five rejection cases, publication revalidation, and Claude/Pi pre-permission bridge rejection. Restoring the guard passed all 57 proposal/bridge tests (524 assertions).
  • Focused service/bridge/receipt/pause/shared-parser regressions: 124 passed across seven files. Existing decline, stale authority/base, identity, journal and no-repeat receipt checks remain green.
  • NODE_OPTIONS=--max-old-space-size=8192 bun run typecheck passed. The default 2 GiB Node heap exhausted memory first.
  • Both provider-history guards were attempted. This host refuses bubblewrap namespace creation; the same two failures reproduce with the unchanged origin/main proposal source. No passing local provider-runtime proof is claimed; hosted runtime proof remains necessary.
  • Pending changeset package validation and full changeset status passed; all planned bumps are minor, none major.
  • Refreshed against main c0bce42e7730f565cc1dac43aca4aea6eaf84675 (index publication fix fix(ui-sdk): a read-only index connection no longer refuses native publication #4011 and identity-gate fix fix(ui-sdk): keep a separate-identity payload out when its coordinator dies before release #4007); documentation citation edits merged cleanly. check:pr passed all gates and 797 fast invariant tests using an owned TMPDIR on adequately provisioned storage. The preceding shared-temp run failed with git fixture disk quota errors; ci: diagnose temporary-storage quota failures cascading through local fast invariants #4017 tracks diagnosis without a release commitment. Receipt below.
{"version":1,"kind":"brain-check-pr-receipt","head":"674b88c5b66a114965fd26578598b019eca48575","base":"origin/main","mode":"focused","startedAt":"2026-11-15T14:51:24.262Z","finishedAt":"2026-11-15T14:52:44.546Z","checks":[{"name":"all lint and leakage gates","categories":["changeset"],"outcome":"passed","elapsedMs":14325.823680000001},{"name":"environment documentation","categories":["changeset"],"outcome":"passed","elapsedMs":126.04588000000149},{"name":"pending changeset package names","categories":["changeset"],"outcome":"passed","elapsedMs":69.69724599999972},{"name":"contribution changeset","categories":["changeset"],"outcome":"passed","elapsedMs":18.372113999997964},{"name":"affected fast invariants","categories":["verify","unit"],"outcome":"passed","elapsedMs":65726.83632999999}]}

Guard containment

The trigger is an ambiguous newly proposed frontmatter boundary; schema, authority and filesystem failures retain their existing handling. Only that proposal is refused, since an actionable policy approval cannot safely proceed with ambiguous delimiters. Read-only review of existing files remains available. Submitting a corrected proposal automatically clears the refusal without restarting or disabling a chat/backend. The validation error explains the cause in the tool result; no pending approval is retained. Service repair tests and both bridge tests prove a refused request leaves subsequent valid requests usable.

Checklist

  • Focused local preflight and behavioral/mutation receipts recorded; integration confirmation supplies selected hosted proof.
  • Acceptance criteria met; local runtime limitation identified above.
  • PR and issue target release 0.45.0; assignments read back before merge.
  • Breaking minor changeset includes migration guidance.
  • Leakage gate passed.
  • Authoritative MCP component and decision documentation updated in the implementation commit.
  • Guard containment answered above.
  • Provider history assembly unchanged; local guards attempted with matching base limitation.

Anything left open

Nothing in implementation scope. This host cannot execute native provider-history guards; automatic hosted proof must establish runtime results.

@schlessera schlessera added this to the 0.45.0 milestone Nov 15, 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. breaking Breaks a published API or documented behaviour. Needs a maintainer ruling before code. labels Nov 15, 2026
@schlessera

Copy link
Copy Markdown
Owner Author

Collision review for head e206665: the PR-mode check reports closure overlap with #3056, #3059, #3069, #3116, #3437, #3581, #3622, #3806, #4002, #4007, #4008, #4012, #4013, with no path or unknown reports. The initial cited-path check separately identified policy-proposal.ts overlap with #3622. This PR changes only proposal-specific delimiter validation there; no other branch was edited. Citation maintenance also touches documentation present in #4002. The refreshed local receipt records main 5af6897.

@schlessera

Copy link
Copy Markdown
Owner Author

Collision review for head 130ad79: 0 path/unknown reports; closure overlap with #3056, #3059, #3069, #3116, #3437, #3581, #3622, #3806, #4002, #4007, #4008, #4012, #4013, #4018. Earlier cited-path overlap with #3622 and documentation overlap with #4002 remain scoped as recorded above. Final local preflight passed on this head.

@schlessera

Copy link
Copy Markdown
Owner Author

Collision review for head 674b88c: no path/unknown reports; closure overlap with #3056, #3059, #3069, #3116, #3437, #3581, #3622, #3806, #4002, #4008, #4012, #4013, #4018, #4020, #4021. Main c0bce42 merged cleanly; fresh local preflight passes all gates and 797 invariants. Earlier source overlap with #3622 and documentation overlap with #4002 remain scoped as recorded.

@schlessera

Copy link
Copy Markdown
Owner Author

Collision review for head 674b88c: 0 path/unknown reports; closure overlap with #3056, #3059, #3069, #3116, #3437, #3581, #3622, #3806, #4002, #4008, #4012, #4013, #4018, #4021, #4022. Main advanced only through #4020 CI tooling, with no overlap in this PR files. Merged origin/main and retained the actual prior local receipt at head 674b88c; no claim that it tested this newer combined tree. Candidate confirmation must prove the refreshed candidate.

@schlessera

Copy link
Copy Markdown
Owner Author

Current-head collision readback: 1c86560; 0 path/unknown reports. Closure overlaps and the unrelated #4020 base refresh remain as recorded above. The first remote push was rejected without detail; a subsequent push succeeded, and confirmation names this refreshed head.

@schlessera
schlessera marked this pull request as ready for review November 15, 2026 15:20
@schlessera
schlessera merged commit 3988a9b into main Nov 15, 2026
49 of 50 checks passed
@schlessera

Copy link
Copy Markdown
Owner Author

Delivered in PR #4016, squash 3988a9bf9aab8c3730ca8e1228a63c169d17cab8, verified as an ancestor of main.

New proposed policy bytes require closed standalone frontmatter fences before approval and at publication revalidation. Accepted BOM/line-ending/EOF/whitespace forms preserve exact bytes, and valid replacements can repair old ambiguous policies without changing shared parser semantics. The contract, decision record and breaking minor changeset carry the approved 0.45.0 migration guidance.

Evidence:

  • Failing-first service and real Claude/Pi bridge rejection assertions; bypassing the strict guard reproduced eight failures, then restoration passed. Final focused proposal/bridge run: 57 tests, 524 assertions.
  • Local focused service/bridge/parser/receipt/pause regressions: 124 passed. Typecheck passed with the documented larger Node heap. Local provider-history guards encountered the same namespace prerequisite failure on the change and base; no local runtime success is claimed.
  • Final local preflight: all gates and 797 invariants passed. Later unrelated base advancement retained that actual receipt; fresh candidate CI proved the refreshed combined tree.
  • Candidate run https://github.com/schlessera/brain-kit/actions/runs/43729313115 passed. Its checkout c6ebfbc51383d754744a6b9318c9e528b87e0892 has parents c6f98e8d9d2f63d144ff82d6d1d6ff0db128547c and 1c865602028ed9be4a0b5c0c7780d1102dc682f3, and tree 4961e4744877a58d2631b69686d723f1873075f3. The squash has that exact base parent and tree.
  • Automatic main run https://github.com/schlessera/brain-kit/actions/runs/43731503582 passed on the squash, including every selected unit, runtime, native-host, browser, layout, capture and endurance category. Job checkout logs identify the squash SHA.

PR and closed issue retain milestone 0.45.0. No dependent blocked issues or review findings remain. Follow-up #4017 records the observed temporary-storage quota failure and separate successful recovery; it has no release milestone. Nothing remains in this implementation's scope.

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. breaking Breaks a published API or documented behaviour. Needs a maintainer ruling before code. 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.

ui-server: reject ambiguous policy frontmatter before approval

1 participant