Title: mcpx testing: every formatter and linter in the CI matrix, pinned by the flake (and run the plugin's bun test) · Issue #1996 · developing-today/code · GitHub
Open Graph Title: mcpx testing: every formatter and linter in the CI matrix, pinned by the flake (and run the plugin's bun test) · Issue #1996 · developing-today/code
X Title: mcpx testing: every formatter and linter in the CI matrix, pinned by the flake (and run the plugin's bun test) · Issue #1996 · developing-today/code
Description: Relocated from dezren39/darwin-nix#141 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#141 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#141 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/1996
X: @github
Domain: github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx testing: every formatter and linter in the CI matrix, pinned by the flake (and run the plugin's bun test)","articleBody":"Relocated from dezren39/nix#141 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: #95\n\n## Summary\n\nPut every formatter (check mode) and every linter (at warning severity or stricter, not the minimal preset) for mcpx into the test matrix, with tool versions pinned by the flake so `nix fmt` / the dev shell locally gives the same answer as CI. Also run the one TypeScript test file CI has never run (`plugin/opencode/mcpx/daemon.test.ts`). The repo already has most of the plumbing -- `treefmt.nix`, a flake `formatter`, `checks.formatting`, `checks.tidy` -- but none of it covers Go, TypeScript or shell, and none of it runs in CI.\n\n## Original notes\n\n> - testing\n> - make a comprehensive github action ci.yaml workflow (or test.yaml) that is as fast as possible,\n> - all formatters and linters in test matrix, formatters in check mode, linters set to warning or more than minimal.\n\n## Current state\n\nExisting plumbing (repo root, main d0b7e01):\n- `treefmt.nix`: `programs.nixfmt` and `programs.rustfmt` enabled; `# programs.shellcheck.enable = true; # failures`. `projectRootFile = \"flake.nix\"`, so it formats the **whole repo**.\n- `flake.nix:422-429`: `formatter` = the treefmt wrapper (`nix fmt`); `checks.formatting` = treefmt's check derivation over `inputs.self`; `checks.tidy` = `flake-tidy all --check`.\n- `justfile` `fmt`: `nixfmt *.nix pkgs/*.nix` then `nix run .#flake-tidy -- all || true` -- the glob does not reach `pkgs/mcpx/package.nix`, and the `|| true` swallows tidy failures. `tidy-check`: `nix run .#flake-tidy -- all --check`. So `just fmt` and `nix fmt` disagree about `package.nix`, and a CI check-mode formatter would fail on a file the documented local command cannot fix. Repair (from #169, see the comment below): `just fmt` calls `nix fmt`, which also picks up every program later added to `treefmt.nix` without a second edit.\n- `pkgs/mcpx/docs/release-runbook.md:158-168` \"Checks\" lists `gofmt -l .`, `go vet ./...`, `go test ./... -count=1`, `scripts/stress.sh`, `scripts/bench.sh`, `nix build .#mcpx`, and \"`README.md` must stay a symlink to `docs/story.md`\" (`test -L README.md`). None of these except `go test` and `nix build` run in CI.\n- `go test` already runs a **subset** of vet (atomic, bool, buildtags, directive, errorsas, ifaceassert, nilfunc, printf, stringintconv, tests; `go help test`). Full `go vet` adds copylocks, loopclosure, lostcancel, unusedresult and others.\n- No `.golangci.yml`, no `deno.json`, no `.shellcheckrc`, no `.editorconfig` in `pkgs/mcpx`.\n- `plugin/opencode/mcpx/daemon.test.ts`: 21 tests at 05c78b2 (#182 added two) over the plugin's daemon discovery ladder, written for **`bun test`** (`import ... from \"bun:test\"`, `Bun.serve({unix})`; the header says `bun test plugin/opencode/mcpx/daemon.test.ts`). Still never run by CI: `.github/workflows/` has no `bun test` or `deno test` step. Plugin direction: #47 (opencode v2), #48 (harness-free core).\n\nBaseline, run read-only on d0b7e01 with the tools installed on a dev machine (not the flake's pinned versions):\n\n| Check | Result |\n| --- | --- |\n| `gofmt -l .` | clean |\n| `deno fmt --check plugin` (deno 2.9.6, defaults) | 9 files differ: 4 TS/TSX (`daemon.ts`, `daemon.test.ts`, `mcpx-session.ts`, `mcpx-tui.tsx`) + 5 Markdown (`README.md`, four `SKILL.md`). The plugin is written in opencode's style (no semicolons); deno's default adds them. With `--no-semicolons --line-width=120` all 9 still differ. |\n| `deno lint plugin` | 13 problems in 4 files: `no-explicit-any` x6, `require-await` x5, `no-unreachable` x1, `no-unused-vars` x1 (`summarise`) |\n| `shellcheck scripts/*.sh` | 3: SC2034 and SC2319 (warnings, `stress.sh:13,87`), SC2012 (info, `bench.sh:60`) |\n| `shfmt -l scripts/*.sh` (defaults) | both files differ |\n| `nixfmt --check pkgs/mcpx/package.nix` | \"not formatted\" (system nixfmt; the flake's may differ) |\n| golangci-lint, staticcheck, gofumpt, actionlint | not installed; unknown |\n\nSo turning any of this on needs one clean-up commit first (or a baseline), and a style decision for TypeScript.\n\n## The tool set\n\n| Area | Formatter (check mode) | Linter (>= warning) | Notes |\n| --- | --- | --- | --- |\n| Go | `gofmt -l` (via treefmt `programs.gofmt`) | `go vet ./...` + `golangci-lint` v2 | gofumpt: stricter, reformats; opt-in, not needed |\n| TypeScript (plugin, docs examples) | `deno fmt --check` with a `deno.json` matching the existing style | `deno lint` (recommended rules) + `deno check` | Deno is already a CI runtime; prettier/eslint would need `node_modules` |\n| Shell (`scripts/*.sh`) | `shfmt -d` (pick `-i` to match the files) | `shellcheck` at default severity (`style`, the strictest) | the treefmt comment says shellcheck \"failures\" -- for the whole repo; scope to mcpx first |\n| Nix (`pkgs/mcpx/package.nix`, flake) | `nixfmt` (already in treefmt) | `statix`, `deadnix` (optional) | |\n| Workflows | -- | `actionlint` (also shellchecks `run:` blocks when shellcheck is on PATH) | covers `mcpx-test.yml`, `format.yaml`; zizmor is security -> deferred |\n| Flake | -- | `flake-tidy all --check` (exists: `checks.tidy`, `just tidy-check`) | repo-wide; run when `flake.nix`/`flake.lock` change |\n| Repo invariants | -- | `test -L pkgs/mcpx/README.md` | from the release runbook; one line |\n\ngolangci-lint configuration, \"warning or more than minimal\": v2 with `linters.default: standard` (errcheck, govet, ineffassign, staticcheck, unused) **plus** a curated set that fits this codebase -- e.g. `errorlint`, `bodyclose`, `noctx`, `misspell`, `unconvert`, `usestdlibvars`, `gocritic` (diagnostic tags), `revive` (a few rules). From #169: `staticcheck` with `checks: [\"all\"]` rather than its default subset, and `copyloopvar` (Go 1.22 made the `rt := rt` idiom redundant; `internal/e2e/runtime_test.go:15,47` still carry it). Not `gosec` in the blocking set: security is deferred, and on a process-spawning CLI it yields a large low-signal backlog. Not `default: all`: it enables style linters that contradict each other and would turn the first PR into a rewrite. Commit `pkgs/mcpx/.golangci.yml`; new linters are added one PR at a time with their fixes.\n\nTypeScript style decision: either adopt deno's defaults and reformat the plugin once, or write a `deno.json` `fmt` block that matches the current opencode style. The plugin is loaded by opencode and #47/#48 may move or reshape it -- coordinate there before a mass reformat; lint can start immediately since it is independent of style.\n\nMarkdown: `deno fmt` also formats `.md`. The book is the docs tree's; exclude `docs/**` and `AGENTS.md` until the docs tree decides its own formatting.\n\n## Approaches -- how tools are installed and pinned\n\n### A -- marketplace actions per tool (least recommended)\n\n`golangci/golangci-lint-action`, `reviewdog/action-shellcheck`, `raven-actions/actionlint`, each with its own version input. Fast to write, and golangci-lint-action caches well. But every tool's version lives in YAML, local runs use whatever is installed (the baseline above already used unpinned local tools), and Renovate bumps them independently of the flake. This is how \"passes locally, fails in CI\" starts.\n\n### B -- Go tools via the `tool` directive, the rest via actions\n\nGo 1.24+ `tool` directives in `go.mod` pin Go tools and `go tool golangci-lint run` works locally and in CI. But it adds golangci-lint's large dependency graph to `pkgs/mcpx/go.mod`/`go.sum`, which **changes the Nix `vendorHash`** and Renovate's grouped Go bumps get much bigger (the vendorHash repair exists precisely because those bumps are painful). Pins Go tools only; shell/Nix/TS tools stay unpinned.\n\n### C -- the flake pins everything; treefmt for formatters, a dev shell for linters (recommended)\n\n- Formatters: extend `treefmt.nix` with `programs.gofmt`, `programs.deno` (fmt), `programs.shfmt`, keeping `nixfmt`; scope the new ones to `pkgs/mcpx/**` with per-program `includes` so the rest of the repo is not reformatted by this issue. treefmt-nix ships modules for gofmt, gofumpt, goimports, golangci-lint, deno, prettier, biome, shfmt, shellcheck, actionlint, nixfmt, statix, deadnix (seen in a local copy of the input; confirm against the pinned rev). CI runs `nix fmt -- --ci` (or builds `checks.x86_64-linux.formatting`) -- check mode, non-zero on any diff, prints the diff. Locally `nix fmt` gives byte-identical results because it is the same derivation.\n- Linters: the `devShells.mcpx` that #134 proposes (go, gopls, deno, bun, node, git, python3, golangci-lint), extended with `shellcheck`, `actionlint`, `statix`, `deadnix` -- one shell, pinned by `flake.lock`; CI runs `nix develop .#mcpx -c \u003clinter>`; locally the same command. **Do not run golangci-lint through treefmt**: its treefmt module runs `golangci-lint run --fix` per file, which needs module downloads (not available in the `checks` sandbox) and rewrites code.\n- Costs: the Nix install (~8 s) plus substitution per lint job; competitive only with a store cache (#135 decision 7). One `flake.lock` bump updates every tool at once -- that is the point, and also a risk (a formatter upgrade reformats; #142 handles that).\n\nRecommended because it is the only option where local == CI by construction, it reuses what the repo already has, and it keeps Go tool dependencies out of mcpx's `go.mod`.\n\n## Matrix layout\n\nThree lint legs, each small, plus a plugin test leg:\n\n| Leg | Runs | Expected |\n| --- | --- | --- |\n| `fmt` | `nix fmt -- --ci` (all formatters, scoped) | seconds after Nix setup |\n| `lint-go` | `go vet ./...`, `golangci-lint run` (with Go build cache from #135) | the slowest lint leg; type-checks the module |\n| `lint-other` | `deno lint`, `deno check`, `shellcheck`, `actionlint`, `statix`/`deadnix`, README symlink, `flake-tidy --check` when the flake changed | seconds |\n| `plugin` | `bun test plugin/opencode/mcpx/daemon.test.ts` (needs Bun only; pin the flake's Bun) | seconds |\n\nIf queue pressure shows up (#140), `fmt` and `lint-other` merge first. Run `plugin` under Deno and Node too only if #48 makes the core runtime-neutral (today the test imports `bun:test` and `Bun.serve`, so it is Bun-only). `scripts/stress.sh` and `scripts/bench.sh` stay manual (they use real servers from `.mcpx.json`); #97 decides whether a stress leg exists.\n\n## Implementation order (small PRs)\n\n1. `.golangci.yml` with `default: standard`, `go vet`, gofmt check, shellcheck/actionlint -- fix what they find (small: gofmt is clean, shellcheck has 3).\n2. `plugin` leg: `bun test` (no reformat needed).\n3. `deno lint` (13 fixes) and `deno check`.\n4. TS/shell/Nix formatting once the style is agreed: one reformat commit per language, then the check turns on. Add the reformat commits to `.git-blame-ignore-revs`.\n5. Curated extra golangci linters, one per PR.\n\nAlternative sequencing (from #169), for any linter whose backlog is too big for one fix-up PR: land it `continue-on-error: true` with `::warning::` annotations, fix the backlog in a dedicated PR, then flip it to blocking. Formatters block from day one either way -- a formatter has no judgement calls. Whichever path, the end state must be \"clean and enforced\", never another `# ... # failures` line like `treefmt.nix:6`.\n\n## Open questions\n\n1. TypeScript style: deno defaults vs matching opencode's (no semicolons, width 120)? Depends on #47/#48 plans for the plugin.\n2. shfmt flags for `scripts/*.sh` (indent width) -- match the existing files.\n3. Scope: mcpx only, or turn the whole-repo `checks.formatting` into a CI job too (#49's territory)?\n4. Is `nix flake check` usable as a CI step for mcpx, or does it evaluate/build too much of the repo (opencode patches, darwin-only packages)? Prefer building the single `checks.x86_64-linux.formatting` attribute.\n5. `deno check` of the plugin needs opencode's plugin types -- available offline, or does it need #48 first?\n6. Does `checks.formatting` pass on `main` today? Nothing runs it; the baseline above already found `pkgs/mcpx/package.nix` unformatted by a system nixfmt. If it is red, step one is the backlog, and its size is unknown (from #169).\n\n## Ease · Impact · Related\n\n**Ease** M (mostly clean-up and one style decision) · **Impact** med · **Depends on / related**: #95, #135 (legs, Nix cache, tool-version decision), #142 (auto-applies the same formatters), #140 (merge legs under queue pressure), #134 (the shared `mcpx` dev shell), #47, #48 (plugin shape and its tests), #49 (repo-wide format/tidy checks), #99 (which of these agents run locally: formatters yes, full lint maybe), #35 (version drift), #129 (its settings-effect guard needs this issue's `plugin` leg to cover plugin-scoped settings, which only the plugin's TypeScript reads).\n\nSecurity/auth deferred; see tracker.\n\n## Acceptance criteria\n\n- Every formatter/linter named in the body's CI matrix runs in CI pinned by the flake, the plugin's bun test runs, and the workflow is green.\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 (CI links, timings, or probe output as applicable) is recorded on this issue before it is closed.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T23:01:05Z","url":"https://github.com/developing-today/code/issues/1996"}
| 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:ca737880-7959-2694-447a-094eff13de6f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 82AE:23514F:A9BAE6:DC6BD0:6B06395B |
| html-safe-nonce | 85359fd3153c69247eaacd2f846c26b12b6357ce6a8455a9838154c1687acc13 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MkFFOjIzNTE0RjpBOUJBRTY6REM2QkQwOjZCMDYzOTVCIiwidmlzaXRvcl9pZCI6IjE2NDI2OTg4MTQ5NjYzNDgxMjMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f464943dcd739a2f7d5485eb4876607f7e1d72ffb8c5674339a724f837deb975 |
| hovercard-subject-tag | issue:6089083647 |
| 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/1996/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a182d2af1757cf19d221a9a4bf2582cd7fffaa3c3e13ce4bc8675fa3c3e7eb0b/developing-today/code/issues/1996 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a182d2af1757cf19d221a9a4bf2582cd7fffaa3c3e13ce4bc8675fa3c3e7eb0b/developing-today/code/issues/1996 |
| og:image:alt | Relocated from dezren39/darwin-nix#141 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 | dcf72c457c022486d23c3cbb0dd21aba537a87611ca9ddabd1799cf2eaa9b297 |
| 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 | 0f38f5735226749ec5e08a8649dce4cb2613d9ad |
| 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