Skip to content

fix(codegen): stop generation on failed steps - #157

Open
omerbek wants to merge 1 commit into
circlefin:masterfrom
omerbek:fix/codegen-failure-propagation
Open

omerbek wants to merge 1 commit into
circlefin:masterfrom
omerbek:fix/codegen-failure-propagation

Conversation

@omerbek

@omerbek omerbek commented Nov 8, 2026

Copy link
Copy Markdown

Summary

  • Stop gen-sdk.sh immediately when a generation, transformation, lint, or formatting command fails.
  • Add five offline regression cases executing the actual Bash script with deterministic command fixtures.
  • Document the nonzero exit behavior and the existing limitation that generated files removed at the beginning are not restored.

Problem / root cause

The script previously returned the status of its last command. In an isolated fixture on current master, generator exit 23 and transform exit 29 both resulted in overall exit 0, and lint/format still ran. A failed transform also replaced the generated index.ts with an empty file. set -e propagates these failures and prevents the subsequent mv after a failed transform. This does not add transactional rollback or change generated SDK APIs.

Testing

  • Offline standalone smoke executing the real script in a temporary directory: generator failure => 23; transform failure => 29 and generated index retained; lint failure => 31; format failure => 31; success => 0 with transformed index. Subsequent commands stopped at the failure.
  • Five regression cases passed using already-installed Jest 29.6.1, after TypeScript 5.4.5 transpilation of tests/gen-sdk.test.ts; focused strict TypeScript checking also passed. This is not a claim that the repository's pinned Jest 28 / ts-jest suite ran.
  • Formatted the new test with Prettier 2.8.3; Bash syntax check passed.
  • Full dependency installation first failed with a registry timeout, then disk exhaustion. Repository ESLint, build, pinned test suite and full generation with JVM/OpenAPI were not run. The existing sandbox HTTP integration test was not invoked; all new failure-path tests are offline.

Risk / compatibility

Only the documented developer codegen command changes failure handling. The successful command order is unchanged. A failing generator can still leave a partial generated tree; atomic preservation is intentionally out of scope.

AI assistance was used to investigate, implement and validate this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant