Skip to content

Narrow filesystem mocks in cache revision specs - #1720

Open
dlq wants to merge 1 commit into
aces:masterfrom
dlq:narrow-cache-revision-spec-mocks
Open

dlq wants to merge 1 commit into
aces:masterfrom
dlq:narrow-cache-revision-spec-mocks

Conversation

@dlq

@dlq dlq commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Cache-revision specs globally replace File.exist?, File.read, IO.sysopen, and IO.open. When those examples run before framework helpers have loaded, the mocks can disrupt lazy loading and produce errors such as an undefined RSpec::Mocks::Matchers::ReceiveMessageChain.

Scope the stubs and expectations to the revision-file path and the simulated file descriptor. Other filesystem calls retain their original behavior. The cache-root fixture now uses Pathname, matching the provider’s normal representation, and the revision path uses DataProvider::DP_CACHE_ID_FILE.

Validation on Ruby 4.0.2 / Rails 8.1.4.1, based on aces:master at 6b6c30216, using the isolated runner in #1719:

  • Cache-revision group, seed 13752 — 10 examples, 0 failures.
  • Full portal suite, seed 13752 — 1,693 examples, 0 failures, 11 pending.
  • Full portal suite, seed 48268 — 1,693 examples, 0 failures, 11 pending.
  • Both full-suite commands exited successfully. Ruby syntax and Git whitespace checks passed.

Before this change, seed 13752 failed in the cache-revision setup and the affected example also failed when run alone. This addresses the test-order issue recorded in #1719.

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