Skip to content

Treat missing marshal files as empty record sets#7

Merged
AZQ1994 merged 3 commits into
masterfrom
fix-marshal-loader-missing-file
May 18, 2026
Merged

Treat missing marshal files as empty record sets#7
AZQ1994 merged 3 commits into
masterfrom
fix-marshal-loader-missing-file

Conversation

@AZQ1994
Copy link
Copy Markdown
Member

@AZQ1994 AZQ1994 commented May 18, 2026

Summary

Patch release v1.0.1.

Fix

  • MarshalLoader#read_raw raised Errno::ENOENT when the dump file was absent, blocking dataset bootstrap before any dump existed.
  • Return nil from read_raw and treat it as an empty record set in build_records, matching QueryLoader's empty-table fallback.
  • Digest stays stable (nil.hash), so a later-appearing file is picked up on the next load_records.

Chore

  • Add CHANGELOG.md (Keep a Changelog format) starting from v1.0.0.
  • Bump SimpleMaster::VERSION to 1.0.1.
  • Realign indentation in lib/simple_master/master/queryable.rb to satisfy newer RuboCop's Layout/IndentationWidth (pre-existing offense surfaced after RuboCop updated).
  • Disable Style/OneClassPerFile in .rubocop.yml — the AR preloader monkey-patch in lib/simple_master.rb and STI subclass families in rails_sample are intentional.

Compatibility

  • No public API change.
  • The only behavior change is on the previously-unhandled missing-file path: callers that relied on Errno::ENOENT being raised will now receive an empty record set instead. Safe under SemVer patch semantics.

Test plan

  • bundle exec rspec spec/simple_master/loader/marshal_loader_spec.rb — 2 examples, 0 failures (includes the new missing-file case)
  • bundle exec rspec full suite — 48 examples, 0 failures
  • CI green (rubocop + Ruby 3.2/3.3/3.4 × Rails 7.0/7.1/7.2/8.0/8.1)

🤖 Generated with Claude Code

AZQ1994 and others added 2 commits May 18, 2026 12:36
MarshalLoader#read_raw raised Errno::ENOENT when the dump file did not
exist, which prevented bootstrapping a dataset before any dump was
produced. Align the behavior with QueryLoader's empty-table fallback so
loading a missing table yields an empty record set instead.

Also realign the inner-block indentation in queryable.rb so newer
RuboCop (Layout/IndentationWidth) stops flagging it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Newer RuboCop releases activated Style/OneClassPerFile by default,
which flags two intentional patterns in this codebase:

- The ActiveRecord::Associations::Preloader::Association reopen in
  lib/simple_master.rb, which is a monkey-patch and not a new class.
- STI subclass families colocated in a single model file in the
  rails_sample.

Both patterns are deliberate, so disable the cop project-wide.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AZQ1994 AZQ1994 force-pushed the fix-marshal-loader-missing-file branch from f19cfb7 to f6e434e Compare May 18, 2026 03:37
Patch release covering the MarshalLoader missing-file fix. No public
API changes; behavior change is limited to gracefully handling a
previously-unhandled error path (missing dump file -> empty record
set), matching QueryLoader's existing fallback.

Adds CHANGELOG.md (Keep a Changelog format) starting from v1.0.0 so
future entries have a home.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@AZQ1994 AZQ1994 force-pushed the fix-marshal-loader-missing-file branch from f6e434e to b437d49 Compare May 18, 2026 03:54
@AZQ1994 AZQ1994 merged commit 28f5c83 into master May 18, 2026
32 checks passed
@AZQ1994 AZQ1994 deleted the fix-marshal-loader-missing-file branch May 18, 2026 09:02
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