test(adcp): harden plan audit Budget.Committed explicit-zero round-trip#310
Draft
bokelley wants to merge 2 commits into
Draft
test(adcp): harden plan audit Budget.Committed explicit-zero round-trip#310bokelley wants to merge 2 commits into
bokelley wants to merge 2 commits into
Conversation
Strengthens TestPlanAuditLogsRoundTrip (issue #306) with a second fixture where Budget.Committed is explicitly 0. Asserts the field unmarshals as a non-nil *float64 pointer and re-marshals as "committed":0 inside the "budget" object — distinct from PlanAuditGovernedAction.Committed (a non-pointer float64). Uses a minimal fixture without empty slices to avoid silent omitempty round-trip asymmetry on Entries. https://claude.ai/code/session_01WBzJCnaT7zEFovwELGVceo
- Add governed_actions entry to raw2 fixture (non-omitempty field; also makes the Budget.Committed vs GovernedAction.Committed contrast explicit and verifiable in the data) - Use err2 instead of err to match raw2/decoded2/encoded2 naming - Improve final Fatalf hint to clarify *float64+omitempty semantics https://claude.ai/code/session_01WBzJCnaT7zEFovwELGVceo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #306
Strengthens
TestPlanAuditLogsRoundTripwith a second fixture case whereBudget.Committedis explicitly zero. The existing case leavesbudget.committedabsent and only asserts the absent case (Committed == nil); the existing"committed":0re-marshal check passes viaPlanAuditGovernedAction.Committed(a non-pointerfloat64), soPlanAuditBudget.Committed(*float64) zero-value round-trip was previously untested. The new case feeds a fixture with"budget":{"authorized":5000,"committed":0}and a governed-actions entry that also carries"committed":0, then asserts (1) the pointer is non-nil after unmarshal and (2)"budget":{"authorized":5000,"committed":0}appears in the re-marshaled output — a scoped check that cannot be satisfied by the governed-actions field.What tested
go vet ./...— cleango test ./... -run TestPlanAuditLogsRoundTrip— PASSgo test ./...(adcp submodule) — all passgo test ./...(root module) — all passPre-PR review
*float64+omitemptyzero-value semantics are correct; flagged missinggoverned_actionsin fixture (addressed in fixup commit); nit onerrshadowing (addressed)governed_actions:nullleak (addressed by adding explicit entry), comment clarity (addressed), and error-message hint wording (addressed)Session: https://claude.ai/code/session_01WBzJCnaT7zEFovwELGVceo
Generated by Claude Code