Skip to content

fix(accountant): Harden stats cache key, state file and panics (#916 #917 #918 #920) - #928

Merged
boazdavid merged 4 commits into
integ/batch1from
fix/accountant-hardening2
Nov 5, 2026
Merged

boazdavid merged 4 commits into
integ/batch1from
fix/accountant-hardening2

Conversation

@boazdavid

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes four accountant and dashboard issues on top of integ/batch1. It does not bump the accountant pin.

What changed

Issue Change
#916 cacheKey keeps since and until exact. The UI rounds its own now to 30 s, so relative ranges still share a key.
#917 State file wrapped in cgStateVersion (now 2); other versions are refused and the proxy starts empty. Sync before Rename. Stale *.tmp* files removed at restore. Save skips an unchanged write. withoutCacheMarks strips cache_control at any depth. Not done: mtime vs snapshot age (5) and flock (6). Item 5 is only an optimisation, and item 6 changes behavior for two proxies on one DB and needs a human decision.
#918 PingSavings and dashEmitter.KeepAlivePing recover and log. accBegin recovers and drops its record, so a panic on a hostile body no longer reaches the pre-forward recover.
#920 Not reproduced with a known price. A realistic first turn books its cost. The $0 rows in the A/B run had no price: the price map loads in the background, and the first three requests came 1.3 s after start. Tests pin both cases. No code change.

Figures can change: the state hash version means one restart after upgrade starts with empty thread state.

How it was tested

  • New tests fail on the old code: cache key, nested mark hash, ping panic, accBegin panic, emitter panic.
  • New tests for old-version file, stale temp files, skipped write.
  • go test -count=1 on dash, proxy, apply, keepalive, components: pass.
  • Known failures unchanged: preflight tests, TestRateFillTableAndPrice.

Assisted-By: Claude (Anthropic AI) noreply@anthropic.com

The key rounded since and until down to 30 s, so a narrower window got
the wider window's cached totals. The key now holds the exact values.
The UI rounds its own now to 30 s so relative ranges still share a key.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: DAVID BOAZ <DAVIDBO@il.ibm.com>
…past nested cache marks (#917)

Wrap the snapshot in a proxy version and refuse another one. Sync before
the rename, skip an unchanged write and remove stale temp files at start.
Strip cache_control at any depth before hashing a body element.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: DAVID BOAZ <DAVIDBO@il.ibm.com>
The keeper's ping row and PingSavings now recover and log, so a library
panic cannot end the process. accBegin recovers and drops its record, so
a panic on a hostile body no longer reaches the pre-forward recover.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: DAVID BOAZ <DAVIDBO@il.ibm.com>
…e map (#920)

A realistic first turn books its cost when the price is known. The
reported rows had no price: the price map loads in the background and
the first requests arrived before it finished. No code change.

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: DAVID BOAZ <DAVIDBO@il.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant