Repository navigation
fix(knowledge): gate, check, and route platform records under docs/specs/components - #9279
Conversation
…ecs/components A platform record such as docs/specs/components/TextInput/TextInput.swift.spec.md was not a knowledge record to change-scope, check:knowledge, or specs:for, so a pull request that made one current passed the spec-owner gate with no approval. - change-scope: a platform record is a spec record, gated like the core record beside it. - check:knowledge: checks a platform record's kind, id, platform_of, owners, authority and approval fields, and verified_by paths. - specs:for: a platform record governs its language's code for the same component root and brings in the core record it names in platform_of. - knowledge-contracts: the enforcement-gap paragraph and the DEC-15 verification row say what is now checked.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
/approve-spec a04614d |
PR Analysis Report🔎 Preview ·
|
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | core |
. · Types · interface FieldStatusProps |
message: string |
import type {FieldStatusProps} from '@astryxdesign/core'; const x: FieldStatusProps = {message: …} |
| + | core |
. · Types · interface FieldStatusProps |
ref?: React.Ref<HTMLDivElement> |
import type {FieldStatusProps} from '@astryxdesign/core'; const x: FieldStatusProps = {ref: …} |
| + | core |
. · Types · interface FieldStatusProps |
type: InputStatusType |
import type {FieldStatusProps} from '@astryxdesign/core'; const x: FieldStatusProps = {type: …} |
| + | core |
. · Types · interface FieldStatusProps |
variant?: FieldStatusVariant = 'attached' |
import type {FieldStatusProps} from '@astryxdesign/core'; const x: FieldStatusProps = {variant: …} |
| + | core |
. · Types · interface FieldStatusProps |
xstyle?: StyleXStyles |
import type {FieldStatusProps} from '@astryxdesign/core'; const x: FieldStatusProps = {xstyle: …} |
| + | core |
. · Types · interface FieldStatusProps |
inherits AriaAttributes, DOMAttributes, HTMLAttributes |
import type {FieldStatusProps} from '@astryxdesign/core' |
| + | core |
. · Types · interface SearchContext |
interface SearchContext<T extends SearchableItem = SearchableItem> |
import type {SearchContext} from '@astryxdesign/core' |
| + | core |
./Typeahead · Also exported from an earlier entry point · SearchContext |
SearchContext (.) |
import {SearchContext} from '@astryxdesign/core/Typeahead' |
| ~ | core |
. · Components · component ComplexSelector |
prop statusVariant?: FieldStatusVariant = 'attached' for input selectors; 'detached' for secondary and ghost selectors → prop statusVariant?: FieldStatusPlacement = 'attached' for input selectors; 'detached' for secondary and ghost selectors |
<ComplexSelector statusVariant="attached" /> |
| ~ | core |
. · Components · component DateInput |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<DateInput statusVariant="attached" /> |
| ~ | core |
. · Components · component DateRangeInput |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<DateRangeInput statusVariant="attached" /> |
| ~ | core |
. · Components · component Field |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<Field statusVariant="attached" /> |
| ~ | core |
. · Components · component FieldStatus |
component FieldStatus(props: FieldStatusProps) → component FieldStatus @deprecated |
<FieldStatus /> |
| ~ | core |
. · Components · component FieldStatus |
prop variant?: FieldStatusVariant = 'attached' → prop variant: FieldStatusVariant = 'attached' |
<FieldStatus variant="attached" /> |
| ~ | core |
. · Components · component FileInput |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<FileInput statusVariant="attached" /> |
| ~ | core |
. · Components · component MultiSelector |
prop statusVariant?: FieldStatusVariant = 'attached' for input selectors; 'detached' for secondary and ghost selectors → prop statusVariant?: FieldStatusPlacement = 'attached' for input selectors; 'detached' for secondary and ghost selectors |
<MultiSelector statusVariant="attached" /> |
| ~ | core |
. · Components · component NumberInput |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<NumberInput statusVariant="attached" /> |
| ~ | core |
. · Components · component PowerSearch |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<PowerSearch statusVariant="attached" /> |
| ~ | core |
. · Components · component Selector |
prop statusVariant?: FieldStatusVariant = 'attached' for input selectors; 'detached' for secondary/ghost selectors → prop statusVariant?: FieldStatusPlacement = 'attached' for input selectors; 'detached' for secondary/ghost selectors |
<Selector statusVariant="attached" /> |
| ~ | core |
. · Components · component TextArea |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<TextArea statusVariant="attached" /> |
| ~ | core |
. · Components · component TextInput |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<TextInput statusVariant="attached" /> |
| ~ | core |
. · Components · component TimeInput |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<TimeInput statusVariant="attached" /> |
| ~ | core |
. · Components · component Tokenizer |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<Tokenizer statusVariant="attached" /> |
| ~ | core |
. · Components · component Typeahead |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusPlacement = 'attached' |
<Typeahead statusVariant="attached" /> |
| ~ | core |
. · Types · interface FieldStatusProps |
interface FieldStatusProps extends BaseProps<HTMLDivElement> (props of FieldStatus) → interface FieldStatusProps extends BaseProps<HTMLDivElement> |
import type {FieldStatusProps} from '@astryxdesign/core' |
| ~ | core |
. · Types · interface FieldStatusVariantMap |
tooltip: true → tooltip: true @deprecated |
import type {FieldStatusVariantMap} from '@astryxdesign/core'; const x: FieldStatusVariantMap = {tooltip: …} |
| ~ | core |
. · Types · interface SearchSource |
search: (query: string) => Promise<T[]> | T[] → search: (query: string, context?: SearchContext<T>) => Promise<T[]> | T[] |
import type {SearchSource} from '@astryxdesign/core'; const x: SearchSource = {search: …} |
| ~ | core |
. · Types · interface UseInputStatusIconOptions |
statusVariant?: FieldStatusVariant → statusVariant?: FieldStatusPlacement |
import type {UseInputStatusIconOptions} from '@astryxdesign/core'; const x: UseInputStatusIconOptions = {statusVariant: …} |
| ~ | richtext |
. · Components · component RichTextEditor |
prop statusVariant?: FieldStatusVariant = 'attached' → prop statusVariant?: FieldStatusVariant | 'tooltip' = 'attached' |
<RichTextEditor statusVariant="tooltip" /> |
Not run on this PR: add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
CI impact: 0 job-min per update · pool 0% · time to green −1.2 min · standard runners · 6 CI action or script files changed (not measured)
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 78.7 | 78.7 | 0 |
| Runner pool, runner-minutes a day | 36,690 | 36,690 | 0 (0%) |
| Average concurrent jobs | 25.5 | 25.5 | 0 |
| Time to green (median → this run) | 14.6 min | 13.4 min | −1.2 min |
| Runs a day | 466 | 466 | 0 |
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/change-scope.cjs, .github/scripts/change-scope.test.mjs, .github/scripts/knowledge-paths.cjs, .github/scripts/knowledge-paths.test.mjs, .github/scripts/spec-owner-decision.test.mjs, .github/scripts/spec-owner-reconcile.test.mjs.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Generated by PR Enrichment workflow | View full report
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested: the gate, check and lookup changes match the knowledge-contracts record, and the new tests fail on main and pass here, but two things need fixing first.
validatePlatformComponentRecordscopies the owners, authority and approval checks fromvalidateAgainstSchemaand has already drifted: acurrentSwift record withverified_by: []passes (the new check-knowledge test asserts it), so please run platform records through the shared validator with a language-qualified id allowance and delete the copy.- The description says
specs:foronTextInput.swiftnow listscomponent:swift/TextInputandcomponent:TextInput, but every Swift record is draft, so the default lookup is unchanged and that holds only with--include-draft; please reword it, and mention that a change touching only Swift records now takes the spec-only CI path.
[Automated review]
| const owners = frontmatter.get('owners'); | ||
| if (!Array.isArray(owners) || owners.length === 0) { | ||
| problems.push(`${filePath}: owners must be a non-empty inline list.`); | ||
| } | ||
|
|
||
| const authority = frontmatter.get('authority'); | ||
| if (!schema.authorities.includes(authority)) { | ||
| problems.push( | ||
| `${filePath}: authority must be ${schema.authorities.join(', ')}.`, | ||
| ); | ||
| } | ||
| if (authority === 'current') { | ||
| if (!engineeringApprovalOwners.includes(frontmatter.get('approved_by'))) { | ||
| problems.push( | ||
| `${filePath}: current records require approved_by to name an authorized owner.`, | ||
| ); | ||
| } | ||
| const approvedAt = frontmatter.get('approved_at'); | ||
| if ( | ||
| typeof approvedAt !== 'string' || | ||
| !/^\d{4}-\d{2}-\d{2}$/.test(approvedAt) | ||
| ) { | ||
| problems.push( | ||
| `${filePath}: current records require approved_at as YYYY-MM-DD.`, | ||
| ); | ||
| } | ||
| } | ||
| if (authority === 'archived') { | ||
| const reason = frontmatter.get('archive_reason'); | ||
| if (!schema.archiveReasons.includes(reason)) { | ||
| problems.push( | ||
| `${filePath}: archived records require archive_reason (${schema.archiveReasons.join(', ')}).`, | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
These owners, authority, approved_by/approved_at and archive_reason checks copy validateAgainstSchema (lines 1977-2029) and leave out its currentNonEmptyFields and superseded_by rules, so a current Swift record with verified_by: [] passes here; the shared validator reports current records require non-empty verified_by for the same record. Run with the component schema, validateAgainstSchema rejects the six Swift records only on the id pattern, so it can take a language-qualified id (component:<language>/<PublicName>), keeping just the platform-specific checks here.
|
/approve-spec 87ab1b1 |
There was a problem hiding this comment.
Changes requested: the gate, check and lookup changes match the knowledge-contracts record, and the misplaced-record cases from the last round (Buton/, Wire/, Banana) now fail pnpm check:knowledge. One gap remains: validatePlatformComponentRecords rebuilds the core placement rule as a single ternary and, for a flat package, skips the root check, so docs/specs/components/RichTextEditor/RichTextView.swift.spec.md passes while the same core record fails, although the amended record says platform records are checked as core records are. Please move the placement checks into one helper that both validateComponentModuleRelationships and validatePlatformComponentRecords call, and add a flat-package case to the platform test.
[Automated review]
| } else if ( | ||
| location.layout === 'flat' | ||
| ? !packageHasPublicComponent(root, location.packageName, publicName) | ||
| : publicName !== componentRoot && | ||
| !componentRootDefinesPublicComponent( | ||
| location.componentSourcePath, | ||
| publicName, | ||
| ) | ||
| ) { | ||
| problems.push( | ||
| `${filePath}: platform record for ${publicName} must match component root ${JSON.stringify(componentRoot)} or an exact public component entry in that root's consumer docs.`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
This folds the core rule's two independent checks (lines 1273-1291) into one ternary, so for a flat package only the export is checked and never that the name is the folder's root or a public component of it. At this head docs/specs/components/RichTextEditor/RichTextView.swift.spec.md passes pnpm check:knowledge, while the same core record fails with "flat component record component:RichTextView must match component root "RichTextEditor"". A shared placement helper called from both functions, plus a flat-package case in the platform test, would close it.
|
/approve-spec 9b6d550 |
There was a problem hiding this comment.
Changes requested: both earlier points are fixed (the platform validator now uses validateAgainstSchema, and the description scopes the specs:for claim to --include-draft), and the new tests fail on main and pass here, but one gap remains. validatePlatformComponentRecords still runs its own record loop, so a platform record's path-applicability:v1 or review-applicability:v1 block is never validated even though specs:for now reads it: a ** pattern in TextInput.swift.spec.md passes check:knowledge and routes unrelated files to the Swift record, and an unsupported trigger passes but makes every pnpm specs:for run exit 1. Please run platform records through the main record loop in validateKnowledgeRoot (passing the language-qualified idPattern), keep only the platform_of, core-id and verified_by checks separate, and add a test with an invalid block.
[Automated review]
| ) { | ||
| const problems = []; | ||
| const tracked = repositoryFiles ? new Set(repositoryFiles) : null; | ||
| for (const absolutePath of discoverPlatformComponentRecords(root)) { |
There was a problem hiding this comment.
This loop runs beside validateKnowledgeRoot's record loop and leaves out its path-applicability, review-applicability and duplicate-id checks. loadKnowledgeIndex now feeds platform records to specs:for, so those blocks take effect without validation. A ** pattern here passes check:knowledge and routes packages/cli/package.json to component:swift/TextInput. An unsupported review trigger passes too, and then every pnpm specs:for run exits 1. Iterating discoverPlatformComponentRecords in the main loop with the idPattern override, and keeping only the platform_of, core-id and verified_by checks here, closes all three.
|
/approve-spec 2e20944 |
There was a problem hiding this comment.
Approval recommended: Swift platform records now go through the spec-owner gate, pnpm check:knowledge and pnpm specs:for the way architecture:knowledge-contracts and spec:AST-093 describe, and the flat-package placement gap from the last round is closed by the shared componentNamePlacement helper with its own test. Nothing further is needed from the author for this review.
[Automated review]
There was a problem hiding this comment.
Changes requested: the gate, check and lookup changes match the knowledge-contracts record, and the earlier applicability-block and duplicate-id gaps are fixed. One gap remains: a platform record filed in the wrong folder, or for a root no registered package has (for example docs/specs/components/Buton/Button.swift.spec.md), still passes pnpm check:knowledge and drops out of specs:for for its Swift view, while the amended record says platform records are checked like every other record. Please check a platform record's folder and public name the way core component records are checked (validateComponentModuleRelationships), even when no core record exists, and add a test for it, or narrow that sentence to the checks that run.
[Automated review]
| ); | ||
| } | ||
| const corePath = `${COMPONENT_SPEC_ROOT}/${componentRoot}/${publicName}.spec.md`; | ||
| if (fs.existsSync(path.join(root, corePath))) { |
There was a problem hiding this comment.
This compares against the core component only when a core record file exists, and platform records never reach validateComponentModuleRelationships (they are kept out of records at line 2316). So docs/specs/components/Buton/Button.swift.spec.md, Wire/Wire.swift.spec.md (no registered package has a Wire root) or Button/Banana.swift.spec.md all pass check:knowledge, while the same mistake in a core record fails, and the misplaced record drops out of specs:for for its Swift view. Resolving the core path with componentRecordLocation even when no core record exists, and requiring the public name to be the root or a public component of it (as lines 1232-1270 do for core records), would close it; a test with a misplaced platform record would pin it.
| `pnpm check:knowledge` checks a platform record | ||
| (`docs/specs/components/<ComponentRoot>/<PublicName>.<language>.spec.md`) like | ||
| every other record, accepting its language-qualified id, and also checks that | ||
| `platform_of` names its core component and that its `verified_by` paths exist. |
There was a problem hiding this comment.
"like every other record" reads as including the folder and component-root checks (the DEC-15 row counts "a record whose component root no registered package's source tree has" as a failure), which platform records do not get yet, and it leaves out that a platform record's theme-target block is not checked. Either add the placement check in validatePlatformComponentRecords or name the checks that run.
|
/approve-spec e7e0a39 |
Maintainer impact
A platform record such as
docs/specs/components/TextInput/TextInput.swift.spec.mdis invisible to the spec tooling. A pull request that edits one, or makes onecurrent, gets a green spec-owner gate ("No knowledge records changed.") with no owner approval;pnpm check:knowledgenever reads it; andpnpm specs:foron a Swift view returns no component record. Owners reviewing a Swift spec change get no gate, and an agent looking up a Swift view gets no contract.Intended invariant
architecture:knowledge-contracts(Owning code, DEC-15) places a platform record beside the core record as<PublicName>.<language>.spec.mdwith the idcomponent:<language>/<PublicName>andplatform_of: component:<PublicName>. A record change is owner-gated, and lookup is path-first. Nothing here changes product code or what a record says.Change
.github/scripts/change-scope.cjs): a platform record is a spec record, so it goes through the spec-owner gate like the core record beside it. A current one needs an engineering owner's approval; a draft one does not.component:<language>/<PublicName>). It is placed like the core record it implements, whether or not that record exists: its folder must be a component root a registered package owns, and its public name must be that root or a public component of it. Then it checks what only a platform record has:platform_ofnames the core component, the core record beside it declares that id, and itsverified_bypaths exist. A platform record's theme-target block is parsed but not checked against a core theming contract.platform_ofit brings in the core record. Every Swift record is draft today, so the default lookup is unchanged. With--include-draft,packages/native/apple/Sources/Astryx/TextInput/TextInput.swiftlistscomponent:swift/TextInputandcomponent:TextInput; a current Swift record will show by default.architecture:knowledge-contractsenforcement-gap paragraph and DEC-15 verification row now say what is checked.Evidence
classifyChanges([{filename: 'docs/specs/components/TextInput/TextInput.swift.spec.md'}])returnstouchesKnowledgeRecords: false.specs:foronTextInput.swiftlists no component record.spec-owner-reconcile.test.mjs.check:knowledgereports a misplaced record (an unknown root, or a name that is not a public component of its root), a wrong or duplicate id, a wrongplatform_of, empty owners, a missingverified_bypath, an invalid path- or review-applicability block, and a current record without approval or with an emptyverified_by.pnpm check:knowledgepasses;specs:for --unreachedreturns 0;specs:for --unroutedoutput is unchanged.Scope
Testing
vitest --project nodeon knowledge-paths, change-scope, spec-owner-decision, spec-owner-reconcile, spec-owner-workflow, check-knowledge, and specs-for-file: 395 tests pass.pnpm check:knowledge,specs:for --unreached, and--unrouted(unchanged).Writing rubric results
Posted by Cindy's agent on her behalf.