Skip to content

fix: address unresolved Copilot review feedback from PRs #3, #5, #6 - #8

Merged
KP2048 merged 2 commits into
1.21.xfrom
copilot-gui-networking-fixes
Aug 6, 2026
Merged

fix: address unresolved Copilot review feedback from PRs #3, #5, #6#8
KP2048 merged 2 commits into
1.21.xfrom
copilot-gui-networking-fixes

Conversation

@KP2048

@KP2048 KP2048 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

You flagged that Copilot left review comments on recent PRs that never got addressed before merge. Checked #3, #4, #5, #6 — all four had Copilot reviews; #4's finding was already fixed before merge, the rest weren't. This PR fixes all of them.

PR #3 (fluid/energy storage)

  • ArchieEnergyStorage.readSnapshot and its Serializer.deserialize now clamp capacity to non-negative and amount to 0..capacity. A malformed/stale snapshot could otherwise leave the storage over-capacity or negative, wedging insert()/extract() permanently.
  • gui.md's ProgressBar example: value ?: 0 / smeltTicks.toFloat() — Elvis's low precedence means this divides 0 by smeltTicks, not the observed value, so a real value passes through undivided instead of becoming a 0..1 fraction. Parenthesized.
  • Added BlockEntityNBTHolderTests.testItemFluidAndEnergyFieldsPersistMutations covering itemField/fluidField/energyField save/load round-tripping — the one field-kind trio the existing suite didn't touch.

PR #5 (docs-sync / GUI+networking KDoc)

  • GuiGraphics.pose/scissor claimed to always restore pose/scissor state even if the block throws, but used no try/finally — an exception left the pose stack or scissor rect unbalanced, breaking subsequent rendering. Wrapped both (the IntRect scissor overload now just delegates to the primary one instead of duplicating the logic).
  • Text's KDoc says "ARGB text color" but the renderer passed color.rgb, silently dropping any alpha the caller set (vanilla's drawString forces alpha=0 to opaque, so this always rendered fully opaque regardless of intent). Switched to color.argb so alpha is actually honored.
  • NetworkChannel.configServerbound's KDoc said persistence happens in decodeDispatchData — it doesn't; that function only does the permission check, in-memory decode, and broadcast/reject. The handler registered by configServerbound is the only place that calls ConfigSpec.save(). Corrected.

PR #6 (changelog automation)

  • release-notes.yaml's base-branch detection used git branch -r --contains, which matches any branch the tag is merely reachable from, not just one it's the tip of — non-deterministic if reachable from several. Switched to --points-at.
  • pr-title-lint.yml used pull_request_target unnecessarily (no checkout/exec of fork code happens, so the base-repo context it grants isn't needed and only widens blast radius for future changes) — switched to pull_request, and secrets.GITHUB_TOKEN to the intended github.token context.

Test plan

  • :common:compileKotlin clean (covers the gametest source set too — new test compiles)
  • Reviewed each fix against the actual current code/behavior it touches, not just the review comment text

🤖 Generated with Claude Code

KP2048 and others added 2 commits August 6, 2026 17:37
All three PRs merged with Copilot review comments still outstanding. Fixing
each finding:

PR #3 (fluid/energy storage):
- ArchieEnergyStorage.readSnapshot and its Serializer.deserialize now clamp
  capacity to non-negative and amount to 0..capacity. A malformed/stale
  snapshot (e.g. from before a capacity change) could otherwise leave the
  storage over-capacity or negative, wedging insert()/extract() permanently.
- gui.md's ProgressBar example: `value ?: 0 / smeltTicks.toFloat()` divides
  by 0 due to Elvis's low precedence, so the raw observed value passed
  straight through undivided instead of becoming a 0..1 fraction. Parenthesized.
- Added BlockEntityNBTHolderTests.testItemFluidAndEnergyFieldsPersistMutations
  covering itemField/fluidField/energyField save/load round-tripping, the one
  field-kind trio the existing suite didn't touch.

PR #5 (docs-sync / GUI-networking KDoc):
- GuiGraphics.pose/scissor claimed to always restore pose/scissor state even
  if the block throws, but used no try/finally - an exception left the pose
  stack or scissor rect unbalanced. Wrapped both (plus the IntRect scissor
  overload, now just delegating to the primary one instead of duplicating
  the logic).
- Text's KDoc says "ARGB text color" but the renderer passed color.rgb,
  silently dropping any alpha the caller set (vanilla's drawString forces
  alpha=0 to opaque, so this always rendered fully opaque regardless of
  intent). Switched to color.argb so alpha is actually honored.
- NetworkChannel.configServerbound's KDoc said persistence happens in
  decodeDispatchData - it doesn't; decodeDispatchData only does the
  permission check, in-memory decode, and broadcast/reject. The handler
  registered by configServerbound is the only place that calls
  ConfigSpec.save(). Corrected.

PR #6 (changelog automation):
- release-notes.yaml's base-branch detection used `git branch -r --contains`,
  which matches any branch the tag is merely reachable from, not just one
  it's the tip of - non-deterministic if a tag is reachable from several
  branches. Switched to `--points-at`.
- pr-title-lint.yml used pull_request_target unnecessarily (no checkout/exec
  of fork code happens, so the base-repo context it grants isn't needed and
  only widens blast radius for future changes) - switched to pull_request,
  and secrets.GITHUB_TOKEN to the intended github.token context.

(One PR #4 finding - a comment about GITHUB_ACTOR injection - was already
corrected before merge; left alone.)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@KP2048
KP2048 marked this pull request as ready for review August 6, 2026 21:41
Copilot AI lite review requested due to automatic review settings August 6, 2026 21:41

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KP2048
KP2048 merged commit e6b2f31 into 1.21.x Aug 6, 2026
@KP2048
KP2048 deleted the copilot-gui-networking-fixes branch August 6, 2026 21:42
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