Skip to content

mozak 0.6.0: vault-only (draft, CI only, do not merge) - #3

Merged
pitfa19 merged 10 commits into
mainfrom
release/0.6.0
Nov 2, 2026
Merged

pitfa19 merged 10 commits into
mainfrom
release/0.6.0

Conversation

@pitfa19

@pitfa19 pitfa19 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

See CHANGELOG 0.6.0 and docs/release-notes-draft.md. Draft for CI only; main is fast-forwarded by the owner.

…entry there

Why: 0.6.0 makes mozak vault-only (spec step 2). Scopes outside a vault
and repo scopes need one owner route that moves their plan files into a
vault without hand edits to mozak.json or the inventory.

What:
- core scope-move.ts: moveScope copies mozak.json, mozak.md (or the
  pre-0.4 names), mozak.annotations.json, README.md and AGENTS.md
  through flushed temp files, verifies every copy byte for byte, then
  rewrites only that inventory entry to { id, root } (other keys such
  as focus and x kept, every other entry untouched) under the
  inventory lock with the same validated atomic write as focus. It
  refuses a target outside a vault (no .obsidian at or above it), a
  target that holds mozak files or any file it would write, another
  scope's root and a source that fails check. Works on local entries,
  legacy vault-plans entries (in place: entry only) and repo-cache
  entries. The old files stay. A failure before the inventory rename
  removes the copies and folders it made. A change to the source under
  the scope lock stops it with stale-input. Idempotent. --dry-run
  writes nothing. --drop removes a 0-plan entry (spec step 11 names
  this form). A pinned spec left behind is a spec-not-moved warning.
- core inventory-file.ts: the inventory lock, JSON style and validated
  write, shared by focus and scope move (focus behaviour unchanged).
- vault-config.ts: vaultOf, the one place the vault rule lives.
- CLI: mozak scope move --scope ID (--to PATH | --drop) --owner-ref
  --owner-message-at --reason [--dry-run] [--json]. Owner route, not in
  MCP.

Proof: scope-move.test.ts and scope-move-cli.test.ts failed first
(missing module, unknown route) and pass: local scope, vault-plans
entry, repo-cache entry, refused targets, failure halfway through (two
injected phases), stale source, plans and receipts byte-identical,
drop. npm test 646 of 646 under default TMPDIR, /tmp and a realpath
folder, test:install 73 + 1 skipped.
ub-mode: CRAP planMove 8.0, moveScope 7.1, assertTargetFree 7.0,
parseMoveArgs 6.0, renderMove 6.0, copyVerified 6.0, others under 5.
dryer: no candidates. mutator scope-move.ts + inventory-file.ts: 62 of
62 killed (dead fallbacks it found were removed).
Why: spec step 3, owner answer of 2026-11-01 ("enforce, do not only
warn"). mozak keeps plans in vaults only.

What:
- loadInventory marks an entry whose root has no folder with .obsidian
  at or above it as refused (scope-outside-vault, naming mozak scope
  move). It is never a whole-inventory error: the entry stays listed,
  other scopes keep working, and scope move still reads it.
  resolveScope throws the refusal, so every read and write route
  refuses the scope. All-scope loops (render, rename-files, similar,
  locators, plans-md) now resolve each entry; local sync and default
  locator roots skip refused entries.
- doctor (source and npm installs) reports the scope with its code and
  the scope move fix (inventoryFix, one place for the next step).
- Test fixtures create their temp base as a vault (test/vault-temp.ts),
  so existing tests run on vault fixtures as the spec asks. The demo
  vault script, the README example and the installer test make the
  .obsidian folder first.

Proof: vault-rule.test.ts (vaultOf, loader keeps and refuses, every
route refuses, all-scope reads report failed coverage, scope move
reads the refused entry) and the doctor tests failed first, pass now.
Before the fixture change 216 existing tests failed on the new rule,
after it none. npm test 652 of 652 under default TMPDIR, /tmp and a
realpath folder, test:install 73 + 1 skipped.
ub-mode: CRAP resolveScope 7.0 (was 10, entry selection split into
selectEntry 4.0), inventoryFix 5.0, vaultOf 4.1, vaultRule 2.0.
loadInventory stays at CC 46 (pre-existing; step 4 restructures it).
dryer: no candidates. mutator on the changed lines: scope-index 5 of
5, vaultOf 1 of 1, inventoryFix 8 of 8 killed.
…ve command

Why: spec step 4. 0.6.0 no longer accepts remote, ref or plans entries
as working scopes. Such an entry must not break the inventory: other
scopes keep working and mozak scope move can read it.

What:
- core legacy-entry.ts: an entry with any of remote, ref, plans is kept
  as a refused entry (legacy-repo-scope). Its root is where its plan
  files are on this machine: the plans folder for a vault-plans entry,
  a 0.5.0 full clone named (absolute path) in the cache metadata while
  it still holds mozak.json, else the sparse cache copy. The message
  names the remote and the exact command, with --to set to the plans
  folder when it is already in a vault and --config set to the
  inventory. No URL parsing, no git, no network.
- loadInventory split into readInventoryJson, localEntry, legacyEntry,
  entryId and assertUnique. Legacy keys stay closed and strict (no root
  beside them, no unknown keys, safe id). The digest is the v2 shape
  for every entry, so local-entry digests are unchanged. ScopeEntry no
  longer gets a remote from the loader, so every remote code path is
  now unreachable (step 6 deletes it).
- sync --scope and pull resolve through resolveScope, so they refuse a
  legacy entry like every other route.
- Tests: legacy-entries.test.ts (new). remote.test.ts,
  vault-plans.test.ts, visibility.test.ts and s2-offline.test.ts are
  deleted: every test in them exercised repo-scope behaviour that no
  longer exists. Their still-valid parts moved: entry strictness,
  digest stability and "local reads never fetch" into
  legacy-entries.test.ts. cwd-scope, render and the plugin model test
  now assert the refusal.

Proof: legacy-entries.test.ts failed first (no refusal, plugin row
without error) and passes (9 tests). npm test 638 of 638 under default
TMPDIR, /tmp and a realpath folder, test:install 73 + 1 skipped.
ub-mode: CRAP loadInventory 8.0 (was CC 46, CRAP 46.6), legacyEntry
8.0, readInventoryJson 8.0, legacyLocation 7.0, repoModeRoot 4.0,
assertUnique under 5. dryer: no candidates. mutator legacy-entry.ts
and the loader lines: 38 killed, 2 equivalent survivors in the id sort
comparator (ids are unique, so < and <= and the tie value never
differ).
Why: spec step 5, owner answer of 2026-11-01 ("keep a display-only repo
link per scope"). With repo scopes gone, the sidebar and scopes still
point at the code repo, without git or the network.

What:
- core repo-link.ts: parseRepoLink (github:owner/repo or an https URL
  with a host, nothing else), repoLinkUrl, repoLinkLabel. Pure.
- Inventory: optional `repo` on every entry, validated at load
  (inventory-invalid with the accepted forms), carried on ScopeEntry.
  The digest ignores it, as with focus.
- core scope-link.ts: mozak scope link --scope ID (--repo SPEC |
  --clear), owner route, same inventory lock and validated write as
  focus; entry order, indent and other keys kept; idempotent.
- scope move --repo SPEC sets the link on the moved entry (spec step
  2's form); without it an existing link is kept. --repo with --drop is
  refused.
- scopes prints "repo: SPEC" and the JSON row carries repo. The plugin
  view model has repo { spec, url, label } and the scope row shows a
  hover link icon (an anchor, opened by Obsidian, never fetched).
- MCP: no write tool (owner route only).

Proof: repo-link.test.ts and the CLI scope link test failed first
(missing modules, unknown route) and pass. npm test 645 of 645 under
default TMPDIR, /tmp and a realpath folder, test:install 73 + 1
skipped.
ub-mode: CRAP parseRepoLink 8.0, parseMoveArgs 6.0 (repo parsing split
into moveRepoArg), linkScope 5.0, localEntry 5.0, movedEntry 5.0,
others under 5. dryer: no candidates. mutator repo-link.ts and
scope-link.ts 17 of 17 killed (dead "."/".." checks removed: the slug
pattern already refuses them); moveRepoArg, movedEntry and the loader
repo lines all killed.
0.6.0 is vault-only. Deletes remote.ts, remote-meta.ts, visibility.ts and
working-copy.ts. sync is local-only (fetch, then fast-forward each vault
repo); the pull route and the MCP mozak_sync tool are gone; scoped reads
always need --scope (no scope from a clone's git origin); bare plans lists
every scope. The plugin drops the Repos group, stale and visibility badges,
remote polling and the cache watch; a scope's display-only repo link stays.

Release-scope tests guard that no remote module, export, pull route or
clone remains and that fetch is used only by upgrade and local sync.
…sclosures

README: plans live only in vaults, inventory example with root and repo,
reads never fetch, sync and --commit are the only scope git, New in 0.6.
installation.md: section 6b vault-only scopes and a "Moving to 0.6.0"
section with the exact scope move steps; sync, focus and limits updated.
Plugin README and submission checklist: no repo scopes, no background git,
no GitHub API; repo links are never fetched. Skill bootstrap and routes:
vault rule, legacy-repo-scope, --scope always, scope move and scope link.
SPEC banner, AGENTS.md, annotations and plans-index docs updated.
CHANGELOG 0.6.0 (breaking) and 0.5.0 dated; release notes draft for 0.6.0.

Version 0.6.0 in package.json, package-lock.json, the four packages and
their @mozak/core pins, manifest.json, the plugin manifest; versions.json
maps 0.6.0 to 1.14.4. The version test failed with only the root bumped
and passes now. Doc tests now guard the 0.6.0 disclosures.

Gate 07-docs-version: build ok, npm test 643/643 in three TMPDIR settings,
test:install 73 passed, 1 skipped; links 0 broken. Docs and version only,
so no crapper, dryer or mutator run.
…ot a refusal

Found by the migration rehearsal on copies of the laptop data: the anpit-web
repo-mode cache (a 0.5.0 sparse clone) never checks out the repo's
.gitignore, so check reports lock-not-ignored there and the move refused.
That finding is about the folder the move leaves behind, not the plans it
copies. lock-not-ignored and lock-ignore-unavailable now come back as
source-* warnings; every other check finding (hand edits, lock-in-git,
stuck locks) still refuses, and check's info entries never count.

verify-old-client-sidecar.sh: its temp base is a vault now (.obsidian),
since the branch CLI refuses scopes outside a vault.

Test first: the new scope-move test failed with move-source-fails-check,
passes now. scope-move.test 14/14. crapper: assertSourceChecks 4.0,
planMove 8.0. dryer: none. mutator on assertSourceChecks 5/5 killed after
removing a redundant early return that a surviving mutant exposed.
Gate 08-move-fix: 644/644 in three TMPDIR settings, install 73+1.
… migration and upgrade rehearsals

Docs only (installation.md section 8 and the status table, README test
count 644). Numbers from logs/08-* in the release work folder.
…e bundle check

Docs only. The flake: recovery-required in one round of the kill -9 test
(lock folder without owner.json), lock code and test unchanged since 0.5.0;
five reruns and the full suite passed in the same folder.
…, sync between two clones, MCP

Docs only. Log: logs/09-e2e-npm.log in the release work folder.
@pitfa19
pitfa19 merged commit acb033e into main Nov 2, 2026
4 checks passed
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