You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Croco's OpenAPI and RPC generators cannot verify that committed outputs match source contracts without rewriting those outputs first.
Generated contract:verify scripts therefore repair stale artifacts during CI instead of proving the repository was already synchronized, hiding drift from reviewers.
Evidence
packages/rpc-codegen/src/libs/cli.ts:55-57 uses --check only to report ContractGraph diagnostics.
packages/rpc-codegen/src/libs/generate.ts:178-183 creates directories and writes every generated file unconditionally.
packages/openapi-spec/src/libs/cli.ts:66-68 gives --check the same graph-only meaning, then lines 92-94 overwrite the output JSON.
Generated admin-console, SaaS, AI-SaaS, and split-app contract:verify scripts call the writing generators.
CI can deterministically fail on stale committed OpenAPI or RPC outputs, show a readable diff/recovery command, and leave the worktree untouched.
Proposed implementation
Add an explicit read-only output-check mode to both CLIs without changing the current graph-diagnostic --check contract.
Generate expected documents/files in memory using the same production emitters.
Compare the complete expected file set and normalized content against disk.
Detect missing, changed, and unexpected stale generated files.
Emit stable drift diagnostics plus the exact regeneration command.
Update generated contract:verify scripts to run read-only checks; keep a separate codegen command for intentional writes.
Add a worktree/mtime guard proving check mode performs no mutation.
Acceptance criteria
Mutating a committed OpenAPI document makes read-only verification fail.
Mutating, deleting, or adding a stale RPC client file makes verification fail with the affected path.
Unchanged outputs pass without changing file bytes, mtimes, or directory contents.
Graph diagnostics and output drift remain distinguishable stable error categories.
Generated app CI verifies before regeneration.
The same emitters power write and check modes so serialization cannot drift.
Validation
Run OpenAPI and RPC codegen test suites.
Add fixtures for changed, missing, extra, and unchanged outputs.
Run generated-app contract:verify and assert git diff --exit-code.
pnpm create-croco-app:smoke
pnpm check
Scope boundaries
Do not introduce a second generator implementation or require semantic API compatibility analysis here. This issue checks deterministic committed artifacts against current emitters.
Priority
P1
Problem
Croco's OpenAPI and RPC generators cannot verify that committed outputs match source contracts without rewriting those outputs first.
Generated
contract:verifyscripts therefore repair stale artifacts during CI instead of proving the repository was already synchronized, hiding drift from reviewers.Evidence
packages/rpc-codegen/src/libs/cli.ts:55-57uses--checkonly to report ContractGraph diagnostics.packages/rpc-codegen/src/libs/generate.ts:178-183creates directories and writes every generated file unconditionally.packages/openapi-spec/src/libs/cli.ts:66-68gives--checkthe same graph-only meaning, then lines 92-94 overwrite the output JSON.contract:verifyscripts call the writing generators.Desired outcome
CI can deterministically fail on stale committed OpenAPI or RPC outputs, show a readable diff/recovery command, and leave the worktree untouched.
Proposed implementation
--checkcontract.contract:verifyscripts to run read-only checks; keep a separatecodegencommand for intentional writes.Acceptance criteria
Validation
contract:verifyand assertgit diff --exit-code.pnpm create-croco-app:smokepnpm checkScope boundaries
Do not introduce a second generator implementation or require semantic API compatibility analysis here. This issue checks deterministic committed artifacts against current emitters.