Skip to content

Commit d8a1c7f

Browse files
claude[bot]claude
andauthored
Gate the form-section name convention in content/docs TS fences (#11890)
* feat(gate): add check-docs-section-name over content/docs TS fences * test(gate): make the self-test's finding assertions crash-proof * docs: name the 6 remaining nameless form-section examples; wire the gate * docs(gate): point the declared YAML scope gap at its filed card --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 1a47a53 commit d8a1c7f

5 files changed

Lines changed: 939 additions & 4 deletions

File tree

‎.github/workflows/lint.yml‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,52 @@ jobs:
10451045
- name: React pages honour the useAdapter() query and result contracts
10461046
run: pnpm check:react-page-adapter-contract
10471047

1048+
# #10830 form-section `name` in docs examples: the docs pages that TEACH
1049+
# the i18n-anchor convention were the one surface where nothing enforced
1050+
# it. `packages/lint`'s `translation-section-name-missing` walks app
1051+
# METADATA — `collectionEntries`, `walkPageComponents`, `viewContainerSites`
1052+
# — and never sees an `.mdx` fence, and its severity is `'warning'` besides.
1053+
# `{/* os:check */}` fences ARE type-checked against the live spec by
1054+
# `packages/spec/scripts/check-skill-examples.ts`, but `name` is
1055+
# `.optional()` in the schema — deliberately, and it STAYS (#10709) — so a
1056+
# nameless section type-checks CLEAN. `content/docs/ui/forms.mdx`'s first
1057+
# block carried an `os:check` marker over a nameless section for months.
1058+
#
1059+
# A gate rather than a fourth sweep, decided by the card's own history:
1060+
# the same population was hand-counted three times and produced three
1061+
# numbers — #10579 "3 of 5 over four ui/ pages" (single-line scan), #10709
1062+
# "7 of 15 across 5 pages" (multi-line, but required `{` to start a fresh
1063+
# line, so it missed `sections: [{`), PR #10827 "8 of 16 across 5 pages".
1064+
# Each pass corrected its predecessor's matcher and introduced a subtler
1065+
# version of the same error.
1066+
#
1067+
# This gate's landing census found the error all three SHARED and none
1068+
# noticed: all three scoped to `content/docs/ui/**`, and six more nameless
1069+
# literals were sitting in TS fences under `content/docs/concepts/` and
1070+
# `content/docs/protocol/objectui/`. The real population is 22 literals
1071+
# across 8 pages, not 16 across 5 — a hand-derived SCOPE is defeated the
1072+
# same way a hand-derived matcher is, and that is the argument for a
1073+
# mechanical one. `CENSUS_ANCHORS` pins one of those out-of-`ui/` pages, so
1074+
# re-narrowing the scope REFUSES instead of reporting a clean corpus.
1075+
#
1076+
# Invoked as `node` rather than through a `pnpm check:*` alias, same as the
1077+
# doc-frontmatter and aggregator-roster steps: that alias belongs in root
1078+
# package.json, declared territory of the @changesets/cli v3 migration lane
1079+
# (#9465) while it runs. Dependency-free filesystem read, sub-second over
1080+
# the whole corpus.
1081+
#
1082+
# Its --self-test runs FIRST and is where the rule is observed FAILING:
1083+
# this PR swept the live corpus, so a passing run over real data cannot
1084+
# distinguish a working matcher from one that matches nothing. The verdict
1085+
# line prints the POPULATION it judged, and `run()` REFUSES — never exits 0
1086+
# — when the corpus falls below its floors or a census anchor stops
1087+
# contributing. A silent zero here would be this gate committing the exact
1088+
# defect it exists to catch.
1089+
- name: Docs form-section examples carry a `name`
1090+
run: |
1091+
node scripts/check-docs-section-name.mjs --self-test
1092+
node scripts/check-docs-section-name.mjs
1093+
10481094
# #9632 published-README links: a README in a package's `files` array with
10491095
# `private` unset is rendered on npm and on GitHub as well as here, and
10501096
# NOTHING read its links. Measured before the gate was written: the lychee

‎content/docs/concepts/architecture.mdx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,12 @@ export const CustomerView = defineView({
263263
data: { provider: 'object', object: 'customer' },
264264
sections: [
265265
{
266+
name: 'company_information',
266267
label: 'Company Information',
267268
fields: ['name', 'industry', 'annual_revenue'],
268269
},
269270
{
271+
name: 'contact',
270272
label: 'Contact',
271273
fields: ['primary_contact'],
272274
},

‎content/docs/protocol/objectui/concept.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ type FormView = z.infer<typeof FormViewSchema>;
474474
const config = FormViewSchema.parse({
475475
type: 'simple',
476476
sections: [
477-
{ label: 'Info', columns: 2, fields: ['name', 'email'] }
477+
{ name: 'info', label: 'Info', columns: 2, fields: ['name', 'email'] }
478478
]
479479
});
480480

‎content/docs/protocol/objectui/index.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ defineView({
234234
data: { provider: 'object', object: 'project' },
235235
// In tabbed forms each section renders as its own tab.
236236
sections: [
237-
{ label: 'Basic Info', columns: 2, fields: ['name', 'status'] },
238-
{ label: 'Dates', columns: 2, fields: ['start_date', 'end_date'] },
239-
{ label: 'Team', fields: ['manager', 'team_lead'] }
237+
{ name: 'basic_info', label: 'Basic Info', columns: 2, fields: ['name', 'status'] },
238+
{ name: 'dates', label: 'Dates', columns: 2, fields: ['start_date', 'end_date'] },
239+
{ name: 'team', label: 'Team', fields: ['manager', 'team_lead'] }
240240
]
241241
}
242242
});

0 commit comments

Comments
 (0)