Skip to content

test(store): drop double-close on raw sqlite handle in legacy-shape test#68

Merged
ojongerius merged 2 commits into
mainfrom
fix/legacy-mismatch-test-double-close
May 22, 2026
Merged

test(store): drop double-close on raw sqlite handle in legacy-shape test#68
ojongerius merged 2 commits into
mainfrom
fix/legacy-mismatch-test-double-close

Conversation

@ojongerius
Copy link
Copy Markdown
Contributor

Summary

Removes the defer db.Close() paired with the explicit db.Close() that landed in #67's TestReader_ListReceipts_OutputStatusMismatch_LegacyShape. Switches the explicit close to an error-checked form so an inner-Close failure surfaces instead of being silently masked by the deferred one.

Why

Copilot review on #67 flagged the double-close after the fix-push but before I had a chance to address it; I merged on CI-green and missed the second-pass review. This is the follow-up.

The explicit close is the load-bearing one — the writer must be quiesced before OpenReadOnly opens the file in read-only mode. The defer was redundant safety that just hid Close errors.

Test plan

  • go vet ./... clean
  • go test ./internal/store/ -run LegacyShape -vTestReader_ListReceipts_OutputStatusMismatch_LegacyShape passes
  • go test ./... — all four packages green

… test

The previous patch (#67) used both `defer db.Close()` and an explicit
`db.Close()` to release the writer before opening the reader. That
double-closes the handle and can mask the inner-Close error. Drop the
defer; the explicit close is required (and now error-checked) so the
reader sees a quiesced file.

Per Copilot review on #67 (landed after merge).
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a test-only SQLite lifecycle issue in TestReader_ListReceipts_OutputStatusMismatch_LegacyShape by removing an unintended double-close and ensuring any Close() failure is surfaced.

Changes:

  • Remove the deferred db.Close() that could mask errors and cause a double-close.
  • Convert the explicit db.Close() to an error-checked close so failures are reported.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/store/reader_test.go Outdated
@ojongerius ojongerius merged commit e581b9f into main May 22, 2026
4 checks passed
@ojongerius ojongerius deleted the fix/legacy-mismatch-test-double-close branch May 22, 2026 04:53
@ojongerius ojongerius mentioned this pull request May 22, 2026
7 tasks
ojongerius added a commit that referenced this pull request May 22, 2026
CHANGELOG entry for the v0.3.0 cut: brings the dashboard onto sdk/go v0.11.0 (envelope-shape parameters_disclosure per ADR-0012) via #67/#68, and backfills the missing 0.2.x compare links.

After merge, push tag v0.3.0 to trigger release.yml → goreleaser → binaries + GitHub Release + homebrew-tap formula update.
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.

2 participants