perf: batch note obfuscation work - #181
Conversation
johnson-ricon
left a comment
There was a problem hiding this comment.
I found two blocking safety issues.
-
.mise/tasks/obfuscate:118-135compares scoped mappings withHEAD, then stages the complete working manifest when any scoped mapping is missing. A scoped new note therefore pulls unrelated unstaged manifest mappings into the index. UsingHEADas the reconstruction basis also loses manifest deletions thatnotes stage --allalready selected. Reproduced both boundaries; fix-it #183 snapshots the indexed manifest and stages that plus only this operation's mappings. -
lib/obfuscate.sh:137-143moves a known readable path onto its manifest ID without checking whether that destination already exists. In an interrupted/stale dual-present state this silently replaces the obfuscated content; duplicated manifest IDs can also send two planned sources to one destination. Reproduced the overwrite; fix-it #182 rejects both collision shapes during corpus planning, before mutation.
The batching design otherwise preserves the intended known-corpus boundary: the 535-note regression proves constant planner/classification calls and one git add plus one git rm, while the scoped regression proves one manifest snapshot and batched staging. It does not prove total constant subprocess work: mv remains per note, and new IDs still require per-note randomness/collision checks. That narrower claim matches the PR description.
Validation on exact head cad9ebe4450e424fa61cc480d87004bc3d6766d1: focused 82 BATS passed, all 8 configured lints passed, README/syntax/diff checks passed, and hosted Ubuntu/macOS checks are green. I also inspected Bash 3.2 constructs; the patch avoids associative arrays and Bash 4-only expansions, with hosted macOS covering the actual 3.2 runtime. The two adversarial fixture repros above failed on this head as described.
…h-collisions fix: reject obfuscation path collisions
…st-staging fix: isolate scoped manifest staging
Summary
Validation
mise run test test/obfuscate.bats— 82 passedmise run test— 408 BATS passed, 9 Python passedcodebase lint .— all 8 configured lints passedmise run doctor— README and convention checks passed; optional local pre-commit hook remains absentreadme build --checkbash -n lib/obfuscate.sh .mise/tasks/obfuscategit diff --checkgit:pre-commitpassedgit:pre-pushreported zero failures; warnings were the expected new-branch/no-upstream state before first push and a GitHub-authored merge commit without Junior's GPG signatureNo timing claim is included. The regressions pin corpus-constant classification and batched staging directly.