camunda / camunda/orchestration-cluster-api-python
Committed generated/ and stubs/ drift from what CI regenerates, undetected
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 6h 15m
- Merged PRs (30d)
- 20
Description
Problem
The committed generated/ and stubs/ artifacts on main are stale relative to what CI actually builds, and nothing detects it.
CI regenerates from scratch on every run:
Clear checked-in spec (prevent stale fallback)→rm -rf external-spec/bundled/*Download bundled spec→ fresh bundle fromcamunda/camunda@mainGenerate SDK→make generate-only
It then type-checks, tests and coverage-checks that freshly generated tree. At no point does it compare the regenerated output against the generated/ and stubs/ trees committed in the repo. As a result the two can diverge without bound, and they have.
How this bit us
While fixing red CI in #267, examples/agent_instance.py looked correct against the local checkout — the committed stubs/ described the old agent-instance API shape. CI disagreed, because CI had regenerated against current upstream where the shape had changed:
AgentInstanceCreationRequestlostdefinitionand gained requiredelement_instance_key,job_key,job_lease,historyAgentInstanceUpdateRequestgained requiredjob_keyandjob_lease- the
createAgentInstanceHistoryItemoperation was removed entirely
The stale stubs actively misled the diagnosis. The only way to get ground truth was to run a full local regeneration and read the generated classes directly.
This is not specific to agent instances — it is a property of the setup. Any upstream schema change produces the same trap, and the cost lands on whoever is next debugging a failure in that area.
Why it also weakens review
Because the committed artifacts are never validated, a PR can hand-edit generated/ or stubs/ — or simply commit output from a differently-configured local run — and CI will happily pass, since it discards those files and regenerates. The committed tree is presented to readers as the generated output, but nothing guarantees it is.
Proposed fix
Add a generation drift job to ci.yml, mirroring the pattern already used in the Go and Rust SDKs:
- bundle the spec (reuse the existing
bundle-specartifact) make generate-onlygit diff --exit-code -- generated stubs
On drift, fail with the diff in the log — or, to avoid making routine upstream churn block unrelated PRs, upload the diff as a patch artifact and emit a warning (the Go SDK's report-only Generation drift job is the reference implementation).
Two details worth getting right:
- Do not use a bare
git diffto decide. Regeneration can add untracked files, whichgit diffdoes not see. Usegit status --porcelain -- generated stubsorgit add -Abefore diffing. (This same blindness exists today in the Go/C#/JS drift jobs and should be fixed there too.) - Decide explicitly whether the committed artifacts are source of truth or convenience only. If convenience only, the cheaper fix is to stop committing them and let consumers generate — but that breaks IDE navigation for anyone reading the repo, so a drift check is likely the better trade.
Acceptance criteria
- CI detects when
generated/orstubs/on a branch differ from a cleanmake generate-onlyagainst the bundled spec. - The check accounts for added and removed files, not just modified ones.
- A regeneration PR that brings the committed artifacts back in line passes cleanly.
- The behaviour on upstream-churn drift (fail vs. warn + patch artifact) is a deliberate, documented choice.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ci.yml and the existing bundle-spec artifact, then trace the make generate-only flow and the Go and Rust SDK drift jobs mentioned in the issue. Add a generation-drift check covering generated/ and stubs/, including added and removed files, and document whether upstream drift fails CI or produces a warning and patch artifact. Verify that a clean regeneration passes and intentional drift is detected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, python
- Domain
- build-system, ci-cd
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100