distributed-races
Skill1 starsChanged 41 days agoMITView on GitHub
Correctness of controllers, reconcile and retry loops in any language — questions about state other actors read and write concurrently: self-triggering status writes, what wakes the loop by its promised deadline, another controller acting on a stale cache, permissions for new API verbs, protection released on spec change, not end of use, objects created before the change, idempotent create/patch, cleanup on delete, error-path retry bounds, holds no watch clears, writes without a resourceVersion or UID fence, unchecked external claims. Use when reviewing or writing a Kubernetes operator/controller, reconcile or requeue path, finalizer, watch, admission webhook, or any converge-to-desired-state loop. Triggers: reconcile, controller, operator, requeue, finalizer, watch, informer, resourceVersion, observedGeneration, eventual consistency, race between controllers. Not for in-process races, locks or async (rust-concurrency), file watchers or MVC controllers.
In this repository42 other files it gives its agents.
- AGENTS.mdAGENTS.md
- addressing-findingsSkill
- auditSkill
- codebase-onboardingSkill
- codex-reviewSkill
- compatibilitySkill
- debuggingSkill
- developSkill
- memorySkill
- nix-dev-envSkill
- nix-flakesSkill
- nixosSkill
- nix-packagingSkill
- nix-reviewSkill
- refactoringSkill
- retroSkill
- review-initSkill
- review-rulesSkill
- rust-architecture-reviewSkill
- rust-architectureSkill
- rust-cliSkill
- rust-cloud-nativeSkill
- rust-concurrencySkill
- rust-ecosystemSkill
- rust-embeddedSkill
- rust-errorsSkill
- rust-fintechSkill
- rust-idiomsSkill
- rust-macrosSkill
- rust-mlSkill
- rust-navigationSkill
- rust-ownershipSkill
- rust-performanceSkill
- rust-pluginsSkill
- rust-reviewSkill
- rust-securitySkill
- rust-testingSkill
- rust-traitsSkill
- rust-unsafeSkill
- rust-webSkill
- specsSkill
- sql-reviewSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 58
Read that source; the diff alone cannot answer them.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Distributed races — controller and reconcile-loop correctness
A reconcile loop is correct only if it converges from every state another actor can leave behind: a crashed earlier pass, a second controller with an older view, a watch that never fires, an object written by last month's version of the code. The bug is almost never on the changed line; it is in an interleaving the author did not play out. This skill is a list of questions, each with the answer a reviewer must produce and where that answer lives. A question you cannot answer from evidence is a finding to raise as open, not a pass.
How to work it
1. MAP — name the primary object, every secondary/child it writes, every object it READS that
another controller owns, and the requeue/error outcomes the pass can return.
2. ASK — run each class below against that map. Skip a class only by saying why it cannot apply.
Apply each class to EVERY instance in the diff, not to the first convenient one.
3. SOURCE — answer from the carrier named in "where", not from comments or the PR text.
4. REPORT — a finding names the interleaving or the request order that produces the bad state,
and says what it does NOT establish (live behaviour, actual data loss).The classes
Each class: question → the answer needed → where to get it. Full wording, examples and the fix shape for every class are in catalogue.md.
| # | Class | The question |
| R1 | Self-triggering write | For EVERY write to the primary in a pass (the driver/error path's status/conditions on holds and errors included): does it change a field every pass (lastTransitionTime), and does the primary's own watch (no predicate/generation filter) re-enqueue it sooner than the requeue the code relies on? Is it skipped when nothing changed? |
| R2 | Wake source | For every outcome the requeue/error policy can return (await-change included), what event or timer guarantees a pass by the deadline the code promises? |
| R3 | Foreign stale cache | Not our own stale read (R12). For EACH object another controller owns that a release/delete/label removal depends on: name that controller and its observed-generation gate (status.observedGeneration, an applied/desired generation pair, e.g. status.observedGeneration vs metadata.generation). Can it still act (recreate a child from the OLD template) after we decided from its "absent/finished" state? Wait until it catches up. |
| R4 | Permissions | Is every API verb and resource the diff newly calls granted in the shipped Role/ClusterRole/chart/IAM policy? |
| R5 | Protection lifetime | Is a finalizer/label/lock/hold released on a change of intent (spec) when the consumer outlives the spec and the release must wait for end of use? |
| R6 | Migration window | Objects created before this change lack a field/label/status the new logic relies on — what does the new code do with them? |
| R7 | Divergent desired state | Do the create path and the update/patch path express the same desired object? |
| R8 | Partial-failure strand | Is progress (observedGeneration/Ready/status) recorded around a step that can fail so a transient error strands state or re-mutates the primary every pass? |
| R9 | Cleanup | Does every resource created during reconcile have a delete path (owner reference that works across the scope boundary, finalizer, or explicit delete)? |
| R10 | Stale or churning status | Is a status/condition cleared when its subject disappears, and written only when desired != current? |
| R11 | Feature gate | Does a disabled path still call the API, or can its error abort the unrelated primary reconcile? |
| R12 | Read-then-write race | Is create/patch chosen off a stale read with no tolerance for 409/AlreadyExists or 404? |
| R13 | Swallowed error, no timer | Is a secondary error swallowed and the pass returns await-change while no watch event will fire in that failure mode? |
| R14 | Strict decode on a shared stream | Can one undecodable object on a shared/cluster-wide watch stall the stream for every object? |
| R15 | Webhook failure policy | Does the admission handler's error→decision mapping match the shipped failurePolicy? |
| R16 | Retry bound lost on an error path | Does every error arm (a failed status write, a Context error) end in a bounded timed retry, or does it return await-change and wait for a change only another actor can make? |
| R17 | Hold only an unwatched object clears | Is every hold or wait released by a change on an object this controller watches (with a mapper back to the primary), or by a timer? |
| R18 | Cached write, no version fence | Is a status write built from a reflector/informer snapshot sent without a resourceVersion precondition, overwriting a concurrent writer? |
| R19 | No identity fence | Between selecting an object by name and mutating or deleting it, is the write fenced on its uid, so a recreated object with the same name is not hit? |
| R20 | Unverified external claim | Is every claim about an external system (API server, KubeVirt, kube-ovn, a cloud API) checked against that system's pinned source or versioned docs? |
R1–R6 are the classes reviews miss most: they need a source outside the diff (the watch setup, the requeue table, the other controller's code, the RBAC manifest, data already in the cluster). Read that source; the diff alone cannot answer them. R16-R20 were found missing by an external reviewer on Kubernetes controllers: they too need a source outside the diff (the watch mapper, the patch parameters, the external system's pinned source).
A finding on a deletion or recovery path (finalizer removal, teardown, a delete handler, crash or partial-failure recovery) is at least Medium (catalogue, "Severity floor").
Where answers live
| Answer | Carrier |
| What triggers a pass | the controller's watch/owns/predicate setup, generation-change filters |
| What a pass may return | the error → requeue policy table, every early return |
| What another controller does | that controller's source (same repo or vendored), its status fields |
| What the controller may call | Role/ClusterRole templates in the chart, operator bundle, IAM policy |
| What exists already | CRD schema history, the migration/backfill code, a release note |
| How an external system behaves | its source or versioned docs at the version the lockfile, chart or image pins |
| What happened on a real cluster | an integration/e2e trace, controller logs — the only carrier for "it works" |
Relation to other skills
R7–R12 are also catalogued for Rust diffs as REC-001…REC-006 in rust-review's rules.md
(the rule IDs a Rust review files findings under). Durability windows
between two writes of one pass are the failure-windows lens of the review workflow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

