Skip to content

[split 2/8 of #1321] atomic SKILL.md publish + SkillDiagnostic, with the 2 rows it changes - #76

Open
easonLiangWorldedtech wants to merge 1 commit into
prep/skills-test-harnessfrom
units/skills-02-atomic-write
Open

easonLiangWorldedtech wants to merge 1 commit into
prep/skills-test-harnessfrom
units/skills-02-atomic-write

Conversation

@easonLiangWorldedtech

@easonLiangWorldedtech easonLiangWorldedtech commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Unit 2 of the eight-unit split of Zoo-Code-Org#1321 planned in comment 6777921244 on Zoo-Code-Org#1321 (contract comment 6774239651).

Parent: prep/skills-test-harness at b66149f6c09e (unit 1, which is Zoo-Code-Org#2417). This is a fork PR against its predecessor branch because the parent is a unit rather than main; it re-opens in the org repo once the parent merges.

What it carries

  • src/services/skills/SkillsManager.ts +396/-41: atomic SKILL.md publish (write to .SKILL.md.<random>.tmp, then rename onto the final path) and the SkillDiagnostic diagnostics path.
  • src/shared/skills.ts +9/-0: the shared type addition the manager returns.
  • src/services/skills/__tests__/SkillsManager.spec.ts +17/-5: the 2 rows whose expectations this production change makes true. They travel with the declaration that makes them true, so the unit is never shipped with a stale or a red suite.

Prices, taken before the push, with the base named

Axis Measured figure Base used
Width (git --numstat) +422 / -46 = 468 added+deleted this commit against its own parent b66149f6c09e
Changed executable lines (scripts/stryker-diff.mjs) extension: 262 against MAX_CHANGED_LINES 500 merge base with the parent, b66149f6c09e
Generated mutants (instrument preflight) 236 against MAX_MUTANTS 400 same merge base

selectFromGit("b66149f6c09e", "6471e7fbd8a9") reported merge base b66149f6c09e2e4649a677049c9b47a336c6a3de, packages [{id: "extension", changedExecutableLines: 262}], advisories []. The 262 lines are the binding axis; the 236 is a preflight reading whose instrument is disclosed below.

How the mutant figure was taken

  1. Instrument delta. The committed scripts/stryker-diff.mjs cannot start Stryker on this machine: node_modules/.bin/stryker is a #!/bin/sh shim (1,724 B, siblings stryker.CMD 1,584 B and stryker.ps1 2,439 B) that spawnSync will not launch on Windows. The committed script exited 1:

    Mutation-testing 1 package(s) from merge base b66149f6c09e: extension (262 lines)
    extension Stryker preflight could not start: spawnSync C:\work\Zoo-Code-fork\wt-r235-prep\node_modules\.bin\stryker ENOENT
    

    The 236 came from a copy of that same 30,108-byte script (digest c332971815aecfaf, blob identical at main tip and at the parent) carrying two edits, and only two. Edit 1 is the spawn target: process.execPath against node_modules/@stryker-mutator/core/bin/stryker.js instead of node_modules/.bin/stryker. Edit 2 is the ceiling: 40 minutes instead of the 12 minutes the committed script sets at line 424, so nothing in the reading below was taken under the committed ceiling. The copy is scratch, never committed, and it is now deleted.

  2. This is not a new finding. It is the defect Mutation gate spawns the extensionless .bin/stryker shim without a shell, which cannot start on Windows Zoo-Code-Org/Zoo-Code#2410 already reports, and the campaign has two reproductions there, one of which invokes exactly this shape (process.execPath against node_modules/@stryker-mutator/core/bin/stryker.js). CI on Linux is unaffected.

  3. The 236 stays labelled as a number taken with that copy until a CI digest keyed to head 6471e7fbd8a9 says otherwise; at that point the digest is the source and the local figure becomes the corroborating reading. A digest comment is reused per PR and re-keyed to the head it measured, so its comment id is not a run identifier.

With the copy, the preflight stage reported:

INFO ProjectReader Found 1 of 1383 file(s) to be mutated.
INFO Instrumenter Instrumented 1 source file(s) with 236 mutant(s)
INFO DryRunExecutor Initial test run succeeded. Ran 1305 tests in 2 minutes and 47 seconds

236 mutants over 262 counted lines is 0.9007 mutants per counted line, measured at head 6471e7fbd8a9 over the file set that run mutated (Found 1 of 1383 file(s) to be mutated; Instrumented 1 source file(s)). The record's 1.0323 per counted line, which predicted roughly 270 here, was measured at 1911 over 5 of 1,383 files and 373 instrumented mutants against 496 lines at main tip, so the ratio is a property of the file set being mutated and not a constant of the repository; it is quoted here as an estimate with a named source, not as a prediction, and it is not reused as a multiplier for a one-file extension delta. The full-run stage with the copy exited 1 and printed, into the file the script itself writes for a PR comment (wt-r235-prep/.tmp-reports-s1/pr-comment.md, a local run print and not a comment on any pull request - this unit has no CI run behind that head marker yet, because the fork reported 0 check-runs and 0 status contexts for it), a head marker head:6471e7fbd8a94ac732197f2ee488e8fbc47902ce blocking:0 advisories:1 with Valid 0, Killed 0, Timeout 0, Survived 0, No coverage 0 and the advisory:

extension mutation run exceeded 12 minutes. Split the PR or obtain a maintainer-reviewed narrow exclusion.

That advisory text is stage-blind in the script (line 442 emits it for either stage, while line 447 is what names a stage), so which spawn hit the ceiling is inferred, not quoted: the measured dry run finished 2 minutes 51 seconds after ProjectReader logged, and the script calls the preflight before the run, so on this machine the ceiling that was reached belongs to the run stage. The advisory is evidence about the wall clock and about the run stopping; it is not evidence about kills. extension is a package whose discoverRelatedTests is false, so the vitest shim in resolveVitestBinary is never spawned for it at all.

a green local preflight over Valid 0, Killed 0, Survived 0 and No coverage 0 with blocking 0 and advisories 2 is not evidence in either direction on this machine.

the mutation leg is unmeasured, a PASS over an empty digest is not evidence in either direction, and CI at the first pushed unit is the only proof of the gate.

Verification on this commit

  • Focused vitest (services/skills/__tests__/SkillsManager.spec.ts): 94 passed (94).
  • Control with this unit's spec against the parent's two production blobs: 2 failed | 92 passed (94), both inside createSkill, both on the staging path: should create a new global skill at spec line 2066 (expect(String(writeCall[0])).toMatch(/[\/\\]new-skill[\/\\]\.SKILL\.md\.[^/\\]+\.tmp$/)) and should allow creating a .roo skill when the duplicate lives in the lower-priority directory at spec line 2188 (expect(String(staged)).toMatch(/\.SKILL\.md\.[^/\\]+\.tmp$/)). On the parent production the write lands directly on SKILL.md, which is the failure the assertions name.
  • tsc -p tsconfig.json --noEmit: 0 errors.
  • pnpm run check-types (cold pair, not deferred): 12 tasks successful, 12 total, 10 cached, 5.373 s.
  • eslint --prune-suppressions --max-warnings=0 on all three touched paths: 0 errors, and src/eslint-suppressions.json byte-equal to the parent blob, so no count moved.
  • prettier --check on the touched paths: 0.
  • Committed with hooks live and no --no-verify; hook stderr was 0 bytes. git status --porcelain --untracked-files=all after the commit lists only .local/state/gh/device-id.

Review-state labels are managed by the reconcile workflow, so nothing was set here; labels were read as empty.

The extension's skills service now stages SKILL.md through a sibling temp file and
renames it into place, so a reader never observes a half-written file, and it reports
per-skill load failures through the SkillDiagnostic type added to src/shared/skills.ts
instead of swallowing them.

The two spec rows whose expectations this changes travel with it: 'should create a new
global skill' and 'should allow creating a .roo skill when the duplicate lives in the
lower-priority source' assert the staging path and the rename pair that the old rows
asserted as a single write. Running the production change against the previous row text
fails exactly those two rows and nothing else, which is why they are in this unit rather
than in a later spec-only unit: a unit that moved the production file without them would
land a red head.

Focused suite 94 of 94 on node v22.23.4, tsc --noEmit clean, eslint --prune-suppressions
reports 0 problems for all three files with the suppression counts unchanged, and
prettier --check passes for all three.

This branch has not been deployed

No deployments
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