Skip to content

fix(pool): the capacity history survives a coordinator restart - #373

Merged
7schmiede merged 1 commit into
mainfrom
pool/history-survives-restart
Oct 30, 2026
Merged

7schmiede merged 1 commit into
mainfrom
pool/history-survives-restart

Conversation

@fen89

@fen89 fen89 commented Oct 29, 2026

Copy link
Copy Markdown
Member

The coordinator kept the pool's capacity history only in memory (ADR-0036 point 2), so every update left the charts empty for an hour and incomplete for a day. The chart also spread whatever points it had over its full width, so half an hour of data looked like a full hour or day.

Review card

Category Point Beats Cost of reversing
Concept The coordinator keeps each node's history (the raw hour, the day by minute) in history.json in its directory and reads it when it starts; a restart loses a minute at most. "In memory, a restart starts it again" (ADR-0036 point 2) Small: stop writing; a leftover file does no harm
Contract Written every 60 s, to a temporary file then renamed (like machines.json), not with every report. Writing with every report Small
Concept Loading drops points older than the hour / the day; a missing or broken file starts the history again with a log line, never a refusal to start. Refusing to start on a broken file Small
Concept The time the coordinator did not run stays a gap; nothing is interpolated. Filling the gap Small

Approved by the owner on 2026-10-29: all four points, and the chart's time axis in the same pull request.

Decided on my own: JSON like the coordinator's other files; no extra write on shutdown (the minute interval covers it); the chart puts each point at its time on the range it shows and draws runs separated by a gap (> 120 s for the hour, > 300 s for the day) apart.

Changes

  • coordinator.rs: History serialises; load_history / save_history; a task writes every minute; test for save, load, trimming and a broken file.
  • PoolCapacityChart.vue: time axis, gaps, hover by time; lib/runs.ts with a test.
  • ADR-0036 addendum, docs/pool.md, docs/dashboard-api.md, CHANGELOG.

Checked

  • cargo test -p devstack-node, cargo clippy, cargo fmt
  • vue-tsc, vitest, npm run build
  • Not checked in a browser against a real coordinator yet.

The coordinator keeps each node's history in history.json, written every
minute and read when it starts, without what is older than the hour or
the day. The capacity chart puts each point at its time and draws a gap
as one, so a short history no longer stretches over the whole range.
@7schmiede
7schmiede merged commit f238809 into main Oct 30, 2026
13 checks passed
@7schmiede
7schmiede deleted the pool/history-survives-restart branch October 30, 2026 10:28
@7schmiede 7schmiede mentioned this pull request Oct 30, 2026
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.

2 participants