Skip to content

chore(codegen): add reproducible Bitbucket GraphQL code generation - #3452

Merged
setchy merged 1 commit into
mainfrom
chore/bitbucket-graphql-codegen
Oct 17, 2026
Merged

setchy merged 1 commit into
mainfrom
chore/bitbucket-graphql-codegen

Conversation

@setchy

@setchy setchy commented Oct 17, 2026

Copy link
Copy Markdown
Member

Why

src/renderer/utils/forges/bitbucket/graphql/generated/graphql.ts is compiled from the Bitbucket GraphQL documents, but no codegen configuration produced it — it was generated ad hoc when Bitbucket support landed, so it could not be regenerated when the documents or the Atlassian schema change. The GitHub types are reproducible; the Bitbucket ones were not.

What changed

  • codegen.ts declares a Bitbucket generator: schema = https://developer.atlassian.com/gateway/api/graphql (public, no credentials), documents = src/renderer/utils/forges/bitbucket/**/*.graphql, output = the existing generated file.
  • Restructured around per-output schemas so the credential-free Bitbucket generator runs even when GITHUB_TOKEN is unset; the GitHub output is included only when a token exists.
  • Settings discovered while implementing:
    • assumeValid: true — the public Atlassian schema trips graphql-js v17's interface/deprecation consistency check, the same class of issue as GitHub.
    • skipDocumentsValidation: true — the gateway schema diverges from the runtime one (e.g. notificationFeed lacks flat); the same workaround setchy/atlassify carries.
    • defaultScalarType: 'string' — otherwise picture/timestamp become unknown, which breaks transform.ts and adapter.ts.

Verification

  • pnpm codegen with GITHUB_TOKEN unset: the Bitbucket generator runs and produces output.
  • Regeneration yields equivalent public types. Three differences are toolchain-version-driven, not config-driven, so byte-identical reproduction is not achievable under the current tooling: Record<string, any>, normalised document strings, and a missing trailing newline.
  • pnpm check passes.
  • The GitHub generated output is unchanged.

OpenSpec change: add-bitbucket-graphql-codegen

The Bitbucket GraphQL types had no producing configuration - they were generated ad hoc, so they could not be regenerated.

- Add a Bitbucket generator to codegen.ts (schema = the public Atlassian gateway, documents = the Bitbucket documents).
- Restructure the entrypoint around per-output schemas so the credential-free Bitbucket generator runs even when GITHUB_TOKEN is unset; the GitHub output is added only when a token exists.
- The public Atlassian schema needs assumeValid (graphql-js v17) and the documents need skipDocumentsValidation (the gateway schema lacks arguments such as 'flat'); defaultScalarType: 'string' preserves the existing string typing for picture/timestamp.

Regeneration produces equivalent public types; three formatting differences (Record<string, any>, normalised document strings, trailing newline) are toolchain-version-driven.

OpenSpec change: add-bitbucket-graphql-codegen
@setchy
setchy requested a review from afonsojramos as a code owner October 17, 2026 12:46
@github-actions github-actions Bot added the chore Miscellaneous tasks label Oct 17, 2026
@sonarqubecloud

Copy link
Copy Markdown

@setchy
setchy merged commit aaf15a2 into main Oct 17, 2026
19 checks passed
@setchy
setchy deleted the chore/bitbucket-graphql-codegen branch October 17, 2026 12:49
@github-actions github-actions Bot added this to the Release 7.10.0 milestone Oct 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in Gitify v7.10.0! 🎉

Downloads for macOS, Windows, and Linux are available on the release page.

Thanks for helping make Gitify better!

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

Labels

chore Miscellaneous tasks

Development

Successfully merging this pull request may close these issues.

1 participant