Repository navigation
Split ImitatePass::reencryptFiles - #2425
Conversation
Fourth batch for #2157: the largest function left (lizard CCN 55, 306 lines). The code and its comments move into helpers; the run does the same steps in the same order. - startReencryptRun(): the checks after the run's own pull (unfinished Git operation, a link, the list Init() wrote changed by the pull), the leftovers of an interrupted run and the backup commit. - reencryptEntry(): one entry, returning false when the run was cancelled meanwhile (the caller then stops, as the old break did). - listKeysFor(): a list's keys now and before Init(), once per run. - readerChangeOf(): who would gain the entry and who was taken off and still reads it. - holdForAgreement(): the question after the run, or the failure when the entry's bytes cannot be read to hold a yes to. - isTrustedEntry() and namedReaders(): the former lambdas. The run's record of key IDs, names and list keys is one WhoReads struct; ListKeys, WhoReads and ReaderChange are defined next to ReencryptResult. reencryptFiles 55 -> 8; every helper is below 15. No behaviour change. Part of #2157. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Anne Jan Brouwer <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
nogeenhenk
left a comment
There was a problem hiding this comment.
Reviewed at 5a0babc. The re-encryption worker, so I compared the old function and the new helpers side by side rather than by removed lines alone. The run is the same:
startReencryptRun()keeps the order pull, unfinished Git operation, link, list changed by the pull, leftover recovery, backup commit, and setsabortedorcancelledin the same cases.reencryptEntry()returns false only at the two cancel points the old loop left withbreak, beforewalkedandcheckedwere touched, and the caller setscancelledand breaks there. ArecipientsForDir()failure still returns the result at once.listKeysFor()still runs beforeprimaryKeysOf()for the entry (it is evaluated as an argument ofreaderChangeOf()), soprimariesandnamesfill in the old order, and the reference it returns intowho.listsstays valid: nothing inserts into that hash whilereaderChangeOf()reads it.holdForAgreement()returns true exactly where the old code setkeepRecord(the bytes cannot be held to a yes), false for a question, sowalkedandstillReadByRemovedcome out as before. An entry with no listable recipients still goes straight toreencryptSingleFile().- All
tr()calls stay inImitatePass.
Nothing to add.
Generated by Claude Code
Summary
Fourth batch for #2157:
ImitatePass::reencryptFiles, the largest function left (lizard CCN 55, 306 lines), on its own because it is the re-encryption worker. The code and its comments move into helpers; the run does the same steps in the same order.startReencryptRun()Init()wrote changed by the pull), leftover recovery, the backup commitreencryptEntry()breakdid (nowalked, nochecked++)listKeysFor()Init(), once per runreaderChangeOf()holdForAgreement()isTrustedEntry(),namedReaders()The run's record of key IDs, names and list keys is one
WhoReadsstruct;ListKeys,WhoReadsandReaderChangeare defined next toReencryptResult.reencryptFiles55 → 8, every helper below 15.Checked by comparing removed and added lines without indentation: the only removed lines that do not come back are renames (
primaries→who.primaries,gaining→change.gaining, the lambdas),return result→return falsein the start checks, and the twoaskbranches folded intoholdForAgreement(). All seventr()calls stay inImitatePass.Test plan
make checkin a scratchHOME/GNUPGHOMEwith a Git identity: 36 suites, 2,043 passed, 0 failed (tst_imitatepassandtst_integrationcover the question, the removed-reader record, cancel and the pull checks)doxygen Doxyfileprints no warningsclang-formatcleanPart of #2157.
🤖 Generated with Claude Code
Summary by CodeRabbit