Skip to content
Open
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
5 changes: 5 additions & 0 deletions .codegraph/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CodeGraph data files — local to each machine, not for committing.
# Ignore everything in .codegraph/ except this file itself, so transient
# files (the database, daemon.pid, sockets, logs) never show up in git.
*
!.gitignore
1 change: 1 addition & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ 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 |
| `psychometric_fit` | CPU `f64` ESEM loading recovery and event-time DSEM lag gates |

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

- `psychometric_fit` CPU `f64` ESEM/DSEM fit: exploratory OLS recovers known cross-loadings from admitted log-ratio or logistic-normal coordinates with computed RMSE below a zero-loading collapse; reverse or zero event-time lagged paths fail closed; a good global fit cannot reclassify formative or network constructs as reflective (ADR 0005). No new migration number (`#45` still owns `0007`).
- `tepp_api` naruon live loopback HTTP/1.1 listener: `serve_one` installs a read/write deadline, requires a loopback `Host`, refuses `Transfer-Encoding` and NIM/proxy credential headers, parses `knowledge_cutoff` as RFC 3339 and refuses a future cutoff, keys analysis-run idempotency by tenant plus key, and proves both analysis-run and export POSTs over a real `TcpStream`. Not a production TLS/`$PORT` service (ADR 0011).
- `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.
Expand Down
4 changes: 4 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/psychometric_fit",
]
default-members = [
"crates/evidence_core",
Expand All @@ -23,6 +24,7 @@ default-members = [
"crates/tepp_simulation",
"crates/validation_core",
"crates/tepp_api",
"crates/psychometric_fit",
]

[workspace.package]
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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
The eleven bounded crates compile independently but intentionally expose no
placeholder production APIs. Domain behavior begins in Task 2 with immutable
evidence identifiers and source records.

Expand All @@ -22,6 +22,7 @@ crates/corpus_split
crates/tepp_simulation
crates/validation_core
crates/tepp_api
crates/psychometric_fit
```

## Local verification
Expand Down
17 changes: 17 additions & 0 deletions crates/psychometric_fit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "psychometric_fit"
description = "CPU f64 ESEM loading recovery and event-time DSEM lag gates."
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

[lints]
workspace = true
80 changes: 80 additions & 0 deletions crates/psychometric_fit/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
//! Fail-closed ESEM/DSEM fit errors.

use std::fmt;

/// A fail-closed psychometric-fit error.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[non_exhaustive]
pub enum PsychometricFitError {
/// Raw simplex proportions were offered as Euclidean fit inputs.
RawProportionForbidden,
/// Empty, rank-unsupported, unequal-length, or non-finite numeric input.
InvalidNumericInput,
/// A predictor matrix has a singular Gram matrix.
SingularDesign,
/// A lagged path would move backward or stay put in event time.
ReverseEventTimePath,
/// A good global fit was used to reinterpret a formative or network
/// construct as reflective.
FormativeReinterpretationForbidden,
/// The construct class is unresolved, so reflective interpretation is
/// unavailable.
UnresolvedConstruct,
}

impl fmt::Display for PsychometricFitError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let message = match self {
Self::RawProportionForbidden => {
"raw topic proportions are forbidden psychometric fit inputs"
}
Self::InvalidNumericInput => "invalid psychometric fit numeric input",
Self::SingularDesign => "singular psychometric fit design matrix",
Self::ReverseEventTimePath => "DSEM lagged paths cannot move backward in event time",
Self::FormativeReinterpretationForbidden => {
"formative or network constructs cannot be reinterpreted as reflective"
}
Self::UnresolvedConstruct => "construct class is unresolved",
};
formatter.write_str(message)
}
}

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

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

#[test]
fn error_messages_are_stable() {
for (error, message) in [
(
PsychometricFitError::RawProportionForbidden,
"raw topic proportions are forbidden psychometric fit inputs",
),
(
PsychometricFitError::InvalidNumericInput,
"invalid psychometric fit numeric input",
),
(
PsychometricFitError::SingularDesign,
"singular psychometric fit design matrix",
),
(
PsychometricFitError::ReverseEventTimePath,
"DSEM lagged paths cannot move backward in event time",
),
(
PsychometricFitError::FormativeReinterpretationForbidden,
"formative or network constructs cannot be reinterpreted as reflective",
),
(
PsychometricFitError::UnresolvedConstruct,
"construct class is unresolved",
),
] {
assert_eq!(error.to_string(), message);
}
}
}
Loading