Files
zlareb1andClaude Opus 4.7 9b6eb38dc9 Bound date-range pipeline with TS_FILTER_END upper edge
Address review comment 3194583058: the date-range workflow promised
"between A and B" but only filtered ts >= '{{TS_FILTER}}', so a request
like "between 2026-04-01 and 2026-05-01" silently included every nightly
after 2026-05-01 and let cumulative deltas drift as new runs accumulated.

Add a parallel TS_FILTER_END / KEEPER_SKILL_THRESHOLD_END upper bound that
mirrors the existing lower bound at every layer:

  - All 6 staging SQL queries: append `AND ts < '{{TS_FILTER_END}}'`.
  - `rebuild.sh`: accept `$3` as the upper bound; sed-substitute both
    placeholders; export both env vars for the Python pipeline.
  - `_common.py`: parse `KEEPER_SKILL_THRESHOLD_END` (defaults to far-future
    sentinel `9999-12-31`) so unbounded callers keep today's behavior.
  - `build_pr_nightly_map.py` and `compute_deltas.py`: filter PRs against
    the half-open `[THRESHOLD, THRESHOLD_END)` interval.
  - `SKILL.md`: update Phase 2 invocation and Example 2 ("between
    2026-04-01 and 2026-05-01") to pass both bounds.
  - `tests/test_common.py`: 2 new cases for the `THRESHOLD_END` default
    and explicit-env-var parse path. 23 -> 25 cases, all pass.

Backward-compat regression contract: invoking `rebuild.sh ... 2026-03-25`
(no upper bound) still produces `cumulative_gains.tsv` md5
e5a27e01008ef7e23597ee041f68103b and the `#99651` PR-branch isolation row
bit-identical. Bounded smoke (`... 2026-03-25 2026-04-15`) verified to
produce strictly fewer rows in `bench_summary.tsv` and `merged_metrics.tsv`,
with max `run_ended` < `2026-04-15` and all `pr_to_nightly.tsv` `merged_at`
< `2026-04-15`.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-06 10:27:53 +00:00

42 lines
2.4 KiB
SQL

-- One row per (scenario, backend, commit_sha) with full bench summary
SELECT
scenario,
backend,
commit_sha,
substring(commit_sha, 1, 8) AS sha8,
max(ts) AS run_ended,
-- argMaxIf pulls each metric from the row where `ts` is max within rows
-- of the requested `name` — i.e. the latest run's value. Plain `maxIf`
-- would mix the latest `ts` (in `run_ended`) with peak-across-all-runs
-- metric values when the same (scenario, backend, commit_sha) was retried.
round(argMaxIf(value, ts, name = 'rps'), 1) AS rps,
round(argMaxIf(value, ts, name = 'read_rps'), 1) AS read_rps,
round(argMaxIf(value, ts, name = 'write_rps'), 1) AS write_rps,
round(argMaxIf(value, ts, name = 'read_p50_ms'), 2) AS read_p50_ms,
round(argMaxIf(value, ts, name = 'read_p95_ms'), 2) AS read_p95_ms,
round(argMaxIf(value, ts, name = 'read_p99_ms'), 2) AS read_p99_ms,
round(argMaxIf(value, ts, name = 'read_p99_90_ms'), 2) AS read_p99_90_ms,
round(argMaxIf(value, ts, name = 'read_p99_99_ms'), 2) AS read_p99_99_ms,
round(argMaxIf(value, ts, name = 'write_p50_ms'), 2) AS write_p50_ms,
round(argMaxIf(value, ts, name = 'write_p95_ms'), 2) AS write_p95_ms,
round(argMaxIf(value, ts, name = 'write_p99_ms'), 2) AS write_p99_ms,
round(argMaxIf(value, ts, name = 'write_p99_90_ms'), 2) AS write_p99_90_ms,
round(argMaxIf(value, ts, name = 'write_p99_99_ms'), 2) AS write_p99_99_ms,
round(argMaxIf(value, ts, name = 'errors'), 0) AS errors,
round(argMaxIf(value, ts, name = 'error_rate') * 100, 4) AS error_pct,
round(argMaxIf(value, ts, name = 'ops'), 0) AS ops,
round(argMaxIf(value, ts, name = 'read_bytes_per_second'), 0) AS read_bps,
round(argMaxIf(value, ts, name = 'write_bytes_per_second'), 0) AS write_bps,
round(argMaxIf(value, ts, name = 'total_znode_delta'), 0) AS znode_delta,
round(argMaxIf(value, ts, name = 'total_dirs_bytes_delta'), 0) AS dirs_bytes_delta,
round(argMaxIf(value, ts, name = 'bench_duration'), 0) AS bench_duration_s
FROM keeper_stress_tests.keeper_metrics_ts
WHERE source = 'bench'
AND stage = 'summary'
AND branch = 'master'
AND ts >= '{{TS_FILTER}}'
AND ts < '{{TS_FILTER_END}}'
GROUP BY scenario, backend, commit_sha
ORDER BY scenario, backend, run_ended
FORMAT TSVWithNames