Problem
Found while live-verifying the cost-tracking writer (#103). Commands resolve the analytics DB path inconsistently:
dispatch (the writer) uses config.Analytics.DBPath from the loaded config.
stats uses a --data-dir flag that defaults to ~/.hookwise/analytics.db (DefaultDBPath) and does not read config.Analytics.DBPath or honor HOOKWISE_STATE_DIR.
So if a user sets a custom analytics.db_path, dispatch writes cost into the custom DB but stats reads the default DB and shows $0. (Repro: set analytics.db_path to a temp file, dispatch a Stop with a transcript → custom DB gets total_today/estimated_cost_usd, but hookwise stats shows $0 from ~/.hookwise/analytics.db.)
Default config (no custom db_path) is unaffected since both land on ~/.hookwise/analytics.db.
Likely also affected
The cost status-line segment / renderCostSegment path — confirm it resolves the DB the same way dispatch does.
Fix direction
Make stats (and the status-line cost path) default dataDir from the loaded config's Analytics.DBPath (falling back to DefaultDBPath) so reader and writer agree. Same class as #104 (doctor reads real ~/.hookwise).
Severity: low-medium (silent $0 under custom db_path), but it undermines confidence in the brand-new cost feature.
Problem
Found while live-verifying the cost-tracking writer (#103). Commands resolve the analytics DB path inconsistently:
dispatch(the writer) usesconfig.Analytics.DBPathfrom the loaded config.statsuses a--data-dirflag that defaults to~/.hookwise/analytics.db(DefaultDBPath) and does not readconfig.Analytics.DBPathor honorHOOKWISE_STATE_DIR.So if a user sets a custom
analytics.db_path,dispatchwrites cost into the custom DB butstatsreads the default DB and shows$0. (Repro: setanalytics.db_pathto a temp file, dispatch a Stop with a transcript → custom DB getstotal_today/estimated_cost_usd, buthookwise statsshows$0from~/.hookwise/analytics.db.)Default config (no custom
db_path) is unaffected since both land on~/.hookwise/analytics.db.Likely also affected
The
coststatus-line segment /renderCostSegmentpath — confirm it resolves the DB the same waydispatchdoes.Fix direction
Make
stats(and the status-line cost path) defaultdataDirfrom the loaded config'sAnalytics.DBPath(falling back toDefaultDBPath) so reader and writer agree. Same class as #104 (doctor reads real~/.hookwise).Severity: low-medium (silent $0 under custom db_path), but it undermines confidence in the brand-new cost feature.