Skip to content

test(agent): a certificate report may fill its budget exactly - #398

Merged
samuelmbabhazi merged 1 commit into
mainfrom
fix/certwatch-budget-test
Nov 21, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
fix/certwatch-budget-test

Conversation

@samuelmbabhazi

@samuelmbabhazi samuelmbabhazi commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

What

TestWithinKeepsTheInventoryAndTheSoonestExpiries now accepts a report whose size equals the budget given to certwatch.Within. It still refuses one that goes over.

Why

CI run 44890781278 failed on an unrelated PR (#395) with a report of exactly 61 376 bytes, the budget of 60 KiB minus 64. Within keeps readings while they fit, the last byte included. The agent gives it MaxReportBytes - 64 - size, and the gateway sends a report below MaxReportBytes, so the equal case is valid. The assertion used >=. Whether a run hits the exact size depends on how the time.Now() timestamps encode, which made the test fail now and then.

How it was tested

The test passes 50 times in a row with -race, and golangci-lint reports no issue.

Security considerations

Test only. The report bound is unchanged.

Summary by CodeRabbit

  • Tests
    • Updated a report-size boundary check so reports exactly at the stated limit pass.

Within keeps readings while they fit, the last byte included, and the
caller's 64-byte margin keeps such a report under the gateway's bound.
The test refused a report equal to the budget, which happens when the
timestamps encode to just the right size (CI run 44890781278).

Signed-off-by: samuel mbabhazi <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The certificate report size test now allows a serialized report that equals the asserted budget of limit-64.

Changes: Certificate report size test

Layer / File(s) Summary
Report size boundary
agent/internal/certwatch/certwatch_test.go
The assertion now fails only when the report size is greater than limit-64. The comments state that a size equal to the bound is allowed.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Other

Possibly related PRs

Merge Risk: Minimal · up to ca502

This only adjusts a flaky test assertion to match the intended size budget. Production behavior and the report size limit are unchanged, so merge risk is minimal.

Security architecture risk: Minimal · up to ca502

This change corrects a test expectation without changing production behavior. No introduced or worsened architecture-level security risk is identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: a certificate report may now fill its size budget exactly. The raw summary confirms the test change treats a report at the limit-64 bound as within budget, and the PR objec…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: a certificate report may now fill its size budget exactly. The raw summary confirms the test change treats a report at the limit-64 bound as within budget, and the PR objectives state the same intent. The title uses the type(scope) format and is specific, so it describes the primary change.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between af0977f and ca5026f.

Files selected for processing: 1

  • agent/internal/certwatch/certwatch_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

@samuelmbabhazi
samuelmbabhazi merged commit 494b071 into main Nov 21, 2026
24 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the fix/certwatch-budget-test branch November 21, 2026 09:56
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.

1 participant