Repository navigation
fix(cli): stop doctor and validate failing on lazily-created trials and warrants - #36
Merged
Merged
Conversation
…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.
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.
Two deterministic failures on main
Both predate the mcp-server fix in #35 — they were masked by it short-circuiting the job.
1.
doctor/validatefailed on a freshly-initialised workspaceREQUIRED_FILESwasCANONICAL_MEMOFS_FILES— the full canonical set. The trials-ledger work addedBOOTSTRAP_FILE_PATHSprecisely because those paths are created lazily on first append soinitoutput stays unchanged (its doc comment says so explicitly), but nothing repointed the CLI at it.REQUIRED_DIRSwas already correct, so the two were inconsistent.REQUIRED_FILES→BOOTSTRAP_FILE_PATHS(files that must exist)SNAPSHOT_FILES→CANONICAL_MEMOFS_FILES(capture what exists)snapshotmoves toSNAPSHOT_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
$idThe CLI stamped
$schema: https://docs.memofs.dev/schema/connectors.jsoninto.memofs/connectors.json, but both hosted schemas and both packaged schemas declarememofs.dev. Confirmed against what is actually served — both hosts resolve and return byte-identical documents, and the$idinside ismemofs.dev. The CLI constants were the outlier.Corrected both schema constants and the six stale test expectations, including a fixture in
@memofs/connectors. The remainingdocs.memofs.devreferences 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 useruns 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, twicedoctor-validate— 8/8 (was 5 failing)@memofs/connectors— 98/98connectors-schema— 5/5 (was failing)Known remaining
turbo run test:run --forcestill 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.