Skip to content

fix(cli): stop doctor and validate failing on lazily-created trials and warrants - #36

Merged
christophersesugh merged 1 commit into
mainfrom
fix/cli-doctor-validate-and-schema-url
Oct 18, 2026
Merged

christophersesugh merged 1 commit into
mainfrom
fix/cli-doctor-validate-and-schema-url

Conversation

@christophersesugh

Copy link
Copy Markdown
Contributor

Two deterministic failures on main

Both predate the mcp-server fix in #35 — they were masked by it short-circuiting the job.

1. doctor / validate failed on a freshly-initialised workspace

missing_file  .memofs/trials/assignments.jsonl
missing_file  .memofs/trials/outcomes.jsonl
missing_file  .memofs/warrants/history.jsonl

REQUIRED_FILES was CANONICAL_MEMOFS_FILES — the full canonical set. The trials-ledger work added BOOTSTRAP_FILE_PATHS precisely because those paths are created lazily on first append so init output stays unchanged (its doc comment says so explicitly), but nothing repointed the CLI at it. REQUIRED_DIRS was already correct, so the two were inconsistent.

  • REQUIRED_FILES → BOOTSTRAP_FILE_PATHS (files that must exist)
  • new SNAPSHOT_FILES → CANONICAL_MEMOFS_FILES (capture what exists)

snapshot moves to SNAPSHOT_FILES, preserving today's behaviour of including trial and warrant state in a snapshot once written. Silently narrowing the shared constant would have dropped that from snapshots.

2. Hosted schema URL disagreed with the published $id

The CLI stamped $schema: https://docs.memofs.dev/schema/connectors.json into .memofs/connectors.json, but both hosted schemas and both packaged schemas declare memofs.dev. Confirmed against what is actually served — both hosts resolve and return byte-identical documents, and the $id inside is memofs.dev. The CLI constants were the outlier.

Corrected both schema constants and the six stale test expectations, including a fixture in @memofs/connectors. The remaining docs.memofs.dev references are prose links that still resolve, so they are left for a separate sweep rather than bundled into a CI fix.

3. One flaky test

packs context for agent use runs three in-process CLI commands against a real filesystem and measured 5025ms against vitest's 5000ms default — a coin flip under parallel load. Given an explicit 30s timeout.

Verified

  • @memofs/cli — 235/235, twice
  • doctor-validate — 8/8 (was 5 failing)
  • @memofs/connectors — 98/98
  • connectors-schema — 5/5 (was failing)
  • typecheck and biome clean

Known remaining

turbo run test:run --force still fails @memofs/adapter-r2, which passes 5/5 in isolation. This suite is broadly load-sensitive — several tests sit near the 5s default and only fail when ~26 packages run in parallel. That is a separate systemic issue and not addressed here.

…nd warrants

Two deterministic failures on main, both predating the current work.

REQUIRED_FILES was CANONICAL_MEMOFS_FILES, the full canonical set. The trials
ledger added BOOTSTRAP_FILE_PATHS precisely because trial ledgers
(trials/*.jsonl) and warrants/history.jsonl are created lazily on first
append, so init output stays unchanged — but nothing repointed the CLI at it.
Every freshly-initialised workspace therefore failed:

  missing_file  .memofs/trials/assignments.jsonl
  missing_file  .memofs/trials/outcomes.jsonl
  missing_file  .memofs/warrants/history.jsonl

REQUIRED_FILES now means "must exist" and is BOOTSTRAP_FILE_PATHS. Snapshot
needs the opposite — capture whatever exists — so it moves to a new
SNAPSHOT_FILES = CANONICAL_MEMOFS_FILES, preserving today's behaviour of
including trial and warrant state in a snapshot once written.

Also corrects the hosted schema URLs from docs.memofs.dev to memofs.dev. The
CLI stamped a $schema into .memofs/connectors.json that disagreed with the
published $id; both hosted and both packaged schemas declare memofs.dev, so
the CLI constants were the outlier. Verified against what is actually served.

Finally gives "packs context for agent use" an explicit timeout: three
in-process CLI runs measured at 5.0-5.5s against vitest's 5s default, so it
failed intermittently under parallel load.

Verified: @memofs/cli 235/235 twice, doctor-validate 8/8, @memofs/connectors
98/98, typecheck and biome clean.
@christophersesugh
christophersesugh merged commit 8ebe942 into main Oct 18, 2026
1 check passed
@christophersesugh
christophersesugh deleted the fix/cli-doctor-validate-and-schema-url branch October 18, 2026 23:02
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