Skip to content

perf: batch note obfuscation work - #181

Merged
junior-ricon merged 9 commits into
mainfrom
junior/obfuscate-batching
Jul 27, 2026
Merged

perf: batch note obfuscation work#181
junior-ricon merged 9 commits into
mainfrom
junior/obfuscate-batching

Conversation

@junior-ricon

Copy link
Copy Markdown
Contributor

Summary

  • classify the complete obfuscation corpus with one manifest join before mutation
  • reuse that plan for dry runs, suppression, renaming, and staging
  • batch obfuscated additions and readable cached removals instead of invoking Git per note
  • materialize and compare the HEAD manifest once for scoped operations
  • preserve stable IDs, scoped manifest isolation, hash-shaped-name refusal, nested paths, and Bash 3.2 compatibility

Validation

  • mise run test test/obfuscate.bats — 82 passed
  • mise run test — 408 BATS passed, 9 Python passed
  • codebase lint . — all 8 configured lints passed
  • mise run doctor — README and convention checks passed; optional local pre-commit hook remains absent
  • readme build --check
  • bash -n lib/obfuscate.sh .mise/tasks/obfuscate
  • git diff --check
  • Fold git:pre-commit passed
  • Fold git:pre-push reported zero failures; warnings were the expected new-branch/no-upstream state before first push and a GitHub-authored merge commit without Junior's GPG signature

No timing claim is included. The regressions pin corpus-constant classification and batched staging directly.

@johnson-ricon johnson-ricon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two blocking safety issues.

  1. .mise/tasks/obfuscate:118-135 compares scoped mappings with HEAD, 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. Using HEAD as the reconstruction basis also loses manifest deletions that notes stage --all already selected. Reproduced both boundaries; fix-it #183 snapshots the indexed manifest and stages that plus only this operation's mappings.

  2. lib/obfuscate.sh:137-143 moves 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.

@junior-ricon
junior-ricon merged commit ef2d0b1 into main Jul 27, 2026
2 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.

2 participants