fix: stop committed generated artifacts drifting from their generators - #468
Open
josecarneiro wants to merge 12 commits into
Open
fix: stop committed generated artifacts drifting from their generators#468josecarneiro wants to merge 12 commits into
josecarneiro wants to merge 12 commits into
Conversation
15 of 51 client typings differed from what `npm run typegen` produces, so the documented CONTRIBUTING flow mixed unrelated churn into every client update. All differences are cosmetic — a stale `/* eslint-disable */` header left over from the pre-biome era (12 clients), blank-line placement (2), and trailing whitespace (2). No type changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
…ked source These were the only two of 52 clients that ran code generation from `build`: - journey-client ran `npm run openapi`, which fetches the live spec from docs.api.epilot.io and overwrites the committed src/openapi.json and src/openapi-runtime.json. A build had a network dependency and its result varied with whatever was deployed to prod at the time. - both ran `npm run typegen`, rewriting the committed src/openapi.d.ts. So `pnpm build` at the root left the working tree dirty. Both now match the other 50 clients: `build` only compiles, and `typegen` moved to `prepublishOnly` so published tarballs still carry freshly generated types. Updating a spec stays the deliberate `npm run openapi` step from CONTRIBUTING.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
The committed spec was still 1.4.2 because the only thing that refreshed it was journey-client's own `build` (now removed), which rewrote the file locally and never got committed. Adds JourneyActivationGuarantee: responses that return a Journey now guarantee an explicit `settings.isActive`, while the flag stays optional in request bodies. Type-level only — no new paths or operations, so src/openapi-runtime.json is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
packages/cli commits ~160 generated artifacts (definitions/, docs/, src/commands/apis/, src/generated/api-list.ts, src/index.ts, README.md). CI regenerates them on every push but only ever stages packages/cli/package.json, so they had not been updated since 2026-08-26 — 30 of 51 definitions/*.json no longer matched the clients/*/src/openapi.json they are copied from. The CLI resolves operations at runtime from definitions/*.json, so running it from source exposed a stale operation set: ai-agents advertised 12 operations against the spec's 21, missing executeAgentStream, getExecutionFeedback and seven others. src/index.ts still reported version 0.1.51 while package.json was at 0.1.140. Published tarballs were unaffected — CI rebuilds before publish. The epilot-sdk-v2 changes are the downstream mirrors of the two preceding commits (client typings and journey-config 1.4.3). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
The repo commits the generated artifacts of @epilot/sdk and @epilot/cli, but nothing verified the committed copies matched their generators. CI ran generate-sdk and build on every push, tested the result and discarded it, so drift accumulated silently — 30 of 51 CLI definitions were stale. Two gates in the test job: - after running both generators, fail if the tree is dirty, so a PR that changes a spec without regenerating is rejected with the command to run. - after `pnpm build`, fail if the tree is dirty, so a build can never again quietly regenerate or re-fetch committed source. And the auto-release job now regenerates the CLI after bumping its version and stages all of packages/cli/. It previously staged only package.json: the pre-bump "Build and test CLI" step generated src/index.ts with the old version and "Rebuild CLI with bumped version" runs after the push, so the committed src/index.ts kept reporting 0.1.51 while package.json reached 0.1.140. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
Replaces the manual package.json bump with a changeset, matching how every other client spec update in the repo is released. Changesets own version bumps. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
The build-cleanliness gate ran after `pnpm test`, so a test that wrote a tracked file would have been reported as the build mutating source. Checking between the two steps means a dirty tree can only be the build's doing, and the gate fails before the test run rather than after it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
…s-outdated-1zq6jq
Merging main brought in the entity-mapping spec update (#467) and the @epilot/cli@0.1.141 release. That release again staged only packages/cli/package.json, so main's packages/cli/definitions/entity-mapping.json was already stale against the spec it is copied from, and src/index.ts still reported 0.1.51 against a package.json at 0.1.141. Regenerating brings both in line: definitions/entity-mapping.json now matches clients/entity-mapping-client/src/openapi.json, and src/index.ts reports 0.1.141. This is the drift this PR's gates are for — it recurred on main within the hour, and gate 1 catches it on the merge result rather than letting it land. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
…committer-vaogdv Co-authored-by: Claude <noreply@anthropic.com>
6 tasks
Merging main brought in the environments-client Map reshape (#463) and the @epilot/cli@0.1.142 release. That release again staged only packages/cli/package.json, so main's packages/cli/definitions/environments.json was already stale against the spec it is copied from, and src/index.ts and README.md still reported 0.1.141 against a package.json at 0.1.142. Regenerating brings all three in line. This is the third time the drift has recurred while this PR has been open, each time from an auto-release — which is what the auto-release staging fix here is for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012SXjdmtUTrPLpQec28c9DQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pnpm install && pnpm buildon a cleanmainleft 68 tracked files dirty. CI was building fine — it just never committed or checked most of what it regenerated.Root cause, in the
auto-releasejob: the SDK branch stagespackages/epilot-sdk-v2/wholesale, but the CLI branch stages onlypackages/clicommits ~160 generated artifacts. CI regenerated them on every push, tested them, and threw them away. They had not been updated since 2026-08-26, and nogit diff --exit-codeexisted anywhere in.github/workflows/to notice.Two concrete symptoms:
packages/cli/src/generated/api-list.tsadvertised 12 operations for ai-agents against the spec's 21 —executeAgentStream,getExecutionFeedbackand seven others were missing. The CLI resolves operations at runtime fromdefinitions/*.json, so running it from source exposed the stale set.packages/cli/src/index.tsreported version0.1.51whilepackage.jsonwas at0.1.140.Published tarballs were never affected — CI rebuilds before publish.
This is still happening
While #466 was open,
@epilot/cli@0.1.141(5e39d9ce) released off the back of the entity-mapping spec update in #467. It again staged onlypackages/cli/package.json, somainimmediately had:packages/cli/definitions/entity-mapping.jsonstale against the spec it is copied frompackages/cli/src/index.tsreporting0.1.51against apackage.jsonat0.1.141The drift recurred within the hour, unprompted. That is the failure mode reproducing on its own, not a reconstruction.
Changes
79fe8c7openapi.d.tswith generator output — all cosmetic (stale/* eslint-disable */header from the pre-biome era, blank lines, trailing whitespace). No type changed.372e632build. journey'snpm run openapifetched the live spec from docs.api.epilot.io and overwrote committed source, so a build had a network dependency. Both now match the other 50:buildonly compiles,typegenmoved toprepublishOnly.df5b78eJourneyActivationGuarantee). Stale precisely because the only thing refreshing it was the build removed above.acc7a57definitions/*.json→ 0 stale.37dba9e4a5725418fafb4pnpm buildrather than afterpnpm test, so a dirty tree can only be the build's doing.7725c2e+d393608mainand regenerate, absorbing the 0.1.141 drift described above.CI
Two gates in the
testjob:pnpm build, fail if the tree is dirty — a build can never again quietly regenerate or re-fetch committed source.And
auto-releasenow regenerates the CLI after the version bump and stages all ofpackages/cli/. Ordering was the reasonsrc/index.tskept the wrong version:Build and test CLIruns before the bump, andRebuild CLI with bumped versionruns after the push, so neither produced output the release commit could carry.Test plan
pnpm lint— clean (524 files)pnpm generate-sdk && pnpm --filter @epilot/cli generate→ no diff (gate 1 passes)pnpm build→ exit 0, tree clean (gate 2 passes; was 68 dirty files)packages/cli/definitions/*.jsonbyte-identical to theclients/*/src/openapi.jsonthey are copied frommain, it flagged the four artifacts the 0.1.141 release had left stalepnpm testfails identically to unmodifiedmain(cli 19/100, sdk-v2 25/334) — both failing suites spin up a local HTTP server and hitERR_INVALID_URLfrom proxy-prefixed URLs in the dev sandbox. Zero new failures, and green in CI.git diffbetween this branch and chore: bring committed generated artifacts back in sync with their generators (1/2) #466's head is empty — the tree is byte-identical, only author/committer metadata changedReview notes
37dba9e,372e632and18fafb4is what matters.src/openapi-runtime.jsonis unchanged.clients/journey-client/src/openapi.jsonchanged.mainmerged and artifacts regenerated each time one lands. The longer it stays open, the more of those merges it collects.Generated by Claude Code