Planner and fuel watch: keep own units' fuel readings for burn rates #40

Manually merged
vinny merged 0 commits from vinny/fuel-samples into master 2026-10-14 16:48:46 -04:00 AGit
Owner

Closes #19.

observation_history gains a row only on a material change. An aircraft flying steadily therefore kept one fuel sample while its fuel fell, so the planner's burn rate, endurance, station time and bingo time stayed unknown.

This PR takes option 2 from the issue:

  • Schema 19 (migration_v19.py) adds observation_fuel. Each row is an own unit's known fuel quantities at a game time.
  • observation/store.py keeps a reading when the quantities changed and at least 120 game seconds have passed since the unit's last one. It keeps the latest 8 readings per unit.
  • The planner (PlanningStore._fuel_samples) and the fuel watch read these readings. The watch also adds the aircraft's current reading, and no longer keeps readings in memory.
  • Retention and the observation-history reset clear the readings with their session.
  • History is unchanged: no fuel-only rows, so the event feed, agent history views and rules see what they saw before.

Tests:

  • tests/stage4/test_fuel_watch.py reproduces the issue: readings of 10,000 and then 9,000 ten game minutes apart, with one history row. The planner now estimates 6,000 an hour. The test also checks the 120-second spacing and the 8-reading bound.
  • The schema-upgrade test now checks schema 19.

Docs: MIGRATION.md, PLANNING_ENGINE.md, TACTICAL_EXECUTION.md.

🤖 Generated with Claude Code

Closes #19. `observation_history` gains a row only on a material change. An aircraft flying steadily therefore kept one fuel sample while its fuel fell, so the planner's burn rate, endurance, station time and bingo time stayed unknown. This PR takes option 2 from the issue: - **Schema 19 (`migration_v19.py`)** adds `observation_fuel`. Each row is an own unit's known fuel quantities at a game time. - **`observation/store.py`** keeps a reading when the quantities changed and at least 120 game seconds have passed since the unit's last one. It keeps the latest 8 readings per unit. - **The planner (`PlanningStore._fuel_samples`) and the fuel watch** read these readings. The watch also adds the aircraft's current reading, and no longer keeps readings in memory. - **Retention and the observation-history reset** clear the readings with their session. - **History is unchanged:** no fuel-only rows, so the event feed, agent history views and rules see what they saw before. Tests: - `tests/stage4/test_fuel_watch.py` reproduces the issue: readings of 10,000 and then 9,000 ten game minutes apart, with one history row. The planner now estimates 6,000 an hour. The test also checks the 120-second spacing and the 8-reading bound. - The schema-upgrade test now checks schema 19. Docs: `MIGRATION.md`, `PLANNING_ENGINE.md`, `TACTICAL_EXECUTION.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
observation_history gains a row only on a material change, so an aircraft
flying steadily kept one fuel sample while its fuel fell, and the planner's
burn rate, endurance and bingo time stayed unknown. Schema 19 adds
observation_fuel: a unit's fuel quantities at a game time, kept when they
changed and at least two game minutes after its last reading, the latest
eight a unit. The planner and the fuel watch read them; the watch no longer
keeps readings in memory. Retention and the observation reset clear them
with their session.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Version 0.7.24 (fuel-samples)
Some checks failed
check / check (ubuntu-latest) (push) Has been cancelled
check / check (windows-latest) (push) Has been cancelled
check / check (ubuntu-latest) (pull_request) Has been cancelled
check / check (windows-latest) (pull_request) Has been cancelled
8fd7687b35
vinny manually merged commit 8fd7687b35 into master 2026-10-14 16:48:46 -04:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
vinny/CMOnet!40
No description provided.