Skip to content

test(research): expose mean-gap padding sensitivity - #124

Merged
stacknil merged 2 commits into
mainfrom
stacknil/v07-density-padding-control
Aug 28, 2026
Merged

test(research): expose mean-gap padding sensitivity#124
stacknil merged 2 commits into
mainfrom
stacknil/v07-density-padding-control

Conversation

@stacknil

Copy link
Copy Markdown
Owner

Summary

  • add one focused characterization control for maximal-window padding sensitivity
  • show that adding one in-window event preserves two selected dense cores but flips the 2x mean-gap diagnostic from pass to fail
  • record why raw selected-window mean gap cannot be the sole candidate-v2 admission rule

Why

Hypothesis: adding evidence inside an already qualifying selected window should not make a two-dense-core admission diagnostic reject the pair when both dense cores and both selected episodes remain present.

The first adversarial control falsifies that hypothesis:

  • base offsets: dense cores at 0..120 and 1260..1380 seconds, bridge events at 650 and 700
  • base result: two five-event selections, 30-second internal means, 380-second bridge mean, 38/3x contrast, pass
  • padded input: add one event at offset 600
  • padded result: selections remain two episodes, the first expands to six events, internal maximum becomes 120 seconds, bridge mean becomes 220 seconds, 11/6x contrast, fail

The stopping rule is the first padding counterexample. No outlier-position or ratio sweep is needed.

Design decision

Do not use raw maximal-selected-window mean gap as a standalone candidate-v2 admission rule. Keep the current diagnostic as research characterization only and require a future design to separate threshold-sized dense-core evidence from maximal-window coverage.

This PR intentionally does not choose or implement a densest-core, quantile, trimmed-gap, or production policy.

How to validate

python -m unittest tests.test_episode_candidate_core
python -m unittest discover -s tests -p 'test_episode*.py'
python -m ruff check scripts tests
cmake --build build --config Debug --target ALL_BUILD -- /m:4 /nr:false /v:q /nologo
ctest --test-dir build -C Debug --output-on-failure
git diff --check origin/main...HEAD
gitleaks detect --source . --no-banner --redact --verbose

Local results:

  • candidate core: 10/10 passed
  • episode research suite: 32/32 passed
  • CTest: 7/7 passed
  • build, Ruff, diff, privacy, and Gitleaks checks: clean
  • fixture mutation: moving the padding event from 600 to 121 seconds made the focused test fail at the expected contrast assertion

Risk / rollout notes

  • Main risk: one synthetic counterexample proves insufficiency but does not select a robust replacement statistic or estimate production alert volume.
  • Compatibility impact: none; only a research test and ADR change. Detector::analyze(), CLI behavior, and loglens.report.v3 are unchanged.
  • Rollback path: revert the two commits in this PR; no schema, data, or runtime migration is involved.
  • Non-claim: the padded event is not classified as belonging or not belonging to a production episode.

@stacknil

Copy link
Copy Markdown
Owner Author

Post-CI final diff review completed.

  • Design decision: reject raw maximal-selected-window mean gap as the sole candidate-v2 admission rule; do not choose a replacement statistic in this PR.
  • Main risk: the synthetic counterexample proves insufficiency but does not estimate production alert volume or decide whether the padding event belongs to an episode.
  • Compatibility impact: none; this PR changes only one research test and the ADR. Detector::analyze(), CLI behavior, and loglens.report.v3 remain unchanged.
  • Rollback path: revert the two semantic commits; no schema, data, or runtime migration is involved.
  • Evidence: 11/11 remote checks passed; local core 10/10, research suite 32/32, CTest 7/7, build/Ruff/diff/Gitleaks/privacy clean. Moving the padding event from 600 to 121 seconds made the focused test fail at its expected contrast assertion.
  • Final review: selected ranges and the exact 38/3x to 11/6x derivation agree; no blocking comments, privacy issues, or unrelated runtime changes.

@stacknil
stacknil merged commit f780843 into main Aug 28, 2026
11 checks passed
@stacknil
stacknil deleted the stacknil/v07-density-padding-control branch August 28, 2026 15:15
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