Skip to content

Avoid redundant path obfuscation hash stretching - #116

Merged
vrtmrz merged 1 commit into
mainfrom
perf/path-obfuscation-id-derivation
Aug 15, 2026
Merged

Avoid redundant path obfuscation hash stretching#116
vrtmrz merged 1 commit into
mainfrom
perf/path-obfuscation-id-derivation

Conversation

@vrtmrz

@vrtmrz vrtmrz commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Remove ineffective path-obfuscation hash stretching so full Metadata identity scans retain the same document IDs without delaying plug-in start-up.

Summary

  • Replace repeated SHA-256 calls over the same unchanged input with one digest.
  • Preserve the existing two-stage passphrase and path derivation, prefixes, case handling, and cache behaviour.
  • Add focused coverage for digest count and established document-ID vectors.

Rationale

Metadata identity validation now derives the expected document ID for every normal-file Metadata entry before Offline Scanner mutation. This exposed a legacy loop in path obfuscation which repeated SHA-256 according to the input length.

Every iteration hashed the original buffer again rather than chaining the previous digest. It therefore produced the same document ID as one digest while adding substantial work. On the local benchmark used for this change, collecting 4,000 consistent Metadata entries with path obfuscation fell from about 13.8 seconds to about 0.29 seconds. Absolute timing is host-dependent.

The path-obfuscation output and stored document IDs remain unchanged.

Verification

  • Confirmed the regression test failed before the implementation change: the first uncached path required 105 digest calls instead of 2.
  • Focused path tests: 7 passed.
  • Commonlib unit suite: 71 files and 1,304 tests passed with one worker.
  • Commonlib type, package-boundary, release-selection, packed-package, and clean-consumer checks passed.
  • The exact packed Commonlib artefact passed Self-hosted LiveSync type checks, application checks, Community Review lint, 91 unit-test files and 639 tests, production build, and iOS 15 compatibility inspection.

@vrtmrz
vrtmrz marked this pull request as ready for review August 15, 2026 12:20
@vrtmrz
vrtmrz merged commit 34fee36 into main Aug 15, 2026
3 checks passed
@vrtmrz vrtmrz mentioned this pull request Aug 15, 2026
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.

1 participant