Repository navigation
fix(ci): verify committed codegen output instead of a regenerated worktree #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ Hand-authored JSON Schema must produce both TypeScript (`@42ch/spoke-schemas`) a | |
|
|
||
| 1. **SSOT** — only `schemas/**/*.schema.json` are hand-authored; generated trees are committed. | ||
| 2. **Orchestrator** — `tooling/codegen` (`pnpm -F @42ch/spoke-codegen codegen` → `node tooling/codegen/src/run.mjs`) walks schemas, localizes `$ref`s for typify, and emits mirrored `generated/{common,connect,data,ops}/` trees in both packages. | ||
| 3. **Verify** — `pnpm run verify-codegen` runs `codegen` → `tooling/codegen/assert-schema-count.mjs` → `tooling/codegen/assert-opaque-json-types.mjs` → `node --test tooling/codegen/test/deep-ref-hoist.test.mjs` → `cargo check --workspace`. | ||
| 3. **Verify** — `pnpm run verify-codegen` checks the committed trees: `tooling/codegen/assert-schema-count.mjs` → `tooling/codegen/assert-opaque-json-types.mjs` → `node --test tooling/codegen/test/deep-ref-hoist.test.mjs` → `@42ch/spoke-schemas` typecheck → `cargo check --workspace`. Regeneration is the author step (`pnpm run codegen`); CI verifies the committed output that ships, never a regenerated worktree. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Knowledge doc presents CI as verifying committed generated trees, but no chain step compares them to [DOCS-01] Knowledge doc presents CI as verifying committed generated trees, but no chain step compares them to
|
||
| 4. **Fail-fast counts** — `assert-schema-count.mjs` holds `EXPECTED_SCHEMA_COUNT = 114`; `tooling/codegen/rust-gen/src/main.rs` holds the same constant and returns non-zero unless exactly 114 Rust schema modules are written. Bump both constants in the same commit as the schema change and the regenerated output. | ||
| 5. **Closed ops responses** — mutually exclusive success/error shapes use draft-07 `oneOf` (see `assemble-response.schema.json`). | ||
| 6. **Opaque JSON** — `#/definitions/OpaqueJson` must be an **empty schema object `{}`**. Consuming properties `$ref` that definition (e.g. `ComputableLogChange.previous` / `.next`, `ExtractionRunMetadata.coverage_hint`). Generators emit any-JSON types (`unknown` / `OpaqueJson` in TS; `serde_json::Value` in Rust). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ | |
| "//": "Cold-clone gate is `ci:typescript` (inlined superset of the ci.yml `typescript` job: `build:operations` precedes every typecheck that resolves @42ch/spoke-operations from dist/, then the demo typechecks + `test:demo`). The composite `typecheck` script is a warm-tree helper only.", | ||
| "scripts": { | ||
| "codegen": "pnpm -F @42ch/spoke-codegen codegen", | ||
| "verify-codegen": "pnpm run codegen && node tooling/codegen/assert-schema-count.mjs && node tooling/codegen/assert-opaque-json-types.mjs && node --test tooling/codegen/test/deep-ref-hoist.test.mjs && cargo check --workspace", | ||
| "verify-codegen": "node tooling/codegen/assert-schema-count.mjs && node tooling/codegen/assert-opaque-json-types.mjs && node --test tooling/codegen/test/deep-ref-hoist.test.mjs && pnpm -F @42ch/spoke-schemas typecheck && cargo check --workspace", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. verify-codegen no longer executes the generator, so CI never proves the schema set is still generatable · 🟡 may-fix
|
||
| "typecheck": "pnpm -F @42ch/spoke-schemas typecheck && pnpm -F @42ch/spoke-operations typecheck && pnpm -F @42ch/spoke-connect typecheck && pnpm -F @42ch/spoke-demo-server typecheck && pnpm -F @42ch/spoke-demo-client typecheck", | ||
| "build:schema": "pnpm -F @42ch/spoke-schemas build", | ||
| "build:operations": "pnpm -F @42ch/spoke-operations build", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README index summary drops the generated-tree freshness dimension the row previously carried · 🔵 nit
[DOCS-02] README index summary drops the generated-tree freshness dimension the row previously carried
.agents/knowledge/README.md:9— the codegen row summary changed from "verify-codegenregenerates both trees, asserts the schema count and opaque-JSON types, then runscargo check --workspace" to "verify-codegenchecks the committed trees — schema count, opaque-JSON types, TypeScript typecheck andcargo check --workspace".package.json:15:assert-schema-count→assert-opaque-json-types→deep-ref-hoisttest →pnpm -F @42ch/spoke-schemas typecheck→cargo check --workspace) and againstpackages/spoke-schemas/package.json:37(typecheck: tsc --noEmitexists). The residual reader cost is only that the index row now reads as a complete verification list while the freshness question (see DOCS-01) is the same one; this is a wording consequence of the same change, not an independent wrong outcome.