Skip to content

feat(sqlitetest): inject rollback failures - #90

Open
Doomguy-BFG9000 wants to merge 1 commit into
gopherium:mainfrom
Doomguy-BFG9000:fix/sqlitetest-rollback
Open

Doomguy-BFG9000 wants to merge 1 commit into
gopherium:mainfrom
Doomguy-BFG9000:fix/sqlitetest-rollback

Conversation

@Doomguy-BFG9000

@Doomguy-BFG9000 Doomguy-BFG9000 commented Oct 15, 2026 •

Copy link
Copy Markdown

Summary

  • add one-shot rollback fault injection to sqlitetest
  • always execute the underlying rollback so the transaction still ends
  • verify dbkit.InTx joins body and rollback errors

Fixes #88.

Verification

Summary by CodeRabbit

  • Testing
    • Expanded coverage for transaction rollback failures, including cases where both the transaction body and rollback return errors.
    • Added support for simulating rollback failures in SQLite tests and verifying that failed transactions leave no inserted data behind.
  • Chores
    • Updated an internal database toolkit dependency.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: af4fa773-3022-4a00-97a8-389f87dca51e
📥 Commits

Reviewing files that changed from the base of the PR and between bfcc05c and 62c829f.

⛔ Files ignored due to path filters: 1
  • dbkit/sqlite/go.sum is excluded by !**/*.sum
📒 Files selected for processing: 4
  • dbkit/sqlite/go.mod
  • dbkit/sqlite/intx_test.go
  • dbkit/sqlite/sqlitetest/faults.go
  • dbkit/sqlite/sqlitetest/faults_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The SQLite test fault helper now supports one-shot rollback failures and combines the injected error with the driver rollback result. Tests cover rollback behavior and verify that dbkit.InTx reports both body and rollback errors. The SQLite module now requires dbkit v0.3.0.

Changes: SQLite rollback fault injection

Layer / File(s) Summary
Add rollback fault injection
dbkit/sqlite/sqlitetest/faults.go, dbkit/sqlite/sqlitetest/faults_test.go
Faults stores and clears a pending rollback error. faultTx.Rollback joins that error with the driver result. Tests verify the injected error and that the uncommitted row remains absent.
Verify InTx error composition
dbkit/sqlite/go.mod, dbkit/sqlite/intx_test.go
The module requires dbkit v0.3.0. The test verifies that dbkit.InTx returns an error matching both the body error and the rollback error.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: sirlouen

Merge Risk: ⚪ Minimal · up to 62c82

This adds a test-only helper for injecting rollback failures, plus tests for it. No actionable merge-blocking risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding rollback failure injection in sqlitetest.
Linked Issues check Passed The changes satisfy the coding requirements in #88. sqlitetest.Faults adds FailNextRollback(err error) and consumes the fault once. The rollback wrapper still calls the driver rollback and joins t…
Out of Scope Changes check Passed The changes stay within #88. The dbkit dependency update enables the tested InTx behavior. The production fault-injection changes and both test additions directly support rollback failure testing.…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 3 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds one-shot rollback failures to sqlitetest while still running the real rollback.

  • SQLite tests can make one rollback report an error.
  • SQLite tests check that InTx keeps both transaction errors.

Reviews (1) · Last reviewed commit: "feat(sqlitetest): inject rollback failur..." · Reviewed by Greptile

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.

Let sqlitetest fail the next rollback

1 participant