Repository navigation
refactor(cli): declare CLI schema facts through the typed constraint helpers - #11205
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The merged change appears safe to merge. SummaryThe merged change moves CLI schema declarations into shared typed helpers and restores the root-discriminator check through
Source review only; tests were not run. Whether another PR supersedes this one could not be checked because GitHub access requires authentication. Reviews (6) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
…helpers The last raw JSON Schema keywords in CLI .meta() calls move to src/domain/schemaConstraints helpers: requirePresence gains requiresValue (the --outline-depth rule) and jsonDocumentText declares JSON document arguments. contractCliDescription reads the root discriminator from its typed annotation; since #10693 the x-rea-root-discriminator keyword no longer reached .meta(), so the check that the discriminator is the delivery's was dead. The raw-json-schema-meta baseline is now empty.
1687899 to
74c2345
Compare
|
@greptileai please review the latest commit: the branch was rebased on main after #11316 split the guard baselines into per-guard files, and the latest score predates that push. |
7d22179 to
5e544ce
Compare
|
@greptileai review — please review the latest commit (merge of current main). |
Summary
This moves the last raw JSON Schema keywords in CLI
.meta()calls onto the typed helpers from #10693, and makes the CLI read the root discriminator from its typed annotation. Since #10693 that annotation no longer reaches.meta(), so the CLI's check that a root discriminator is the delivery's had silently stopped running. W1 plan item 4.Problem and expected behavior
src/cli/jsonInputArgument.ts(2 sites) andsrc/cli/utilityCommands.ts(1 site) still wrote raw keywords (contentMediaType/contentSchema,if/then) into.meta(), counted in theraw-json-schema-metabaseline.src/cli/contractCliDescription.tslooked for thex-rea-root-discriminatorkeyword ininputSchema.meta(). feat(mcp)!: retire the full schema profiles and declare schema facts as typed annotations #10693 moved that fact toschemaAnnotations(...).rootDiscriminator, so the CLI no longer refused a contract whose root discriminator it does not project.Expected: every CLI schema fact comes from a typed annotation or a
schemaConstraintshelper, the baseline is empty, and the root-discriminator check runs again.Change and scope
src/domain/schemaConstraints.ts:PresenceRule.requiresValue: the required property must hold exactly this value. It is checked at parse time and declared asif: {required: [when]}, then: {required: [requires], properties: {requires: {const}}}.jsonDocumentText(schema, contentSchema?): declarescontentMediaType: application/jsonand the decoded content's schema. JSON Schema'scontent*keywords are annotations, not assertions, so it adds no check; the command that decodes the text admits the content with the owning schema.src/cli/utilityCommands.ts:import-reference-sourceoptions userequirePresencewith the same rule, message and issue path (--outline-depth requires --detail summary).src/cli/jsonInputArgument.ts: usesjsonDocumentText.src/cli/contractCliDescription.ts: readsschemaAnnotations(contract.inputSchema)?.rootDiscriminatorand refuses it at registration unless it is a delivery field.ROOT_DISCRIMINATORis removed.scripts/verify/baselines/raw-json-schema-meta.json: removed; the guard's baseline is empty.Contract and boundary impact
Semantic owner and earliest changed stage:
src/domain/schemaConstraints.tsowns the check and its declaration; the CLI consumes the helpers.Contribution scope fit and linked maintainer decision: not applicable (refactor within existing boundaries).
CLI and MCP/tool-catalog contract: CLI
--schemaoutput for these commands declares the same keywords as before. Runtime validation is unchanged. MCP is unchanged.Provider, bridge, target-format, or platform compatibility: none.
Evidence, artifact, provenance, or reconstruction contract: none.
Target selection, authority, upstream behavior, and cleanup details: not applicable.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Launch or attach to a process.
Inject instrumentation or run scripts/code.
Change process memory, registers, files, or configuration.
Contact network services.
Recover protected code or work around protections.
Documentation or usability only; no target interaction.
Not sure yet; investigation or maintainer guidance needed.
Evidence and regression coverage
src/domain/schemaConstraints.test.ts:requiresValuedeclaration, parse issues, and Ajv agreement with parsing;jsonDocumentTextdeclaration.tests/boundary/cli/cliContractCommandParity.test.ts: "refuses a root discriminator that is not the delivery's".contractCliDescription.ts(no error is thrown) and passes with this change.For evidence-bearing changes:
Validation performed
npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts: 558 passed. Against main'scontractCliDescription.ts: 1 failed (the new case).npm run test:focused -- src/domain/schemaConstraints.test.ts: 11 passed.npm run test:focused -- tests/boundary/cli/referenceSourceSummary.test.ts tests/boundary/cli/cliInputSchemaRequired.test.ts tests/boundary/cli/cliDomainFieldSchema.test.ts tests/boundary/cli/jsonInputSchema.test.ts tests/boundary/cli/cliContractSchemaParity.test.ts: 61 passed.npx oxfmt --check .,npm run check:fast,node scripts/verify/architecture-guards.mjs: passed.main(merge 5e544ce), commit written without the pre-commit lint-staged pass so it carries no unrelated autofixes; pre-push hook ran. fix(native)!: report a target-selected plist against the target, not the unsent path input #10798 had widened the CLI's accepted root discriminator from the delivery's fields to every field the projection does not take from argv or that selects the input branch (discriminatorFields), still reading the deadx-rea-root-discriminator.meta()keyword. The resolution keeps this PR's typedschemaAnnotations(...).rootDiscriminatorread and checks it against main's widerdiscriminatorFieldsset; the regression test is renamed to match. After the merge:npm run check:fastpass;npm run test:focused -- tests/boundary/cli/cliContractCommandParity.test.ts src/domain/schemaConstraints.test.ts1053 passed;briefs/local-gate.sh 11205 refactor/cli-schema-annotationspass.Compatibility, safety, and release
Author readiness
Human owner:
Before merge
type(scope): outcome.