Skip to content

test(adcp): harden plan audit Budget.Committed explicit-zero round-trip#310

Draft
bokelley wants to merge 2 commits into
mainfrom
claude/issue-306-explicit-committed-zero-roundtrip
Draft

test(adcp): harden plan audit Budget.Committed explicit-zero round-trip#310
bokelley wants to merge 2 commits into
mainfrom
claude/issue-306-explicit-committed-zero-roundtrip

Conversation

@bokelley
Copy link
Copy Markdown
Contributor

Closes #306

Strengthens TestPlanAuditLogsRoundTrip with a second fixture case where Budget.Committed is explicitly zero. The existing case leaves budget.committed absent and only asserts the absent case (Committed == nil); the existing "committed":0 re-marshal check passes via PlanAuditGovernedAction.Committed (a non-pointer float64), so PlanAuditBudget.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 ./... — clean
  • go test ./... -run TestPlanAuditLogsRoundTrip — PASS
  • go test ./... (adcp submodule) — all pass
  • go test ./... (root module) — all pass

Pre-PR review

  • code-reviewer: approved — no blockers; confirmed *float64 + omitempty zero-value semantics are correct; flagged missing governed_actions in fixture (addressed in fixup commit); nit on err shadowing (addressed)
  • dx-expert: approved — no blockers; nits on governed_actions:null leak (addressed by adding explicit entry), comment clarity (addressed), and error-message hint wording (addressed)
  • security-reviewer: approved — no blockers; test-only change, no TEE paths touched, no pinhole widening, no metric cardinality or error-sanitization changes

Triage-managed PR. This bot does not currently iterate on
review comments or PR conversation threads (only on the source
issue). To unblock:

  • Push fixup commits directly: gh pr checkout <num>
    fix → push.
  • Or request a new first draft PR: comment /triage execute
    on the source issue only when no triage-managed PR is already
    open. Triage does not update existing PRs.

See adcp#3121
for context.

Session: https://claude.ai/code/session_01WBzJCnaT7zEFovwELGVceo


Generated by Claude Code

claude added 2 commits May 29, 2026 11:57
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Harden plan audit explicit-zero round-trip coverage

2 participants