refactor(codegen): remove default selects entirely (Path A)#694
Open
pyramation wants to merge 10 commits intomainfrom
Open
refactor(codegen): remove default selects entirely (Path A)#694pyramation wants to merge 10 commits intomainfrom
pyramation wants to merge 10 commits intomainfrom
Conversation
…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
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor(codegen): remove default selects entirely, make selection required
Summary
Removes all default select logic from the codegen package (Path A). Previously, every generated hook and ORM model method had two overloads: one requiring an explicit
fields/select, and a second that fell back to aconst defaultSelect = { id: true } as constwhen no fields were provided. This "magic" fallback is removed —selectionwithfieldsis now required in all hook and ORM method signatures.What was removed:
getDefaultSelectFieldName()fromutils.tsbuildDefaultSelectLiteral()fromselect-helpers.tsbuildSelectFallbackExpr(),buildDefaultSelectExpr(),withoutFieldsSelectionType(),withoutFieldsListSelectionType(),NON_SELECT_TYPES_ASTfromhooks-ast.tsbuildDefaultSelectExpression()fromorm/custom-ops-generator.tsconst defaultSelect = ...declarations and Overload 2 (without fields) from all generatorsdefaultRef()helper and related fallback logic fromorm/model-generator.tsNet result: ~1,300 lines removed, 25 snapshots updated to reflect the simpler single-overload signatures.
Updates since last revision
makagefrom0.1.10→0.1.12across all 78 workspace packages. This picks up theENOTEMPTYrace condition fix (maxRetries: 3onfs.rminclean.ts) that was causing intermittent CI build failures in packages likepg-ast,csv-to-pg, etc.Review & Testing Checklist for Human
selection/fieldsrequired is intentional but breaking. Any existing consumer code calling hooks without specifying fields will fail to compile. Confirm this is the desired behavior before merging.defaultSelectreferences — no unintended logic changes. Whitespace/formatting differences from Babel AST output are expected.findMany,findFirst,findOne,create,update,deleteall properly requireselectin their signatures (no optional fallback).typeRegistryparameter fromgenerateCustomQueryOpsFile/generateCustomMutationOpsFiledoesn't break anything (it was only used for building default selects).pnpm build && pnpm testingraphql/codegen— all 204 tests should pass. CI should now pass with makage 0.1.12.Notes