Skip to content

sweep: note.daily computes the daily-note path before it takes the vault's lock, but lodge-app.md says it is judged under the lock #250

Closed

Description

@frostyard-machines

Kind: non-conformance. Severity: low (a race with a change of the daily-note settings), but it is an agent scope check.

Rule: docs/specs/lodge-app.md lines 282-284:

note.daily and note.appendDaily: the day's note writable, or under daily today's, and not under except. It is judged under the vault's lock, at the path the daily-note settings give.

Where (commit 83fb2a5): internal/vault/daily.go lines 72-93, withDaily:

  • line 73 reads the settings (LoadSettings(v.root)) and line 77 computes the path (DailyPath(settings.Daily, date)) before line 86 takes the lock (v.lock());
  • line 93 then judges that path (checkGuard(ctx, p)), under the lock.
  • internal/vault/configure.go line 31: Configure writes the settings under the same lock, so it can change the daily-note folder or format between lines 77 and 86.
  • api/scope.go line 330, CheckDaily, allows a daily token to write p when today is true, whatever p is.

Why it matters: A token limited to today's daily note can, in that window, write the note at the old daily path, which is no longer the daily note and can be outside the token's scope. The spec says the path is taken under the lock to close this.

Suggested fix: Read the settings and compute the path after v.lock(), and add a test that changes the settings between the two steps (or a test that holds the order).

Activity

  1. added
    sweep
    on Nov 19, 2026
  2. added a commit that references this issue on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sweep

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions