Skip to content

feat!: release v4 + adjusts - #3299

Merged
ommeirelles merged 2 commits into
devfrom
feat/release-v4-adjusts
May 7, 2026
Merged

ommeirelles merged 2 commits into
devfrom
feat/release-v4-adjusts

Conversation

@eduardoformiga

@eduardoformiga eduardoformiga commented May 6, 2026 •

Copy link
Copy Markdown
Member

What's the purpose of this pull request?

This PR aims to:

  • force v4 version using !.
  • fix release publish in CI.
  • remove release-dev.yml file.

The CI's pnpm build ran cache-graphql, which rewrote the versioned discovery.config.default.js (Biome formatting mismatch broke lint, and the dirty working tree broke lerna publish).

The fix was to extract cachedOperations into a generated file under @generated/ (gitignored), so the build no longer touches versioned files.

How does it work

This pull request refactors how cached GraphQL operations are managed and consumed in the codebase. Instead of embedding cached operations in the discovery.config file, the process now outputs them to a dedicated cached-operations.json file, which is then imported at runtime. This streamlines the workflow and decouples cached operations from configuration, making the system more modular and maintainable.

Refactoring cached GraphQL operations handling:

  • The CLI command in cache-graphql.ts now writes cached operations to a new cached-operations.json file instead of modifying the discovery.config file. This file is generated alongside persisted documents and contains only the cached operation names. [1] [2] [3]
  • The runtime logic in request.ts is updated to import and use the new cached-operations.json file to determine whether an operation should use the GET or POST HTTP method, improving separation of concerns and error handling.

Minor cleanup:

  • The unused prettier import was removed from cache-graphql.ts, reflecting the fact that formatting is no longer needed for the new JSON output.

Summary by CodeRabbit

  • Refactor
    • Restructured GraphQL cached operations handling to generate a dedicated file format, replacing the previous configuration-based approach. This improves code organization and simplifies how cached operations are resolved during request processing.

- Introduced a new cached operations file to store GraphQL query results.
- Updated the cache-graphql command to save cached operations.
- Modified request method to utilize cached operations for determining HTTP method.
@eduardoformiga
eduardoformiga requested a review from a team as a code owner May 6, 2026 22:16
@eduardoformiga
eduardoformiga requested review from gabpaladino, lucasfp13 and ommeirelles and removed request for a team, gabpaladino and lucasfp13 May 6, 2026 22:16
@coderabbitai

coderabbitai Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The CLI's CacheGraphql command now generates a standalone cached-operations.json file containing a list of cached query names, replacing the previous pattern of embedding cachedOperations into the discovery.config output. The SDK's MethodByOperation function is updated to import this generated file and determine HTTP method (GET vs POST) based on operation presence, removing runtime config loading.

Changes

GraphQL Caching Data Flow

Layer / File(s) Summary
Data Shape & Generation
packages/cli/src/commands/cache-graphql.ts
Introduces cachedOperationsFileName constant and derives cachedOperationsPath. Computes cachedQueries from persisted-documents and writes them to cached-operations.json as pretty-printed JSON. Removes prettier import and old discovery.config modification logic.
Request Routing
packages/core/src/sdk/graphql/request.ts
Updates MethodByOperation to import the generated cached-operations.json instead of runtime discovery.config loading. Returns 'GET' when operation name exists in the cached list, otherwise 'POST', with fallback to 'POST' on import failure.
Logging & Integration
packages/cli/src/commands/cache-graphql.ts
Adds informational log output for the cached-operations file path.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A config file transforms to JSON light,
Build-time static—no runtime flight,
Cached operations now rest in stone,
SDK reads what CLI has sown. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'feat!: release v4 + adjusts' is vague and uses non-descriptive terms like 'adjusts' that obscure the main technical changes—separating cached GraphQL operations into a generated file to prevent build-time mutations. Use a more descriptive title focusing on the key technical change, such as 'feat!: extract cached GraphQL operations to generated file' or 'feat!: refactor cached operations to prevent config mutations'.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/release-v4-adjusts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codesandbox-ci

codesandbox-ci Bot commented May 6, 2026

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/cli/src/commands/cache-graphql.ts (1)

13-13: ⚡ Quick win

configPath / config flag / configFileName are dead code post-refactor.

The command still hard-exits (process.exit(1)) if discovery.config.default.js isn't found (lines 51–56), yet configPath is only consumed in a logger.info call and the file is never opened or read. This directly contradicts the PR's stated goal of decoupling cache-graphql from discovery.config. Any environment where the config file is absent will hit a spurious failure.

♻️ Proposed cleanup
-const configFileName = 'discovery.config.default.js'
 const cachedOperationsFileName = 'cached-operations.json'

 export default class CacheGraphql extends Command {
   static flags = {
     queries: Flags.string({
       name: 'queries',
       description: 'The path to locate persisted-document file.',
     }),
-    config: Flags.string({
-      name: 'config',
-      description: 'The path where the discovery.config is located',
-    }),
   }
   ...
   async run() {
     const { args, flags } = await this.parse(CacheGraphql)

     const rootPath = getBasePath()
     const argPath =
       (args?.store && path.resolve(rootPath, args.store)) || rootPath
     const { tmpDir } = withBasePath(argPath)
-    const configPath =
-      this.getConfigFile(flags.config && path.resolve(argPath, flags.config)) ||
-      this.getConfigFile(tmpDir) ||
-      this.getConfigFile(argPath)
     const persistedDocumentsPath = ...
-    if (!configPath) {
-      return this.errorFileNotFound(
-        configFileName,
-        `\n    ${tmpDir}\n    ${argPath}`
-      )
-    }

     if (!persistedDocumentsPath) { ... }
     ...
     if (fsExtra.pathExistsSync(tmpDir))
       logger.info(`${chalk.blue('[Info]')} - .faststore Path at: ${tmpDir}`)

-    logger.info(`${chalk.blue('[Info]')} - Config file location: ${configPath}`)
     logger.info(...)

Also applies to: 22-25, 43-56, 74-74

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/src/commands/cache-graphql.ts` at line 13, The configPath/config
flag and the configFileName constant are dead after the refactor and are causing
a spurious hard exit; remove the unused const configFileName, remove the command
flag named "config" and any reads of configPath (including the logger.info that
prints it), and delete the file-existence check that calls process.exit(1) (the
block that looks for discovery.config.default.js and exits on missing file).
Ensure no other code in cache-graphql.ts (search for symbols configFileName,
configPath, and the "config" flag registration) relies on that file so the
command no longer fails when discovery.config.default.js is absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/cli/src/commands/cache-graphql.ts`:
- Line 13: The configPath/config flag and the configFileName constant are dead
after the refactor and are causing a spurious hard exit; remove the unused const
configFileName, remove the command flag named "config" and any reads of
configPath (including the logger.info that prints it), and delete the
file-existence check that calls process.exit(1) (the block that looks for
discovery.config.default.js and exits on missing file). Ensure no other code in
cache-graphql.ts (search for symbols configFileName, configPath, and the
"config" flag registration) relies on that file so the command no longer fails
when discovery.config.default.js is absent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ee23aa40-368a-47b5-b69b-56809b972d2e

📥 Commits

Reviewing files that changed from the base of the PR and between e912b5e and 8cd3929.

⛔ Files ignored due to path filters (2)
  • .github/workflows/release-dev.yml is excluded by none and included by none
  • .gitignore is excluded by none and included by none
📒 Files selected for processing (2)
  • packages/cli/src/commands/cache-graphql.ts
  • packages/core/src/sdk/graphql/request.ts

@ommeirelles
ommeirelles merged commit 75287b5 into dev May 7, 2026
5 checks passed
@ommeirelles
ommeirelles deleted the feat/release-v4-adjusts branch May 7, 2026 14:22
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.

3 participants