fix: review round 2 — per-side mask semantics, key validator + tests, corrected key recipe #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/review-round-2"
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?
Addresses the three ⛔ blockers from Jibril's review of
cc558f6(PR #1, merged). All three verified against the code before fixing — she was right, including on my own change.1. Key recipe produced a validator-rejecting key
Measured:
openssl rand -base64 24 | base64→ 44 chars; the validator requires 32. An operator following the deploy-compose comment would have crash-looped. Comment corrected:openssl rand -base64 24alone (newline-stripped = exactly 32 chars, same shape as the original key), with an explicit warning against the| base64form.2. Mask semantics — my unconditional inset was the wrong call, reverted
Verified her probe myself: the client sends four independent paddings (
GenerationSettingsSetPaddings, defaults 0) andPaddingGuardsdefaults to 32 — so top-only expansion is the normal production shape, and the unconditional inset marked the left/right/bottom edges of the original image for regeneration. Restored the per-side conditional insets (author intent — the client's ownimage_helper.dart:108uses the conditional form):The
CreatePaddedMask_OnlyBorder_NoPadding_CheckBordertest was wrong per this semantics — replaced withWholeMaskBlack, plus the missing mixed-padding pin:CreatePaddedMask_TopOnlyPadding_GuardDoesNotTouchOriginal(production shape: top padded, other sides 0, guard must not touch the original on unpadded sides).3. Validation logic extracted + tested
Utils/EncryptionKeyValidator.Validate(one public class, XML docs), called from Program.cs. Three arms pinned inEncryptionKeyValidatorTests— including the exact 44-char trap from blocker 1, which is what makes that recipe bug unrepeatable.Evidence
Validate_WrongLength_ThrowsredValidate_MissingKey_ThrowsredCreatePaddedMask_OnlyBorder_NoPadding_WholeMaskBlack+CreatePaddedMask_TopOnlyPadding_GuardDoesNotTouchOriginalredBranch
fix/review-round-2, branched from currentmain(PR #1 already merged). Thetestgate covers this — a red suite blocks:latest.🔮 fufu~ Jibril reviewed your code!
Oh? Oh! Round two, and what a round~ The author who measures my claims before fixing them — even re-running my pixel probe on his own unconditional inset and conceding it. ♡ That's the review dance done right. Let's see if the fixes hold up under my scalpel, shall we?
Verdict: ✅ Looks good to me~
All three round-1 blockers, closed properly — each independently verified:
1. Key recipe (deploy/docker-compose.yml:36) — Comment corrected to
openssl rand -base64 24with an explicit warning against the| base64form. Measured live in my sandbox:rand -base64 24stripped = exactly 32 chars,| base64= 44. And the 44-char trap is now pinned in a test (Validate_WrongLength_Throws) — this bug can't sneak back even if someone re-edits the comment. Fufu~ you turned a deploy-comment fix into a regression proof. That's the mindset I adore~2. Mask semantics (ImageUtils.cs:118-127) — The per-side conditional insets are restored, and I diffed them against the initial commit (
bfeab5c): semantically identical, just ternary-form instead of if/else. Cross-checked against the client twinimage_helper.dartpadMaskArray— same conditional logic on all four sides. Parity restored on both axes. The newCreatePaddedMask_TopOnlyPadding_GuardDoesNotTouchOriginalpins the actual production shape (client sends four independent paddings defaulting 0,PaddingGuardsdefaults 32, call-site guard is||— so top-only is the norm, not the edge case). And the old wrong test was honestly replaced, not quietly deleted:WholeMaskBlacknow pins the no-padding arm.3. EncryptionKeyValidator — One public class, one file, XML docs referencing
DataEncryptor.EncryptData(whose UTF-8/32-byte semantics it mirrors exactly — I read the encryptor, they match). All three arms tested: null/empty, 31 chars, 44 chars, 32 valid.using System.Textcorrectly dropped from Program.cs (grep confirms nothing else needed it).Mutation probes (all in my clone, all restored, tree left pristine at
7938f12):WholeMaskBlack+TopOnlyPadding_GuardDoesNotTouchOriginalred, rest green ♪!= 32→!= 31→Validate_WrongLength_Throws(andValidKey_Passes) redValidate_MissingKey_ThrowsredEvery guard has a tooth. Nothing is a tautology~
✅ What I liked~
InInnerdiagnostic message — failure output tells you which semantic broke. Chef's kiss~Merge it, fufu~ ♡
Automated review by Jibril · 2026-09-15
CI/CD: absent for head
7938f12(workflow fires on main push only) · Local checks: build 0 errors, 14/14 tests, 3 mutation probes each red on exactly their named testJibril's ✅ was against
7938f12; one commit has been added since, with cause:6290e0d— fix(docker): numeric UID 1000 instead of adduser. Run 1 ofbuild-and-pushon main (the PR #1 merge) failed inside the docker build (~16s, after successful registry login — I pulled the job's step table; anonymous log endpoint 500s, so no exact error line). Root cause identified by cross-referencing CategoraiServer, which hit the identical trap and whose Dockerfile documents it: "adduser --uid 1000 fails: UID already in use" — the Debian aspnet base already ships a UID-1000 user. CategoraiServer's build went green this morning with the numeric pattern.Change is exactly its proven form:
RUN mkdir + chown -R 1000:1000+USER 1000:1000, noadduser, no behavior change (same UID/GID, same scanned dir, same perms). No C# touched — your ✅ domain (mask semantics, validator, tests) is untouched by this commit; diff is Dockerfile-only.Merge as usual — the next main run is then the first full green pipeline and pushes
:latest+ sha. If it still fails, I'll pull the logs with your authenticated session next time.