Skip to content

feat: Adds stability domain - /race-condition-repro skill - #97

Merged
MajorLift merged 7 commits into
jongsun/add/memory-leak-hunt-skill-v2from
jongsun/add/race-condition-proof
Aug 31, 2026
Merged

MajorLift merged 7 commits into
jongsun/add/memory-leak-hunt-skill-v2from
jongsun/add/race-condition-proof

Conversation

@MajorLift

@MajorLift MajorLift commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds race-condition-repro, the engine behind evidence's B7 deterministic-interleaving evidence category and the sibling red-on-base names for ordering bugs.
  • Covers claims where correctness is the interleaving rather than a value: cancellation, supersession, retry ordering, debounce/throttle, locks, queues, async state machines.
  • The falsifier is a test that never interleaved — operations that run to completion in sequence exercise no race and produce a vacuous green indistinguishable from a real pass. The proof obligation is therefore to show the interleaving occurred, not that the assertion passed.
  • Lands in domains/stability/ beside memory-leak, the other defect-class engine evidence delegates to.

Test plan

  • node .github/scripts/lint-skill-entry.mjs domains/stability/skills/race-condition-repro/skill.md — 0 errors
  • Frontmatter: name matches directory, maturity: experimental, description within the 1536-char budget
  • domains/stability/ is also created by feat: Adds stability domain - /memory-leak, /race-condition-repro skills #81; domains are discovered via readdirSync, not a registry, so both can add it independently

Validation runs

Trial runs of this PR's skills against merged metamask-extension PRs nobody flagged. Every claim was re-verified against the real diff before posting. Clean results are included on purpose — a skill that only ever reports problems cannot be calibrated.

PR Skill Verdict Finding
#41917 race-condition-repro Mixed one guarantee forced, the sibling untested
#44194 race-condition-repro Gap abort path: 0 refs across 181 test lines

Each comment carries a trial-run disclaimer and links back here for feedback.

abretonc7s and others added 4 commits July 30, 2026 15:28
Bugbot already reviews every non-draft PR update. This checked-in
`.cursor/BUGBOT.md` focuses those runs on skill-file security:
hidden/overriding instructions (prompt injection), credential access &
data exfiltration, unsafe execution & safety-control bypass, and remote
instructions fetched at runtime. Scope is changed lines only, with
advisory comments that escalate to the full security review when needed.

This is the same mechanism already used by metamask-mobile and
metamask-extension.

A marked merge point in the file takes the security team's tailored
OWASP LLM Top 10 prompt when it is delivered.

---------

Co-authored-by: behroozreview <behrooz.aghakhanian@gmail.com>
## Summary

Acceptance criteria for skill contributions, in both halves — a CI
validator for the deterministic properties, and the two questions in
`CONTRIBUTING.md` that no check can answer. From the [ADR 0057
review](MetaMask/decisions#162), where
acceptance criteria were raised as an open item.

## The validator

`yarn lint:skills` checks directory layout, `skill.md` path and name
pattern, frontmatter keys and maturity values, `mms-` prefix misuse,
repo-overlay names, and description length. `tools/skill-schema.mjs` is
the single source of truth, imported by the linter so the documented and
enforced schemas cannot drift.

**Description budget is 1,536** — a repo budget, not an operator limit.

An earlier draft used 1,024, justified as the per-operator minimum
citing OpenCode. That does not hold up: `tools/install` emits the
description verbatim with no truncation anywhere in the tooling, and six
skills over 1,024 — up to 1,344 — install and load in Claude Code today.
It also never bound anything, since the 46 skills on `main` have a
median description of 45 characters and a maximum of 928.

Enforcing it had a real cost. A description is the discovery surface and
the only part of a skill carrying its own trigger cues, so trimming one
to fit makes the skill less likely to be selected when it is relevant.
The budget still exists — always-on context should be bounded — but at a
number that reflects a deliberate choice rather than an unverified
external claim, and the comment now asks for an operator and version
before anyone tightens it.

## What running it against `main` turned up

Three errors, two of which were defects in the repo rather than in the
check:

- **`workflows/` never shipped.** 14 files across two `web3-tools`
skills, referenced **22 times** from their bodies, absent from the
installer's bundle list — so every installed copy carried 22 dangling
links and nothing reported it. Added to `copy_bundle_dirs`; all 22 now
resolve, 42 files delivered.

This is the third instance of one root cause, after `pr-validate`'s
`hooks/` and domain `knowledge/`: a directory that exists in source and
is not in the copy list.

- **`metadata` was rejected** as unknown frontmatter, though README
documents it as preserved through install. Now in the optional set.

- **`performance` description was 1,078 chars.** Under the 1,536 budget,
so it stays as authored — an earlier trim to 928 was reverted along with
the ceiling that motivated it.

Validator now reports **0 errors across 46 skills**.

## So the list stops being written twice

Two tests read `tools/install` directly:

- `BUNDLE_DIRS` must match the directories it copies.
- Every key it reads via `frontmatter_value` must be declared in the
schema.

The comment asking a human to keep Bash and JS in sync is now checked.
Knowledge files also get their own declared keys, since they take
`domain` rather than the installer-behaviour keys skills use.

## And the half a linter cannot check

`CONTRIBUTING.md` gains two questions:

**Is it a skill, or does it belong in an enforcement layer?** Skills
shape generation; linters, hooks, and fitness functions enforce. A skill
that *substitutes* for enforcement is unsafe — an agent can ignore any
context it is given. One that *restates* a deterministic check is
wasteful. One that *teaches the upstream pattern* so enforcement rarely
fires is the right shape, and should name the layer it pairs with.

**Does it earn its context budget?** Frontmatter for every installed
skill loads at agent startup, so a skill that is never selected still
costs its `description` on every run.

## Keeping the number honest

Two tests, because the failure mode here was documentation drifting from
enforcement in both directions:

- The boundary case derives its length from `DESCRIPTION_MAX` rather
than hardcoding one, so it keeps testing the boundary when the budget
moves. The previous hardcoded 1,100 silently stopped exercising anything
the moment the ceiling rose.
- A new check fails if `README.md`, `CONTRIBUTING.md`, or
`.github/SKILL_TEMPLATE.md` state a figure the schema does not enforce.
All three had said 1,536 while the schema said 1,024; reconciling them
by editing the docs down was the wrong direction, and this makes that
disagreement fail rather than get silently resolved.

## Test plan

- [x] `node .github/scripts/lint-skill-entry.mjs` — 0 errors, 46 skills
- [x] `test/lint-skill-entry.test.mjs` — 10 pass, including both drift
checks
- [x] `test/cli.test.mjs` 11 pass, `test/unit.test.mjs` 30 pass
- [x] Real install of `web3-tools`: 22/22 `workflows/` references
resolve, 42 files delivered
- [x] 84 remaining warnings are all missing recommended sections —
advisory, non-blocking

## Notes

- Supersedes #92, folded here: the check handles what it can, the prose
says where to spend review attention instead.
- 84 warnings suggest either the recommended sections are wrong for this
corpus or most skills predate them. Worth a follow-up decision; not
blocking, since warnings do not fail CI.
## Summary
- Add `testing/mobile-testing` as the single MetaMask Mobile
functional-testing skill: short router + progressive-disclosure
references for unit, component-view, integration, Appium E2E,
Detox→Appium migration, and test-layer placement.
- Deprecate superseded Mobile peer skills (`unit-testing`,
`component-view-test`, `integration-test`, `e2e-test`,
`test-layer-placement`) as thin redirects; remove the Mobile
`e2e-testing` overlay while keeping Extension E2E/unit overlays.
- Default new device journeys to Appium; keep Detox docs only as
nearly-deprecated migration / remaining-suite support. Update
`testing-layers.md`, README, and Mobile coding/PR pointers.

Closes / tracks:
[MMQA-2142](https://consensyssoftware.atlassian.net/browse/MMQA-2142)

## Test plan
- [ ] `metamask-skills describe testing/mobile-testing`
- [ ] `metamask-skills sync --repo metamask-mobile --include
testing/mobile-testing` installs router + all references
(unit/CV/integration/appium/detox/placement)
- [ ] Mobile install skips `e2e-testing` (no Mobile overlay) and still
installs deprecated stubs that redirect to `mobile-testing`
- [ ] Extension install still gets `e2e-testing` + `unit-testing`
Extension overlays; `mobile-testing` is skipped (Mobile-only)
- [ ] Router/layers policy mark Appium as default E2E and Detox as
nearly deprecated
- [ ] Spot-check relative links from `skill.md` → layer refs → nested
refs


Made with [Cursor](https://cursor.com)

Co-authored-by: Cursor <cursoragent@cursor.com>
…rency

The falsifier for a concurrency claim is a test that never interleaved: a
sequential run exercises no race and produces a green indistinguishable from a
real pass. The skill therefore treats showing the interleaving occurred as the
proof obligation, not the assertion passing.

Lands in `stability/` beside `memory-leak-hunt`, the other defect-class engine
`pr-validate` delegates to.
@MajorLift MajorLift changed the title feat(stability): add race-condition-proof skill feat(stability): add race-condition-proof skill Jul 31, 2026
…xing it

The description read "the engine behind evidence's B7 deterministic-interleaving
evidence category". "B7" is an address into evidence-catalog.md, not a name: it
carries no meaning to a reader who has not opened the catalog, and a frontmatter
description cannot link out to one.

- Drop the lane id from the description; name the role instead.
- Replace the trailing Notes reference with a Related section that links the
  catalog by URL. A relative path would not survive installation, which flattens
  skills to mms-<name>/.
- Drop the exogram-daemon path, which is a private repo the reader cannot open.
- Update the stale pr-validate name to evidence.
As a noun suffix, `-proof` is privative in English — waterproof, bulletproof,
tamper-proof all mean "immune to". So `race-condition-proof` parses as "immune to
race conditions" rather than "produces a proof about ordering", and that
misreading is plausible enough not to self-correct.

`-repro` names what the harness produces and carries no such inversion.
@MajorLift MajorLift changed the title feat(stability): add race-condition-proof skill feat(stability): add race-condition-repro skill Jul 31, 2026
@MajorLift

Copy link
Copy Markdown
Contributor Author

Context budget

What this PR costs an agent, measured from an install rather than read from the diff. Three tiers, and only the first is unavoidable.

Skill Frontmatter Selected + refs & knowledge
race-condition-repro 1,236 chars ~2,008 tok ~2,008 tok

Frontmatter is the only tier paid unconditionally — every agent loads it on every run once the skill is installed, used or not, because it is what the agent reads to decide relevance. The 28 skills across the eleven open skill PRs sit at a median of ~1,716 tokens selected and ~1,860 with references followed. All are within the 1,536-character description budget.

Selected is paid only when the agent picks the skill. + refs & knowledge is the ceiling if every bundled reference is then read; it is a worst case, not an expectation.

Method

tools/install --repo metamask-extension --maturity experimental against this branch at 6a9343423, measured per installed skill directory. Repo overlays are merged into the emitted SKILL.md, so they land in the selected tier rather than being missed by a source-byte count. Token figures are bytes/4 — a proxy for scale, not accounting.

These figures are pinned to the commit above and drift on every push; #96 tracks automating them.

The installer emits `mms-race-condition-repro`; the description advertised
`/race-condition-repro`.
@MajorLift MajorLift changed the title feat(stability): add race-condition-repro skill feat: Adds stability domain - race condition repro skill Aug 31, 2026
@MajorLift MajorLift changed the title feat: Adds stability domain - race condition repro skill feat: Adds stability domain - /race-condition-repro skill Aug 31, 2026
@MajorLift
MajorLift changed the base branch from main to jongsun/add/memory-leak-hunt-skill-v2 August 31, 2026 14:47
@MajorLift
MajorLift merged commit cb9777b into jongsun/add/memory-leak-hunt-skill-v2 Aug 31, 2026
28 checks passed
@MajorLift
MajorLift deleted the jongsun/add/race-condition-proof branch August 31, 2026 14:48
MajorLift added a commit that referenced this pull request Aug 31, 2026
The 25 conflicts were all in files this branch picked up when #97 merged in,
never in its own `domains/stability/` content. `main` has since carried five
more commits over those same files — #109, #115, #54, #120, #132 — against
this branch's single snapshot of them, so `main` is authoritative for every
one and its version is taken throughout.

That includes six deletions: #120 dropped Detox E2E, and the four
`references/detox/` files plus `detox-to-appium.md` and
`detox/legacy-playbook.md` go with it. Nothing references them.

The merged tree now differs from `main` only in the `CODEOWNERS` line this PR
adds and its five `domains/stability/` files.
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.

3 participants