Skip to content

feat(event): score mention confidence with a known-truth Brier rule - #64

Merged
seonghobae merged 5 commits into
mainfrom
agent/event-confidence-brier
Aug 24, 2026
Merged

feat(event): score mention confidence with a known-truth Brier rule#64
seonghobae merged 5 commits into
mainfrom
agent/event-confidence-brier

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

#37#63 remain review-blocked (no independent APPROVE). #37 and #45 kept ready. Next no-0008 gap: mention-confidence Brier score in existing event_core (does not recreate the TDT/CHRONOS #50 slice).

  • Perfect (0,1,0,1) forecasts recover Brier 0
  • Constant 0.5 recovers 0.25 with computed residual RMSE
  • Empty/mismatched streams fail closed

Test plan

  • RED: confidence_calibration_contract failed with E0432
  • cargo test -p event_core --offline
  • cargo clippy -p event_core --all-targets --offline -- -D warnings
  • python3 scripts/validate_documentation.py and check_docstrings.py
  • exact-head required Checks (do not treat queued evidence as passed)

Do not self-approve or merge. Prefer merge #37 then #45 when eligible. Do not allocate 0008.


Open in Devin Review

Perfect forecasts recover Brier 0 and constant 0.5 recovers 0.25.
Empty or mismatched streams fail closed. No new migration.
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 19 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0132aa0b-32e1-4a6e-a690-3e51936c5944

📥 Commits

Reviewing files that changed from the base of the PR and between 1808151 and 40e6926.

📒 Files selected for processing (8)
  • CHANGELOG.md
  • DOCUMENTATION.md
  • crates/event_core/src/confidence.rs
  • crates/event_core/src/lib.rs
  • crates/event_core/tests/confidence_calibration_contract.rs
  • docs/TRACEABILITY.md
  • docs/research/mention-confidence-brier.md
  • docs/validation/temporal-event-foundation.md

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as draft August 13, 2026 17:47
@seonghobae

Copy link
Copy Markdown
Contributor Author

Revalidated current head b056ac9. Mention-confidence validation is finite and bounded in [0,1]; perfect known-truth forecasts produce Brier score 0, constant 0.5 forecasts produce 0.25, and empty or mismatched streams fail closed. Passed: cargo fmt --all -- --check; pinned Rust 1.97.1 cargo test -p event_core --offline (4 unit, 2 confidence-calibration, 1 crate, 4 mention-instance, doctests); cargo clippy -p event_core --all-targets --offline -- -D warnings with the repository toolchain on PATH; python3 scripts/check_docstrings.py; python3 scripts/validate_documentation.py; git diff --check. The research and validation entries document the known-truth Brier acceptance.

# Conflicts:
#	CHANGELOG.md
#	DOCUMENTATION.md
#	docs/TRACEABILITY.md
#	docs/validation/temporal-event-foundation.md
@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head refresh completed for d2d552d90dd1f2cab377760cde705747c002f9a4 (merge commit d2d552d from protected main).\n\n- Resolved the DIRTY state while preserving the mention-confidence/Brier evidence and protected-main persistence/API documentation.\n- cargo fmt --all -- --check: passed.\n- cargo test -p event_core --all-features: 11 passed, 0 failed.\n- cargo clippy -p event_core --all-features -- -D warnings: passed.\n- python scripts/check_workspace_contract.py: passed.\n- python -m pytest -q tests/quality/test_check_docstrings.py: 5 passed.\n\nThe hosted Checks have restarted for this exact head. Merge remains blocked pending completion and a qualifying independent approval.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Fixed current-head validation-ledger duplicates at 22a5955a0ba23a65ee597ff5f630eadb389e7446.

  • Retained the richer Versioned API/export row with naruon interchange evidence and removed the stale duplicate.
  • Retained one Mention-confidence Brier score row.
  • python scripts/validate_documentation.py: passed.
  • python -m pytest -q tests/quality: 89 passed, 1 warning, 18 subtests.
  • git diff --check: passed.

Hosted Checks are running for this exact head; no bypass or merge was performed.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head review refresh for :\n\n- The mention-confidence implementation keeps calibration as a known-truth Brier-rule measurement rather than treating a confidence score as scientific authority.\n- , documentation validation, workspace contract, docstring contract, and passed locally.\n- All hosted exact-head checks, including Rust tests, PostgreSQL integration, coverage, security scans, and Strix, pass.\n- No new actionable defect was found at this exact head; no approval is being self-issued.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Current-head review refresh for 22a5955:

  • The mention-confidence implementation keeps calibration as a known-truth Brier-rule measurement rather than treating a confidence score as scientific authority.
  • git diff --check, documentation validation, workspace contract, docstring contract, and cargo fmt --all -- --check passed locally.
  • All hosted exact-head checks, including Rust tests, PostgreSQL integration, coverage, security scans, and Strix, pass.
  • No new actionable defect was found at this exact head; no approval is being self-issued.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head review receipt: current-main conflict repair was completed and pushed at c11adce997d4f3e462f50711211af9f051e747b0. Local proof: Rust fmt, event_core confidence/Brier tests, workspace clippy -D warnings, documentation validator, workspace contract, git diff --check, CodeGraph sync, and CodeReviewGraph update. Please evaluate this exact SHA with independent Noema/OpenCode review; current-head required Checks remain authoritative before merge. @cwl-noema-review @opencode-agent

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head c11adce997d4f3e462f50711211af9f051e747b0.

  • Head SHA: c11adce997d4f3e462f50711211af9f051e747b0

  • Workflow run: 32593778852

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (5 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (5 files)"]
  R1 --> V1["required checks"]
  Evidence --> S2["Docs (5 files)"]
  S2 --> I2["operator or user guidance"]
  I2 --> R2["Review risk: Docs (5 files)"]
  R2 --> V2["docs review"]
Loading

@opencode-agent

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: c11adce997d4f3e462f50711211af9f051e747b0
  • Workflow run: 32593778852
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head c11adce997d4f3e462f50711211af9f051e747b0.

  • Head SHA: c11adce997d4f3e462f50711211af9f051e747b0

  • Workflow run: 32593778852

  • Workflow attempt: 1

Coverage evidence

Coverage Decision

  • Result: FAIL
  • Test evidence: not proven passing
  • Docstring evidence: not proven passing when configured
  • Failure count: 1

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file (5 files)"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file (5 files)"]
  R1 --> V1["required checks"]
  Evidence --> S2["Docs (5 files)"]
  S2 --> I2["operator or user guidance"]
  I2 --> R2["Review risk: Docs (5 files)"]
  R2 --> V2["docs review"]
Loading

@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 23, 2026 13:16

Stale coverage-evidence CHANGES_REQUESTED. Exact head c11adce now has coverage-evidence success. Not an approval.

@seonghobae
seonghobae enabled auto-merge (squash) August 24, 2026 00:58
…e-brier

# Conflicts:
#	CHANGELOG.md
#	DOCUMENTATION.md
#	docs/TRACEABILITY.md
#	docs/validation/temporal-event-foundation.md
@seonghobae
seonghobae merged commit 8ae8932 into main Aug 24, 2026
25 of 27 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 new potential issues.

Open in Devin Review

Comment on lines +48 to +63
pub fn mention_brier_score(
forecasts: &[EventConfidence],
outcomes: &[bool],
) -> Result<f64, EventError> {
if forecasts.is_empty() || forecasts.len() != outcomes.len() {
return Err(EventError::InvalidWirePayload);
}
let mut square_sum = 0.0_f64;
for (forecast, outcome) in forecasts.iter().zip(outcomes) {
let target = if *outcome { 1.0 } else { 0.0 };
let residual = forecast.value() - target;
square_sum += residual * residual;
}
#[allow(clippy::cast_precision_loss)]
Ok(square_sum / forecasts.len() as f64)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Brier score computation is correct and fail-closed

mention_brier_score (confidence.rs) computes the mean of squared residuals against binary truth, matching the standard Brier score. It fails closed on empty or length-mismatched inputs via EventError::InvalidWirePayload, and EventConfidence already guarantees finite values in [0,1], so no NaN/overflow risk exists. The logic verified against the documented test vectors (perfect 0, constant-0.5 = 0.25).

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +13 to +21
## Authoritative sources

Brier, G. W. (1950). Verification of forecasts expressed in terms of probability. *Monthly Weather Review, 78*(1), 1–3. https://doi.org/10.1175/1520-0493(1950)078<0001:VOFEIT>2.0.CO;2

Gneiting, T., & Raftery, A. E. (2007). Strictly proper scoring rules, prediction, and estimation. *Journal of the American Statistical Association, 102*(477), 359–378. https://doi.org/10.1198/016214506000001437

## Application

Brier (1950) defines the mean squared error of a probability forecast. Gneiting and Raftery (2007) treat the Brier score as a strictly proper scoring rule, so a mention that is certain when true and impossible when false is uniquely optimal. TEPP therefore scores mention confidence against known binary outcomes rather than treating a high score as an event instance (Brier, 1950; Gneiting & Raftery, 2007).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: APA 7 reference placed in separate doctoring note, matching repo pattern

CONTRIBUTING.md states APA 7 references are recorded in docs/research/standards-and-literature.md, and the Brier/Gneiting references are NOT added there. I did not flag this because the established repo convention (e.g. docs/research/adaptive-orchestration-router.md) is per-capability doctoring notes carrying their own "Authoritative sources" section, which mention-confidence-brier.md follows, and AGENTS.md rule 13 only requires citation somewhere in docs/research/. Reviewer may still want to confirm whether the central register should be kept in sync.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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