Skip to content

Ignore what the ledger format doesn't name (#104) - #105

Merged
shovon merged 2 commits into
mainfrom
worktree-ledger-ignore-unnamed-104
Oct 27, 2026
Merged

shovon merged 2 commits into
mainfrom
worktree-ledger-ignore-unnamed-104

Conversation

@shovon

@shovon shovon commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Closes #104.

What changed

Code (packages/ledger/ledger.ts): #scan now skips dot-entries, files and folders, at the top of the ledger and inside writer directories. inspect already did this, and now both use one hidden() check. Before this change, .git, .stfolder and .stversions were each read as a writer, and a segment-named file inside .git was actually folded.

Spec (packages/ledger/multi-writer.md): a new section, "What else the folder may hold":

  • The rule: a writer writes the format exactly, a reader ignores what the format does not name (as long as that does not change the fold), and a build may add files.
  • Extras at the top are files. No name pattern for writer directories. Every non-dot folder at the top is still a writer, and a build that needs a folder there changes the format. Every writer directory so far is named by a UUID (randomUUID() before and after Swap @pbnotes/ledger for @pbnotes/append-only-log in the app #50, a UUIDv8 from openWriter). A pattern was considered, but it protects nothing until every build in use has it, and it would mean renaming every writer folder in the tests.
  • Dot-entries are ignored everywhere and are not listed in status.ignored. Everything else the format does not name is still listed.
  • The marker check is unchanged. A file at the top that several writers may create is created with an exclusive create, never rewritten, and has the same bytes on every build of one format version. And these extras are not a back door for format changes.
  • Named extras: the list starts empty. AGENTS.md and the code that reads the list land in ledger: write an AGENTS.md at the root of a new ledger #63.
  • "LEDGER is the only file at the top" now says "the only file required at the top". app/CLAUDE.md says the same.

For the reviewer

Tests

  • New test: a .git folder that holds a valid segment folds nothing. .stfolder, .DS_Store (at the top and in a writer folder) and a Syncthing temp file are neither read nor listed. A plain notes.txt at the top is still listed in status.ignored. The test failed before the fix (.git-1 was folded).
  • npm test (138 tests across all workspaces) and npm run typecheck pass.

🤖 Generated with Claude Code

shovon and others added 2 commits October 27, 2026 15:01
The format said what a ledger folder must hold and nothing about what else
may be in it. The code filled the gap by accident: #scan read every folder at
the top as a writer, .git and .stfolder included, so a segment-named file
inside .git was folded.

#scan now skips dot-entries at the top and in writer directories, the way
inspect already did, and does not list them in status.ignored. Everything
else the format does not name is still listed there.

multi-writer.md gets a section with the rule (a writer writes the format
exactly, a reader ignores what it does not name, a build may add files),
extras at the top as files only, the unchanged marker check, the rule for
shared files at the top, and an empty list of named extras for #63.
"LEDGER is the only file at the top" becomes "the only file required".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-unnamed-104

# Conflicts:
#	packages/ledger/ledger.ts
@shovon
shovon merged commit d6ba1df into main Oct 27, 2026
1 check 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.

ledger: ignore what the format doesn't name, instead of refusing or reporting it

1 participant