Skip to content

docs(architecture): a record's approval lines are append-only - #10688

Merged
cixzhang merged 6 commits into
mainfrom
docs/approval-lines-append-only
Nov 9, 2026
Merged

cixzhang merged 6 commits into
mainfrom
docs/approval-lines-append-only

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Who decided a record stays true. A pull request that changes or removes an existing decision's Decider line, or replaces a record's approved_by with a different account, needs that original decider's approval at its exact head; cixzhang's own pull request counts as hers. Adding a decision or an approver needs nothing extra.

Record changes

All in docs/architecture/knowledge-contracts.md:

  • INV31 (new "Approval lines" subsection under Boundaries and invariants, after INV30's "External links"): a record's approval lines are append-only. It defines the original decider, what counts as approval (an approving review at the exact head or /approve-spec <full head SHA> from that account; any decider other than cixzhang approves the exact head, also on their own pull request), and what counts as a change (a moved line, text added after an unchanged Decider line, and a filled placeholder decider are not changes).
  • DEC-18: its Decider line (cixzhang, 2026-11-08) is a placeholder until the owner confirms the rule; this pull request stays a draft until then.
  • Verification row for INV31 and DEC-18: a pull request that changes or removes an existing Decider or approved_by line without the original decider's exact-head approval is held; one that only adds a decision or an approver is not.
  • Global review applicability: INV31 joins the specification trigger, so a review of any record change loads it.
  • Current enforcement gap: no repository check reads approvals; pnpm check:knowledge --base warns and review and merge tooling outside the repository enforces the approval.

Knowledge check

pnpm check:knowledge --base <base> (the mode CI already runs on pull requests, next to the append-only schema check) now lists each changed approval line with its original decider, for example docs/architecture/<record>.md: DEC-1 changes from "<old>" to "<new>"; it needs <login>'s approval at the exact head (INV31).

  • It warns and does not fail: the check cannot see reviews or comments, so a failure would also block a change the original decider approved.
  • Records pair by id, decisions by DEC id, so a moved record or a moved line is not a change.
  • scripts/check-knowledge.test.mjs "approval line history" was red first (3 failing) and is green now: a rewritten approved_by plus Decider is reported with the original decider; a removed decision is reported; a new decision, an added approver, an amendment appended to a Decider line, a filled <pending> placeholder, and a moved decision are silent. Run on the real rewrite that motivated the rule, the function reports both the approved_by and the DEC-1 change.
  • Size: about 100 lines in scripts/check-knowledge.mjs (including a small refactor that lets the existing authority reader and the new check share one read of the records at a revision) plus 77 lines of tests.

Existing authority searched

architecture:knowledge-contracts (INV19, INV21, INV30, DEC-11, DEC-14, DEC-17, the review gate under Owning code, the schema append-only check), .github/REVIEW_GATE.md, .github/ENGOWNERS, .github/DESIGNOWNERS, and open pull requests touching knowledge-contracts. DEC-14 says who may approve record content; no current claim protects the recorded decider of an existing decision, so the rule extends the canonical owner of approval policy instead of creating a new record.

Claim scope and non-goals

The rule covers existing Decider lines and approved_by only. It does not change who may approve new record content (DEC-14), add a workflow, or make the knowledge check read approvals.

Writing rubric results

  • R1 narration: none. INV31, DEC-18, the verification row, and the gap describe the system in the present tense; the trigger is not described in the record.
  • R2 research in the record: none.
  • R3 evidence naming a change: none. The verification row names the test and the check output.
  • R4 rejected alternatives over one line or outside a decision: none; DEC-18 records no rejected alternative.
  • R5 pull request or issue references remaining: none in the added lines (searched for # followed by digits, /pull/, /issues/).
  • R6 ruled open questions still listing options: none.

Validation

  • pnpm check:knowledge and node scripts/check-knowledge.mjs --base origin/main: aligned, no approval-line warnings for this pull request's own changes.
  • vitest run scripts/check-knowledge.test.mjs: 147 passed.
  • pnpm review:pre: 0 findings, 231 authored lines, merge into main clean.
  • pnpm specs:for on both changed paths; Prettier; git diff --check.

No Changeset: records and repository tooling only.

@vercel

vercel Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 9, 2026 3:56pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 8, 2026
@cixzhang
cixzhang changed the base branch from docs/link-guard-invariant to main November 8, 2026 16:05
@astracat-bot

astracat-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 9, 2026, 4:03 PM UTC

@cixzhang
cixzhang force-pushed the docs/approval-lines-append-only branch from 89402b0 to 3e85894 Compare November 8, 2026 16:07
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 8, 2026
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 2360b35

⏳ Building… Until it's ready, Storybook · Sandbox open the branch's previous preview.

Current run: The current CI run concluded skipped. Current analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval waits on an engineering owner's decision on the new INV31 and DEC-18 in architecture:knowledge-contracts, and two gaps in the new check:knowledge --base warnings need fixing.

To settle the spec, an engineering owner reviews INV31, DEC-18 and the INV31 verification row, then comments /approve-spec <full head SHA> or says what should change. The author can do this as an engineering owner. The points to settle are whether a pull request from the cixzhang account should count as her approval with no explicit act, whether other deciders must approve the exact head while DEC-14 binds approval to content, and whether DEC-18 should record cixzhang, 2026-11-08 or keep the <pending> placeholder until the decision.

Required fixes:

  • The placeholder test at scripts/check-knowledge.mjs:944 matches "pending" or <…> anywhere in a line, so a decided line such as ChatComposerInput DEC-1 ("pending-search Enter") or a named `cixzhang`, `<pending>` decider can be rewritten or removed with no warning; test the decider token instead and add those cases.
  • Both record lists filter with isKnowledgeRecordPath (:870, :961), which skips platform records, so changing approved_by in the current TextInput.swift.spec.md prints no warning; read records with isValidatedRecordPath, or narrow the "lists each changed approval line" wording in the verification row and the enforcement gap.

[Automated review]

Comment thread scripts/check-knowledge.mjs Resolved
Comment thread scripts/check-knowledge.mjs Resolved
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 3e85894

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 9, 2026
@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 13:48

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the record change is approved for this head, and two gaps in the new check:knowledge --base warning need fixing so that it lists each changed approval line, as the INV31 verification row and the description say.

  • The placeholder test at scripts/check-knowledge.mjs:944 matches "pending" anywhere in a Decider line, so rewriting or removing a decided line such as ChatComposerInput DEC-1 ("…; pending-search Enter, …") prints no warning; look for a placeholder only in the original decision's decider and date fields, and add that case to the tests.
  • Both record lists filter with isKnowledgeRecordPath (:870, :961), which skips platform records, so changing approved_by in docs/specs/components/TextInput/TextInput.swift.spec.md prints no warning; select records with isValidatedRecordPath on both sides and add a test, or narrow the verification row and the enforcement-gap wording to the records the check reads.

After the fix, an engineering owner comments /approve-spec <full head SHA> again for the new head.

[Automated review]

@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec e7d5625

@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 14:14

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. INV31 and DEC-18 are approved for this head, and the earlier gaps for platform records and "pending" text in the check:knowledge --base warning are fixed; one gap remains.

  • Miss: deciderLines (scripts/check-knowledge.mjs:889-906) reads a Decider line only when **Decider:** starts the line under a DEC-n heading, so rewriting or removing any of 11 decided lines in six current records (spec:AST-009 DEC-1 to DEC-5, spec:AST-008 DEC-13's **Deciders:**, the list-item DEC-1 of component:ComplexSelector and component:MultiSelector, and the amendments in spec:AST-006 and spec:AST-034) prints no warning, although the INV31 verification row (docs/architecture/knowledge-contracts.md:1378) says the check lists each changed approval line; widen the parsing with a test per shape, or narrow the row, the gap paragraph and the description to the shapes it reads.

If the fix changes the record's text, an engineering owner approves the new head again with /approve-spec <full head SHA>.

[Automated review]

Comment thread scripts/check-knowledge.mjs Resolved
@cixzhang
cixzhang marked this pull request as draft November 9, 2026 14:48
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 83e6e16

@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 14:49

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. INV31 and DEC-18 are approved for this head. Every decider-line shape named in the last review is now read, and the earlier gap is fixed. One gap remains in the check:knowledge --base warning.

  • Miss: check:knowledge --base never reads theme:neutral DEC-1's two decider lines (**System-boundary decider:** and **Final Neutral adoption decider:**, packages/themes/neutral/neutral.spec.md:196-197), because DECIDER_LINE matches only labels that start with **Decider and deciderLines keeps one line per decision (scripts/check-knowledge.mjs:896, :909), so the verification row's "lists each changed approval line" does not hold: read every bold label that ends in decider or deciders (except Proposed decider) as its own entry under the decision and add a test, or narrow the row and the gap paragraph to **Decider:** and **Deciders:** lines.

Narrowing the row changes approved spec text, so it would need a new /approve-spec for that head. Separately, CI runs the --base step only for pull requests that are not spec-only, so a record-only pull request shows the warning only when someone runs the check locally.

[Automated review]

Comment thread scripts/check-knowledge.mjs Resolved
@cixzhang
cixzhang marked this pull request as draft November 9, 2026 15:09
Merges main: DEC-18 comes before main's DEC-19.
@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 15:11
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 9, 2026
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec f59452d

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 9, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested. INV31 and DEC-18 are approved for this head. Two gaps remain in the check:knowledge --base warning, which the approved verification row says lists each changed approval line with its original decider:

  • Miss: DECIDER_LINE (scripts/check-knowledge.mjs:899) reads only labels that end in decider or deciders, so rewriting or removing any of the 20 **Direction owner:** lines that record who decided spec:AST-036 DEC-1 to DEC-12, spec:AST-037 DEC-1 to DEC-3 and module:Table/useTableRowStatus DEC-1 to DEC-5 prints no warning; read that label as a decider with a test, relabel those lines **Decider:**, or narrow INV31 under a new /approve-spec.
  • Miss: hasPlaceholderDecider (scripts/check-knowledge.mjs:942-948) tests only the text before the first ;, so when an owner decides module:DropdownMenu/useMenuPress DEC-4, whose Decider is proposed by `vjeux`, `2026-09-27`; pending owner review, the check warns that the change needs "proposed by vjeux"'s approval, although INV31 says a filled placeholder is not a change; treat a decider field that starts with proposed as a placeholder and add that shape to the placeholder test.

[Automated review]

Comment thread scripts/check-knowledge.mjs Resolved
Comment thread scripts/check-knowledge.mjs Resolved
@cixzhang
cixzhang marked this pull request as draft November 9, 2026 15:48
@cixzhang

cixzhang commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 2360b35

@cixzhang
cixzhang marked this pull request as ready for review November 9, 2026 15:50

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: some required checks have not finished on this head yet.

INV31 and DEC-18 are approved for this head, and the two gaps in the check:knowledge --base warning are fixed: **Direction owner:** lines now count as decider lines, and deciding a proposed by … decision no longer warns. A test covers each shape, and both fail against the previous revision's script.

[Automated review]

@cixzhang
cixzhang merged commit 516630d into main Nov 9, 2026
114 checks passed
@github-actions
github-actions Bot deleted the docs/approval-lines-append-only branch November 10, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 2360b357 Deployed Nov 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant