Title: mcpx testing: flake policy -- race, shuffle, repeat runs, quarantine with expiry, a second OS · Issue #1973 · developing-today/code · GitHub
Open Graph Title: mcpx testing: flake policy -- race, shuffle, repeat runs, quarantine with expiry, a second OS · Issue #1973 · developing-today/code
X Title: mcpx testing: flake policy -- race, shuffle, repeat runs, quarantine with expiry, a second OS · Issue #1973 · developing-today/code
Description: Relocated from dezren39/darwin-nix#130 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/ni...
Open Graph Description: Relocated from dezren39/darwin-nix#130 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue referenc...
X Description: Relocated from dezren39/darwin-nix#130 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue refe...
Opengraph URL: https://github.com/developing-today/code/issues/1973
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx testing: flake policy -- race, shuffle, repeat runs, quarantine with expiry, a second OS","articleBody":"Relocated from dezren39/nix#130 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).\n\nParent: #99\n\n## Summary\n\nA flaky test found only on the lead's third full-suite run is the motivating case: a flake that one run in three exposes is invisible to a CI that runs once, and invisible to agents who (per #127) will no longer run the full suite at all. This issue decides how flakes are **found** (race detector, shuffled order, repeat runs), **where** that costs time (changed tests per PR, everything nightly), and what happens when one is found (fix vs quarantine; never a silent retry). It also records that macOS vs Linux differences (#35) are a flake source CI cannot see today.\n\n## Original notes\n\n> - testing\n> - importantly, as we add more testing agents should not run every single test basically ever. below documents a rough idea of a ci job design/policy, the main priority is being short as possible.\n> - agents should make at least 1 simple, new test for every bug observed from any source, when cheap to do so-- aggresively test many permutations. \n\n(Why these: repeat runs and `-race` cost time the second line forbids spending on every PR, so most of it moves to scheduled jobs; \"aggresively test many permutations\" includes permutations of *order* and *schedule*, which is what `-shuffle` and `-race` supply. The seed bullet under the third line is owned by #93 and quoted in #128; the only part used here is that the shuffle seed derives from the run seed.)\n\n## Current state\n\n- CI runs `go test ./... -count=1` once, ubuntu-latest only, no `-race`, no `-shuffle` (`.github/workflows/mcpx.yml:65`, unchanged at 05c78b2). No test calls `t.Parallel()`, so the main nondeterminism is order, timing, subprocesses and goroutines inside the daemon.\n- Today the only repeat runs are by hand, in the integrator's pre-merge routine: PR #69/#70 \"Suite 2× clean\", #171 \"Suite 3× clean before my change and 2× after\", #182 \"Suite 3× clean\" (plus a daemon count across the three). #127 rule 7 keeps that exception until the jobs below replace it.\n- Flakes and races found so far, all by repetition or by `-race` run by hand:\n - PR #46: \"A flaky client test: the older fake answered the client's own replies ... One run in three panicked. Found by running the suite repeatedly, not once.\"\n - PR #56 / #61: a data race in `internal/tasks` + `internal/mcpserver`, \"~1 run in 5 under `-race`\", \"Invisible because the suite does not run `-race`.\"\n - `internal/testsupport/build.go:47-53`: building the binary per test under `go test ./...` load \"produc[ed] a different spurious failure on each run\".\n - #35: two tests passed on macOS and failed on Linux (the tests were wrong). Development happens on macOS; CI is Linux. Once agents stop running the full suite locally (#127), **nothing runs the full suite on macOS any more.**\n- `go help testflag`: `-shuffle off,on,N` randomizes test order within a package and reports the seed; `-count n` runs each test n times; results are reported per run. The race detector costs roughly 2-20x CPU and 5-10x memory (https://go.dev/doc/articles/race_detector); since Go 1.20 it needs no cgo on macOS, and on Linux needs a C linker (present on ubuntu-latest) (https://go.dev/doc/go1.20).\n- The repo is public, so GitHub-hosted macOS runners cost no minutes (they are slower to start and fewer run concurrently).\n\n## Proposed policy\n\n1. **No retries that hide flakes.** No `gotestsum --rerun-fails`, no \"re-run failed jobs until green\" as a merge path. A test that failed once and passed on retry is a found flake: it gets an issue.\n2. **Changed tests are repeated before merge.** Tests added or modified in a PR (selected by the #127 script) run in a PR job with `-race -shuffle=\u003cderived> -count=N` -- N=10 for unit, N=3 for e2e as a start. Runs in parallel with the main matrix so it does not lengthen the longest job (#95's budget).\n3. **The whole suite is stressed on a schedule.** Nightly (or per N commits to `main`): `go test -race -shuffle=\u003cderived> -count=3 ./...` on ubuntu **and macOS**. Failures open or update an issue automatically; the job never blocks a PR.\n4. **`-shuffle` seed derives from the run seed** (#93), e.g. the first 63 bits of its hash, so a failing order is reproduced from the one seed CI printed. `-shuffle=on` (clock-seeded) is not used in CI.\n5. **Fix now, or quarantine with an expiry.** A quarantined test calls a helper, e.g. `testsupport.Quarantine(t, \"#123\", \"2026-11-15\")`, that skips it until the date and then **fails** -- so a quarantine cannot become permanent. The nightly job runs quarantined tests anyway and reports them without blocking. A guard lists quarantine calls and fails on a missing issue link or an expired date (#129).\n6. **Reproduce locally by name only:** `go test -count=20 -race -shuffle=\u003cseed> ./internal/\u003cpkg> -run '^TestX$'`. Never \"run the whole suite a few times\" locally as a way to reproduce (#127: cost; #52's leak is fixed by #182, so the cost is time only).\n\n## Approaches\n\n### A -- retry on failure (least recommended)\nLet CI retry failed tests (or jobs) once or twice and merge on green. It is what many projects do because it makes the dashboard quiet. It is exactly wrong here: the #46 flake panicked one run in three, so a single retry passes it ~89% of the time and the bug ships; retries also double the time of every red run, against the \"short as possible\" priority, and teach everyone that red means \"try again\". Rejected.\n\n### B -- fix-now always, no quarantine\nAny flake blocks all merges until fixed. Honest and simple. In practice a flake in, say, the TUI blocks an unrelated protocol fix, and the path of least resistance becomes deleting or `t.Skip`-ing the test with no record -- a worse quarantine than a tracked one. Fine as the default *intent*; too rigid as the only rule.\n\n### C -- detect by repetition off the critical path, fix-now by default, quarantine only with issue and expiry (recommended)\nPolicy 1-6 above: `-race`/`-shuffle`/`-count` on changed tests per PR (cheap, parallel), the whole suite stressed nightly on two OSes, no hiding retries, quarantine as a dated, linked, guarded exception. Recommended because it finds the classes that have actually bitten mcpx (order/timing flakes, data races, OS differences) at a cost outside the PR's longest job, and it makes the escape hatch visible and self-expiring instead of forbidding it and getting silent skips.\n\n### Sub-choice: other operating systems\n\n| Option | Catches #35-type bugs | Cost |\n| --- | --- | --- |\n| ubuntu only (today) | only Linux-side | none |\n| macOS in the nightly stress job only | yes, within a day | nightly minutes only |\n| macOS for e2e on every PR | yes, before merge | slower runner start; lengthens the longest job if e2e shards are not rebalanced (#95) |\n\nRecommended: macOS nightly now, promote to a PR shard if a macOS-only bug escapes. Other OSes and distros (alpine, fedora, windows) belong to the environment matrix in #97; this issue only asks that at least one non-ubuntu OS runs the suite on a schedule.\n\n## Open questions\n\n- N for `-count` per tier (10 unit / 3 e2e is a guess; measure against #95's budget).\n- Does `-race` on the e2e package help? The race detector instruments the test binary, not the `mcpx` binary it builds. A race-enabled *mcpx* needs `go build -race ./cmd/mcpx` in `testsupport` behind an env switch -- probably worth it for the nightly job.\n- Is the nightly job allowed to open issues automatically, or only post to a tracker comment?\n- Quarantine helper name and where the \"expired\" check runs (test itself vs a guard vs CI).\n\n## Ease · Impact · Related\n\n**Ease** M · **Impact** high\n**Depends on / related**: #93 (run seed -> shuffle seed), #95 (PR job, nightly job, budget), #97 (OS/environment matrix), #35, #52 (closed, fixed in #182), #46, #56, #61; siblings #127 (rule 7: the integrator's repeat runs, which this issue moves into CI), #128, #129, #131.\n\nSecurity/auth deferred; see tracker.\n\n## Acceptance criteria\n\n- A flake policy is decided and recorded (on this issue and in the contributor page, #1976): how flakes are found (race detector, shuffled order, repeat runs) and where that time is spent (changed tests per PR, full coverage nightly).\n- The found-a-flake process is defined: fix vs quarantine, quarantine always with an expiry, and never a silent retry.\n- The macOS-vs-Linux flake source is recorded with a route to visibility (second OS in CI) or an explicit deferral with its reason.\n- The work described in the Summary/Scope above is delivered via a branch + PR (no direct push to main); verification runs in GitHub Actions CI, not on the sandbox.\n- Evidence (policy text and any CI changes) is recorded on this issue before it is closed.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:51:52Z","url":"https://github.com/developing-today/code/issues/1973"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c052cfcf-0e58-11ca-8886-73c5f72440dd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A716:372B4B:3E2817:53975F:6B061E4E |
| html-safe-nonce | 505d5b7b684217ce2b18a13bf0bb9c7e1ea6ac3eaa8985b2a0bf9489c42e5345 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzE2OjM3MkI0QjozRTI4MTc6NTM5NzVGOjZCMDYxRTRFIiwidmlzaXRvcl9pZCI6IjEzNjEwMDYyNzY2ODczMDYzMTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d3acb004d4f74f69265fe4403859db6130e4b74a470933ff071c56721ddde319 |
| hovercard-subject-tag | issue:6088970073 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1973/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f6fc81fbafb003ca44d7906835219752eaa9fb968b4f1aadc31a5d0e6b02bc9b/developing-today/code/issues/1973 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f6fc81fbafb003ca44d7906835219752eaa9fb968b4f1aadc31a5d0e6b02bc9b/developing-today/code/issues/1973 |
| og:image:alt | Relocated from dezren39/darwin-nix#130 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue referenc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9a7c5824b75ea2ec5e3de73a483229c7bb9f32a774ffd401f010dd9bacf1483d |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b25c3080e84402f75431d8dc7a96b2635219cec7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width