Repository navigation
feat(mpc): retain input provenance - #898
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a1c04d38a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| slot.WeatherRowSource = weatherInput.Source | ||
| slot.WeatherRowAvailableAtMs = weatherInput.FetchedAtMs |
There was a problem hiding this comment.
Persist the weather row timestamp
A normal multi-hour forecast fetch assigns the same provider name and nowMs to every row (go/internal/forecast/forecast.go:351,392-400), so these two values identify only the fetch batch, not the row consulted. Without retaining weatherInput.SlotTsMs—particularly when lookupCloudInput selects a nearest row across a gap—the historical diagnostic cannot distinguish which hourly row produced the input, defeating exact provenance and leak-free replay.
Useful? React with 👍 / 👎.
Why
Historical planner diagnostics keep the slot values, but not which price and weather rows Core used. That blocks leak-free replay and makes forecast errors hard to trace.
What changed
input_provenance_schema: 1so current missing data stays distinct from legacy snapshotsThe weather fields identify the cached row only. They do not claim full PV-model provenance. The availability times are local fetch or creation times, not provider issue times or model revisions.
No SQL migration or optimizer wire change is needed.
Tests
go/internal/mpcwith and without race detectormake verifymake verify-all, including Python, Go, Core↔Optimizer contracts, Compose migration, vet, build, and Linux ARM64/AMD64 plus Windows AMD64 cross-buildsPart of #885.