Skip to content

Hold a changepoint model beside a threshold's model - #1534

Draft
epompeii wants to merge 1 commit into
develfrom
u/ep/changepoint/slot
Draft

epompeii wants to merge 1 commit into
develfrom
u/ep/changepoint/slot

Conversation

@epompeii

Copy link
Copy Markdown
Member

A threshold gains a second model slot, changepoint_model, beside model. The threshold's key does not change, and no threshold changes identity. Which slot a model belongs in follows from its test: a test that checks a line goes in changepoint_model, and every other test goes in model. No line test exists yet, so in this change every test is a metric test and the new slot refuses every model. A later change adds the line test with one arm.

What changes

  • Schema. threshold.changepoint_model_id, nullable, a foreign key to model, directly after model_id, by table recreate. Every existing row has it empty. Every index and foreign key is kept, and the new column gets its own index.
  • Threshold responses carry changepoint_model beside model, null when empty.
  • Threshold create and update bodies take a nested changepoint_model object beside the flat model fields. On an update, an absent key changes nothing, null empties the slot, and an object sets it. A model whose test belongs in the other slot is refused with a 400 that names the slot.
  • GET a threshold takes ?changepoint_model=<uuid> beside ?model=<uuid> to pin a model of that slot. A pin whose test belongs in the other slot is a 400.
  • Reports at BMF v1 route each threshold entry to a slot by its test. Two entries for one key apply when their slots differ; within one slot the last entry wins, as today. reset clears every slot the report did not name. At BMF v0 nothing changes.
  • Start point clones copy both slots, and a re-sync with reset replaces both.
  • The console API serves the threshold page with models (the metric lineage) beside changepoint_model and changepoint_models, and each list row with changepoint_model.
  • Detection does not change. The metric detector, boundaries, and alerts read model only.
  • Docs: --thresholds-reset clears each slot that the subcommand does not specify.

Tests

lib/api_projects/tests/changepoint_model.rs covers the migration up, down, and up; the empty slot in responses; the refusals on create, update, and pins; a pinned alert view; the console page; report reset; clone and re-sync; and that no delete or replacement leaves a slot pointing at a replaced or deleted model.

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

ProjectBencher
Branchu/ep/changepoint/slot
Testbedintel-v1
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
Adapter::Json📈 view plot
🚷 view threshold
5.27 µs
(+1.43%)Baseline: 5.20 µs
5.47 µs
(96.34%)
Adapter::Magic (JSON)📈 view plot
🚷 view threshold
5.13 µs
(+2.06%)Baseline: 5.03 µs
5.29 µs
(97.10%)
Adapter::Magic (Rust)📈 view plot
🚷 view threshold
26.34 µs
(-1.89%)Baseline: 26.85 µs
28.64 µs
(91.96%)
Adapter::Rust📈 view plot
🚷 view threshold
4.55 µs
(+1.86%)Baseline: 4.47 µs
4.67 µs
(97.46%)
Adapter::RustBench📈 view plot
🚷 view threshold
4.54 µs
(+1.69%)Baseline: 4.46 µs
4.67 µs
(97.13%)
🐰 View full continuous benchmarking report in Bencher

@epompeii
epompeii added this pull request to stack #1536 November 18, 2026 23:42
@epompeii
epompeii force-pushed the u/ep/changepoint/slot branch from f4603a0 to e237943 Compare December 1, 2026 23:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant