Skip to content

Explain the two load-bearing lines in the binary snapshot spec - #15

Merged
saturnflyer merged 1 commit into
mainfrom
fix/snapshot-spec-rationale
Aug 26, 2026
Merged

saturnflyer merged 1 commit into
mainfrom
fix/snapshot-spec-rationale

Conversation

@saturnflyer

Copy link
Copy Markdown
Member

Why

Follow-up to #13. Both fixes landed correctly, but two explanatory comments were left behind when that branch merged.

Two lines in the binary round-trip spec read as removable and are not. I know because I removed one of them during review and broke the suite:

  • Encoding.default_internal = Encoding::UTF_8 — text-mode IO#write only transcodes, and so only raises, when an internal encoding is set. Rails sets one from config.encoding, which is why the bug surfaced in an app and never in this SQLite-only suite. Drop the assignment and the spec passes against the bug it exists to catch.
  • BinaryDataAdapter#initialize's connection argument — it is never read inside the fake, so it looks dead. Store#initialize builds its Fingerprint from adapter.instance_variable_get(:@connection).

Summary

  • Comments only. No behaviour change, no test change.
  • bundle exec rake: 216 examples, 0 failures, standard clean.

Two things in this spec look removable and are not. Text-mode IO#write only
transcodes — and so only raises — when an internal encoding is set, which is
why the bug surfaced in a Rails app (config.encoding sets one) and never in
this suite; drop the assignment and the spec passes against the bug. And the
fake adapter's connection argument feeds Store#initialize, which builds its
Fingerprint from adapter.instance_variable_get(:@connection); removing it as
dead fails the suite.
@saturnflyer
saturnflyer merged commit 92c9792 into main Aug 26, 2026
4 checks passed
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