feat: calibration from closed-issue actuals → forecast flips off cold-start (#1)
Close the D3 loop. The forecast now learns from the team's own estimate-vs-actual history (the working time #5 infers from git events) instead of guessing forever. core (@commitea/core/calibration-v0): - fitCalibration(samples): lognormal fit on log(actual/estimate) — global + per-bucket (once a bucket clears the floor) + per-person bias. coldStart until n >= 20 closed-with-estimate issues. - calibrationSamples(): pull those samples from the closed backlog via lifecycle inference (estimate label vs inferred actualWorkingDays). - toDurationModel(): project the fit to the params forecast consumes. - forecast() gains options.model: when past cold-start, fitted params drive the sim (per bucket, global fallback); otherwise the code priors do. Forecast.coldStart now reflects the model. nearestBucket extracted + exported. app: - AppShell fits calibration once from the reconciled backlog, feeds the model into forecastBacklog (cone), and drives the Calibration screen + Runway header. - Focus cone footer, Runway note, and Calibration screen now say cold-start (N/20) vs calibrated (on N closed) from real data; Calibration scatter / bucket bias / per-person all fitted, degrading honestly on a thin dataset. Known refinement: same-day closes yield 0 working-day actuals (day-granular) and are excluded, so a fast-moving repo can sit at n=0 — honest, but a fractional (hours-based) actual would let those count. Per-person uses gitea login, not display name, until the person map lands. Note: also re-lands #10 (Monte Carlo) and #5 (lifecycle) which merged into their stacked base branches but never propagated to main (stacked-merge trap); this branch is cut from main and carries all three so main is whole again. Verified: 74 core tests green (9 calibration + 2 forecast-switch added), desktop typecheck clean, 14 fixture e2e green, live spec asserts the real cold-start calibration surface (Runway note + screen badge fitted from actuals). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,5 +45,32 @@ export type {
|
||||
SchedulePlan,
|
||||
} from './scheduler/scheduler-v0.js'
|
||||
|
||||
export { COLD_START_PRIORS, forecast, priorForEstimate } from './forecast/forecast-v0.js'
|
||||
export type { BurnUpPoint, Forecast, ForecastOptions, LognormalPrior } from './forecast/forecast-v0.js'
|
||||
export {
|
||||
COLD_START_PRIORS,
|
||||
durationParams,
|
||||
forecast,
|
||||
nearestBucket,
|
||||
PRIOR_BUCKETS,
|
||||
priorForEstimate,
|
||||
} from './forecast/forecast-v0.js'
|
||||
export type {
|
||||
BurnUpPoint,
|
||||
DurationModel,
|
||||
Forecast,
|
||||
ForecastOptions,
|
||||
LognormalPrior,
|
||||
} from './forecast/forecast-v0.js'
|
||||
|
||||
export {
|
||||
CALIBRATION_BUCKET_FLOOR,
|
||||
calibrationSamples,
|
||||
COLD_START_THRESHOLD,
|
||||
fitCalibration,
|
||||
toDurationModel,
|
||||
} from './calibration/calibration-v0.js'
|
||||
export type {
|
||||
BucketFit,
|
||||
CalibrationModel,
|
||||
CalibrationSample,
|
||||
PersonBias,
|
||||
} from './calibration/calibration-v0.js'
|
||||
|
||||
Reference in New Issue
Block a user