Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open Beginner friendly
#4,583 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, graphql, typescript

Research direction

Start in .github/workflows/server-tests.yml and compare its GraphQL and PgTyped cache paths and keys with .github/actions/setup/action.yml and the generate:graphql targets in package.json. Update the cache ownership and paths, preserving distinct cache keys where required. Run the server-tests workflow twice to verify the first run generates outputs after a miss and the exact-hit rerun remains green.

Written by the indexing model from the issue text.

Description

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.
Dominant language
TypeScript
Stars
30
Forks
8
Avg merge
2d 9h
Merged PRs (30d)
200

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Urigo/accounter-fullstack

All issues in Urigo/accounter-fullstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.