Skip to content

feat(api): carry scientific acceptance only on terminal results - #358

Closed
seonghobae wants to merge 2 commits into
mainfrom
feat/scientific-acceptance-terminal-wire-gap-003a
Closed

feat(api): carry scientific acceptance only on terminal results#358
seonghobae wants to merge 2 commits into
mainfrom
feat/scientific-acceptance-terminal-wire-gap-003a

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Consolidation decision — closed after invalid scientific authority was retired

This PR is not merged. Its exact head 96a34a41136bfd9ab405acd808645a5f422652ed is preserved as transport-contract lineage, but its purpose is to carry tepp.scientific_acceptance.v1 produced by #356. PR #356 has now been closed as scientifically unsafe because its generic RMSE/SE gate is scale-invariant, its recovery provenance is caller-declared, and it conflates Validation Evidence with Scientific Claim Promotion.

A terminal-result contract remains useful, but it must be rebuilt/folded into the coherent Analysis Run / Validation landing vehicle under #166 and #435 with these boundaries:

  • accepted/running receipts stay metric-free;
  • terminal transport may carry a versioned Validation Evidence reference/artifact only after that artifact is produced by the owning Rust validation path;
  • transport does not declare scientific acceptance or promote a model claim;
  • terminal binding/digest/failure-state tests from this branch must be preserved and re-run on the folded exact head;
  • Scientific Claim Promotion remains a separate scientific-validation aggregate/policy consuming formulation-specific recovery evidence.

Do not reopen this exact vehicle merely by renaming scientific_acceptance_v1; the authority model must change first. Branch, commits, tests, review history and doctoring remain available as fold evidence.

GAP-003A second slice: AnalysisRunRequest and AnalysisRunAccepted stay
metric-free receipts. tepp.scientific_acceptance.v1 is admitted only on a
succeeded terminal result with profile scientific_acceptance_v1. Receipt
RMSE/bias/coverage keys, missing artifacts, failed-terminal artifacts,
all-zero binding digests, and digest mismatch fail closed.

Does not promote implemented-main. analysis_engine library binding remains
on live #356. Persistence remains GAP-003B (issue #166).
@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 31 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: 50e653af-9168-48f2-977c-55c3f7a4f096

📥 Commits

Reviewing files that changed from the base of the PR and between 1bc02f5 and 96a34a4.

📒 Files selected for processing (10)
  • CHANGELOG.md
  • crates/tepp_api/src/analysis_result.rs
  • crates/tepp_api/src/analysis_run.rs
  • crates/tepp_api/src/lib.rs
  • crates/tepp_api/src/scientific_acceptance.rs
  • crates/tepp_api/tests/scientific_acceptance_contract.rs
  • docs/API_CONTRACT.md
  • docs/TRACEABILITY.md
  • docs/research/scientific-acceptance-terminal-wire.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.

@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.

Note

This report is out of date. Scroll down for Devin Review's latest report on this PR.

Devin Review found 8 potential issues.

Devin Review

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Required coverage evidence is absent

Repository rules require 100% production line and branch coverage. The listed verification omits coverage for the new validation and detector branches.

Devin Review

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

Comment thread crates/tepp_api/src/scientific_acceptance.rs
Comment thread crates/tepp_api/src/analysis_result.rs
Comment on lines +178 to +180
if !is_canonical_sha256(&self.binding_sha256)
|| self.binding_sha256.bytes().all(|byte| byte == b'0')
{

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Arbitrary digests pass binding validation

Any nonzero hexadecimal binding_sha256 passes without derivation from the artifact’s run, snapshot, cutoff, model, seed, backend, or precision. Invalid provenance appears verified.

Prompt for agents
Define a canonical, versioned preimage for ScientificAcceptanceArtifact.binding_sha256 and verify the field against a SHA-256 computed from the intended run-binding inputs. The encoding must be deterministic and unambiguous, and construction plus deserialization must use the same function. Add tests proving that changing each bound input independently invalidates the digest.
Devin Review

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

Comment thread crates/tepp_api/src/scientific_acceptance.rs Outdated
Comment thread crates/tepp_api/src/scientific_acceptance.rs Outdated
Comment on lines +187 to +189
impl Eq for ScientificAcceptanceReport {}

impl Eq for ScientificAcceptanceArtifact {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 Equality promise excludes constructible NaNs

Public f64 fields permit NaN-bearing values, while manual Eq promises reflexivity. Terminal results and statuses inherit the same invalid generic contract.

Devin Review

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

|| artifact.snapshot_id != self.snapshot_id
|| artifact.knowledge_cutoff != self.knowledge_cutoff
|| artifact.output_profile != self.output_profile
|| artifact.sha256()?.as_str() != digest

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: Nested artifact limit remains enforced

Terminal validation hashes through the artifact’s bounded serializer. Construction, parsing, and serialization therefore retain the independent 16 KiB artifact limit.

Devin Review

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

@seonghobae
seonghobae marked this pull request as draft August 31, 2026 08:08
GAP-003A Devin repair on #358. Terminal artifacts now fail closed on
negative RMSE/SEs, coverage/Wilson/temporal-order outside [0, 1],
inverted Wilson bounds, se_gate_accepted inconsistent with
|RMSE| <= k * SE(RMSE), k > MAX_SE_GATE_K, a model that does not match
the request, a future or malformed cutoff, and a run_id that is not
tepp-validation-{first 32 hex of binding_sha256}. Receipt metric
detection covers both standard errors, Wilson upper, and temporal-order
accuracy.

Not implemented-main. Engine binding remains #356. Persistence remains
GAP-003B.
@seonghobae
seonghobae marked this pull request as ready for review August 31, 2026 08:12

@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.

Devin Review

result_artifact_id: Some(result_artifact_id.into()),
result_sha256: Some(digest),
result_schema_version: Some(SCIENTIFIC_ACCEPTANCE_SCHEMA_VERSION.into()),
completed_at: completed_at.into(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Completion can predate evidence cutoff

succeeded_scientific_acceptance accepts completed_at earlier than the knowledge cutoff. The result can include evidence unavailable when it supposedly completed.

Prompt for agents
AnalysisRunTerminalResult::succeeded_scientific_acceptance and terminal-result validation parse completed_at and knowledge_cutoff independently but do not enforce temporal ordering. Reject terminal results whose system completion instant precedes their knowledge cutoff, so the eligible evidence horizon cannot extend beyond completion. Apply the invariant in shared terminal validation so parsed JSON and both succeeded constructors behave consistently, and add a test with completed_at before knowledge_cutoff.
Devin Review

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

Comment on lines +276 to +290
fn se_gate_accepts(rmse: f64, rmse_standard_error: f64, k: f64) -> Result<bool, ApiError> {
if ![rmse, rmse_standard_error, k]
.iter()
.all(|value| value.is_finite())
{
return Err(ApiError::InvalidWirePayload);
}
if k < 0.0 || rmse_standard_error < 0.0 || rmse < 0.0 {
return Err(ApiError::InvalidWirePayload);
}
if rmse_standard_error == 0.0 {
return Ok(rmse == 0.0);
}
let scale = rmse.max(rmse_standard_error).max(1.0);
Ok((rmse / scale) <= k * (rmse_standard_error / scale))

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: SE gate matches existing arithmetic

se_gate_accepts reproduces the existing zero-target acceptance rule. Scaling before multiplication preserves valid comparisons for very large finite inputs.

Devin Review

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

Copy link
Copy Markdown
Contributor Author

Hour-20 exact-head review request.

Current head 96a34a41136bfd9ab405acd808645a5f422652ed. Devin/CodeRabbit/author COMMENTED is not independent APPROVE. OpenCode DISMISSED/REQUEST_CHANGES on predecessor heads does not transfer. Ruleset 18156473 needs two independent APPROVE reviews on this exact SHA.

GAP-003A tepp_api terminal-wire. Metric-free request/accepted; tepp.scientific_acceptance.v1 only on succeeded terminal with profile scientific_acceptance_v1. Do not duplicate this DTO slice.

Do not self-approve. Do not --admin merge. Checks/reviews are not a reason to weaken fail-closed gates.

Copy link
Copy Markdown
Contributor Author

Hour-21 exact-head review request.

Current head 96a34a41136bfd9ab405acd808645a5f422652ed.
Devin/CodeRabbit/author COMMENTED is not independent APPROVE. Copilot review requests are not APPROVE. Ruleset 18156473 needs two independent approvals. Do not self-approve. Do not merge without two independent APPROVE reviews on this exact head.

@opencode-agent review

Copy link
Copy Markdown
Contributor Author

Hour-23 exact-head review request.

Current head 96a34a41136bfd9ab405acd808645a5f422652ed.
Do not duplicate this GAP-003A DTO slice. Metric-free request/accepted; tepp.scientific_acceptance.v1 only on succeeded terminal with profile scientific_acceptance_v1.

@opencode-agent review

This was referenced Aug 31, 2026
@seonghobae seonghobae closed this Sep 1, 2026
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