Skip to content

Bundled dev pack: the shared-state skill - #543

Open
ion-alpha-dev wants to merge 5 commits into
mainfrom
skill/concurrency
Open

Bundled dev pack: the shared-state skill#543
ion-alpha-dev wants to merge 5 commits into
mainfrom
skill/concurrency

Conversation

@ion-alpha-dev

@ion-alpha-dev ion-alpha-dev commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

What

Adds shared-state to 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, and TestPackIsRetrievable runs 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.

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

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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