feat(ztd-cli): add SQL rewrite logging to generated testkit client - #318
Conversation
|
Warning Rate limit exceeded@mk3008 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 21 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (3)
WalkthroughA new SQL rewrite logging feature is added to the generated testkit client, enabling structured logs of SQL queries before and after pg-testkit rewrites. Logging is controlled via environment variables (ZTD_SQL_LOG, ZTD_SQL_LOG_PARAMS) and per-call options, with helper utilities supporting environment-based toggles and JSON serialization. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related issues
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.changeset/bright-dogs-smile.md(1 hunks)packages/ztd-cli/README.md(1 hunks)packages/ztd-cli/templates/tests/support/testkit-client.ts(3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Remove console debugging before committing.
Files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
🧠 Learnings (29)
📓 Common learnings
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx,js} : All SQL must flow through the testkit-core AST rewriter before execution; new rewrite behavior must be added to testkit-core first, then threaded into sqlite-testkit
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : Do not rewrite SQL by string concatenation without AST in testkit-core
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to {packages/core,packages/testkit-core,packages/pg-testkit,packages/sqlite-testkit}/src/**/*.{ts,tsx} : All SQL rewrites must rely on `rawsql-ts` AST utilities (parser, analyzer, splitQueries). Regex-based rewrites are allowed only as guarded fallbacks with comments explaining why. Block contributions introducing regex parsing when an AST alternative exists.
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to packages/pg-testkit/src/**/*.{ts,tsx} : Application SQL may freely use normal CRUD (`INSERT`, `UPDATE`, `DELETE`). pg-testkit will automatically rewrite them into `SELECT` queries. Library code must never bypass the rewriter.
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to {packages/pg-testkit,packages/sqlite-testkit}/**/*.test.{ts,tsx} : Do not hand-construct `QueryResult` or mock `Client#query`. All tests must flow through the rewrite pipeline + fixtures.
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : Do not re-parse SQL after rewrite in testkit-core
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/tests/**/*.{test,spec}.{ts,tsx} : Add test coverage for fixture resolution paths, CRUD rewrite transformations, CTE + multi-statement handling, fallback logic, identifier casing rules, and error diagnostics in testkit-core
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : Intercept prepare, all, get, and run APIs to apply AST-based rewrite from testkit-core and execute the resulting SELECT against better-sqlite3
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : warn and passthrough modes in testkit-core must behave predictably and never silently rewrite incorrect SQL
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: The core role of rawsql-ts/testkit-core is to rewrite all CRUD SQL into fixture-backed SELECT queries without creating, reading, or mutating physical tables
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/pg-testkit/AGENTS.md:0-0
Timestamp: 2025-12-13T04:09:30.398Z
Learning: All CRUD operations (INSERT, UPDATE, DELETE, RETURNING) must be rewritten by testkit-core before reaching pg-testkit; the driver must execute only rewritten SELECT queries against fixtures
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : Only record queries when recordQueries is true; guard all logging hooks so missing callbacks never crash consumers
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to ztd.config.json : Application SQL can omit schema qualifiers (e.g., `SELECT ... FROM users`). pg-testkit maps those references to canonical `schema.table` keys by consulting the `ddl.defaultSchema` / `ddl.searchPath` block in `ztd.config.json` before looking up fixtures or DDL metadata.
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/pg-testkit/AGENTS.md:0-0
Timestamp: 2025-12-13T04:09:30.398Z
Learning: pg-testkit must not implement its own rewrite logic; all CRUD-to-SELECT transformation belongs exclusively in testkit-core
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: playgrounds/ztd-playground/AGENTS.md:0-0
Timestamp: 2025-12-13T04:10:16.411Z
Learning: Applies to playgrounds/ztd-playground/tests/**/*.test.{ts,tsx} : Always wire Postgres execution through `tests/support/testkit-client.ts` which opens a `pg.Client` and passes it into `rawsql-ts/pg-testkit`
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx,js} : All SQL must flow through the testkit-core AST rewriter before execution; new rewrite behavior must be added to testkit-core first, then threaded into sqlite-testkit
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : Do not re-parse SQL after rewrite in testkit-core
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.md
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : warn and passthrough modes in testkit-core must behave predictably and never silently rewrite incorrect SQL
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : Do not rewrite SQL by string concatenation without AST in testkit-core
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-08T14:13:45.136Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to packages/pg-testkit/src/**/*.{ts,tsx} : Application SQL may freely use normal CRUD (`INSERT`, `UPDATE`, `DELETE`). pg-testkit will automatically rewrite them into `SELECT` queries. Library code must never bypass the rewriter.
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : Intercept prepare, all, get, and run APIs to apply AST-based rewrite from testkit-core and execute the resulting SELECT against better-sqlite3
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/tests/**/*.{test,spec}.{ts,tsx} : Add test coverage for fixture resolution paths, CRUD rewrite transformations, CTE + multi-statement handling, fallback logic, identifier casing rules, and error diagnostics in testkit-core
Applied to files:
packages/ztd-cli/README.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : No code path bypasses testkit-core's rewrite pipeline
Applied to files:
packages/ztd-cli/README.md
📚 Learning: 2025-12-08T14:13:45.136Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to {packages/core,packages/testkit-core,packages/pg-testkit,packages/sqlite-testkit}/src/**/*.{ts,tsx} : All SQL rewrites must rely on `rawsql-ts` AST utilities (parser, analyzer, splitQueries). Regex-based rewrites are allowed only as guarded fallbacks with comments explaining why. Block contributions introducing regex parsing when an AST alternative exists.
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.md
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : Only record queries when recordQueries is true; guard all logging hooks so missing callbacks never crash consumers
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: The core role of rawsql-ts/testkit-core is to rewrite all CRUD SQL into fixture-backed SELECT queries without creating, reading, or mutating physical tables
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-13T04:10:16.411Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: playgrounds/ztd-playground/AGENTS.md:0-0
Timestamp: 2025-12-13T04:10:16.411Z
Learning: Applies to playgrounds/ztd-playground/tests/**/*.test.{ts,tsx} : Always wire Postgres execution through `tests/support/testkit-client.ts` which opens a `pg.Client` and passes it into `rawsql-ts/pg-testkit`
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-08T14:13:45.136Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to {packages/pg-testkit,packages/sqlite-testkit}/**/*.test.{ts,tsx} : Do not hand-construct `QueryResult` or mock `Client#query`. All tests must flow through the rewrite pipeline + fixtures.
Applied to files:
packages/ztd-cli/README.md.changeset/bright-dogs-smile.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-13T04:09:44.212Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/ztd-cli/templates/AGENTS.md:0-0
Timestamp: 2025-12-13T04:09:44.212Z
Learning: Applies to packages/ztd-cli/templates/tests/**/*.test.{ts,tsx} : Import table types from `tests/generated/ztd-row-map.generated.ts` when constructing test scenarios and fixtures
Applied to files:
packages/ztd-cli/README.md
📚 Learning: 2025-12-08T14:13:45.136Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-08T14:13:45.136Z
Learning: Applies to ztd.config.json : Application SQL can omit schema qualifiers (e.g., `SELECT ... FROM users`). pg-testkit maps those references to canonical `schema.table` keys by consulting the `ddl.defaultSchema` / `ddl.searchPath` block in `ztd.config.json` before looking up fixtures or DDL metadata.
Applied to files:
packages/ztd-cli/README.md
📚 Learning: 2025-12-13T04:10:16.411Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: playgrounds/ztd-playground/AGENTS.md:0-0
Timestamp: 2025-12-13T04:10:16.411Z
Learning: Applies to playgrounds/ztd-playground/tests/**/*.test.{ts,tsx} : Import `ZtdConfig`, `ZtdRowShapes`, `ZtdTableName`, and `tableFixture()` from `tests/generated/ztd-row-map.generated.ts` and trust the generated helpers for row shapes instead of duplicating row interfaces
Applied to files:
packages/ztd-cli/README.mdpackages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-13T04:09:44.212Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/ztd-cli/templates/AGENTS.md:0-0
Timestamp: 2025-12-13T04:09:44.212Z
Learning: Ensure ZTD tests are safe to run in parallel against a single Postgres instance without per-test databases or schemas
Applied to files:
packages/ztd-cli/README.md
📚 Learning: 2025-12-13T04:09:30.398Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/pg-testkit/AGENTS.md:0-0
Timestamp: 2025-12-13T04:09:30.398Z
Learning: Load DDL-based fixtures from canonical schema files (tests/generated/ztd-row-map.generated.ts, ztd/ddl/, or legacy ddl/ directory) rather than reverse-engineering the database structure
Applied to files:
packages/ztd-cli/README.md
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : Do not use hand-written QueryResult-like objects in testkit-core; use database engine execution for final SELECT results
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-13T04:10:16.411Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: playgrounds/ztd-playground/AGENTS.md:0-0
Timestamp: 2025-12-13T04:10:16.411Z
Learning: Applies to playgrounds/ztd-playground/tests/**/*.test.{ts,tsx} : Never issue DDL statements against Postgres from the playground; all CRUD operations must flow through pg-testkit so they resolve to fixture-backed `SELECT` queries
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : In rawsql-ts/testkit-core, remain DBMS-agnostic with no Postgres/SQLite conditionals or behavior
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:21.022Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:21.022Z
Learning: Applies to packages/core/src/**/*.ts : Always prefer AST helpers (SelectQueryParser, SelectAnalyzer, splitQueries, formatter APIs) for SQL parsing
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:58:15.347Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/testkit-core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:58:15.347Z
Learning: Applies to packages/testkit-core/src/**/*.{ts,tsx} : Always use SelectQueryParser, SelectAnalyzer, and splitQueries for rewriting SQL; use regex only as a fallback with a comment explaining the need, a link to a tracking issue, and a description of AST migration
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:21.022Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/core/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:21.022Z
Learning: Applies to packages/core/src/**/*.ts : Do not introduce dialect branching (if postgres...) in parser or analyzer logic
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-13T04:10:16.411Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: playgrounds/ztd-playground/AGENTS.md:0-0
Timestamp: 2025-12-13T04:10:16.411Z
Learning: Applies to playgrounds/ztd-playground/tests/**/*.test.{ts,tsx} : Provide explicit fixtures for each test using `tableFixture('schema.table', [{ ... }])` pattern
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : Validate fixtures at construction time to keep per-query interception fast; respect passthrough tables and wildcard overrides driven by testkit-core
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : Do not rely on real table state between queries even for in-memory databases; all perceived state must originate from fixtures supplied to the driver
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
📚 Learning: 2025-12-02T22:57:55.637Z
Learnt from: CR
Repo: mk3008/rawsql-ts PR: 0
File: packages/drivers/sqlite-testkit/AGENTS.md:0-0
Timestamp: 2025-12-02T22:57:55.637Z
Learning: Applies to packages/drivers/sqlite-testkit/src/**/*.{ts,tsx} : withFixtures() must return a shallow copy of the driver, inherit base configuration, and layer additional fixtures/scenario-specific data on top
Applied to files:
packages/ztd-cli/templates/tests/support/testkit-client.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-and-test (20.x)
🔇 Additional comments (9)
packages/ztd-cli/README.md (1)
145-155: Documentation clearly describes the SQL logging feature.The documentation accurately explains the environment variable controls and per-call options, matching the implementation in the generated testkit client.
packages/ztd-cli/templates/tests/support/testkit-client.ts (7)
17-33: Well-structured logging types.The type definitions provide a clean API for SQL logging with appropriate optional fields for params and fixturesApplied.
46-52: Environment variable parsing is appropriate.The helper correctly handles common truthy values for environment variables.
129-132: API extension maintains backward compatibility.The optional
ZtdSqlLogOptionsparameter allows existing code to continue working while enabling new logging functionality.
133-139: Logging setup correctly prioritizes options over environment variables.The default console.log logger is appropriate for this intentional logging feature (not debugging code), and users can provide a custom logger via
ZtdSqlLogOptions.logger.
141-142: Stack-based queryId tracking correctly handles concurrent queries.The stack approach ensures that when async queries interleave, each rewritten SQL log uses the correct queryId from its originating query.
150-166: onExecute callback properly integrates logging with pg-testkit.The callback efficiently guards logging with early return, correctly retrieves the queryId from the stack, and includes appropriate diagnostic information (fixturesApplied).
172-191: Query method correctly logs original SQL and maintains stack integrity.The try/finally block ensures queryId is always removed from the stack, and the logging sequence (original → push → execute → pop) correctly correlates with the onExecute callback.
.changeset/bright-dogs-smile.md (1)
1-8: Changeset accurately describes the new logging feature.The description covers the key aspects: structured logs, environment variable controls, and parameter inclusion.
Summary by CodeRabbit
Release Notes
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.