Repository navigation
A little more pollish for the Todo Tutorial - #83
Merged
Merged
Conversation
…right on the site. * Extra whitespace with code indenting removed. * Indenting in chapter 2 removed. * Triple asterisks removed.
mpantel
pushed a commit
to mpantel/hyperstack
that referenced
this pull request
Sep 2, 2026
A little more pollish for the Todo Tutorial
mpantel
added a commit
to mpantel/hyperstack
that referenced
this pull request
Sep 2, 2026
…yperstack-org#83) hyperstack-org#67 made expect_evaluate_ruby / expect_promise poll by RE-RUNNING their block, which is the right cure for the read-once race it was opened for. It silently assumes re-reading is free of side effects. Where the block mutates the very quantity being asserted, that assumption inverts the fix: every retry moves the value one step further from the matcher, so the expectation cannot converge BY CONSTRUCTION, and the example burns the whole default_max_wait_time before failing with a "got" that is really just a count of retry iterations. batch6/server_method_spec.rb:71 failed that way on three different cells over two days -- expected: 5, got 44 / 59 / 60 -- against a server_method that is literally `server_method_count += 1`. The failure is invisible until the first read happens to be wrong, so it surfaces as a rare flake with a wildly inflated value rather than as a reproducible error. This is not a reason to revert hyperstack-org#67; it is a reason to stop writing expectations of this shape. server_method_spec.rb: drop to evaluate_promise and a plain expect. Reading once reopens no race here -- the promise resolution IS the synchronisation the polling was standing in for. The assertion now compares the resolved value against the server's own counter, which is what the step is actually about (load resolves with the value the server computed for THIS call, not the default and not a stale one) and no longer depends on how many times the earlier steps in the rspec-steps sequence happened to call the method. That history dependence is what made the old eq(5) brittle even before hyperstack-org#67. A sweep of all 485 expect_promise / expect_evaluate_ruby call sites for blocks that mutate what they assert found two more, both fixed by making the block idempotent so that polling -- and hyperstack-org#67's protection -- is kept: - batch3/aaa_edge_cases_spec.rb "does not double count local saves" created a Todo and asserted the absolute Todo.count; it now asserts the delta, which is what the example means (one local save moves the count by one, not two) and is stable however many times the block runs. - client_features/react_spec.rb reopened a class whose constructor did `@@count ||= 0; @@count += 1`, so the count survived a re-run and could never come back to 2; the reset moves into the class body, which the re-run re-executes. One further site is flagged but deliberately left alone: batch7/sti_spec.rb:184 updates `Sti::NoSyncSubClass1.first`, so a retry would walk a different row and diverge the same way. It has never been observed failing, and pinning the row would mean threading a server-side id into the client block -- more risk than the latent flake warrants. Noted on hyperstack-org#83 as a follow-up. The hazard is documented in AsyncExpectationTarget, next to the side-effect note hyperstack-org#67 left, so the next person writing one of these meets it in the code rather than in CI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019RqRpFdVUXjFb64U21ZxL1
mpantel
added a commit
to mpantel/hyperstack
that referenced
this pull request
Sep 2, 2026
specs: stop asserting exact values the polled block itself mutates (hyperstack-org#83) Closes hyperstack-org#83 See merge request ru/hyperstack!131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current problems:
Chapter 7
"Notice that as you click each link the page reloads."
Reconfirming that the links created don't actually fully reload the page, on Firefox and Chrome.
It's this code in footer.rb, that won't work:
Chapter 11

At row 840
Firefox has difficulty rendering the checkbox with the provided css.