Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ boundaries above remain the target modular MSA architecture.
| `tepp_simulation` | known-truth temporal/event data generation |
| `validation_core` | RMSE, bias, coverage, graph, and Monte Carlo metrics |
| `tepp_api` | versioned DTO, schema, and export contracts |
| `prediction_contradiction` | Allen promotion gate: `before`/`after` stay contradictory; `meets`/`met_by` stay unsupported |

No crate exposes placeholder production behavior in Task 1. This prevents an
empty façade from becoming a de facto public API before its invariants and tests
exist.
Foundation crates expose only tested contracts. Empty façades are not public
APIs.

## Immutable evidence boundary

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to TEPP are documented here. The format follows Keep a Chang

### Added

- `prediction_contradiction` promotion gate: `temporal_core` Allen classification refuses `before`/`after` as contradiction and `meets`/`met_by` as unsupported adjacency; evidence available after the knowledge cutoff is ineligible. Label agreement is not RMSE recovery (ADR 0002, ADR 0016).
- `tepp_api` adaptive orchestration router (ADR 0010): versioned `direct`/`verify`/`committee`/`conductor`/`abstain` selection from CPU `f64` risk, ambiguity, evidence, and token-budget inputs; recorded stages, recursion, decomposition, access lists, and role-specific reasoning effort; fail-closed document-controlled policy/access/credentials; LLM plans remain proposals under deterministic statistical authority; comparable-budget ablation requires a direct baseline; credential-free contextual-orchestrator binding. Live NIM HTTP remains accepted-target.
- `tepp_api` purpose-bound provider-payload minimization: time-bounded `PurposeGrant` evaluation, fail-closed expired/not-yet-valid/inverted/cross-tenant/impossible-calendar denial, semantic UTC calendar validation, refusal to copy identity mappings into model-provider payloads or ordinary logs, preservation of opaque analytical identifiers and membership roles (no blanket PII mask), a separately authorized scientific re-identification path, and an internally bound FIPS 180-4 SHA-256 audit digest appended through `ReidentificationAuditSink` before disclosure.
- `persistence_postgres` backup/restore integrity: restored snapshots stay unusable until tenant, canonical `SHA-256`, knowledge-cutoff eligibility, temporal window order, and append-only triggers revalidate; SQL probes raise `restore integrity failed` (ADR 0013).
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ members = [
"crates/tepp_simulation",
"crates/validation_core",
"crates/tepp_api",
"crates/prediction_contradiction",
]
default-members = [
"crates/evidence_core",
Expand All @@ -23,6 +24,7 @@ default-members = [
"crates/tepp_simulation",
"crates/validation_core",
"crates/tepp_api",
"crates/prediction_contradiction",
]

[workspace.package]
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ implemented in Rust.

## Current implementation state

This branch establishes the Task 1 Rust workspace and quality-gate foundation.
The ten bounded crates compile independently but intentionally expose no
placeholder production APIs. Domain behavior begins in Task 2 with immutable
evidence identifiers and source records.
This branch keeps the Rust workspace quality foundation and the bounded
foundation crates. Domain crates expose only tested contracts: immutable
evidence, six-clock temporal values, event mentions/instances, relations,
membership, persistence, splits, simulation, validation, API DTOs, and the
predicted-versus-observed promotion gate.

```text
crates/evidence_core
Expand All @@ -22,6 +23,7 @@ crates/corpus_split
crates/tepp_simulation
crates/validation_core
crates/tepp_api
crates/prediction_contradiction
```

## Local verification
Expand Down
20 changes: 20 additions & 0 deletions crates/prediction_contradiction/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "prediction_contradiction"
description = "Predicted intervals that contradict observations cannot become fact."
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true
publish = false

[dependencies]
temporal_core = { path = "../temporal_core", version = "0.1.0" }

[lints]
workspace = true
82 changes: 82 additions & 0 deletions crates/prediction_contradiction/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//! Fail-closed prediction-contradiction errors.

use std::fmt;

/// A fail-closed prediction-contradiction error.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum PredictionContradictionError {
/// Predicted and observed event-time intervals are Allen `before` or `after`.
PredictionContradictsObservation,
/// Predicted and observed intervals meet but do not overlap in their interiors.
PredictionLacksOverlappingSupport,
/// Observed evidence covers only part of the predicted interval.
PredictionLacksFullSupport,
/// Observed evidence became available after the analysis knowledge cutoff.
EvidenceAfterCutoff,
/// An interval is not a closed proper Allen input.
InvalidIntervalPayload,
/// An agreement-rate comparison used empty or length-mismatched slices.
AgreementSliceMismatch,
}

impl fmt::Display for PredictionContradictionError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let message = match self {
Self::PredictionContradictsObservation => {
"predicted interval contradicts observed evidence"
}
Self::PredictionLacksOverlappingSupport => {
"predicted interval is adjacent to observation without overlapping support"
}
Self::PredictionLacksFullSupport => {
"predicted interval is not fully supported by observed evidence"
}
Comment thread
seonghobae marked this conversation as resolved.
Self::EvidenceAfterCutoff => {
"observed evidence is available after the knowledge cutoff"
}
Self::InvalidIntervalPayload => "invalid prediction-contradiction payload",
Self::AgreementSliceMismatch => "agreement slices are empty or length-mismatched",
};
formatter.write_str(message)
}
}

impl std::error::Error for PredictionContradictionError {}

#[cfg(test)]
mod tests {
use super::PredictionContradictionError;

#[test]
fn error_messages_are_stable() {
for (error, message) in [
(
PredictionContradictionError::PredictionContradictsObservation,
"predicted interval contradicts observed evidence",
),
(
PredictionContradictionError::PredictionLacksOverlappingSupport,
"predicted interval is adjacent to observation without overlapping support",
),
(
PredictionContradictionError::PredictionLacksFullSupport,
"predicted interval is not fully supported by observed evidence",
),
(
PredictionContradictionError::EvidenceAfterCutoff,
"observed evidence is available after the knowledge cutoff",
),
(
PredictionContradictionError::InvalidIntervalPayload,
"invalid prediction-contradiction payload",
),
(
PredictionContradictionError::AgreementSliceMismatch,
"agreement slices are empty or length-mismatched",
),
] {
assert_eq!(error.to_string(), message);
}
}
}
Loading
Loading