Skip to content

Bound evidence per kind instead of failing the packet - #62

Merged
gowtham0992 merged 1 commit into
mainfrom
bar-evidence-budget
Aug 15, 2026
Merged

Bound evidence per kind instead of failing the packet#62
gowtham0992 merged 1 commit into
mainfrom
bar-evidence-budget

Conversation

@gowtham0992

@gowtham0992 gowtham0992 commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Bounds collector evidence per kind so a large job log trims instead of
failing the capture.

Problem

EvidenceBuilder.validate_limits raised once the aggregate 400-line or
64 KiB ceiling was reached. That aborted build_packet_for_job, and
because collect_packets builds every packet in one comprehension, a
single oversized job discarded the packets for healthy jobs in the same
run.

Change

  • Per-kind line and byte budgets, clamped by what the packet has already
    consumed, so the aggregate ceilings cannot be exceeded by construction.
  • bounded_evidence_text keeps a deterministic prefix satisfying both.
  • EvidenceBuilder.add returns a boolean instead of raising, so an item
    that sanitizes to nothing is skipped rather than killing the packet.
  • Trimming sets sanitization.truncated and adds a missing_evidence
    declaration.

Budgets total exactly the aggregate ceilings: 3 log windows at 56 lines
and 12 KiB, one workflow snippet at 48 and 8 KiB, four diffs at 40 and
5 KiB.

Verification against run 31668261705 attempt 2

Packets built from live GitHub data, not fixtures.

windows-smoke package
evidence 8 items, 18,361 B, 284 lines 5 items, 9,684 B, 161 lines
packet 33,367 B 23,320 B
Bar validator accepted accepted
  • Delivery IDs match Bar's server-side derivation for both.
  • Byte-identical across two independent live collections.
  • Diagnostic content survives: WinError 32, page-fts-v1.sqlite, and
    PermissionError in the Windows packet; Forced include not found
    and .linkignore in the package packet.
  • Citation ranges stay true after trimming. A window covering original
    lines 100-159 trimmed to 56 lines cites 100-155, and the last retained
    line is exactly line 155.
  • Budgets are per job. A 4,000-line log on one job does not shrink the
    other job's packet.

Full suite 1041 passed, ruff clean, actionlint clean, release hygiene
passed.

Known follow-ups, not addressed here

  • sanitization.truncated is effectively always true, because per-kind
    caps trim routinely. Both packets above report truncation while using
    28% and 15% of the byte budget, so the signal does not distinguish
    a real ceiling from a routine per-item cap.
  • validate_limits no longer guarantees at least one evidence item,
    while Bar rejects an empty evidence array.
  • Job isolation is size-only. A build error or a delivery failure on one
    job still prevents the other job's packet from being sent.

The evidence builder raised as soon as the aggregate 400-line or 64 KiB
limit was reached, which aborted the entire capture including healthy
jobs in the same run. Give each evidence kind a line and byte budget,
clamped by what the packet has already used, and keep a deterministic
prefix that fits both. Trimming is recorded in sanitization.truncated
and declared in missing_evidence rather than discarding the packet.

Verified against run 31668261705 attempt 2: both packets stay inside
Bar's budgets, are byte-identical across repeated live collections, and
are accepted by Bar's ingestion validator.
@gowtham0992
gowtham0992 merged commit e6b253a into main Aug 15, 2026
10 checks passed
@gowtham0992
gowtham0992 deleted the bar-evidence-budget branch August 15, 2026 21:00
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