Skip to content

refactor(codegen): remove dead maxFieldDepth code and enforce trailing commas#697

Open
pyramation wants to merge 18 commits intomainfrom
feat/codegen-cleanup-trailing-commas
Open

refactor(codegen): remove dead maxFieldDepth code and enforce trailing commas#697
pyramation wants to merge 18 commits intomainfrom
feat/codegen-cleanup-trailing-commas

Conversation

@pyramation
Copy link
Contributor

refactor(codegen): remove dead maxFieldDepth, enforce trailing commas, clean CI

Summary

Three changes bundled together:

1. Dead code removal — maxFieldDepth config option
Removed maxFieldDepth from the config type, defaults, and the entire pipeline (index.tscustom-queries.ts / custom-mutations.ts). The only consumer was getSelectableFields() in type-resolver.ts, which had zero callers anywhere in the codebase — it was leftover from the old default-select system that was removed in PR #694. skipQueryField is retained because shouldSkipField() still has active callers.

2. Trailing comma enforcement on graphql/codegen/src/
Ran Prettier with --trailing-comma all across the codegen package source. This is formatting-only — no logic changes. 2 snapshots updated (template output now includes trailing commas in generated type definitions). No Prettier/ESLint config files were committed per user request.

3. CI & workspace cleanup (carried from prior commits on this branch)

  • Renamed test-codegen-app's "build""build:app" so pnpm -r run build skips it (it requires live API codegen)
  • Reverted root package.json build scripts to clean pnpm -r run build (no --filter '!' hacks)
  • Reverted run-tests.yaml and docker-launchql.yaml to remove paths-ignore and negated filter workarounds
  • Added examples/codegen-integration private package with dedicated CI workflow
  • Bumped makage to 0.1.12 across workspace (fixes ENOTEMPTY race condition in fs.rm)

Review & Testing Checklist for Human

  • Verify getSelectableFields is truly dead — search the codebase for any callers of getSelectableFields that may have been missed. This was an exported function; downstream consumers outside the monorepo could theoretically depend on it.
  • Spot-check trailing comma diff is formatting-only — the bulk of the diff (93 files, ~6k lines) is Prettier reformatting. Spot-check a few high-risk files (custom-queries.ts, custom-mutations.ts, mutations.ts, hooks-ast.ts) to confirm no logic was accidentally changed.
  • Confirm skipQueryField is still actively used — it was kept in the config while maxFieldDepth was removed. Verify shouldSkipField() has real callers to justify keeping it.
  • Test pnpm build from clean state — ensure the build:app rename doesn't cause issues and the workspace builds cleanly without filters.

Recommended test plan:

git clean -fdx && pnpm install && pnpm build
cd graphql/codegen && pnpm test

Notes

  • All 204 codegen tests pass locally
  • 2 snapshots updated (formatting-only changes to generated type output)
  • CI should pass — the examples-integration workflow runs codegen against a fixture schema

Link to Devin run: https://app.devin.ai/sessions/a93d427c49214dce877d1fedee950c04
Requested by: @pyramation

yyyyaaa and others added 18 commits February 6, 2026 01:59
…copy patterns

- Convert queries.ts, mutations.ts, custom-queries.ts, custom-mutations.ts from lines.push() string concatenation to Babel AST generation
- Convert client.ts and selection.ts from string template literals to template-copy pattern
- Add hooks-ast.ts shared helper library for Babel AST node construction
- Add template files: hooks-client.ts, hooks-selection.ts
- Add AGENTS.md with codegen rules (AST-only, no string concat, templates as files)
- Update test snapshots for Babel formatting changes (whitespace/formatting only)
…-browser-compatible

- Add hyphenateKeys, flattenDbFields, buildDbConfig, seedArgvFromConfig,
  buildGenerateOptions to shared.ts as generic reusable utilities
- Replace manual cliOverrides/hasNonInteractiveArgs with prompt->camelize->generate flow
- Remove deprecated --browser-compatible flag from CLI, config types, and generate
- Simplify both CLI entry points (graphql/codegen/src/cli, packages/cli)
- Update test mocks to match new shared utility imports
- Remove all defaultSelect constants and overload 2 (without fields) from all hook generators
- Remove buildDefaultSelectExpr, buildSelectFallbackExpr, buildDefaultSelectLiteral, getDefaultSelectFieldName
- Remove withoutFieldsSelectionType, withoutFieldsListSelectionType, NON_SELECT_TYPES_AST
- Remove buildDefaultSelectExpression from ORM custom-ops-generator
- Remove defaultSelect/defaultRef from ORM model-generator
- Make selection with fields required in all hook and ORM method signatures
- Update 25 snapshots to reflect removed overloads
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants