Skip to content

fix(knowledge): status phrases are matched across wrapped lines - #14101

Merged
cixzhang merged 4 commits into
mainfrom
lane4/knowledge-status-wrapped-phrases
Dec 1, 2026
Merged

cixzhang merged 4 commits into
mainfrom
lane4/knowledge-status-wrapped-phrases

Conversation

@cixzhang

@cixzhang cixzhang commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

User impact

A spec author runs pnpm check:knowledge to catch temporary project status before a record lands (INV32). When a status phrase wraps across a line break, as "Implementation gap: not" at the end of one line and "built; …" at the start of the next, the check says nothing, so the phrase reaches main in a current record: two such wrapped phrases are in AST-103 on main today, and one is in AST-057. After this change the check warns on a wrapped phrase at the line where it starts, as it does for a phrase on one line.

Problem and solution fit

  • Why it is missed: findStatusPhrases strips code spans and quotes from a whole paragraph, but then splits the paragraph back into physical lines before it matches. Each phrase pattern already allows any whitespace between its words, a line break included, but it never sees two lines at once.
  • Why it matters: records are wrapped at about 80 columns, so a two- or three-word phrase often lands across a line break. A missed warning is how project status enters a current record.
  • The fix: match each run of wrapped lines as one text, and map each hit back to the line where it starts. A list item starts a new run and a table row is a run of its own, also in a table written without outer pipes (a paragraph with a delimiter row), so a phrase never joins two items or two rows.

Expected behavior and authority

architecture:knowledge-contracts INV32 (records state behavior and decisions, not project status), whose verification row reads: "pnpm check:knowledge warns on each build-status or sequencing phrase in a spec or architecture record and does not fail (DEC-20)". A wrapped phrase is such a phrase. The check stays advisory: it prints warnings and never fails (DEC-20).

Smallest restoration

  • scripts/lib/knowledge-status-phrases.mjs: phrase matching runs over each run of wrapped prose lines and reports each hit at its starting line, one entry per phrase and line, in the phrase list's order as before. The Status: line and in-progress checks stay per line. Code-span, quote and behavior-context blanking are unchanged.
  • docs/specs/AST-057-row-actions/spec.md: the one phrase the fixed check newly finds outside AST-103 ("A second / consumer") is reworded; meaning unchanged.
  • The two wrapped phrases the fixed check finds in AST-103 are reworded by docs(spec): AST-103 says what is absent, not what is not built #14089, so this pull request merges after it.

Evidence

  • Reproduction before the change: the new case "warns on a phrase that wraps across a line break, at the line where it starts" fails at d6bbd4f (no hit for "is not / built." or "has not / started"), and so does "joins the wrapped lines of one list item".
  • Result after the change: all 24 cases in knowledge-status-phrases.test.mjs pass.
  • Representative unchanged path: every earlier case passes unchanged (one-line phrases, whole words only, one Status line, code spans, quotes, block quotes, behavior contexts, gap sections, frontmatter, paths). The new negative case "does not join two list items or two table rows into one phrase" passes before and after.
  • Across all 335 checked records on main (5f9d5ee): 5 existing warnings, all kept; the fixed check adds 3 (AST-057:169, AST-103:189, AST-103:291) and removes none. With this pull request's AST-057 wording and docs(spec): AST-103 says what is absent, not what is not built #14089's AST-103 wording, no new warning remains.
  • Regression test or other mutation-sensitive proof: the two red cases above.

Scope

Components: knowledge checks (scripts/lib/knowledge-status-phrases.mjs); spec:AST-057 wording

Overlap checked: #14089 (AST-103 wording only, the two wrapped phrases this check now finds; this pull request merges after it), #12237, #11176, #12562, #8485, #8217, #8121, #10462 (each edits other parts of AST-057, such as #12237's FR4 row, none the "Public out-of-flow slots" bullet), #8288, #12592 (edit scripts/check-knowledge.mjs, not this module)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

For the AST-057 edit (one bullet in Non-goals):

R1 narration: none.
R2 research: none.
R3 evidence: none touched.
R4 rejected alternatives: none touched.
R5 change references: none.
R6 open questions: none touched.
R7 project status: "A second consumer" (sequencing) restated as "Any other out-of-flow part … needs its own component:Item anatomy record".

Testing

  • pnpm vitest run --project node scripts/lib/knowledge-status-phrases.test.mjs: 24 pass. The case for a table without outer pipes fails at 9e11f23 and passes at this head.
  • findStatusPhrases before and after over every record under docs/specs/ and docs/architecture/: the counts above.
  • pnpm check:knowledge: passes (the status check warns only).

Red: check:knowledge reads status phrases one physical line at a time, so
"not" at the end of one line and "built." at the start of the next is
missed. Two list items or two table rows that only touch must not join.
check:knowledge matched each status phrase within one physical line, so a
phrase wrapped across a line break went unreported. It now matches each run
of wrapped lines (a list item or table row starts its own run) and reports
the hit at the line where the phrase starts. AST-057 gets the one newly found
phrase reworded; the two in AST-103 are reworded by #14089.
@cixzhang cixzhang added the lane:4 Astryx fix-loop lane 4 owns this label Dec 1, 2026
@vercel

vercel Bot commented Dec 1, 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 Dec 1, 2026 1:33am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Dec 1, 2026
@astracat-bot

astracat-bot Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Dec 1, 2026, 1:51 AM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Dec 1, 2026
@cixzhang

cixzhang commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 84a8d3e

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

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · cd39f53

Storybook · Sandbox · built from this PR's head

Package size: no published package changed; no new dependencies.

Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@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. Matching each run of wrapped lines works: the new cases pass, the two wrap cases fail without the change, and over the records on main the check keeps every existing warning and adds only the three wrapped phrases the description names. One stated guarantee does not hold yet:

  • scripts/lib/knowledge-status-phrases.mjs:102 treats a line as a table row only when it starts with |, so a GitHub table written without outer pipes (Label | not above built | here) is joined into one run and warns "not built", which contradicts "a table row is a run of its own, so a phrase never joins two items or two rows" in the description and the wrapRuns comment.

Treating any line with a | outside code spans as a row (for example const TABLE_ROW = /\|/;), plus a pipe-less table in the "does not join" case, fixes it without changing any current warning; narrowing the comment and the description to rows that start with | would also resolve it.

Claims and files checked

Review mode: same-head; reason: none

  • Title (live): status phrases are matched across wrapped lines — verified (the head passes the wrap cases at test lines 56-68 and 86-92).
  • Claim: a phrase that wraps across a line break now warns at the line where it starts — verified (both wrap cases assert the starting line).
  • Claim: the old check split each paragraph back into physical lines before matching — verified (the base matched each prose line on its own).
  • Claim: every phrase pattern already allows any whitespace between its words — verified (wordPattern builds every pattern with \s+).
  • Claim: a list item starts a new run and a table row is a run of its own, so a phrase never joins two items or two rows — false (rows without a leading pipe are joined).
  • Claim: output stays one entry per phrase and line in phrase-list order, with the Status line, in-progress and blanking rules unchanged — verified (lines 215-229; proseLines is unchanged).
  • Claim: main holds two wrapped phrases in the reorderable spec and one in the row-actions spec — verified (run over all 335 checked records).
  • Claim: across those 335 records, 5 existing warnings are kept, 3 are added and none is removed — verified (same run, every checked path).
  • Claim: the row-actions rewording handles the only other new find and keeps its meaning — verified (bullet read; the head reports nothing in that record).
  • Claim: with this and the companion pull request's wording, no new warning remains — verified (0 warnings with both).
  • Claim: the two new cases fail before the change, and the negative case passes before and after — verified (head test file against the base module fails exactly those two).
  • Claim: all 23 cases pass — verified (23 of 23 at this head).
  • Claim: pnpm check:knowledge passes and the check stays advisory — verified (CI's lint at this head runs it, prints 7 warnings and passes).
  • Claim: overlap with other open pull requests was checked, and this merges after the companion pull request — reported.
  • File: scripts/lib/knowledge-status-phrases.mjs — finding (table-row boundary).
  • File: scripts/lib/knowledge-status-phrases.test.mjs — clear (its negative case covers only pipe-led rows).
  • File: docs/specs/AST-057-row-actions/spec.md — clear.

Automated review (maintainer link)

Red: a GitHub table may leave out the outer pipes, so a row need not start
with one, and the wrapped-phrase match joins two such rows.
In a paragraph with a table's delimiter row, every line with a pipe is a row,
as GitHub tables may leave out the outer pipes.
@cixzhang

cixzhang commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec cd39f53

@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: the heavy CI jobs (build, test and docsite-test) run once review passes and must pass before merge.

Wrapped status phrases now warn at the line where they start, and a table written without outer pipes keeps its rows apart, pinned by the new test case. Merge after #14089, so main does not pick up the two wrapped AST-103 phrases this check now reports.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (0): none
  • Claim: a status phrase that wraps across a line break now warns at the line where it starts. Verified: the wrap test passes on the head and fails on the base, and the record line numbers match.
  • Claim: the base matched each physical line on its own, so wrapped phrases were missed. Verified: base code, and the wrap tests fail against it.
  • Claim: each phrase pattern already allows any whitespace, a line break included. Verified: the pattern builder turns each space into one-or-more whitespace.
  • Claim: a list item starts a new run and a table row is a run of its own, with or without outer pipes, so a phrase never joins two items or two rows. Verified: the list, piped-table and pipe-less-table cases stay silent, and so do item, row and header-row probes.
  • Claim: the Status line and in-progress checks stay per line, blanking is unchanged, and output stays one entry per phrase and line in phrase-list order. Verified: code read, and every earlier case passes.
  • Claim: the check stays advisory and never fails. Verified: the warning-only printer is unchanged, and Lint passes with 7 warnings.
  • Claim: over the 335 checked records, 5 existing warnings are kept, 3 are added (AST-057:169, AST-103:189, AST-103:291) and none are removed. Verified: own run over the base and main records.
  • Claim: with this pull request's AST-057 wording and #14089's AST-103 wording no new warning remains. Verified: own run, 0 warnings.
  • Claim: the AST-057 rewording keeps its meaning. Verified: the same requirement, approved by an engineering owner at this head.
  • Claim: all 24 test cases pass, the two wrap cases fail before the fix, the pipe-less table case fails at the previous head, and the new negative case passes before and after. Verified: own runs of the test file against each version of the module.
  • Claim: pnpm check:knowledge passes. Verified: Lint at this head.
  • Claim: overlap with other open pull requests was checked. Reported.
  • File scripts/lib/knowledge-status-phrases.mjs: clear
  • File scripts/lib/knowledge-status-phrases.test.mjs: clear
  • File docs/specs/AST-057-row-actions/spec.md: clear

Automated review (maintainer link)

@cixzhang
cixzhang merged commit 3e9743a into main Dec 1, 2026
138 of 141 checks passed
@github-actions
github-actions Bot deleted the lane4/knowledge-status-wrapped-phrases branch December 2, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — cd39f53a Deployed Dec 1, 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. lane:4 Astryx fix-loop lane 4 owns this

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant