Bundled dev pack: the shared-state skill - #543
Open
ion-alpha-dev wants to merge 5 commits into
Open
Conversation
A skill for code where two paths can touch the same state at once, organised around one distinction: a race is a missing ordering edge, and the edge lives either in memory or in the data. An edge in memory is a mutex, a channel send, an atomic or an actor hop. The language memory model defines it, a dynamic detector can see it, and it reaches to the end of the address space and no further. An edge in the data is a version compared on write, a sequence number, a logical timestamp or an idempotency key. Code you wrote defines it, nothing observes it, and it is the only kind that survives a process boundary. Confusing the two is the mistake that gets through review. The body carries what is measured rather than what is asserted: that a third of real concurrency bugs are order violations no lock expresses, that 92% of them can be forced with an order among four accesses, that 63% of distributed concurrency bugs need a fault present to appear at all, and that a graded set of model solutions failed most often by never creating the concurrency, which compiles, answers correctly and is green under every detector. The rule the skill exists to enforce is that a concurrency fix ships with a test that fails without it, and the sections that follow name what makes such a test writable here: the injected manual clock, call-counted fault injection at the ports, a state machine over the event log that shrinks a failure to its minimal sequence, and the hybrid logical clock that orders events across instances without trusting a wall clock. A reference document holds the failure shapes, each with what is shared, which edge is missing, how it presents and the test that fails before the fix. Signed-off-by: Ion Alpha <contact@ionalpha.io>
…directory Signed-off-by: Ion Alpha <contact@ionalpha.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
What
Adds
shared-stateto the bundled skill pack, with a reference taxonomy of the failure shapes and its retrieval rows in the skill's own directory.Why
Two code paths can touch the same state at once: two goroutines on one counter, two users editing one record, a retry that repeats a write the server already applied. The skill asks two questions before anyone reaches for a lock or a queue, what is shared and what orders the accesses to it, then covers the ordering kept in data where no compiler or race detector can see it, retry safety after a timeout, read-modify-write split across two processes, and ordering events from several machines without trusting a wall clock. Above all of that, a concurrency fix comes with a test that fails without the fix, because a race detector reports only the races it happened to observe.
How to verify
go test ./skill/.... Conformance reads the new directory and its reference document, andTestPackIsRetrievableruns the runtime's own ranker over the eight retrieval rows.Notes for reviewers
The branch predates the move of retrieval rows into each skill directory. Its rows now sit in
skill/bundled/skills/shared-state/retrieval.txt, and it no longer touches a shared table.