Repository navigation
refactor(validation): extract shared info-object validation - #92
Conversation
The Info Object checks were byte-identical in the 3.0 and 3.1 validators and every change to them landed as lockstep edits. Move them to validate-info.ts beside validate-security.ts, taking the dialect as a parameter and rendering its own spec links. Closes #90.
|
This PR extracts the byte-identical Info Object validation (object presence + Findings
Otherwise this is a clean, faithful extraction. I verified the removed inline blocks and the new module are equivalent in messages, check order, and control flow (the Verdict✅ Approve — a faithful, well-tested extraction with no behavioral change, matching the established shared-rule pattern; the two nits are non-blocking polish. 🤖 automatic review · T3 thread |
Review notes on #92: label the hardcoded spec-page URLs as a deliberate pin (a SPEC_PAGE bump must update them in the same commit) so nobody imports SPEC_PAGE and silently loses the exactness guarantee; and remove run()'s unused '3.0' fallback.
Summary
Extracts the byte-identical Info Object validation from both dialect validators into one shared module, following the
validate-security.tsprecedent (issue #90).Same signature contract as
validateSecurity(spec, version, errors); callsspecViolation(version, key, message)internally so each dialect keeps its own spec links. Messages, check order, and post-#88 semantics (empty-stringtitle/versionvalid; non-objectinforeports onlyinfo-object) are byte-identical.Scope deliberately limited to the
infoblock — thedocument-root,openapi-field, andcomponents.schemasduplication stays for a later, separate decision.Also ships:
CONTEXT.mdShared rule entry (it names the new module)tests/unit/version/validate-info.test.tspinning the exact message + link per dialect × key — thev3.0.4/v3.1.1URLs are hardcoded on purpose; the follow-up on Extract shared info-object validation from the per-dialect validators #90 documents why the pre-existingexpectViolationregex was too loose to catch version/key mix-ups.Closes #90.
Evidence
TDD red→green on the new module, then the full suite.
Before (test written first, module absent):
After (module + both validators wired):
npm run checkclean ·npm run format:checkclean · oxlint clean on touched files.Two-axis review of the branch (standards + spec sub-agents) found no hard violations; the spec axis verified all binding requirements with line-level evidence.
Merge Danger
Door: two-way — pure internal refactor, no behavior change, trivially revertible.
Blast radius: tiny. Nothing exported from the package root changes; generated-client output is unchanged (snapshot-backed suites cover it).