Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/graphql-17-documents.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@stats-forge/github-stats-forge-core': patch
---

build: regenerate the GraphQL documents with graphql 17

Input objects in the query text gain inner spaces; what GitHub is asked is unchanged.
25 changes: 17 additions & 8 deletions packages/core/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,20 @@ dev-only — no codegen dependency reaches consumers. It is covered by
source file. The repo-root `scripts/` is covered the same way, by `tsconfig.scripts.json`
at the root.

**`graphql` is held at 16 — 17 cannot generate these types.** v17 enforces that an
implementation field is not deprecated where the interface field it satisfies isn't, and
GitHub's published SDL breaks it on five fields across `TeamDiscussion` and
`TeamDiscussionComment`. The generator's `buildSchema(…, { assumeValidSDL: true })` does
not help: codegen runs `assertValidSchema` of its own inside `validateGraphQlDocuments`,
so `check-graphql-types` fails before writing anything. `@octokit/graphql-schema` also
depends on graphql `^16.0.0`, so 17 puts two copies in the lockfile for no gain. Tried and
reverted on 2026-09-13; retry only once GitHub's SDL is clean or octokit moves to 17.
**`graphql` is 17, and the generator builds GitHub's schema with `assumeValid: true` to get
there.** v17 enforces that an implementation field is not deprecated where the interface
field it satisfies isn't, and GitHub's published SDL breaks it on fifteen fields, from
`Project.id` to `TeamDiscussionComment.url`. `assumeValidSDL` alone does not cover it:
codegen runs `assertValidSchema` inside `validateGraphQlDocuments`, and `assumeValid` on
`buildSchema` is what answers that. **The queries are still validated against the schema** —
a misspelt field fails `check-graphql-types` as before; only GitHub's own SDL goes unchecked.
It was held at 16 from 2026-09-13 to 2026-10-10, the first attempt having stopped at that
error without trying the flag.

- **An override in `pnpm-workspace.yaml` is what keeps graphql 16 out of the lockfile**,
`@octokit/graphql-schema` depending on `^16.0.0`. That range serves its `validate` export,
which nothing here calls — the generator reads only the `idl` string. It loads under 17
all the same, `check-graphql-types` importing it on every run. Drop the override when
octokit moves to 17.
- **v17's `print` spaces an input object** — `{ field: SIZE, direction: DESC }` — which is the
whole of what changed in the generated documents when it landed.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"@testing-library/jest-dom": "7.0.1",
"@types/node": "24.19.1",
"@uppercod/css-to-object": "1.1.1",
"graphql": "16.14.2",
"graphql": "17.0.2",
"js-yaml": "5.4.3",
"jsdom": "catalog:default",
"vitest": "catalog:default"
Expand Down
5 changes: 3 additions & 2 deletions packages/core/scripts/generate-graphql-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ const config: TypeScriptPluginConfig & TypeScriptDocumentsPluginConfig = {
scalars: { DateTime: 'string' },
};

// GitHub's SDL declares a few fields twice, which trips SDL validation
const schemaAst = buildSchema(githubSchema.idl, { assumeValidSDL: true });
// GitHub's SDL declares a few fields twice, which trips SDL validation, and deprecates fields
// whose interface does not, which trips graphql 17's schema validation
const schemaAst = buildSchema(githubSchema.idl, { assumeValidSDL: true, assumeValid: true });
// printed once: every query output reuses it
const schemaDocument = parse(printSchema(schemaAst));

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/graphql/generated/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ query getOrganization($login: String!, $after: String) {
after: $after
privacy: PUBLIC
isFork: false
orderBy: {field: STARGAZERS, direction: DESC}
orderBy: { field: STARGAZERS, direction: DESC }
) {
totalCount
pageInfo {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/graphql/generated/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fragment RepoStars on User {
first: 100
after: $after
ownerAffiliations: $ownerAffiliations
orderBy: {direction: DESC, field: STARGAZERS}
orderBy: { direction: DESC, field: STARGAZERS }
) {
totalCount
nodes {
Expand Down Expand Up @@ -175,7 +175,7 @@ fragment RepoStars on User {
first: 100
after: $after
ownerAffiliations: $ownerAffiliations
orderBy: {direction: DESC, field: STARGAZERS}
orderBy: { direction: DESC, field: STARGAZERS }
) {
totalCount
nodes {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/graphql/generated/top-languages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ query topLanguages($login: String!, $ownerAffiliations: [RepositoryAffiliation])
}
fragment TopLanguagesRepository on Repository {
name
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
edges {
...TopLanguage
}
Expand Down
131 changes: 66 additions & 65 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ overrides:
# no code of either package runs here, the site importing webawesome's components and
# never the @lit-labs/ssr behind them.
node-fetch: npm:node-fetch-native@^1.6.7
# It asks for ^16 on behalf of a `validate` nothing here calls; the generator reads only its SDL.
'@octokit/graphql-schema>graphql': ^17.0.0

allowBuilds:
# astro's bundler; it fetches its platform binary in a postinstall
Expand Down
Loading