Skip to content

fix: stop committed generated artifacts drifting from their generators - #468

Open
josecarneiro wants to merge 12 commits into
mainfrom
claude/rebase-pr-466-committer-vaogdv
Open

fix: stop committed generated artifacts drifting from their generators#468
josecarneiro wants to merge 12 commits into
mainfrom
claude/rebase-pr-466-committer-vaogdv

Conversation

@josecarneiro

Copy link
Copy Markdown
Contributor

Replaces #466 — identical tree, recommitted under the correct author. #466 can be closed.

Summary

pnpm install && pnpm build on a clean main left 68 tracked files dirty. CI was building fine — it just never committed or checked most of what it regenerated.

Root cause, in the auto-release job: the SDK branch stages packages/epilot-sdk-v2/ wholesale, but the CLI branch stages only

FILES_TO_ADD="$FILES_TO_ADD packages/cli/package.json packages/cli-wrapper/package.json"

packages/cli commits ~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 no git diff --exit-code existed anywhere in .github/workflows/ to notice.

Two concrete symptoms:

  • packages/cli/src/generated/api-list.ts advertised 12 operations for ai-agents against the spec's 21executeAgentStream, getExecutionFeedback and seven others were missing. The CLI resolves operations at runtime from definitions/*.json, so running it from source exposed the stale set.
  • packages/cli/src/index.ts reported version 0.1.51 while package.json was at 0.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 only packages/cli/package.json, so main immediately had:

  • packages/cli/definitions/entity-mapping.json stale against the spec it is copied from
  • packages/cli/src/index.ts reporting 0.1.51 against a package.json at 0.1.141

The drift recurred within the hour, unprompted. That is the failure mode reproducing on its own, not a reconstruction.

Changes

Commit What
79fe8c7 Align 15 committed client openapi.d.ts with generator output — all cosmetic (stale /* eslint-disable */ header from the pre-biome era, blank lines, trailing whitespace). No type changed.
372e632 journey-client and configuration-hub-client were the only 2 of 52 clients running codegen from build. journey's npm run openapi fetched 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: build only compiles, typegen moved to prepublishOnly.
df5b78e Refresh journey-config spec 1.4.2 → 1.4.3 (JourneyActivationGuarantee). Stale precisely because the only thing refreshing it was the build removed above.
acc7a57 Regenerate the stale CLI and SDK artifacts. 30 of 51 definitions/*.json → 0 stale.
37dba9e The CI fixes (below).
4a57254 Release the journey refresh via changeset, matching every other client update.
18fafb4 Move the build-cleanliness gate to sit directly after pnpm build rather than after pnpm test, so a dirty tree can only be the build's doing.
7725c2e + d393608 Merge main and regenerate, absorbing the 0.1.141 drift described above.

CI

Two gates in the test job:

  1. After running both generators, fail if the tree is dirty — a PR that changes a spec without regenerating is rejected with the command to run.
  2. Directly after pnpm build, fail if the tree is dirty — a build can never again quietly regenerate or re-fetch committed source.

And auto-release now regenerates the CLI after the version bump and stages all of packages/cli/. Ordering was the reason src/index.ts kept the wrong version: Build and test CLI runs before the bump, and Rebuild CLI with bumped version runs 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)
  • All 51 packages/cli/definitions/*.json byte-identical to the clients/*/src/openapi.json they are copied from
  • CI green on chore: bring committed generated artifacts back in sync with their generators (1/2) #466's head — Test, Lint, CodeQL and Analyze all pass, with both new gates passing in CI
  • Gate 1 demonstrated working: after merging main, it flagged the four artifacts the 0.1.141 release had left stale
  • Locally pnpm test fails identically to unmodified main (cli 19/100, sdk-v2 25/334) — both failing suites spin up a local HTTP server and hit ERR_INVALID_URL from proxy-prefixed URLs in the dev sandbox. Zero new failures, and green in CI.
  • git diff between 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 changed

Review notes

  • The regeneration commits are large but entirely generator output — reviewing 37dba9e, 372e632 and 18fafb4 is what matters.
  • The journey spec change is type-level only: no new paths or operations, so src/openapi-runtime.json is unchanged.
  • Merging this triggers an SDK auto-release, since clients/journey-client/src/openapi.json changed.
  • Time-sensitive: every auto-release re-introduces this drift, so the branch needs main merged and artifacts regenerated each time one lands. The longer it stays open, the more of those merges it collects.

Generated by Claude Code

josecarneiro and others added 10 commits August 31, 2026 15:43
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
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>
josecarneiro and others added 2 commits September 1, 2026 12:43
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
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