Skip to content

feat(ci): add a cf-typegen staleness check for worker-configuration.d.ts - #2599

Merged
JSONbored merged 1 commit into
mainfrom
ci/cf-typegen-staleness-check
Jul 2, 2026
Merged

feat(ci): add a cf-typegen staleness check for worker-configuration.d.ts#2599
JSONbored merged 1 commit into
mainfrom
ci/cf-typegen-staleness-check

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • worker-configuration.d.ts is generated from wrangler.jsonc bindings via npm run cf-typegen, but unlike its sibling generated artifacts (openapi.json, migrations) there was no CI guard against it drifting.
  • Two PRs that each independently add a wrangler binding (KV namespace, D1 database, queue, R2 bucket, Durable Object) can both pass CI individually, then merge sequentially and leave a stale/inconsistent committed worker-configuration.d.ts, silently, with zero gate signal.

Scope

  • package.json — added cf-typegen:check (wrangler types --check, which wrangler already supports natively — no custom diffing script needed), wired into test:ci right after db:migrations:check.
  • .github/workflows/ci.yml — added wrangler.jsonc and worker-configuration.d.ts to the changes job's backend path filter, and a new "cf-typegen drift check" step in validate-code, gated identically to "Check migrations".
  • .claude/skills/contributing-to-gittensory/reference.md — added a row to the CI-check table (the cf-typegen regeneration requirement itself was already documented in SKILL.md; this just closes the CI-enforcement gap).
  • test/unit/ci-cf-typegen-check.test.ts — new regression tests asserting the npm script wiring, the path-filter change, and the workflow step's gating.

Validation

  • npx vitest run test/unit/ci-cf-typegen-check.test.ts — 3/3 passing
  • npm run actionlint — clean
  • npm run typecheck — clean
  • npm run test:ci — full local gate green (includes the new cf-typegen:check step passing against the current committed worker-configuration.d.ts)
  • npm audit --audit-level=moderate — 0 vulnerabilities

Safety

  • A PR that doesn't touch wrangler.jsonc/worker-configuration.d.ts sees zero added CI cost (path-gated, same pattern as db:migrations:check).
  • No behavior change to the current, already-consistent committed state — wrangler types --check already passes against it.
  • Touches .github/workflows/**, a guarded path — expect this to be held for manual owner merge rather than auto-merged.

Closes #2557

worker-configuration.d.ts is generated from wrangler.jsonc bindings via
npm run cf-typegen, but unlike its sibling generated artifacts
(openapi.json, migrations) there was no CI guard against it drifting.
Two PRs that each independently add a wrangler binding can both pass CI
in isolation, then merge sequentially and leave a stale committed
worker-configuration.d.ts with zero prior gate signal.

Added cf-typegen:check (wrangler types --check, which wrangler already
supports natively -- no custom diffing script needed) and wired it into
test:ci right after the migrations check. wrangler.jsonc and
worker-configuration.d.ts are now backend-filter paths in ci.yml so the
validate-code job's new drift-check step actually runs when either
changes. Documented the new check in the contributing skill's reference
table alongside the other generated-artifact guards.

Closes #2557
@dosubot dosubot Bot added the size:XS label Jul 2, 2026
@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 12:20:15 UTC

4 files · 1 AI reviewer · no blockers · readiness 82/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
This change adds a native `wrangler types --check` drift guard, wires it into both local `test:ci` and the backend-gated workflow path, and documents the new CI check. The workflow gating matches the existing migrations guard, and the added regression tests verify the package script, path filter, and workflow step placement. I do not see a reachable correctness issue in the visible diff.

Nits — 6 non-blocking
  • test/unit/ci-cf-typegen-check.test.ts:45 slices the raw `filters` string between `backend:` and `ui:`, which is a bit brittle if the workflow filter order changes even though the backend entries remain correct.
  • package.json:17 keeps `cf-typegen` as `wrangler types` plus a Perl whitespace cleanup while `cf-typegen:check` uses raw `wrangler types --check`; confirm that Wrangler's check path compares the same normalized output the generation script commits.
  • In test/unit/ci-cf-typegen-check.test.ts:45, parse the nested `filters` YAML string and assert against the `backend` array directly instead of relying on substring boundaries.
  • In package.json:17, consider aligning the generation and check scripts' normalization behavior or adding a short comment if `wrangler types --check` is intentionally equivalent to the committed post-Perl output.
  • PR author also opened the linked issue — Link an issue that was opened by a different contributor, or provide a rationale for why this self-authored issue represents genuine discovery work.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2557
Related work ⚠️ 2 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:XS; 1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 55 merged, 536 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 65 PR(s), 536 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • No action.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.02%. Comparing base (2af7092) to head (ceb2dfe).
⚠️ Report is 10 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2599      +/-   ##
==========================================
+ Coverage   95.99%   96.02%   +0.02%     
==========================================
  Files         230      233       +3     
  Lines       25887    26077     +190     
  Branches     9410     9474      +64     
==========================================
+ Hits        24851    25041     +190     
  Misses        425      425              
  Partials      611      611              
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 612969d into main Jul 2, 2026
12 checks passed
@JSONbored
JSONbored deleted the ci/cf-typegen-staleness-check branch July 2, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ci): add a cf-typegen staleness check for worker-configuration.d.ts

1 participant