Skip to content

Login reuse follow-ups: real reek in CI, deterministic cache spec, README placement, shared restore lock - #171

Merged
aguspe merged 6 commits into
masterfrom
chore/login-reuse-followups
Oct 31, 2026
Merged

aguspe merged 6 commits into
masterfrom
chore/login-reuse-followups

Conversation

@aguspe

@aguspe aguspe commented Oct 31, 2026

Copy link
Copy Markdown
Collaborator

Four follow-ups to login reuse (#170), as approved. There's no version bump and no release.

P1: deterministic template-cache spec

end_to_end_spec.rb's wall-clock comparison failed under load. When it failed it also left test_cache_1/2 behind, which then broke whole-repo RuboCop and reek. The spec now counts PartialCache#compile_template calls: the first generation compiles more than zero partials and the second compiles none. Cleanup runs in ensure.

The spec fails when the cache lookup is disabled: expected 0, got 8.

P2: reek actually runs in CI and the release

release.yml and reek.yml ran a bare reek. With no terminal attached, reek reads standard input, so it checked nothing. On master, bundle exec reek < /dev/null exits 0 while bundle exec reek . exits 2. So the "Reek clean" results for the 3.10.0 and 3.11.0 releases were vacuous.

Both workflows now run bundle exec reek .. Master had nine warnings:

  • Seven are fixed. The sha256 parameters are renamed to digest, and the template error subclasses use their attribute readers.
  • Two are baselined in .reek.yml, each with a reason: RubyRaider::Ffmpeg TooManyConstants, and ScaffoldingCommands MissingSafeMethod for the Thor guard validate_project!.

P3: README placement

In generated web READMEs, "Reusing the login" now sits before "Reporting". The existing ### Sponsors heading therefore no longer nests under it. Mobile READMEs are byte-identical.

P4: shared lock for restores in the generated SessionState

  • Shared restores. Checking freshness, restoring and running valid: happen under a shared flock, so parallel workers restore at the same time.
  • Exclusive only for logins. Only a real login takes the exclusive lock. The shared lock is released explicitly first, because Windows won't upgrade a held lock in place.
  • Peer-save check. With the exclusive lock held, it compares inode, mtime and size. If another worker saved in between, it restores that login instead of logging in again.
  • Warnings wait for the outcome. Each fallback that really logs in prints exactly one [login_state] warning. A restore rescued by a peer's save prints none.
  • Spec. The raider_planning spec's "Parallel runs" section is updated to match.

Checks

  • spec/generators: 79 examples, 0 failures.
  • spec/integration --tag ~slow: 1464 examples, 0 failures.
  • Whole-repo rubocop exits 0, and bundle exec reek . exits 0.
  • The generated project's own RuboCop config reports nothing on helpers/session_state.rb.
  • The slow live test "saves the login once and reuses it" passes against raider-test-site.
  • The new concurrent-restore spec failed before the change: a timeout under the exclusive lock.
  • The two peer-save warning specs failed before the fix, with two warnings printed.
  • The SessionState specs were stable over repeated runs.

…ings

Bare `reek` reads stdin when there is no terminal, so the CI and release
steps checked nothing. Rename the sha256 parameters, read the template
error attributes through their readers, and baseline the two design-level
warnings in .reek.yml.
The timing comparison failed under load and, when it failed, left
test_cache_1/2 behind, which then broke whole-repo rubocop and reek.
…wait on each other

Only a real login takes the exclusive lock. Upgrading from shared to
exclusive releases the shared lock first, so a worker that gets the
exclusive lock after another worker saved restores that login instead
of logging in again.
…e per real fallback

Windows does not upgrade a held shared lock in place, so unlock first.
Warnings now wait for the outcome: a peer's save can still rescue a failed
restore, and only a path that really logs in prints its one warning. The
peer-save check compares inode, mtime and size.
@aguspe
aguspe merged commit 1274a66 into master Oct 31, 2026
12 checks passed
@aguspe
aguspe deleted the chore/login-reuse-followups branch October 31, 2026 23:11
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