Skip to content

research(episodes): materialize window-separated candidate oracle - #115

Merged
stacknil merged 8 commits into
mainfrom
stacknil/v07-candidate-oracle
Aug 27, 2026
Merged

research(episodes): materialize window-separated candidate oracle#115
stacknil merged 8 commits into
mainfrom
stacknil/v07-candidate-oracle

Conversation

@stacknil

@stacknil stacknil commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Summary - consume the fail-closed v0.6 baseline contract from #117 before oracle generation - materialize a canonical candidate oracle whose full derived state must match fixture recomputation - use one event-to-candidate membership index for overlap, decision, and validation cross-references ## Why The first delayed review found four merge blockers: source-inconsistent oracle fields were accepted, unsupported rule families could borrow brute-force scoring, equivalent timestamp offsets changed finding identity, and baseline drift beyond episode count was ignored. It also found repeated membership scans that took about 32.7 seconds at the legal 990-candidate boundary. #117 owns rule/baseline/UTC identity binding. This PR stays focused on oracle materialization and exact source-derived validation, keeping its evaluator plus tests at 485 nonblank lines. ## Measured result - baseline: 1 episode - candidate: 2 episodes - included evidence: 10 dense-peak events, each consumed once - excluded evidence: 5 bridge-background events, retained as explicit decisions - deterministic finding IDs: finding:brute_force:584fd14b544a7959 and finding:brute_force:a885dcb623777120 - reversed input and equivalent timezone offsets: identical ordered oracle - legal 200-event / 990-candidate local benchmark: 0.658 seconds for build plus cross-reference validation after indexing ## How to validate text python -m ruff check scripts/episode_baseline_contract.py scripts/episode_candidate_core.py scripts/evaluate_episode_candidate.py tests/test_episode_candidate_baseline_contract.py tests/test_episode_candidate_core.py tests/test_episode_candidate.py python -B -m unittest discover -s tests -p "test_episode_candidate*.py" -v python scripts/evaluate_episode_candidate.py --fixture tests/fixtures/episode_semantics_v0.7/continuous_background_two_peaks/fixture.json --baseline tests/fixtures/episode_semantics_v0.7/continuous_background_two_peaks/baseline.expected.json --check tests/fixtures/episode_semantics_v0.7/continuous_background_two_peaks/candidate.window-separated-v1.expected.json cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=ON -D LOGLENS_WARNINGS_AS_ERRORS=ON cmake --build build --config Release ctest --test-dir build --build-config Release --output-on-failure Expected: Ruff passes, 16 research tests pass, the oracle is byte-stable, and all 7 CTest entries pass. ## Design decision #117 is authoritative for fixture-to-baseline compatibility. This layer builds candidate state from that validated context, checks local evidence ownership, then requires an audited oracle to equal a complete canonical recomputation. Membership is indexed once per segment rather than repeatedly scanning all candidates. ## Main risk This proves one bounded synthetic fixture only. The remaining ADR fixture matrix and a production complexity design still block runtime adoption. ## Compatibility impact None for Detector::analyze(), loglens.report.v3, CLI output, configuration, or release behavior. The JSON remains a research-only fixture artifact. ## Rollback path Revert the oracle commits after removing this stacked layer. The baseline contract and selection core remain independently useful; no runtime state or consumer migration is involved. ## Review policy

Merged after the delayed review's four semantic findings and performance finding were resolved, the exact head completed fresh checks (11/11), and final diff review found no remaining issue. #116 was subsequently retargeted to main.

@stacknil

Copy link
Copy Markdown
Owner Author

Post-CI diff review completed at c26972400a4aece464dcff7c8d493ded1e1e4395.

  • Design decision: one baseline-bound evaluator is authoritative for candidate-v1 oracle generation and semantic cross-reference validation.
  • Main risk: the result proves one bounded synthetic fixture only; super-quadratic research complexity and the remaining ADR matrix block runtime adoption.
  • Compatibility impact: no detector, report-v3, CLI, configuration, or release behavior changes.
  • Rollback path: revert the three oracle commits; the independently merged core remains intact.

Evidence: clean detached-tree 8/8 candidate tests, exact oracle regeneration, Draft 2020-12 validation, MSVC /WX build, 7/7 CTest, git diff --check, and Gitleaks with no findings. All GitHub checks pass and no review/bot comment requires action.

This PR remains draft for the required delayed report/schema review. Stacked validation gate: #116.

@stacknil
stacknil changed the base branch from main to stacknil/v07-baseline-contract August 26, 2026 02:12
@stacknil
stacknil changed the base branch from stacknil/v07-baseline-contract to main August 27, 2026 03:09
@stacknil

Copy link
Copy Markdown
Owner Author

Final current-head review for 3d5c1090c87c8712b85d7784abf7180cfcb54a7a is complete.

  • Design decision: consume the independently validated baseline contract, materialize one canonical oracle from source fixtures, and reuse a single event-to-candidate membership index for decisions and cross-reference validation.
  • Main risk: the result proves one bounded synthetic fixture and the exhaustive candidate materialization still has super-quadratic worst-case cost. Hard 200-event/1,000-candidate limits and explicit research-only labeling keep that boundary fail closed.
  • Compatibility impact: none for Detector::analyze(), loglens.report.v3, CLI output, configuration, or released behavior.
  • Rollback path: revert the research(episodes): materialize window-separated candidate oracle #115 merge commit. The merged research(episodes): bind candidates to the v0.6 baseline contract #117 baseline contract remains independently useful, and no runtime or consumer migration is involved.

Fresh evidence on this exact head:

  • GitHub checks: 11/11 successful
  • Ruff: passed
  • research suite: 16/16 passed
  • committed oracle byte check: passed
  • strict MSVC /WX build: passed
  • CTest: 7/7 passed
  • git diff --check origin/main...HEAD: passed
  • Gitleaks over origin/main..HEAD: no leaks
  • final delayed diff review: no unresolved findings

The delayed review's four semantic blockers and repeated membership-scan finding are closed. No review or bot comment requires action.

@stacknil
stacknil marked this pull request as ready for review August 27, 2026 03:15
@stacknil
stacknil merged commit 42c4e21 into main Aug 27, 2026
11 checks passed
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