test(client): the rest of the writeSkills suite - #34
Merged
Merged
Conversation
This was referenced Aug 25, 2026
XieX
force-pushed
the
xie/skills-06-write-fs-tests
branch
2 times, most recently
from
August 28, 2026 20:30
cf1326b to
bf1a9e2
Compare
XieX
force-pushed
the
xie/skills-06-write-fs-tests
branch
2 times, most recently
from
August 31, 2026 18:10
9141f55 to
d70ce4a
Compare
XieX
force-pushed
the
xie/skills-06-write-fs-tests
branch
from
September 14, 2026 20:13
d70ce4a to
1d0ebd2
Compare
XieX
marked this pull request as ready for review
September 14, 2026 20:35
The functional half of the materialization suite, split out so it is not read alongside the implementation and the abuse matrix in one sitting. No source changes — everything here covers code that already landed, and the gap it closes is real: until now `writeSkills` had its defenses proven but not its ordinary behaviour. - Basic writes and the returned report: what lands on disk, at what path, and what each `ReconcileAction` says about it. - Manifest: the serialization is asserted byte for byte, since it is a cross-language on-disk contract. Written literally rather than by importing the implementation's own constants — a test that imported them could not detect a change to them. - Reconcile semantics: `written`, `updated`, `skipped_current`, `removed`, and the `prune` and `onUnavailable` behaviours, including that a retrieval failure under `keep` leaves existing content alone. - Root handling, and the bare-string guard on the argument surface. - Atomicity and permissions: the temp file is created in the target's own directory so the rename is same-filesystem rather than cross-device, the mode is `0644`, and a failure injected between write and rename leaves no partial file and produces an `error` action. - Resilience: an unreadable directory, a failing unlink, a manifest that cannot be rewritten. One skill failing never takes the run down, and every failure appears in the report. - Verify-then-write: content is re-verified immediately before the write, so a `Skill` a caller built by hand gets the same treatment as one an accessor produced. - Orphaned temp files: the sweep removes an orphan a killed reconcile left behind, and does so ahead of the prune, so the `rmdir` that empties a skill directory is no longer blocked by one. Most of the block is about what the sweep must *not* touch — a customer file, a temp-shaped name that fails the anchored pattern at either end, a temp for another target, a symlink wearing a temp name, anything in the managed root itself, and everything at all when the manifest is corrupt. - The write half of the telemetry seam, with the same allowlist sweep the accessor half applies: three signal names, no content, no paths. Client package: 555 -> 619 tests (+2 skipped). typecheck, biome, and sherif clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Per review feedback. The two manifest serialization tests asserted the right bytes but named the Python SDK in their titles and rationale. They now describe the shared on-disk form directly — two-space indent, sorted keys, no trailing newline, non-ASCII escaped as \uXXXX — which is what the assertions actually check. No assertions changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
XieX
force-pushed
the
xie/skills-06-write-fs-tests
branch
from
September 16, 2026 18:26
1d0ebd2 to
1c2c602
Compare
andrewklatzke
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sixth of seven. Test-only — the functional half of the materialization suite, split out so it isn't read alongside the implementation and the abuse matrix in one sitting.
This closes the coverage gap the previous PR flagged: until now
writeSkillshad its defenses proven but not its ordinary behaviour.What's covered
ReconcileActionsays about it.written,updated,skipped_current,removed, and thepruneandonUnavailablebehaviours, including that a retrieval failure underkeepleaves existing content alone.0644, and a failure injected between write and rename leaves no partial file and produces anerroraction.Skilla caller built by hand gets the same treatment as one an accessor produced. Directly constructedSkills carryUint8Arraycontent, and the pass hashes those bytes as-is; thecontent_bytestelemetry property is asserted to be the encoded byte count.rmdirthat empties a skill directory is no longer blocked by one. Most of the block is about what the sweep must not touch: a customer file, a temp-shaped name that fails the anchored pattern at either end, a temp for another target, a symlink wearing a temp name, anything in the managed root itself, and everything at all when the manifest is corrupt.Verification
Client package 555 → 619 tests (+2 skipped). Workspace 1148 passing.
typecheck,biome, andsherifclean.The 2 skips are expected: the TOCTOU swap-race pair, gated off
SUPPORTS_DIR_FD, which isfalseon Node because it exposes no*at()syscall family.🤖 Generated with Claude Code
Note
Overview
Test-only expansion of
skills-fs.test.ts: closes the gap wherewriteSkillshad security/abuse coverage but not ordinary materialization behavior.Adds large new Vitest blocks for basic writes (Skill vs store refs,
"*", reconcile actions), manifest byte-level contract (sorted keys, no trailing newline,\uXXXXescaping, unknown field preservation), reconcile/prune semantics, root and argument validation, atomic rename/unlink (includinginterceptUnlinkandassertAtomicRenameOf), resilience (onUnavailable, timeouts, no prune on store outage, no retries), verify-then-write, orphaned temp sweep (narrow pattern, corrupt manifest suppresses sweep), and the write-side telemetry allowlist (Materialized, Revoked, Integrity; no paths or bodies).Shared harness additions:
RecordingEmitter,_setStore/_setEmitterForTesting, telemetry signal constants, and a test hygiene check thatfsOpsmocks are restored between tests.Reviewed by Cursor Bugbot for commit 1c2c602. Bugbot is set up for automated code reviews on this repo. Configure here.