Follow-ups from the PR #96 re-review: retention bound docs and untested normalisation #99
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Tracking issue for the non-blocking items from the independent re-review of PR #96 (#79), so they do not become untracked. None blocked that merge. They are small enough to land as one tidy commit.
Items
README.mdis inaccurate about the upper bound. It says a retention value above the ceiling "is rejected with a 400". That is only true for the finite unsafe band(106751, 365000). A value of365000or above is accepted and means retain forever. One clarifying sentence: values aboveMaxFiniteRetentionDaysbut below the retain-forever sentinel are rejected; the sentinel and anything above it mean forever.The normalisation arm has no test behind it. Mutating
return database.RetentionForeverDays, niltoreturn v, nilinparseRetentionDaysleaves the entire suite green. This is the one piece of the new boundary logic with no coverage, and it is precisely the arm the author deliberately deviated on (folding>= RetentionForeverDaysto the sentinel rather than 400). Add a test pinning365001→ stored365000.errInvalidRetentionis still never anerrors.Isoperand. OnlyerrRetentionTooLargeis matched. The rework comment's claim that it is "now used that way" overstates it. Either match on it or correct the comment — an error value that exists only to be returned and never compared is a trap for the next reader.The
sweepskip is fully redundant withretentionCutoff. Replacing the skip withif falseleaves the suite green, becauseretentionCutoffalready returnsfalsefor retain-forever. Harmless defense-in-depth, but either give it a test that distinguishes it from the inner guard or drop it and rely on the one that is actually load-bearing.The HTML-escaping test uses plain ASCII, so it would not catch a future raw-HTML regression in the create-form refill. The escaping itself was verified correct by execution during review (a
x"><script>payload renders fully entity-escaped in both thevalue="attribute and the textarea) — this is only about the test being weaker than the check it stands for.A hypothetical legacy negative
retention_daysrow 400s on an unchanged edit-form submit. No such row can be created now that theBeforeSavehook normalises them, so this is only reachable via direct DB manipulation. Worth a line of thought about whether the edit path should normalise rather than reject.Definition of done
make checkgreen via the repo's own entrypoints;.golangci.ymluntouched.