ci(server-tests): GraphQL codegen outputs cached incompletely / in the wrong cache
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
- Ambito
- build-system, ci-cd
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
ChargeSortByFieldinpackages/server/src/modules/ledger/resolvers/ledger.resolver.ts. No test loads it: nothing under test importsmodules-app.tsor 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 thatpath: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:
- GraphQL cache.
- Generate GraphQL Types.
- Typecheck the gateway.
- pgtyped cache restore.
- 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.tsbut not on the server schema, so it can be stale after a schema change. - Impact today: low. The document text only changes when
mutations.tschanges, 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/gqlinto the GraphQL cachepath:, andpackages/scraper-app/src/server/graphql/mutations.tsinto that key. Remove both from the pgtyped step. This matches how the setup action caches it. - Caution: after this change, the
server-testsGraphQL key and the setup-action key must stay distinct as long as they cache differentpath:sets. Today theserver-testskey 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.ymlGraphQL cache lists everygenerate:graphqloutput 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Urigo/accounter-fullstack
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Urigo/accounter-fullstack#4580 ·
I maintainer di solito rispondono entro 2 giorni
-
Document PG18 migration conventions: NOT NULL NOT VALID, and generated columns default to VIRTUALAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
Urigo/accounter-fullstack#4366 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
Urigo/accounter-fullstack#4579 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Urigo/accounter-fullstack#4560 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 28/100
Urigo/accounter-fullstack#4558 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di Urigo/accounter-fullstack
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
lichess-org/api#678 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
PostHog/posthog.com#20628 ·
I maintainer di solito rispondono entro 1 giorno
-
bug status:Needs Triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
jupyterlab/jupyterlab#19964 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
agentscope-ai/QwenPaw#8064 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: notebooks-jupyter bug theme: new notebook frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
posit-dev/positron#16347 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno