AletheiaFact / AletheiaFact/aletheia
INST-2 · Materialize stateHistory[] + stageDurations on the reviewTask
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 20
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 2
Description
> Item derived from the fact-checking cycle analysis (**2026-07-03**). Production numbers (namespace `main`), unless noted.
### Finding (evidence)
Measuring time-per-stage today requires parsing **163 MB** of `histories` and rebuilding each task's timeline from `details.after.value` (a generic field, easy to get wrong — that's where the first pass went wrong).
### Action
A single `transitionState()` helper that, on transition, writes to `histories` (as today) **and** pushes to a typed `stateHistory[]` (`from` / `to` / `at` / `byUserId` / `byRole`) + recomputes `stageDurations` / `cycleMetrics`. Retroactive backfill already available (it's the reconstruction run during the analysis).
### Impact
Time-per-stage becomes a flat field; no future analysis needs to rebuild the timeline.
---
- **Priority:** 🔴 High · **Effort:** M (medium)
- **Dependencies:** requires migration/backfill (`needs-migration`). Wave 2, alongside INST-4.
- **Epic:** #2489
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the reviewTask transitionState() entry point and inspect how histories is currently written. Trace the existing reconstruction/backfill run for the fields, then verify that transitions produce stateHistory[], stageDurations, and cycleMetrics so future analysis no longer needs to rebuild the timeline.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100