Skip to content

Make explicit-file changes, stage, and commit truly targeted #154

Description

@c0da-ricon

Problem

Explicit-file Notes workflows still perform whole-corpus change detection before applying the requested filename filter. On a large deobfuscated repo, the supposedly targeted path is too slow for interactive editing.

Observed with shiv:notes 0.8.19 in ricon-family/fold on 2026-07-17:

  • 437 manifest entries / 438 readable Markdown files;
  • git status --short --branch: 0.062s;
  • notes parse notes/notes-performance-fast-path.md: 0.804s;
  • notes changes notes/notes-performance-fast-path.md: exceeded a 20s hard timeout;
  • notes changes --summary: exceeded a 20s hard timeout;
  • targeted notes commit --dry-run ... notes/notes-performance-fast-path.md: exceeded a 20s hard timeout.

Each timeout terminated the command. No result was treated as complete.

Source finding

In 0.8.19:

  • .mise/tasks/changes calls detect_changes "$abs_notes_dir" before filtering by ARGS;
  • .mise/tasks/stage does the same before selecting requested paths;
  • .mise/tasks/commit delegates to stage, then calls whole-corpus detection again during post-commit verification.

A component probe on the same Fold checkout found:

  • stale-readable detection: about 3s;
  • batched lookup of 437 HEAD objects: 0.232s;
  • two batched attribute scans: 0.106s;
  • batched hashing of all 437 readable notes through configured Git filters: about 14s.

The explicit filename currently improves safety and scope, but not discovery cost.

Desired direction

Make explicit-file operations genuinely targeted while preserving fail-closed safety for the selected notes.

--all and deep diagnostic paths may remain whole-corpus operations. Ordinary edits to one or a few known notes should not hash every readable note multiple times.

Acceptance

  • notes changes <known-file> compares only the requested note and returns its readable diff/summary.
  • notes stage <known-file> validates and stages the requested note without first detecting every unrelated change.
  • notes commit <known-files> does not perform repeated whole-corpus scans before and after the commit.
  • Selected-note guards still cover stale readables, dual-present conflicts, double tracking, manifest mapping, hook availability, and post-commit correctness.
  • --all retains complete whole-corpus behavior.
  • Large-corpus regression coverage demonstrates that targeted cost scales with selected files rather than total notes.

Current workaround

Batch related note edits and run one supported targeted notes commit at a coherent boundary. Avoid repeated notes status / notes changes rituals during editing. This reduces frequency but does not fix the underlying cost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions