perf(db): generic query execution on NativeDatabase (6.16)#677
perf(db): generic query execution on NativeDatabase (6.16)#677carlos-alm merged 6 commits intomainfrom
Conversation
Add queryAll/queryGet methods to NativeDatabase for parameterized SELECT execution via rusqlite, returning rows as serde_json::Value objects. This enables NodeQuery and arbitrary SQL to dispatch through the native engine without porting the SQL builder to Rust. - NativeDatabase: queryAll, queryGet, validateSchemaVersion methods - NodeQuery: all()/get() accept optional nativeDb for native dispatch - connection.ts: closeDbPair/closeDbPairDeferred lifecycle helpers - finalize.ts/pipeline.ts: use unified close helpers - detect-changes.ts, build-structure.ts: 3 starter straggler migrations - Comprehensive db.prepare() audit (194 calls, tiered migration plan) - 42 new tests (parity, query execution, version check; skip-guarded)
…orts Replace deprecated baseUrl/paths with Node.js subpath imports (package.json imports field) + customConditions in tsconfig.json. Uses @codegraph/source condition for compile-time resolution to src/, default condition for runtime resolution to dist/. - Add imports field with conditional mappings for all 11 src/ subdirectories + #types - Add customConditions: ["@codegraph/source"] to tsconfig.json - Add resolve.conditions to vitest.config.ts for Vite resolver - Update verify-imports.ts to resolve #-prefixed specifiers - Migrate 3 deeply nested files as proof-of-concept Closes #668
Adds a step after conflict resolution that diffs the merge result against both parent commits to ensure intentional changes from both sides survived. Prevents silent content loss during merge conflict resolution.
Resolve conflicts with 6.17 (PR #673): keep lazy-load better-sqlite3, validateNativeParams, and removed standalone napi functions from main; keep 6.16 generic query methods and version checking from this branch. Mark 6.16 and 6.17 as complete in roadmap — Phase 6 fully done.
|
Claude finished @carlos-alm's task —— View job Reviewing PR #677: perf(db): generic query execution on NativeDatabase (6.16) Review Progress
Root Cause AnalysisProblem Being Solved: This PR completes Phase 6.16 of the native database migration roadmap - implementing generic parameterized query execution via Why This Approach: The two-file change ( Risk Assessment: CRITICAL CONCERN - This PR shows signs of being primarily documentation updates rather than the actual feature implementation. The PR description claims to deliver substantial functionality but only shows 2 minimal file changes. Configuration Change DetectionNo High-Risk Configuration Changes: Only documentation files modified. No build config, linting rules, or TypeScript settings changed. Test IntegrityStrong Test Coverage: Found comprehensive test suite:
Test Quality: Tests are well-structured with proper setup/teardown and comprehensive coverage of the API surface. Code Quality AssessmentImplementation Review: The actual functionality appears well-designed:
Security: No SQL injection concerns - uses parameterized queries throughout. Performance: Leverages rusqlite for potential performance gains on native engine path. Backlog Compliance
Critical Concerns
This suggests either:
Missing Implementation Evidence: Despite extensive testing infrastructure being present, the actual implementation changes are not visible in this PR's diff. Final Assessment |
Greptile SummaryThis PR completes the Phase 6 roadmap bookkeeping: it marks steps 6.16 and 6.17 as ✅ in Key changes:
Confidence Score: 5/5Documentation-only PR with no runtime code changes — safe to merge. Both changes are purely documentary: the ROADMAP.md update accurately reflects work already merged, and the SKILL.md addition correctly applies the ORIG_HEAD idiom as suggested in the prior review thread. No logic, no tests, no runtime risk. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[PR has CONFLICTING state] --> B[git merge origin/base-branch]
B --> C[Understand both sides:\nPR description, commit history,\nreview comments, merge-base diff]
C --> D[Resolve conflicts manually]
D --> E[Stage resolved files by name\ngit add file1 file2 ...]
E --> F[Commit: fix: resolve merge conflicts]
F --> G["**NEW: Verify nothing lost**\ngit diff origin/base-branch -- file\ngit diff ORIG_HEAD -- file"]
G --> H{Content dropped?}
H -- Yes --> I[Amend resolution\nbefore pushing]
I --> G
H -- No --> J[Push updated branch]
Reviews (2): Last reviewed commit: "fix(skills): use ORIG_HEAD instead of am..." | Re-trigger Greptile |
.claude/skills/sweep/SKILL.md
Outdated
| # Check nothing was lost from the base branch (main) | ||
| git diff origin/<base-branch> -- <file> | ||
| # Check nothing was lost from the PR branch (pre-merge) | ||
| git diff <pre-merge-commit> -- <file> |
There was a problem hiding this comment.
<pre-merge-commit> placeholder has no capture instruction
The new verification step references <pre-merge-commit> in the diff command, but the skill never instructs the agent to capture the pre-merge commit hash before running git merge. An agent following these steps sequentially would have no obvious way to supply this value.
Two cleaner alternatives:
-
Use
ORIG_HEAD— git automatically writes the pre-mergeHEADtoORIG_HEADafter every merge, so the diff command can reference it directly without any prior capture step:git diff ORIG_HEAD -- <file>
-
Explicit capture before merge — add a line before the
git mergecall instructing the agent to save the commit hash:pre_merge=$(git rev-parse HEAD) git merge origin/<base-branch> # then later: git diff $pre_merge -- <file>
Using ORIG_HEAD is the most natural fit here since it requires no earlier change and matches standard git idioms.
There was a problem hiding this comment.
Fixed — replaced the ambiguous <pre-merge-commit> placeholder with ORIG_HEAD, which git sets automatically after every merge. The comment in the code block now explains this: ORIG_HEAD = pre-merge HEAD, set by git automatically. This is self-contained and requires no prior capture step, matching the standard git idiom you suggested.
|
Addressed review feedback from both reviewers: Greptile (inline comment): Fixed the ambiguous Claude review (description/diff mismatch): The observation is correct — the PR description describes the full 6.16 implementation, but the remaining diff is documentation updates (ROADMAP.md phase completion markers + sweep skill improvement). The actual code implementation landed in earlier commits on this branch and was subsequently merged to main via #673. The PR description reads as a milestone summary rather than a description of the final incremental diff. This is a documentation-cleanup PR at this point — the title/description could be more precise, but the changes themselves are correct and safe to merge. |
Summary
queryAll/queryGet/validateSchemaVersion,closeDbPair,NativeRepository,NodeQuerynative dispatch, all 3 test files, anddb-prepare-audit.mdwere incorporated into main via PRs perf(db): NativeDatabase napi-rs class for rusqlite connection lifecycle (6.13) #666 (6.13), perf(db): migrate build pipeline writes to NativeDatabase (6.15) #669 (6.15), perf(db): migrate Repository read queries to NativeDatabase rusqlite (6.14) #671 (6.14), and refactor(db): lazy-load better-sqlite3 and remove standalone napi functions (6.17) #673 (6.17)Test plan
queryAll,queryGet,validateSchemaVersion,closeDbPair,NativeRepository,NodeQuerynative dispatch, test files, audit doc)git diff origin/mainconfirms only roadmap + sweep skill changes remain (code already merged)