Skip to content

[codex] test cache behavior for batched mutations#282

Open
Saiaaax wants to merge 1 commit into
outerbase:mainfrom
Saiaaax:codex/cache-batched-mutation-tests
Open

[codex] test cache behavior for batched mutations#282
Saiaaax wants to merge 1 commit into
outerbase:mainfrom
Saiaaax:codex/cache-batched-mutation-tests

Conversation

@Saiaaax

@Saiaaax Saiaaax commented Jun 24, 2026

Copy link
Copy Markdown

Summary

  • Add focused regression tests for SQL batches that combine a read with a mutation.
  • Verify beforeQueryCache does not read cached data for a SELECT; DELETE batch.
  • Verify afterQueryCache does not write results for the same batch, including the optional-params path.
  • Include a 9-second validation demo.

Why

node-sql-parser returns an AST array for multi-statement SQL. hasModifyingStatement recursively detects mutations in that array, but the behavior had no regression coverage. If it regressed, a batch containing a write could incorrectly interact with the query cache.

Validation

  • node node_modules/vitest/vitest.mjs --run src/cache/index.test.ts — 16 tests passed.
  • node node_modules/prettier/bin/prettier.cjs --check src/cache/index.test.ts — passed.
  • Full coverage run: 153 tests passed; the same four pre-existing RLS assertions fail on main. Cache branch coverage increased from 81.39% to 86.04%; global branch coverage increased from 47.68% to 47.99%.
  • git diff --check — passed.

AI-assisted with Codex; the diff and test behavior were reviewed locally.

/claim #71

@Saiaaax Saiaaax marked this pull request as ready for review June 24, 2026 03:32
@Saiaaax

Saiaaax commented Jun 24, 2026

Copy link
Copy Markdown
Author

/claim #71

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.

1 participant