Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

ci(server-tests): GraphQL codegen outputs cached incompletely / in the wrong cache

Aperta Adatta ai principianti
#4,583 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github-actions, graphql, typescript

Direzione di ricerca

Inizia in .github/workflows/server-tests.yml e confronta i relativi percorsi e chiavi della cache GraphQL e PgTyped con .github/actions/setup/action.yml e i target generate:graphql in package.json. Aggiorna la proprietà e i percorsi della cache, mantenendo chiavi della cache distinte dove richiesto. Esegui il workflow server-tests due volte per verificare che la prima esecuzione generi gli output dopo un miss e che la riesecuzione con un hit esatto rimanga corretta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Found while checking Urigo/accounter-fullstack#4581, which fixes the GraphQL codegen cache key. This issue covers two problems with the cached paths in .github/workflows/server-tests.yml. That PR leaves both alone to stay focused.

Background

server-tests.yml runs yarn generate:graphql only when the "Cache GraphQL Generated Types" step misses (if: steps.graphql-cache.outputs.cache-hit != 'true'). generate:graphql first deletes every codegen output with rimraf, then regenerates all of them (see generate:graphql:clear in the root package.json). On an exact hit, generation is skipped, so any codegen output not listed under path: is simply missing for the rest of the job.

.github/actions/setup/action.yml already hit this and fixed it. Its comment reads: "Every generate:graphql output must be listed … packages/server/src/__generated__ was missing, which broke any module value-importing from it."

1. packages/server/src/__generated__ is not cached in server-tests.yml

The GraphQL cache there lists:

path: |
  schema.graphql
  packages/server/src/modules/**/__generated__
  packages/client/src/gql
  packages/email-ingestion-gateway/src/gql

It leaves out packages/server/src/__generated__, which holds the base resolver types (baseTypesPath: '../__generated__/types.ts' in codegen.ts).

  • Impact today: none (latent). Vitest removes type-only imports, and the only runtime value import from that file is ChargeSortByField in packages/server/src/modules/ledger/resolvers/ledger.resolver.ts. No test loads it: nothing under test imports modules-app.ts or the ledger resolver.
  • Risk: the first test that loads the full application or the ledger module, or any new runtime enum import from __generated__/types.js, fails with a missing-module error. It fails only on exact cache hits, so the failure looks like a flake.
  • Fix: add packages/server/src/__generated__ to that path: list, the same fix as in the setup action.

2. scraper-app's GraphQL codegen output is stored in the pgtyped cache

The "Cache PgTyped Generated Types" step in server-tests.yml caches packages/scraper-app/src/server/gql/index.ts and adds packages/scraper-app/src/server/graphql/mutations.ts to its key. That file is produced by GraphQL codegen (the packages/scraper-app/src/server/gql/index.ts target in codegen.ts), not by pgtyped (generate:sql is yarn pgtyped in packages/server).

Step order in the job:

  1. GraphQL cache.
  2. Generate GraphQL Types.
  3. Typecheck the gateway.
  4. pgtyped cache restore.
  5. Generate Postgres types.
  • Problem: on a GraphQL cache miss, step 2 writes fresh scraper-app types. Then an exact pgtyped hit in step 4 overwrites them with the cached copy. That copy is keyed on mutations.ts but not on the server schema, so it can be stale after a schema change.
  • Impact today: low. The document text only changes when mutations.ts changes, and that file is in the pgtyped key. Only the generated TS types can go stale, and vitest doesn't typecheck.
  • Fix: move packages/scraper-app/src/server/gql into the GraphQL cache path:, and packages/scraper-app/src/server/graphql/mutations.ts into that key. Remove both from the pgtyped step. This matches how the setup action caches it.
  • Caution: after this change, the server-tests GraphQL key and the setup-action key must stay distinct as long as they cache different path: sets. Today the server-tests key is a strict subset of the setup key. If both lists become identical, give one of them its own prefix, e.g. graphql-codegen-server-tests-. Otherwise one workflow could restore the other's cache and miss outputs.

Acceptance

  • The server-tests.yml GraphQL cache lists every generate:graphql output that the job's steps use.
  • The pgtyped cache contains only pgtyped outputs.
  • CI shows a cache miss followed by generation on the first run, then an exact hit on a re-run with the job still green.
Lingua principale
TypeScript
Stelle
30
Fork
8
Merge medio
2g 9h
PR unite (30g)
202

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Urigo/accounter-fullstack

Tutte le issue di Urigo/accounter-fullstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.