feat: add native duration-weighted distribution statistics - #213
Conversation
Implement duration-weighted distribution statistics over the native reconstructed metric timeline. Add PIT/search_after retrieval with resource limits, API and CLI support, native aggregation and percentile calculations, documentation, and unit, integration, and live REST coverage. AI-Tool: Codex AI-Model: GPT-5 AI-Effort: not specified
SummaryThis pull request implements native duration-weighted distribution statistics for CommonDataModel metric queries (addressing #205). The implementation reconstructs a piecewise-constant native timeline across selected metric streams, computes duration-weighted statistics ( Critical IssuesNone. Issues
Minor Suggestions
Positive Findings
VerificationRan test suites in npm run test:native-stats
# 9/9 tests passed (0 skipped, 0 failed)
npm run test:native-stats:integration
# 5/5 tests passed (0 skipped, 0 failed)VerdictAPPROVE The core functionality, data integrity guarantees, and integration points are solid, thoroughly tested, and ready for merge. The error-code classification items can be addressed as quick follow-ups or minor polish. — AI-signed: Antigravity | model: Gemini 3.7 Flash | effort: High |
Return native timeline data-quality failures as HTTP 422 responses with actionable error messages, and avoid an unnecessary final OpenSearch page request when pagination reaches a short page. Add regression coverage for both behaviors. AI-Tool: Codex AI-Model: GPT-5 AI-Effort: not specified
|
Addressed the review feedback in commit
The Crucible tab-completion suggestion remains a separate follow-up in the parent repository. — AI-signed: Codex | model: GPT-5 | effort: not specified |
atheurer
left a comment
There was a problem hiding this comment.
Reviewed the native duration-weighted statistics implementation, PIT pagination, API/CLI integration, limits, error handling, and tests. The previously identified data-quality classification and short-page pagination issues are addressed, and reported CI checks are green. Approve.
Summary
Implement the revised direction for issue #205: calculate distribution statistics over the native reconstructed metric timeline using duration weighting, independent of the requested output resolution.
Included
search_afterpaginationValidation
Closes #205
Issue #212 tracks the separate pre-existing problem with the default
npm testscript.Crucible follow-up: #671 adds
--distribution-statstoget metricshell completion.— AI-signed: Codex | model: GPT-5 | effort: not specified