diff --git a/scripts/pm/dispatch-gates.data.mjs b/scripts/pm/dispatch-gates.data.mjs index cd0f2b14277..1546fb14aae 100644 --- a/scripts/pm/dispatch-gates.data.mjs +++ b/scripts/pm/dispatch-gates.data.mjs @@ -1481,6 +1481,241 @@ export const CHANGE_KIND_ROWS = [ }, ], }, + { + kind: "changes TemplateManifestSchema's KEY SET (a key added, removed or renamed in its own `.extend()` literal, a key added to or dropped from its `.omit()` list, or a key added, removed or renamed in CreatePackageRequestSchema, the request it omits from and extends, read from the DIFF against the merge base)", + matches: 'template-manifest-key-set', + gates: [ + { + name: 'pnpm --filter @objectstack/cli exec vitest run test/package-publish-uncarried-manifest-keys.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/cli/test/package-publish-uncarried-manifest-keys.test.ts', + why: "its partition case holds the publish command's five key buckets (sent, warned about as uncarried, refused, scaffold-only, retired) equal to Object.keys(TemplateManifestSchema.shape), so a key the manifest gains (in the template's own extension, through the request it extends, or by leaving the omit list) reds it until publish classifies the key, and a key it loses reds it until the bucket drops it. It is a cli test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config does NOT alias the spec package, so the test reads the BUILT spec dist and a stale dist answers green for your edit: build the closure first, pnpm --filter '@objectstack/cli^...' build . Repair by placing the key in exactly one bucket, with the publish behaviour that justifies it", + }, + ], + }, + { + kind: "changes EmailServiceConfigSchema's KEY SET (a key added, removed or renamed in the email service config, read from the DIFF against the merge base)", + matches: 'email-config-key-set', + gates: [ + { + name: 'pnpm --filter @objectstack/plugin-email exec vitest run src/capability-arg.config-parity.contract.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/plugins/plugin-email/src/capability-arg.config-parity.contract.test.ts', + why: "it holds the keys resolveEmailCapabilityArg reads off config.email equal to Object.keys(EmailServiceConfigSchema.shape), both directions, and spells the declared list literally, so a key added to, removed from or renamed in the schema reds it until the resolver reads the key and the list moves with it. It is a plugin-email test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config does NOT alias the spec package, so the test reads the BUILT spec dist and a stale dist answers green for your edit: build the closure first, pnpm --filter '@objectstack/plugin-email^...' build . Repair by reading the key in the resolver (or declaring the key the resolver reads), then moving the literal list", + }, + ], + }, + { + kind: "changes CloneFlowRequestSchema's KEY SET (a key added, removed or renamed in the flow clone request body, read from the DIFF against the merge base)", + matches: 'clone-flow-request-key-set', + gates: [ + { + name: 'pnpm --filter @objectstack/runtime exec vitest run src/domains/automation-flow-clone-custom-package.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/runtime/src/domains/automation-flow-clone-custom-package.test.ts', + why: "it holds Object.keys(CloneFlowRequestSchema.shape) equal to a literal list of the body keys the clone route sends, so a key added to, removed from or renamed in the request reds it until the route and the list move with it. It is a runtime test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config aliases every spec namespace to SOURCE, but the other workspace packages it imports resolve through their built dist: build the closure first, pnpm --filter '@objectstack/runtime^...' build . Repair by carrying the key through the clone route, then moving the list", + }, + ], + }, + { + kind: "changes the KEY SET of an engine option schema (BaseEngineOptionsSchema, or the `.extend()` literal of EngineQueryOptionsSchema, EngineUpdateOptionsSchema, EngineDeleteOptionsSchema, EngineCountOptionsSchema or EngineAggregateOptionsSchema: a key added, removed or renamed, read from the DIFF against the merge base)", + matches: 'engine-option-key-set', + gates: [ + { + name: 'pnpm --filter @objectstack/objectql exec vitest run src/engine-unknown-option.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/objectql/src/engine-unknown-option.test.ts', + why: "its drift pin holds each engine method's legal option set (ENGINE_OPTION_KEY_SETS) to its schema's shape less the named tombstones, plus a named list of documented extras, both directions, so a key added to an option schema (or to the base every one extends) reds it until the engine's gate accepts the key, and a key removed reds it until the gate drops it. It is a objectql test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config does NOT alias the spec package, so the test reads the BUILT spec dist and a stale dist answers green for your edit: build the closure first, pnpm --filter '@objectstack/objectql^...' build . Repair by adding the key to the engine's legal set for that method (or to the test's tombstones with its retirement)", + }, + ], + }, + { + kind: "changes ExplainOperationSchema's VALUE SET (a verb added, removed or renamed in the explain operation enum, read from the DIFF against the merge base)", + matches: 'explain-verb-rows-value-set', + gates: [ + { + name: 'pnpm --filter @objectstack/plugin-security exec vitest run src/controlled-by-parent-write-member.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/plugins/plugin-security/src/controlled-by-parent-write-member.test.ts', + why: "it holds the explain operation enum's options equal to the keys of VERB_ROWS (the controlled-by-parent write member's row per verb), so a verb added to, removed from or renamed in the enum reds it until the table carries the verb. It is a plugin-security test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config does NOT alias the spec package, so the test reads the BUILT spec dist and a stale dist answers green for your edit: build the closure first, pnpm --filter '@objectstack/plugin-security^...' build . Repair by adding the verb's row to the table, with the behaviour it pins", + }, + ], + }, + { + kind: "changes ExplainOperationSchema's VALUE SET (a verb added, removed or renamed in the explain operation enum, read from the DIFF against the merge base)", + matches: 'explain-verb-class-value-set', + gates: [ + { + name: 'pnpm --filter @objectstack/plugin-security exec vitest run src/explain-controlled-by-parent-write.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/plugins/plugin-security/src/explain-controlled-by-parent-write.test.ts', + why: "it holds the explain operation enum's options equal to the keys of VERB_CLASS (the verb classes the controlled-by-parent write explain answers), so a verb added to, removed from or renamed in the enum reds it until the table carries the verb. It is a plugin-security test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config does NOT alias the spec package, so the test reads the BUILT spec dist and a stale dist answers green for your edit: build the closure first, pnpm --filter '@objectstack/plugin-security^...' build . Repair by adding the verb's row to the table, with the behaviour it pins", + }, + ], + }, + { + kind: "changes ExplainOperationSchema's VALUE SET (a verb added, removed or renamed in the explain operation enum, read from the DIFF against the merge base)", + matches: 'explain-door-value-set', + gates: [ + { + name: 'pnpm --filter @objectstack/plugin-security exec vitest run src/explain-read-absent-every-write-verb.test.ts', + ciJob: 'Test Core', + ciRunner: 'set -- pnpm turbo run test', + ciSubset: 'packages/plugins/plugin-security/src/explain-read-absent-every-write-verb.test.ts', + why: "it holds the explain operation enum's options equal to the keys of DOORS (the write door each verb is explained through), so a verb added to, removed from or renamed in the enum reds it until the table carries the verb. It is a plugin-security test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task. Its vitest config does NOT alias the spec package, so the test reads the BUILT spec dist and a stale dist answers green for your edit: build the closure first, pnpm --filter '@objectstack/plugin-security^...' build . Repair by adding the verb's row to the table, with the behaviour it pins", + }, + ], + }, + { + kind: "changes the KEY SET of a spec props schema the console registry-inputs parity holds whole (ListViewSchema's shape, ElementRecordPickerPropsSchema or ElementTextInputPropsSchema: a key added, removed or renamed, read from the DIFF against the merge base)", + matches: 'registry-inputs-key-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run apps/console/src/__tests__/registry-inputs-spec-parity.test.ts', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "for every block ComponentPropsMap registers with declared inputs, it holds the registered inputs to the top-level keys the block's spec props schema declares, so a key added to one of those schemas reds the block's case until the registry publishes an input for it. ⚠ Measured on three of those schemas (the list view, the record picker and the text input); the rest of ComponentPropsMap is not read by this row, and a key added there still derives nothing. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by publishing the key as an input in the block's registration, or by justifying it in the test's unpublished set", + }, + ], + }, + { + kind: "changes the KEY SET of the `doc` navigation arm (DocNavItemSchema's own members, or BaseNavItemSchema, the base it spreads: a key added, removed or renamed, read from the DIFF against the merge base)", + matches: 'nav-doc-arm-key-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/types/src/__tests__/navigation-spec-parity.test.ts', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds the ui navigation mirror's `doc` arm keys equal to Object.keys(DocNavItemSchema.shape), so a key added to, removed from or renamed in the doc arm, or in the base item every arm spreads, reds it until the mirror's arm moves with it. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by adding the key to the mirror's doc arm", + }, + ], + }, + { + kind: "changes BulkActionOperationSchema's VALUE SET (an operation added, removed or renamed, read from the DIFF against the merge base)", + matches: 'bulk-operation-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/types/src/__tests__/bulk-action-spec-parity.test.ts', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds the ui BulkActionOperation union equal to the spec enum's options, verbatim, so an operation added to, removed from or renamed in the enum reds it until the ui union moves with it. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by moving the ui union", + }, + ], + }, + { + kind: "changes ColumnSummarySchema's VALUE SET (an aggregation added, removed or renamed in the list column summary enum, read from the DIFF against the merge base)", + matches: 'column-summary-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/summary-spec-parity.test.ts', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds every value of the column summary enum to an aggregation useColumnSummary computes, so a value added to the enum reds it until the grid implements it (it would render a blank footer cell). It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by implementing the aggregation in useColumnSummary", + }, + ], + }, + { + kind: "changes the FieldType VALUE SET (a field type added, removed or renamed in the field type enum, read from the DIFF against the merge base)", + matches: 'field-type-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/field-types.spec-parity-11909.test.ts', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds the metadata-admin field-type catalog, its pickers and both designer tables to the field type enum's values, so a type added to, removed from or renamed in the enum reds it until each of them carries the type. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by adding the type to the catalog, a picker category and both designer tables", + }, + ], + }, + { + kind: "changes ChartTypeSchema's VALUE SET as the dashboard widget dispatch holds it (a chart type added, removed or renamed, read from the DIFF against the merge base)", + matches: 'chart-type-dispatch-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/widget-dispatch-spec-parity.test.ts', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds every chart type the enum declares to a route in widgetDispatch, so a type added to the enum reds it until the dispatch routes it (it would render the unknown-component panel). It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by routing the type in widgetDispatch", + }, + ], + }, + { + kind: "changes ChartTypeSchema's VALUE SET as the chart renderer holds it (a chart type added, removed or renamed, read from the DIFF against the merge base)", + matches: 'chart-type-renderer-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds every chart type the enum declares to a real branch of the chart renderer (series, single-value or tabular), so a type added to the enum reds it until the renderer classifies it (it would draw a silent empty plot). It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by classifying the type in the chart renderer", + }, + ], + }, + { + kind: "changes the VALUE SET of ChartTypeSchema or ReportType as the report renderer holds them (a chart type or a report type added, removed or renamed, read from the DIFF against the merge base)", + matches: 'report-chart-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/plugin-report/src/__tests__/report-spec-parity.test.tsx', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds every chart type the enum declares to a branch of planReportChart, and every report type to its own presentation, so a value added to either enum reds it until the report renderer classifies it. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by classifying the value in the report renderer", + }, + ], + }, + { + kind: "changes ChartAggregateFunctionSchema's VALUE SET (an aggregate function added, removed or renamed, read from the DIFF against the merge base)", + matches: 'chart-aggregate-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/pivot-aggregation-spec-parity.test.tsx', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds every aggregate function the enum declares to one PivotTable.aggregate computes, so a function added to the enum reds it until the pivot implements it. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by implementing the function in PivotTable.aggregate", + }, + ], + }, + { + kind: "changes NotificationPositionSchema's VALUE SET as the toaster holds it (a position added, removed or renamed, read from the DIFF against the merge base)", + matches: 'notification-position-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/components/src/__tests__/toaster-position-spec-parity.test.tsx', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds every notification position the enum declares to a sonner position the toaster maps it onto, so a position added to the enum reds it until the toaster maps it. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by mapping the position in the toaster", + }, + ], + }, + { + kind: "changes the VALUE SET of NotificationTypeSchema or NotificationPositionSchema as the notification hook holds them (a type or a position added, removed or renamed, read from the DIFF against the merge base)", + matches: 'notification-hook-value-set', + gates: [ + { + name: 'pnpm --dir ui exec vitest run packages/react/src/hooks/__tests__/animation-notification-spec-parity.test.tsx', + ciJob: 'Test UI', + ciRunner: 'pnpm --dir ui exec vitest run', + why: "it holds the notification types and positions the hook implements equal to the two enums' values, both ways, so a value added to, removed from or renamed in either enum reds it until the hook moves with it. It is a ui test, so no package suite outside ui and no check family covers it: CI runs it only inside the Test UI shards. ui's vitest config aliases only the sdui-parser to source, so the test reads @objectstack/spec from its BUILT dist and a stale one answers for your edit: build the seven @objectstack packages the job builds first, exactly as it does: pnpm exec turbo run build --filter=@objectstack/spec... --filter=@objectstack/client... --filter=@objectstack/core... --filter=@objectstack/formula... --filter=@objectstack/lint... --filter=@objectstack/sdui-parser... --filter=@objectstack/types... . One positional file, no bare `--`, from the repo root. Repair by implementing the value in the hook", + }, + ], + }, + { + kind: 'changes the generated-artifact merge routing (a `merge=os-regen` line added, removed or edited in .gitattributes, read from the DIFF against the merge base) or edits scripts/pm/os-regen-merge.sh itself', + matches: 'os-regen-merge-input', + gates: [ + { + name: 'bash scripts/pm/os-regen-merge.sh --self-test', + ciJob: 'Lint · repo & tooling gates', + ciRunner: 'bash scripts/pm/os-regen-merge.sh', + why: "its self-test holds the script's OS_REGEN_CLASSES table equal to the `merge=os-regen` lines in .gitattributes (each routed pattern classed for step 2's merge-side selection), and pins the script's own behaviour on synthetic fixture repos, so a routing line added, removed or respelled without its table row, or an edit to the script, reds it. No check family names it: lint.yml runs it as a bare `bash … --self-test` step in the repo & tooling job, and the family discovery reads only node scripts, so a card that added one routing line learned of it a CI round later, after a fully green local ledger. It needs no build, only git and a temp dir, and runs in seconds. Repair by adding the pattern's row to OS_REGEN_CLASSES (or removing it) in the same edit", + }, + ], + }, ]; /** @@ -1556,6 +1791,14 @@ export const SPEC_MIGRATION_ENTRY_ROOTS = Object.freeze([ * further than any row reads is outside this table, and a change there derives * nothing: the rows are the measured population (`SERVED_KEY_SET_PINS` says how it was found), never every schema. * + * The same rows read schemas no metadata type nests (a publish manifest, a service config, a request body, the + * engine's option bags) and the VALUE sets of enums. Nothing new addresses them: a `call` of `extend` or `omit` names + * one literal of a chained declaration (the template manifest is the create-package request less an omit list plus an + * extension, so it is three rows: the request's own literal, the `.omit()` literal, whose KEYS are the keys dropped, + * and the `.extend()` literal), and a `call` of `z.enum` reads its array literal's elements (`arrayLiteralElements`), + * so a value added, removed or renamed moves the row exactly as a key does. A base the declaration names but does not + * spread (`Base.extend({ … })`) is its own row, held by the same pin, never followed. + * * Fourteen types, the thirteen `CARD_PROPERTY_COUNTS` counts in the metadata-protocol test plus `action`, whose count * the same file pins in a case of its own; the self-test holds each type's expanded key count equal to the number its * pin spells, so a type that joins the pin without a row here reds it. Field's history, measured at a73edb3c: over the @@ -1610,6 +1853,33 @@ export const SERVED_KEY_SET_DECLARATIONS = Object.freeze([ argument: 1, within: Object.freeze([Object.freeze({ member: 'pool', call: 'strictObject', argument: 1 })]), }), + // Whole-set pins over schemas no metadata type nests (a publish manifest, a service config, a request body, the + // engine's option bags) and the VALUE sets of enums held whole (a `z.enum` row reads its array literal's elements). + Object.freeze({ schema: 'TemplateManifestSchema', path: 'packages/spec/src/marketplace/template-manifest.zod.ts', declares: 'TemplateManifestSchema', call: 'extend', argument: 0 }), + Object.freeze({ schema: 'TemplateManifestSchema.omit', path: 'packages/spec/src/marketplace/template-manifest.zod.ts', declares: 'TemplateManifestSchema', call: 'omit', argument: 0 }), + Object.freeze({ schema: 'CreatePackageRequestSchema', path: 'packages/spec/src/marketplace/package.zod.ts', declares: 'CreatePackageRequestSchema', call: 'z.object', argument: 0 }), + Object.freeze({ schema: 'EmailServiceConfigSchema', path: 'packages/spec/src/system/email-config.zod.ts', declares: 'EmailServiceConfigSchema', call: 'z.object', argument: 0 }), + Object.freeze({ schema: 'CloneFlowRequestSchema', path: 'packages/spec/src/api/automation-api.zod.ts', declares: 'CloneFlowRequestSchema', call: 'z.object', argument: 0 }), + Object.freeze({ schema: 'BaseEngineOptionsSchema', path: 'packages/spec/src/data/data-engine.zod.ts', declares: 'BaseEngineOptionsSchema', call: 'z.object', argument: 0 }), + Object.freeze({ schema: 'EngineQueryOptionsSchema', path: 'packages/spec/src/data/data-engine.zod.ts', declares: 'EngineQueryOptionsSchema', call: 'extend', argument: 0 }), + Object.freeze({ schema: 'EngineUpdateOptionsSchema', path: 'packages/spec/src/data/data-engine.zod.ts', declares: 'EngineUpdateOptionsSchema', call: 'extend', argument: 0 }), + Object.freeze({ schema: 'EngineDeleteOptionsSchema', path: 'packages/spec/src/data/data-engine.zod.ts', declares: 'EngineDeleteOptionsSchema', call: 'extend', argument: 0 }), + Object.freeze({ schema: 'EngineCountOptionsSchema', path: 'packages/spec/src/data/data-engine.zod.ts', declares: 'EngineCountOptionsSchema', call: 'extend', argument: 0 }), + Object.freeze({ schema: 'EngineAggregateOptionsSchema', path: 'packages/spec/src/data/data-engine.zod.ts', declares: 'EngineAggregateOptionsSchema', call: 'extend', argument: 0 }), + Object.freeze({ schema: 'ExplainOperationSchema', path: 'packages/spec/src/security/explain.zod.ts', declares: 'ExplainOperationSchema', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'ListViewShapeSchema', path: 'packages/spec/src/ui/view.zod.ts', declares: 'ListViewShapeSchema', call: 'strictObject', argument: 1 }), + Object.freeze({ schema: 'ElementRecordPickerPropsSchema', path: 'packages/spec/src/ui/component.zod.ts', declares: 'ElementRecordPickerPropsSchema', call: 'strictObject', argument: 1 }), + Object.freeze({ schema: 'ElementTextInputPropsSchema', path: 'packages/spec/src/ui/component.zod.ts', declares: 'ElementTextInputPropsSchema', call: 'strictObject', argument: 1 }), + Object.freeze({ schema: 'DocNavItemSchema', path: 'packages/spec/src/ui/app.zod.ts', declares: 'DocNavItemSchema', call: 'strictObject', argument: 1 }), + Object.freeze({ spread: 'BaseNavItemSchema.shape', path: 'packages/spec/src/ui/app.zod.ts', declares: 'BaseNavItemSchema', call: 'z.object', argument: 0 }), + Object.freeze({ schema: 'BulkActionOperationSchema', path: 'packages/spec/src/ui/bulk-action.zod.ts', declares: 'BulkActionOperationSchema', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'ColumnSummarySchema', path: 'packages/spec/src/ui/view.zod.ts', declares: 'ColumnSummarySchema', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'FieldType', path: 'packages/spec/src/data/field.zod.ts', declares: 'FieldType', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'ChartTypeSchema', path: 'packages/spec/src/ui/chart.zod.ts', declares: 'ChartTypeSchema', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'ChartAggregateFunctionSchema', path: 'packages/spec/src/ui/chart.zod.ts', declares: 'ChartAggregateFunctionSchema', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'ReportType', path: 'packages/spec/src/ui/report.zod.ts', declares: 'ReportType', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'NotificationPositionSchema', path: 'packages/spec/src/ui/notification.zod.ts', declares: 'NotificationPositionSchema', call: 'z.enum', argument: 0 }), + Object.freeze({ schema: 'NotificationTypeSchema', path: 'packages/spec/src/ui/notification.zod.ts', declares: 'NotificationTypeSchema', call: 'z.enum', argument: 0 }), ]); /** @@ -1652,6 +1922,23 @@ export const SERVED_KEY_SET_DECLARATIONS = Object.freeze([ * config, the flow clone request, the engine option schemas, the explain operation enum's values); and the TOMBSTONE * sets the unauthorable-columns test holds whole (a key retired in place moves no key set, so no row here can derive * it). + * + * The pins OUTSIDE that class, measured at e4a02bee: the non-metadata whole-set pins are read (each test's assertion + * compares the schema's keys or the enum's options whole, so a key or a value added reds it): the cli publish + * partition (the template manifest), plugin-email's config parity, the runtime clone route, objectql's engine option + * drift pin, and the three plugin-security tests that hold the explain verbs to a table each. The ui spec-parity half + * was PROBED, not read: one key (or value) added to each of 43 spec schemas the 37 `*spec-parity*` files and the two + * named app-shell censuses import, the spec dist rebuilt, and those files run; a row is here for each file that went + * red on a probe: the console registry-inputs parity (the list view, record picker and text input props), the + * navigation mirror's doc arm, and nine enum value-set holders (bulk operations, column summaries, field types, chart + * types three times, the report types, chart aggregates, notification positions twice, notification types). ⚠ What a + * green there means is narrow: green FOR THE KEY PROBED, mostly because the ui mirror derives from the spec schema and + * follows a new key by construction; a schema a file reads that took no probe is unmeasured. NOT in this table: the + * two dogfood tests that hold the explain verbs (they run only in the queue's dogfood shards, and no gate binding here + * names that job), the rest of ComponentPropsMap's props schemas the registry-inputs parity walks, the two parity + * files whose suite reads the spec's DECLARATION files (`page-nav-misc`, `report-chart-query`: not measured, the + * probe dist was built without them), and the export-NAME parities (`auth`, `share-filter-sort`, `offline-nav`), + * which compare spec export names, not a key set. */ export const SERVED_KEY_SET_PINS = Object.freeze({ 'field-schema-key-set': Object.freeze({ types: Object.freeze(['field']), throughSpreads: true }), @@ -1676,6 +1963,36 @@ export const SERVED_KEY_SET_PINS = Object.freeze({ 'chart-axis-key-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ChartAxisSchema']), throughSpreads: true }), 'chart-axis-presentation-key-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ChartAxisSchema']), throughSpreads: true }), 'index-console-key-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['IndexSchema']), throughSpreads: true }), + 'template-manifest-key-set': Object.freeze({ + types: Object.freeze([]), + schemas: Object.freeze(['TemplateManifestSchema', 'TemplateManifestSchema.omit', 'CreatePackageRequestSchema']), + throughSpreads: true, + }), + 'email-config-key-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['EmailServiceConfigSchema']), throughSpreads: true }), + 'clone-flow-request-key-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['CloneFlowRequestSchema']), throughSpreads: true }), + 'engine-option-key-set': Object.freeze({ + types: Object.freeze([]), + schemas: Object.freeze(['BaseEngineOptionsSchema', 'EngineQueryOptionsSchema', 'EngineUpdateOptionsSchema', 'EngineDeleteOptionsSchema', 'EngineCountOptionsSchema', 'EngineAggregateOptionsSchema']), + throughSpreads: true, + }), + 'explain-verb-rows-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ExplainOperationSchema']), throughSpreads: true }), + 'explain-verb-class-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ExplainOperationSchema']), throughSpreads: true }), + 'explain-door-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ExplainOperationSchema']), throughSpreads: true }), + 'registry-inputs-key-set': Object.freeze({ + types: Object.freeze([]), + schemas: Object.freeze(['ListViewShapeSchema', 'ElementRecordPickerPropsSchema', 'ElementTextInputPropsSchema']), + throughSpreads: true, + }), + 'nav-doc-arm-key-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['DocNavItemSchema']), throughSpreads: true }), + 'bulk-operation-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['BulkActionOperationSchema']), throughSpreads: true }), + 'column-summary-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ColumnSummarySchema']), throughSpreads: true }), + 'field-type-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['FieldType']), throughSpreads: true }), + 'chart-type-dispatch-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ChartTypeSchema']), throughSpreads: true }), + 'chart-type-renderer-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ChartTypeSchema']), throughSpreads: true }), + 'report-chart-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ChartTypeSchema', 'ReportType']), throughSpreads: true }), + 'chart-aggregate-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['ChartAggregateFunctionSchema']), throughSpreads: true }), + 'notification-position-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['NotificationPositionSchema']), throughSpreads: true }), + 'notification-hook-value-set': Object.freeze({ types: Object.freeze([]), schemas: Object.freeze(['NotificationTypeSchema', 'NotificationPositionSchema']), throughSpreads: true }), }); /** diff --git a/scripts/pm/dispatch-gates.mjs b/scripts/pm/dispatch-gates.mjs index b13b9501bc7..c48e03b37d8 100644 --- a/scripts/pm/dispatch-gates.mjs +++ b/scripts/pm/dispatch-gates.mjs @@ -12256,6 +12256,39 @@ export function readBySpecMigrationEntryConsumers(path, roots = SPEC_MIGRATION_E return triggerListCovers(roots, path.replace(/^\.\//, '')) !== null; } +/** The script whose self-test holds its routing table equal to the `merge=os-regen` lines of `.gitattributes`. */ +export const OS_REGEN_MERGE_SCRIPT = 'scripts/pm/os-regen-merge.sh'; +const GITATTRIBUTES_PATH = '.gitattributes'; + +/** + * The patterns `.gitattributes` routes to the generated-artifact merge driver, sorted: the first field of every + * non-comment line carrying the `merge=os-regen` attribute, the same reading `os-regen-merge.sh` makes of the file. + */ +export function osRegenRoutedPatterns(text) { + return String(text) + .split('\n') + .filter((line) => !/^[ \t]*#/.test(line) && /(^|[ \t])merge=os-regen([ \t]|$)/.test(line)) + .map((line) => line.trim().split(/[ \t]+/)[0]) + .sort(); +} + +/** + * Does this path move what `os-regen-merge.sh --self-test` holds? The script itself, on any edit; `.gitattributes` + * when its routed patterns differ between the merge base and the working tree (read from the DIFF, as the key-set + * readers are), so an edit to some other attribute line derives nothing. A `.gitattributes` the diff leaves unchanged + * (a surface named before its code) or cannot read on one side derives the self-test: it is a seconds-long run with + * no build, so reading wide costs nothing worth saving, and a quiet answer here is the miss this row exists for. + */ +export function changesOsRegenRouting(path, { readHead = readTrackedSource, readBase = readReadmeNetBase } = {}) { + const rel = path.replace(/^\.\//, ''); + if (rel === OS_REGEN_MERGE_SCRIPT) return true; + if (rel !== GITATTRIBUTES_PATH) return false; + const head = readHead(rel) ?? null; + const base = readBase(rel) ?? null; + if (head === base || head === null || base === null) return true; + return JSON.stringify(osRegenRoutedPatterns(head)) !== JSON.stringify(osRegenRoutedPatterns(base)); +} + // The member readers' sticky lookaheads: each is anchored at the offset `stickyAt` sets before every exec. const MEMBER_BARE_SPREAD = /\.\.\.\s*([A-Za-z_$][\w$.]*)\s*(?=[,}])/y; const MEMBER_NAMED = /(?:(?:get|set|async)\s+)?\*?\s*([A-Za-z_$][\w$]*)\s*\??\s*[:(,}<]/y; @@ -12419,6 +12452,9 @@ function callArgumentStart(masked, at, call, argument, end = masked.length) { * takes no step, an inline one names its path (`FieldSchema`'s `lookupAutofill` member, the `strictObject` call in * it, its second argument). A descent never leaves the member's own value, so a `call` that appears only after the * member is not taken for it, and an edit to a sibling member moves nothing the step reads. + * + * A literal that opens with a bracket instead of a brace is an enum's value list (`z.enum([...])`), read by + * `arrayLiteralElements`: the set answered is then the VALUES, compared exactly as a key set is. */ export function declaredKeySet(source, { declares, call = null, argument = 0, within = [] }) { const masked = maskCommentsAndLiterals(source); @@ -12439,10 +12475,55 @@ export function declaredKeySet(source, { declares, call = null, argument = 0, wi if (open !== null && open >= span.end) return null; } if (open === null) return null; - const members = objectLiteralMembers(source, open, masked); + const members = masked[open] === '[' ? arrayLiteralElements(source, open, masked) : objectLiteralMembers(source, open, masked); return members === null ? null : [...members].sort(); } +/** + * The elements an array literal lists at its own depth, in source order: a quoted string by its content, anything + * else (a spread, a name, a call) by its own comment-masked source text with whitespace collapsed. It is the VALUE + * set of a `z.enum([...])` row, read the way `objectLiteralMembers` reads a key set: a value added, removed or + * renamed moves the set, a comment or a `.describe()` beside the literal does not, and a spread (`...BASE_VALUES`) + * is one element, so its arrival is a change and the census over the members can name it. `open` is the offset of + * the opening bracket in `source`. Null when the literal does not close where the brackets say it does, so a reader + * that lost its place says so instead of answering a short list. + */ +export function arrayLiteralElements(source, open, masked = maskCommentsAndLiterals(source)) { + if (masked[open] !== '[') return null; + const elements = []; + let depth = 0; + let start = open + 1; + let commentMasked = null; + const close = (end) => { + const text = masked.slice(start, end).trim(); + if (text === '') return; + const lead = start + masked.slice(start, end).search(/\S/); + // The mask blanks a literal's content and keeps its delimiters, so a whole-string element is a quote, blanks, the quote. + if (/^(['"`])[^'"`]*\1$/.test(text)) { + elements.push(source.slice(lead + 1, lead + text.length - 1)); + return; + } + commentMasked ??= maskComments(source); + elements.push(commentMasked.slice(start, end).replace(/\s+/g, ' ').trim()); + }; + for (let k = open + 1; k < masked.length; k++) { + const c = masked[k]; + if (c === '{' || c === '[' || c === '(') depth++; + else if (c === '}' || c === ']' || c === ')') { + if (depth === 0) { + if (c !== ']') return null; + close(k); + return elements; + } + depth--; + } else if (c === ',' && depth === 0) { + close(k); + start = k + 1; + } + } + return null; +} + /** * The declaration rows one served key-set pin holds: the rows of the types it names (`types`) and of the nested * schemas it names (`schemas`), each a row's own `type` or `schema` key. @@ -12618,6 +12699,7 @@ const CHANGE_KIND_PREDICATES = Object.freeze({ 'adr-anchored-file': (path) => breaksAnAdrAnchor(path), 'ui-scripts-suite-input': (path) => readByUiScriptsSuite(path), 'spec-migration-entry': (path) => readBySpecMigrationEntryConsumers(path), + 'os-regen-merge-input': (path) => changesOsRegenRouting(path), // One per served key-set pin, each bound to the types and nested schemas its test holds. ...servedKeySetPredicates(), // One per population net (#31257), each bound to its own net. diff --git a/scripts/pm/dispatch-gates.self-test.mjs b/scripts/pm/dispatch-gates.self-test.mjs index 8c070c543cf..e17406ae56c 100644 --- a/scripts/pm/dispatch-gates.self-test.mjs +++ b/scripts/pm/dispatch-gates.self-test.mjs @@ -302,6 +302,10 @@ import { declaredKeySet, objectLiteralMembers, objectLiteralMemberValue, + arrayLiteralElements, + changesOsRegenRouting, + osRegenRoutedPatterns, + OS_REGEN_MERGE_SCRIPT, SERVED_KEY_SET_DECLARATIONS, SERVED_KEY_SET_PINS, adrAnchorTargets, @@ -5679,18 +5683,45 @@ export function selfTest({ tier = 'full' } = {}) { 'chart-axis-key-set': 'pnpm --dir ui exec vitest run packages/plugin-charts/src/normalizeChartSchema.specAxisKeys-7690.test.ts', 'chart-axis-presentation-key-set': 'pnpm --dir ui exec vitest run packages/plugin-charts/src/normalizeChartSchema.xAxisPresentationGate-10516.test.ts', 'index-console-key-set': 'pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/EmbeddedItemEditor.indexFallback.test.tsx', + 'template-manifest-key-set': 'pnpm --filter @objectstack/cli exec vitest run test/package-publish-uncarried-manifest-keys.test.ts', + 'email-config-key-set': 'pnpm --filter @objectstack/plugin-email exec vitest run src/capability-arg.config-parity.contract.test.ts', + 'clone-flow-request-key-set': 'pnpm --filter @objectstack/runtime exec vitest run src/domains/automation-flow-clone-custom-package.test.ts', + 'engine-option-key-set': 'pnpm --filter @objectstack/objectql exec vitest run src/engine-unknown-option.test.ts', + 'explain-verb-rows-value-set': 'pnpm --filter @objectstack/plugin-security exec vitest run src/controlled-by-parent-write-member.test.ts', + 'explain-verb-class-value-set': 'pnpm --filter @objectstack/plugin-security exec vitest run src/explain-controlled-by-parent-write.test.ts', + 'explain-door-value-set': 'pnpm --filter @objectstack/plugin-security exec vitest run src/explain-read-absent-every-write-verb.test.ts', + 'registry-inputs-key-set': 'pnpm --dir ui exec vitest run apps/console/src/__tests__/registry-inputs-spec-parity.test.ts', + 'nav-doc-arm-key-set': 'pnpm --dir ui exec vitest run packages/types/src/__tests__/navigation-spec-parity.test.ts', + 'bulk-operation-value-set': 'pnpm --dir ui exec vitest run packages/types/src/__tests__/bulk-action-spec-parity.test.ts', + 'column-summary-value-set': 'pnpm --dir ui exec vitest run packages/plugin-grid/src/__tests__/summary-spec-parity.test.ts', + 'field-type-value-set': 'pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/previews/field-types.spec-parity-11909.test.ts', + 'chart-type-dispatch-value-set': 'pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/widget-dispatch-spec-parity.test.ts', + 'chart-type-renderer-value-set': 'pnpm --dir ui exec vitest run packages/plugin-charts/src/__tests__/chart-type-spec-parity.test.tsx', + 'report-chart-value-set': 'pnpm --dir ui exec vitest run packages/plugin-report/src/__tests__/report-spec-parity.test.tsx', + 'chart-aggregate-value-set': 'pnpm --dir ui exec vitest run packages/plugin-dashboard/src/__tests__/pivot-aggregation-spec-parity.test.tsx', + 'notification-position-value-set': 'pnpm --dir ui exec vitest run packages/components/src/__tests__/toaster-position-spec-parity.test.tsx', + 'notification-hook-value-set': 'pnpm --dir ui exec vitest run packages/react/src/hooks/__tests__/animation-notification-spec-parity.test.tsx', }); + // The pins outside the metadata types' nesting, and the enum value sets, by the package their test runs in. + const KS_CORE_PKG = Object.freeze({ + 'template-manifest-key-set': 'cli', 'email-config-key-set': 'plugin-email', 'clone-flow-request-key-set': 'runtime', 'engine-option-key-set': 'objectql', + 'explain-verb-rows-value-set': 'plugin-security', 'explain-verb-class-value-set': 'plugin-security', 'explain-door-value-set': 'plugin-security', + }); + const KS_NEW_UI = Object.freeze(['registry-inputs-key-set', 'nav-doc-arm-key-set', 'bulk-operation-value-set', 'column-summary-value-set', 'field-type-value-set', + 'chart-type-dispatch-value-set', 'chart-type-renderer-value-set', 'report-chart-value-set', 'chart-aggregate-value-set', 'notification-position-value-set', 'notification-hook-value-set']); const KS_JOB = Object.freeze({ 'field-schema-key-set': 'Test Core', 'object-reference-key-set': 'Test Core', 'served-type-key-set': 'Test Core', 'report-inspector-key-set': 'Test UI', 'served-row-key-set': 'Test Core', 'dashboard-widget-options-key-set': 'Test UI', 'datasource-pool-key-set': 'Test Core', 'chart-axis-key-set': 'Test UI', 'chart-axis-presentation-key-set': 'Test UI', 'index-console-key-set': 'Test UI', + ...Object.fromEntries(Object.keys(KS_CORE_PKG).map((k) => [k, 'Test Core'])), + ...Object.fromEntries(KS_NEW_UI.map((k) => [k, 'Test UI'])), }); const KS_NAMES = Object.values(KS_GATES); const ksEntry = CHANGE_KIND_GATES.filter((k) => k.gates.some((g) => KS_NAMES.includes(g.name))); const ksRows = CHANGE_KIND_ROWS.filter((r) => r.gates.some((g) => KS_NAMES.includes(g.name))); t('⭐ the pins table and the rows agree: one row per pin, named by the pin\'s key, each carrying exactly its one test, bound to its CI job', JSON.stringify(Object.keys(SERVED_KEY_SET_PINS)) === JSON.stringify(Object.keys(KS_GATES)) - && ksRows.length === 10 && ksEntry.length === 10 + && ksRows.length === 28 && ksEntry.length === 28 && ksRows.every((r) => r.gates.length === 1 && KS_GATES[r.matches] === r.gates[0].name && KS_JOB[r.matches] === r.gates[0].ciJob)); t('…and no pin names a type or a nested schema the reader has no row for (the load-time refusal\'s input is empty)', servedKeySetPinGaps().length === 0); t('CONTROL: a pin naming an undeclared type IS a gap, by pin and type', @@ -5712,6 +5743,25 @@ export function selfTest({ tier = 'full' } = {}) { && SERVED_KEY_SET_PINS['chart-axis-presentation-key-set'].schemas.join() === 'ChartAxisSchema' && SERVED_KEY_SET_PINS['index-console-key-set'].schemas.join() === 'IndexSchema' && ['served-row-key-set', 'dashboard-widget-options-key-set', 'datasource-pool-key-set', 'chart-axis-key-set', 'chart-axis-presentation-key-set', 'index-console-key-set'].every((k) => SERVED_KEY_SET_PINS[k].types.length === 0)); + t('the pins outside the metadata types\' nesting: the manifest\'s three literals, the email config, the clone request, the six engine option bags, the explain verbs on three pins', + SERVED_KEY_SET_PINS['template-manifest-key-set'].schemas.join() === 'TemplateManifestSchema,TemplateManifestSchema.omit,CreatePackageRequestSchema' + && SERVED_KEY_SET_PINS['email-config-key-set'].schemas.join() === 'EmailServiceConfigSchema' + && SERVED_KEY_SET_PINS['clone-flow-request-key-set'].schemas.join() === 'CloneFlowRequestSchema' + && SERVED_KEY_SET_PINS['engine-option-key-set'].schemas.join() === 'BaseEngineOptionsSchema,EngineQueryOptionsSchema,EngineUpdateOptionsSchema,EngineDeleteOptionsSchema,EngineCountOptionsSchema,EngineAggregateOptionsSchema' + && ['explain-verb-rows-value-set', 'explain-verb-class-value-set', 'explain-door-value-set'].every((k) => SERVED_KEY_SET_PINS[k].schemas.join() === 'ExplainOperationSchema')); + t('…and the ui spec-parity pins: three registry props schemas, the doc nav arm, and the eight enum value sets on their nine tests', + SERVED_KEY_SET_PINS['registry-inputs-key-set'].schemas.join() === 'ListViewShapeSchema,ElementRecordPickerPropsSchema,ElementTextInputPropsSchema' + && SERVED_KEY_SET_PINS['nav-doc-arm-key-set'].schemas.join() === 'DocNavItemSchema' + && SERVED_KEY_SET_PINS['bulk-operation-value-set'].schemas.join() === 'BulkActionOperationSchema' + && SERVED_KEY_SET_PINS['column-summary-value-set'].schemas.join() === 'ColumnSummarySchema' + && SERVED_KEY_SET_PINS['field-type-value-set'].schemas.join() === 'FieldType' + && SERVED_KEY_SET_PINS['chart-type-dispatch-value-set'].schemas.join() === 'ChartTypeSchema' + && SERVED_KEY_SET_PINS['chart-type-renderer-value-set'].schemas.join() === 'ChartTypeSchema' + && SERVED_KEY_SET_PINS['report-chart-value-set'].schemas.join() === 'ChartTypeSchema,ReportType' + && SERVED_KEY_SET_PINS['chart-aggregate-value-set'].schemas.join() === 'ChartAggregateFunctionSchema' + && SERVED_KEY_SET_PINS['notification-position-value-set'].schemas.join() === 'NotificationPositionSchema' + && SERVED_KEY_SET_PINS['notification-hook-value-set'].schemas.join() === 'NotificationTypeSchema,NotificationPositionSchema' + && [...Object.keys(KS_CORE_PKG), ...KS_NEW_UI].every((k) => SERVED_KEY_SET_PINS[k].types.length === 0)); // The member reader, pure. const olm = (src) => objectLiteralMembers(src, src.indexOf('{')); t('the member reader reads names, quoted keys, methods, shorthands and spreads at its own depth', @@ -5723,6 +5773,17 @@ export function selfTest({ tier = 'full' } = {}) { t('…and nothing nested, commented or quoted', JSON.stringify(olm("{ a: z.object({ inner: 1 }), // gone: 1,\n /* x: 2, */ b: 'c: { d: 1 }', e: [{ f: 1 }], g: (h) => { const i = { j: 1 }; return i; } }")) === JSON.stringify(['a', 'b', 'e', 'g'])); t('…and null for a literal that does not close, never a short list', olm('{ a: 1, b: { c: 2 }') === null); + // The element reader a `z.enum` row's value set is read with. + const ale = (src) => arrayLiteralElements(src, src.indexOf('[')); + t('the element reader reads a quoted value by its content, any other element (a spread, a call) as its source text, one each', + JSON.stringify(ale("[ 'read', \"a,b\", `tpl`, ...BASE_VERBS, pick('x', 'y'), 'last' ]")) === JSON.stringify(['read', 'a,b', 'tpl', '...BASE_VERBS', "pick('x', 'y')", 'last'])); + t('…and nothing commented, with or without a trailing comma', JSON.stringify(ale("[\n 'a', // 'gone',\n /* 'x', */ 'b',\n]")) === JSON.stringify(['a', 'b'])); + t('…and null for a literal that does not close, never a short list', ale("['a', ['b'") === null); + t('⭐ a `z.enum` row reads its VALUE set, sorted, and a describe() beside the literal is no element', + JSON.stringify(declaredKeySet("export const VerbSchema = z.enum([\n 'update', 'read',\n]).describe('the verbs');", { declares: 'VerbSchema', call: 'z.enum', argument: 0 })) === JSON.stringify(['read', 'update'])); + t('…and a chained `.omit()` and `.extend()` are two literals of one declaration, each read by its own call', + JSON.stringify(declaredKeySet('export const M = lazySchema(() => Base.omit({ a: true, b: true }).extend({ c: z.string() }));', { declares: 'M', call: 'omit', argument: 0 })) === JSON.stringify(['a', 'b']) + && JSON.stringify(declaredKeySet('export const M = lazySchema(() => Base.omit({ a: true, b: true }).extend({ c: z.string() }));', { declares: 'M', call: 'extend', argument: 0 })) === JSON.stringify(['c'])); // The lookahead reads the masked text with no window, and a non-name spread is cut from comment-masked text. const LONG_COMMENT = `/* ${'a comment longer than the old two-hundred-character lookahead window, '.repeat(4)}*/`; t('⭐ a bare-name spread that is the LAST member, with no trailing comma and a long comment before the brace, is still the bare name', @@ -5758,8 +5819,10 @@ export function selfTest({ tier = 'full' } = {}) { // shape, and the InlineGridColumnSchema declaration beside it, so every row the file holds reads on both sides. const FK_PAIR_MEMBER = " lookupAutofill: z.array(strictObject({ surface: 'this pair' }, {\n target: z.string(),\n source: z.string(),\n })).min(1).optional(),"; const FK_GRID_DECL = "export const InlineGridColumnSchema = lazySchema(() => strictObject({ surface: 'this inline grid column' }, {\n name: z.string(),\n width: z.number().optional(),\n}));\n"; + // …and the FieldType enum the field-type pin reads, declared the same on both sides unless an edit says otherwise. + const FK_ENUM_DECL = "export const FieldType = z.enum([\n 'text',\n 'number',\n]);\n"; const fkSrc = (shape, opts = "surface: 'this field', guidance: { columnName: 'removed' }", grid = FK_GRID_DECL) => - `import { z } from 'zod';\n${grid}export const FieldSchema = lazySchema(() => {\n const base = strictObject({ ${opts} }, {\n${shape}\n });\n return base.superRefine((f, ctx) => { ctx.addIssue({ code: 'custom', path: ['x'] }); });\n});\n`; + `import { z } from 'zod';\n${FK_ENUM_DECL}${grid}export const FieldSchema = lazySchema(() => {\n const base = strictObject({ ${opts} }, {\n${shape}\n });\n return base.superRefine((f, ctx) => { ctx.addIssue({ code: 'custom', path: ['x'] }); });\n});\n`; const FK_SHAPE = ` name: z.string().describe('Machine name'),\n type: FieldTypeSchema,\n${FK_PAIR_MEMBER}\n ...MetadataProtectionFields,`; const FK_BASE = fkSrc(FK_SHAPE); t('the declaration reader takes the strictObject call\'s SECOND argument, not the options before it', @@ -5824,7 +5887,20 @@ export function selfTest({ tier = 'full' } = {}) { : `export const ${row.declares} = lazySchema(() => strictObject({ surface: 'this ${row.type}' }, {\n${shape}\n}));\n`); // The nested-schema rows that share a type's file, declared the same on both sides so only the edit under test moves: // a named one as its own declaration, an inline one (whose enclosing declaration is no type row) with its member. - const ksSchemaSrc = (row, shape = ' a: z.string(),') => (row.within !== undefined + // An enum row lists values, not keys: each ` name: …,` line of a shape is that name as a quoted value, so the same + // shapes drive both (a describe() on a line moves no value, which is the control the loops below assert). + const ksEnumShape = (shape) => shape.split('\n').map((line) => line.replace(/^(\s*)([A-Za-z_$][\w$]*)\s*:.*$/, "$1'$2',")).join('\n'); + // Rows reading two literals of ONE declaration (a chained `.omit()` and `.extend()`) render as one declaration, each + // call carrying its own row's shape: `shapes` maps a row's key to the shape it takes, every other row the default. + const ksChained = (rows, shapes = {}) => `export const ${rows[0].declares} = lazySchema(() => Base${rows.map((r) => `.${r.call}({\n${shapes[r.schema] ?? ' a: z.string(),'}\n})`).join('')});\n`; + const ksChainRows = (row) => SERVED_KEY_SET_DECLARATIONS.filter((d) => d.schema !== undefined && d.path === row.path && d.declares === row.declares && (d.call === 'omit' || d.call === 'extend')); + const ksSchemaSrc = (row, shape = ' a: z.string(),') => (row.call === 'z.enum' + ? `export const ${row.declares} = lazySchema(() => z.enum([\n${ksEnumShape(shape)}\n]));\n` + : (row.call === 'omit' || row.call === 'extend') && row.schema !== undefined && ksChainRows(row).length > 1 + ? ksChained(ksChainRows(row), { [row.schema]: shape }) + : row.call === 'extend' || row.call === 'omit' + ? `export const ${row.declares} = lazySchema(() => Base.${row.call}({\n${shape}\n}));\n` + : row.within !== undefined ? `export const ${row.declares} = lazySchema(() => strictObject({ surface: 'outer' }, {\n${row.within.map((st) => ` ${st.member}: ${st.call}({ surface: 'inner' }, {\n${shape}\n }),`).join('\n')}\n}));\n` : row.call === null ? `export const ${row.declares} = {\n${shape}\n} as const;\n` @@ -5832,8 +5908,13 @@ export function selfTest({ tier = 'full' } = {}) { ? `export const ${row.declares} = lazySchema(() => z.object({\n${shape}\n}));\n` : `export const ${row.declares} = lazySchema(() => strictObject({ surface: 'this ${row.schema}' }, {\n${shape}\n}));\n`); const ksTypeDeclares = new Set(SERVED_KEY_SET_DECLARATIONS.filter((d) => d.type !== undefined).map((d) => d.declares)); + // A chained declaration renders once (from its first row), and none of it when `except` is one of its rows (the + // caller renders the whole declaration with that row's shape); a spread row declared beside a schema renders too. const ksSiblings = (path, except = null) => SERVED_KEY_SET_DECLARATIONS - .filter((d) => d.schema !== undefined && d.path === path && d !== except && !(d.within !== undefined && ksTypeDeclares.has(d.declares))) + .filter((d) => (d.schema !== undefined || (d.spread !== undefined && d.path !== FK_PROT.path && d.path !== KS_OVR.path)) && d.path === path && d !== except + && !(d.within !== undefined && ksTypeDeclares.has(d.declares)) + && !(except !== null && except.declares === d.declares && ksChainRows(except).includes(d)) + && !(ksChainRows(d).length > 1 && ksChainRows(d)[0] !== d)) .map((d) => ksSchemaSrc(d)).join(''); const KS_SHAPE = ` name: z.string(),\n label: z.string(),\n${FK_PAIR_MEMBER}\n ...MetadataProtectionFields,\n ...OverrideDeclarationFields,`; const KS_SHAPE_ADDED = `${KS_SHAPE}\n extra: z.string().optional(),`; @@ -5848,6 +5929,7 @@ export function selfTest({ tier = 'full' } = {}) { 'chart-axis-key-set': ['ChartAxisSchema'], 'chart-axis-presentation-key-set': ['ChartAxisSchema'], 'index-console-key-set': ['IndexSchema'], + ...Object.fromEntries([...Object.keys(KS_CORE_PKG), ...KS_NEW_UI].map((k) => [k, [...PIN[k].schemas]])), }); for (const row of SERVED_KEY_SET_DECLARATIONS.filter((d) => d.type !== undefined)) { const io = fkIo(ksTypeSrc(row, KS_SHAPE_ADDED) + ksSiblings(row.path), ksTypeSrc(row, KS_SHAPE) + ksSiblings(row.path)); @@ -5957,15 +6039,38 @@ export function selfTest({ tier = 'full' } = {}) { const base = `${typeRow ? ksTypeSrc(typeRow, KS_SHAPE) : ''}${ksSiblings(row.path, row)}${ksSchemaSrc(row)}`; return [row.path, [head, base]]; }; + // A whole declaring file with the named rows' key (or value) sets grown by one and every other row, the type's + // included, unchanged: several rows of one file move in one edit, which a per-path io needs. + const KS_BUMP = ' a: z.string(),\n b: z.string(),'; + const ksRender = (path, bumped = [], typeShape = KS_SHAPE) => { + const typeRow = SERVED_KEY_SET_DECLARATIONS.find((d) => d.type !== undefined && d.path === path); + const parts = SERVED_KEY_SET_DECLARATIONS + .filter((d) => (d.schema !== undefined || (d.spread !== undefined && d.path !== FK_PROT.path && d.path !== KS_OVR.path)) && d.path === path + && !(d.within !== undefined && ksTypeDeclares.has(d.declares)) && !(ksChainRows(d).length > 1 && ksChainRows(d)[0] !== d)) + .map((d) => (ksChainRows(d).length > 1 + ? ksChained(ksChainRows(d), Object.fromEntries(ksChainRows(d).filter((r) => bumped.includes(r.schema)).map((r) => [r.schema, KS_BUMP]))) + : ksSchemaSrc(d, bumped.includes(d.schema) ? KS_BUMP : undefined))); + return `${typeRow ? ksTypeSrc(typeRow, typeShape) : ''}${parts.join('')}`; + }; + const ksBumped = (schemas, typeShape = KS_SHAPE) => { + const path = ksRow(schemas[0]).path; + return [path, [ksRender(path, schemas, typeShape), ksRender(path)]]; + }; const ksBothIo = ksIoOf(Object.fromEntries([ - [FK_PATH, [FK_EDITS['a key added'][0], FK_BASE]], [REPORT.path, [ksTypeSrc(REPORT, KS_SHAPE_ADDED), ksTypeSrc(REPORT, KS_SHAPE)]], + [FK_PATH, [FK_EDITS['a key added'][0].replace(" 'number',", " 'number',\n 'email',"), FK_BASE]], + [REPORT.path, [ksRender(REPORT.path, ['ReportType'], KS_SHAPE_ADDED), ksRender(REPORT.path)]], ksNestedEdit('PageComponentSchema'), ksNestedEdit('DashboardWidgetOptionsSchema'), ksNestedEdit('DatasourceSchema.pool'), - ksNestedEdit('ChartAxisSchema'), ksNestedEdit('IndexSchema'), + ksBumped(['ChartAxisSchema', 'ChartTypeSchema', 'ChartAggregateFunctionSchema']), ksNestedEdit('IndexSchema'), + ksBumped(['TemplateManifestSchema']), ksBumped(['EmailServiceConfigSchema']), ksBumped(['CloneFlowRequestSchema']), ksBumped(['BaseEngineOptionsSchema']), + ksBumped(['ExplainOperationSchema']), ksBumped(['ListViewShapeSchema', 'ColumnSummarySchema']), ksBumped(['DocNavItemSchema']), + ksBumped(['BulkActionOperationSchema']), ksBumped(['NotificationPositionSchema', 'NotificationTypeSchema']), ])); const ksBound = ksEntry.map((k) => ({ ...k, matches: (p) => changesServedKeySet(p, PIN[ksRows.find((r) => r.kind === k.kind).matches], ksBothIo) })); - const ksPaths = [FK_PATH, REPORT.path, ...['PageComponentSchema', 'DashboardWidgetOptionsSchema', 'DatasourceSchema.pool', 'ChartAxisSchema', 'IndexSchema'].map((n) => ksRow(n).path)]; + const ksPaths = [FK_PATH, REPORT.path, ...['PageComponentSchema', 'DashboardWidgetOptionsSchema', 'DatasourceSchema.pool', 'ChartAxisSchema', 'IndexSchema', + 'TemplateManifestSchema', 'EmailServiceConfigSchema', 'CloneFlowRequestSchema', 'BaseEngineOptionsSchema', 'ExplainOperationSchema', 'ListViewShapeSchema', + 'DocNavItemSchema', 'BulkActionOperationSchema', 'NotificationPositionSchema'].map((n) => ksRow(n).path)]; const ksLines = changeKindLines(ksPaths, ksResolved, ksBound); - t('a field, a report, a page component, a widget options, a pool, a chart axis and an index key-set change render all ten pins runnably, anchored on the delimiter', KS_NAMES.every((n) => ksLines.some((l) => l.includes(`- ${n} —`)))); + t('a key or value added in each declaring file renders all twenty-eight pins runnably, anchored on the delimiter', KS_NAMES.every((n) => ksLines.some((l) => l.includes(`- ${n} —`)))); t('…each line states its build prerequisite as measured: none for driver-sql, the closure build for the four that read the spec dist, the job\'s seven-package build for the five ui tests', ksLines.some((l) => l.includes(KS_GATES['field-schema-key-set']) && /needs NO build/.test(l)) && ksLines.some((l) => l.includes(KS_GATES['object-reference-key-set']) && l.includes("pnpm --filter '@objectstack/metadata-core^...' build")) @@ -5973,16 +6078,19 @@ export function selfTest({ tier = 'full' } = {}) { && ksLines.some((l) => l.includes(KS_GATES['served-row-key-set']) && l.includes("pnpm --filter '@objectstack/metadata-protocol^...' build")) && ksLines.some((l) => l.includes(KS_GATES['datasource-pool-key-set']) && l.includes("pnpm --filter '@objectstack/service-datasource^...' build")) && ['report-inspector-key-set', 'dashboard-widget-options-key-set', 'chart-axis-key-set', 'chart-axis-presentation-key-set', 'index-console-key-set'].every((k) => ksLines.some((l) => l.includes(KS_GATES[k]) && /seven @objectstack packages/.test(l) && l.includes('--filter=@objectstack/sdui-parser...')))); - t('…and carries no tracker number in the text a dev is shown', ksLines.length === 20 && ksLines.every((l) => !/#\d{4,5}\b/.test(l))); + t('…and the new pins state theirs: the package closure build for the seven package tests, the job\'s seven-package build for the eleven ui tests', + Object.entries(KS_CORE_PKG).every(([k, pkg]) => ksLines.some((l) => l.includes(KS_GATES[k]) && l.includes(`pnpm --filter '@objectstack/${pkg}^...' build`))) + && KS_NEW_UI.every((k) => ksLines.some((l) => l.includes(KS_GATES[k]) && /seven @objectstack packages/.test(l) && l.includes('--filter=@objectstack/sdui-parser...')))); + t('…and carries no tracker number in the text a dev is shown', ksLines.length === 56 && ksLines.every((l) => !/#\d{4,5}\b/.test(l))); const ksDerived = commandsFor({ kindGroups: changeKindGates(ksPaths, ksResolved, ksBound) }); - t('the runnable union carries all ten', KS_NAMES.every((n) => ksDerived.includes(n))); + t('the runnable union carries all twenty-eight', KS_NAMES.every((n) => ksDerived.includes(n))); t('CONTROL: a describe-only edit renders none of them', changeKindLines([FK_PATH], ksResolved, ksEntry.map((k) => ({ ...k, matches: (p) => changesServedKeySet(p, PIN[ksRows.find((r) => r.kind === k.kind).matches], fkIo(FK_EDITS['a describe() reworded'][0], FK_BASE)) }))).length === 0); for (const gate of KS_NAMES) { const without = runReconciliation({ derived: ksDerived, record: parseRunRecord(ksDerived.filter((c) => c !== gate).map((c) => `${c} :: exit 0`).join('\n')) }); t(`⭐ a run record carrying every derived command BUT ${gate.split(' ')[2]}'s pin is NOT ok, and names it unrun`, !without.ok && without.unrun.some((u) => u.command === gate)); } - t('CONTROL: the same record WITH all ten is ok', runReconciliation({ derived: ksDerived, record: parseRunRecord(ksDerived.map((c) => `${c} :: exit 0`).join('\n')) }).ok); + t('CONTROL: the same record WITH all twenty-eight is ok', runReconciliation({ derived: ksDerived, record: parseRunRecord(ksDerived.map((c) => `${c} :: exit 0`).join('\n')) }).ok); const ksStale = changeKindLines(ksPaths, () => null, ksBound); t('an unresolvable binding renders each pin STALE, naming the job and what it lost (the file for a Test Core subset, the runner for the ui one)', ksEntry.every((k) => k.gates.every((g) => ksStale.filter((l) => l.includes(`⚠ ${g.name}: STALE`) && l.includes(`job named '${g.ciJob}…'`) @@ -6099,8 +6207,10 @@ export function selfTest({ tier = 'full' } = {}) { t('⭐ a key added to ChartAxisSchema derives BOTH chart normalizer pins, and a describe() inside it neither', (() => { const row = ksRow('ChartAxisSchema'); - const io = fkIo(ksSchemaSrc(row, ' field: z.string(),\n title: z.string(),\n ticks: z.number(),'), ksSchemaSrc(row, ' field: z.string(),\n title: z.string(),')); - const quiet = fkIo(ksSchemaSrc(row, " field: z.string(),\n title: z.string().describe('t'),"), ksSchemaSrc(row, ' field: z.string(),\n title: z.string(),')); + // The rows declared beside it in chart.zod.ts (the chart type and aggregate enums) unchanged on both sides. + const sib = ksSiblings(row.path, row); + const io = fkIo(sib + ksSchemaSrc(row, ' field: z.string(),\n title: z.string(),\n ticks: z.number(),'), sib + ksSchemaSrc(row, ' field: z.string(),\n title: z.string(),')); + const quiet = fkIo(sib + ksSchemaSrc(row, " field: z.string(),\n title: z.string().describe('t'),"), sib + ksSchemaSrc(row, ' field: z.string(),\n title: z.string(),')); return ksFired(row.path, io).join() === 'chart-axis-key-set,chart-axis-presentation-key-set' && ksFired(row.path, quiet).length === 0; })()); const INDEX_PIN = maskComments(readFileSync(nodePath.join(ROOT, 'ui/packages/app-shell/src/views/metadata-admin/EmbeddedItemEditor.indexFallback.test.tsx'), 'utf8')); @@ -6111,6 +6221,98 @@ export function selfTest({ tier = 'full' } = {}) { const viewBranches = [...(/VIEW_METADATA_BRANCHES = \[([^\]]*)\]/.exec(VIEW_SRC)?.[1] ?? '').matchAll(/'([^']+)'/g)].map((m) => m[1]).sort(); t(`⭐ LIVE: the view union's branch list (${viewBranches.length}) is exactly the member record's keys the row reads`, viewBranches.length > 1 && JSON.stringify(viewBranches) === JSON.stringify(liveSet('VIEW_METADATA_MEMBERS'))); + // The pins outside the metadata types' nesting and the value sets: each test still enumerates its schema whole, + // and where it spells the set as a literal the reader's set equals it. + const ksPinText = (k) => maskComments(readFileSync(nodePath.join(ROOT, KS_GATES[k].startsWith('pnpm --dir ui ') ? `ui/${KS_GATES[k].split(' ').pop()}` : ksEntry.flatMap((e) => e.gates).find((g) => g.name === KS_GATES[k]).ciSubset), 'utf8')); + const KS_LIVE_SPELLINGS = Object.freeze({ + 'template-manifest-key-set': /Object\.keys\(TemplateManifestSchema\.shape\)/, + 'email-config-key-set': /Object\.keys\(EmailServiceConfigSchema\.shape\)/, + 'clone-flow-request-key-set': /Object\.keys\(CloneFlowRequestSchema\.shape\)/, + 'engine-option-key-set': /expectSetMatches\('find', EngineQueryOptionsSchema[\s\S]*expectSetMatches\('update', EngineUpdateOptionsSchema[\s\S]*expectSetMatches\('delete', EngineDeleteOptionsSchema[\s\S]*expectSetMatches\('count', EngineCountOptionsSchema[\s\S]*expectSetMatches\('aggregate', EngineAggregateOptionsSchema/, + 'explain-verb-rows-value-set': /\[\.\.\.ExplainOperationSchema\.options\]\.sort\(\)\)\.toEqual\(Object\.keys\(VERB_ROWS\)/, + 'explain-verb-class-value-set': /\[\.\.\.ExplainOperationSchema\.options\]\.sort\(\)\)\.toEqual\(Object\.keys\(VERB_CLASS\)/, + 'explain-door-value-set': /\[\.\.\.ExplainOperationSchema\.options\]\.sort\(\)\)\.toEqual\(Object\.keys\(DOORS\)/, + 'registry-inputs-key-set': /Object\.keys\(ComponentPropsMap\)/, + 'nav-doc-arm-key-set': /Object\.keys\(SpecDocNavItemSchema\.shape\)/, + 'bulk-operation-value-set': /BulkActionOperationSchema/, + 'column-summary-value-set': /ColumnSummarySchema/, + 'field-type-value-set': /FieldType/, + 'chart-type-dispatch-value-set': /ChartTypeSchema/, + 'chart-type-renderer-value-set': /ChartTypeSchema/, + 'report-chart-value-set': /ChartTypeSchema[\s\S]*ReportType|ReportType[\s\S]*ChartTypeSchema/, + 'chart-aggregate-value-set': /ChartAggregateFunctionSchema/, + 'notification-position-value-set': /NotificationPositionSchema/, + 'notification-hook-value-set': /NotificationTypeSchema[\s\S]*NotificationPositionSchema|NotificationPositionSchema[\s\S]*NotificationTypeSchema/, + }); + t('the live-spelling table covers exactly the eighteen pins outside the metadata types\' nesting', JSON.stringify(Object.keys(KS_LIVE_SPELLINGS).sort()) === JSON.stringify([...Object.keys(KS_CORE_PKG), ...KS_NEW_UI].sort())); + for (const [k, spelling] of Object.entries(KS_LIVE_SPELLINGS)) { + t(`⭐ LIVE: ${k}'s test still reads its schema from the spec, and every schema the pin holds reads a non-empty set`, spelling.test(ksPinText(k)) && PIN[k].schemas.every((n) => liveSet(n).length > 0)); + } + const cloneSpelled = [...(/Object\.keys\(CloneFlowRequestSchema\.shape\)\.sort\(\)\)\.toEqual\(\[([^\]]*)\]/.exec(ksPinText('clone-flow-request-key-set'))?.[1] ?? '').matchAll(/'([^']+)'/g)].map((m) => m[1]).sort(); + t(`⭐ LIVE census: CloneFlowRequestSchema's keys (${liveSet('CloneFlowRequestSchema').length}) equal the list the runtime pin spells (${cloneSpelled.length})`, + cloneSpelled.length > 0 && JSON.stringify(liveSet('CloneFlowRequestSchema')) === JSON.stringify(cloneSpelled)); + const emailSpelled = [...(/expect\(keysDeclaredBySchema\(\)\)\.toEqual\(\[([^\]]*)\]/.exec(ksPinText('email-config-key-set'))?.[1] ?? '').matchAll(/'([^']+)'/g)].map((m) => m[1]).sort(); + t(`⭐ LIVE census: EmailServiceConfigSchema's keys (${liveSet('EmailServiceConfigSchema').length}) equal the list the plugin-email pin spells (${emailSpelled.length})`, + emailSpelled.length > 0 && JSON.stringify(liveSet('EmailServiceConfigSchema')) === JSON.stringify(emailSpelled)); + const manifestKeys = [...new Set([...liveSet('CreatePackageRequestSchema').filter((k) => !liveSet('TemplateManifestSchema.omit').includes(k)), ...liveSet('TemplateManifestSchema')])].sort(); + t(`⭐ LIVE: the manifest's key set is the request's less the omit list plus the extension (${manifestKeys.length}), and none of the three literals spreads`, + manifestKeys.length > 10 && ['TemplateManifestSchema', 'TemplateManifestSchema.omit', 'CreatePackageRequestSchema'].every((n) => liveSet(n).every((k) => !k.startsWith('...')))); + // The doc arm spreads the base item; a key added to the base derives the doc pin through it. + const DOC_NAV = ksRow('DocNavItemSchema'); + const BASE_NAV = ksRow('BaseNavItemSchema.shape'); + const navWorld = (docSpreads) => { + const app = (base) => ksTypeSrc(ksRow('app'), ' name: z.string(),') + + ksSchemaSrc(DOC_NAV, docSpreads ? ' type: z.string(),\n ...BaseNavItemSchema.shape,' : ' type: z.string(),') + + ksSchemaSrc(BASE_NAV, base); + // Every other declaring file as `ksWorld` renders it, so a pin reading a spreader elsewhere reads that file. + const w = ksWorld(SPREADS_NOW); + return { + readHead: (p) => (p === DOC_NAV.path ? app(' id: z.string(),\n label: z.string(),') : w.readHead(p)), + readBase: (p) => (p === DOC_NAV.path ? app(' id: z.string(),') : w.readBase(p)), + }; + }; + t('⭐ a key added to BaseNavItemSchema derives the doc nav pin once the doc arm spreads it, read from the arm\'s own members', + ksFired(DOC_NAV.path, navWorld(true)).join() === 'nav-doc-arm-key-set'); + t('CONTROL: …and nothing while the arm does not spread it', ksFired(DOC_NAV.path, navWorld(false)).length === 0); + t('⭐ LIVE: the doc arm spreads the base item on this tree, through the row the census holds', liveSet('DocNavItemSchema').includes('...BaseNavItemSchema.shape') && (liveKs.get(BASE_NAV) ?? []).length > 3); + // The generated-artifact merge routing: `os-regen-merge.sh --self-test`, which no family carries. + const OSR_ROW = CHANGE_KIND_ROWS.find((r) => r.matches === 'os-regen-merge-input'); + const OSR_GATE = OSR_ROW?.gates[0]; + const OSR_ENTRY = CHANGE_KIND_GATES.find((k) => k.gates.some((g) => g.name === OSR_GATE?.name)); + const GA = '# generated artifacts\npackages/spec/api-surface/** merge=os-regen\ncontent/docs/references/** merge=os-regen -diff\n*.png binary\n'; + t('the routed-pattern reader takes the first field of every non-comment merge=os-regen line, as the script does', + JSON.stringify(osRegenRoutedPatterns(`${GA}# x/** merge=os-regen\nfoo/** merge=os-regen-old\n`)) === JSON.stringify(['content/docs/references/**', 'packages/spec/api-surface/**'])); + const OSR_EDITS = Object.freeze({ + 'a routed pattern added': [`${GA}packages/spec/docs/references/** merge=os-regen\n`, true], + 'a routed pattern removed': [GA.replace('packages/spec/api-surface/** merge=os-regen\n', ''), true], + 'a routed pattern respelled': [GA.replace('api-surface/**', 'api-surface-v2/**'), true], + 'the file deleted': [null, true], + 'an unrelated attribute line added': [`${GA}*.jpg binary\n`, false], + 'a comment reworded': [GA.replace('# generated artifacts', '# generator-owned artifacts'), false], + 'another attribute added to a routed line': [GA.replace('api-surface/** merge=os-regen', 'api-surface/** merge=os-regen -diff'), false], + }); + for (const [edit, [head, expected]] of Object.entries(OSR_EDITS)) { + t(`${expected ? '' : 'CONTROL: '}.gitattributes: ${edit} ${expected ? 'derives' : 'derives nothing'}`, changesOsRegenRouting('.gitattributes', fkIo(head, GA)) === expected); + } + t('⭐ an unchanged .gitattributes (a surface named before its code) derives it: a seconds-long self-test reads wide', changesOsRegenRouting('./.gitattributes', fkIo(GA, GA))); + t('the script itself derives it on any edit, unread', changesOsRegenRouting(OS_REGEN_MERGE_SCRIPT, { readHead: () => { throw new Error('read'); }, readBase: () => { throw new Error('read'); } })); + t('CONTROL: a sibling pm script and a nested .gitattributes derive nothing', + !changesOsRegenRouting('scripts/pm/dev-worktree.sh', fkIo('a', 'b')) && !changesOsRegenRouting('ui/.gitattributes', fkIo(`${GA}x/** merge=os-regen\n`, GA))); + t('the row names the self-test alone, bound to the repo & tooling job by its runner', + OSR_ROW?.gates.length === 1 && OSR_GATE.name === `bash ${OS_REGEN_MERGE_SCRIPT} --self-test` && OSR_GATE.ciJob === 'Lint · repo & tooling gates' && OSR_GATE.ciRunner === `bash ${OS_REGEN_MERGE_SCRIPT}` && OSR_GATE.ciSubset === undefined); + t('⭐ LIVE: the binding resolves, lint.yml still runs the self-test in that job', ciJobRunsRunner(OSR_GATE, discoverFamilies().workflowEntries)); + t('⭐ LIVE: the script still reads .gitattributes and holds OS_REGEN_CLASSES, the table the row\'s reason names', (() => { + const text = readFileSync(nodePath.join(ROOT, OS_REGEN_MERGE_SCRIPT), 'utf8'); + return /\bOS_REGEN_CLASSES=/.test(text) && text.includes('.gitattributes') && text.includes('merge=os-regen'); + })()); + const osrBound = [{ ...OSR_ENTRY, matches: (p) => changesOsRegenRouting(p, fkIo(OSR_EDITS['a routed pattern added'][0], GA)) }]; + const osrLines = changeKindLines(['.gitattributes'], ksResolved, osrBound); + t('a routed pattern added renders the self-test runnably, stating it needs no build', + osrLines.length === 2 && osrLines[1].includes(`- bash ${OS_REGEN_MERGE_SCRIPT} --self-test —`) && /needs no build/.test(osrLines[1]) && !/#\d{4,5}\b/.test(osrLines.join('\n'))); + const osrDerived = commandsFor({ kindGroups: changeKindGates(['.gitattributes'], ksResolved, osrBound) }); + t('…the runnable union carries it, and a run record without it is NOT ok, naming it unrun', + osrDerived.includes(OSR_GATE.name) && (() => { const r = runReconciliation({ derived: osrDerived, record: parseRunRecord('') }); return !r.ok && r.unrun.some((u) => u.command === OSR_GATE.name); })()); + t('…and an unresolvable binding renders it STALE, naming the job', changeKindLines(['.gitattributes'], () => null, osrBound).some((l) => l.includes(`⚠ ${OSR_GATE.name}: STALE`) && l.includes("job named 'Lint · repo & tooling gates…'"))); t('CONTROL: the live files, read at base and head alike, derive no pin', SERVED_KEY_SET_DECLARATIONS.every((d) => { const text = readFileSync(nodePath.join(ROOT, d.path), 'utf8'); return Object.values(PIN).every((pin) => !changesServedKeySet(d.path, pin, fkIo(text, text))); }));