Skip to content
Draft
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
1 change: 1 addition & 0 deletions CHANGELOG.d/analysis-run-collection-consumer-parity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `tepp_api` adds `lineageweave_analysis_run_collection_exchange`, Naruon compatibility-listener collection GET, and a `tepp-loopback` TCP list proof (ADR 0042). Metric-free collection rows are unchanged from ADR 0031. Not GET status, not lifecycle POST, not an ADR 0014 claim.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ All notable changes to TEPP are documented here. The format follows Keep a Chang

## [Unreleased]

### Added

- Loopback collection GET consumer parity: LineageWeave collection exchange, Naruon compatibility-listener list, and `tepp-loopback` TCP proof (ADR 0042).

- `tepp_api` serves `GET /v1/analysis-runs` on the shared loopback listener (ADR 0031). Operators enumerate accepted, running, cancelled, and terminal runs as metric-free collection rows. Collection bodies refuse RMSE/bias/coverage/SE-gate/scientific-acceptance/`terminal_result` keys. GET-by-id and running/terminal POST remain later GAP-003A slices; this is not an ADR 0014 claim.

- `tepp_api` serves `POST /v1/analysis-runs/{run_id}/cancel` on the shared loopback listener (ADR 0029). Accepted and running runs become metric-free `cancelled` status. Succeeded, failed, and unknown runs cannot be cancelled. Cancel bodies refuse RMSE/bias/coverage/SE-gate/scientific-acceptance keys. GET status and running/terminal POST remain later GAP-003A slices; this is not an ADR 0014 claim.
Expand Down
1 change: 1 addition & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ TEPP's approved PRD v0.4 and implementation plan are the primary product baselin
| Orchestrator live HTTP doctoring | [`docs/research/orchestrator-live-http.md`](docs/research/orchestrator-live-http.md) |
| Analysis-run cancel HTTP doctoring | [`docs/research/analysis-run-cancel-http.md`](docs/research/analysis-run-cancel-http.md) |
| Analysis-run collection HTTP doctoring | [`docs/research/analysis-run-collection-http.md`](docs/research/analysis-run-collection-http.md) |
| Analysis-run collection consumer-parity doctoring | [`docs/research/analysis-run-collection-consumer-parity.md`](docs/research/analysis-run-collection-consumer-parity.md) |
| UML/runtime/scientific flows | [`docs/UML.md`](docs/UML.md) |
| Logical/physical ERD | [`docs/ERD.md`](docs/ERD.md) |
| Security policy | [`SECURITY.md`](SECURITY.md) |
Expand Down
2 changes: 2 additions & 0 deletions crates/tepp_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ pub use lineage_pair_criterion::LineageTemporalProvenance;
pub use lineageweave_http::LINEAGEWEAVE_CONSUMER_CODE;
/// Published Naruon modular-consumer identity.
pub use lineageweave_http::NARUON_CONSUMER_CODE;
/// Build a `LineageWeave` collection GET without provider credentials.
pub use lineageweave_http::lineageweave_analysis_run_collection_exchange;
/// Build a `LineageWeave` analysis-run exchange without provider credentials.
pub use lineageweave_http::lineageweave_analysis_run_exchange;
/// Build a `LineageWeave` project-history exchange without provider credentials.
Expand Down
97 changes: 96 additions & 1 deletion crates/tepp_api/src/lineageweave_http.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Published modular-consumer identity and `LineageWeave` TEPP exchanges.

use crate::analysis_run_collection_http::naruon_analysis_run_collection_exchange;
use crate::naruon_http::compose_https_target;
use crate::project_history::build_project_history_exchange;
use crate::{
Expand Down Expand Up @@ -38,6 +39,30 @@ pub fn lineageweave_analysis_run_exchange(
Ok(exchange)
}

/// Build a `LineageWeave` → TEPP collection GET without credentials.
///
/// The function reuses TEPP's existing origin and pagination validation, then
/// replaces only the published modular-consumer identity. The response remains
/// a metric-free enumeration of run rows, not a measurement result.
///
/// # Errors
///
/// Returns the same fail-closed errors as [`naruon_analysis_run_collection_exchange`].
pub fn lineageweave_analysis_run_collection_exchange(
origin: &str,
cursor: Option<&str>,
limit: Option<&str>,
) -> Result<NaruonHttpExchange, ApiError> {
let mut exchange = naruon_analysis_run_collection_exchange(origin, cursor, limit)?;
let consumer_header = exchange
.headers
.iter_mut()
.find(|(name, _)| name.eq_ignore_ascii_case("tepp-consumer"))
.ok_or(ApiError::InvalidWirePayload)?;
LINEAGEWEAVE_CONSUMER_CODE.clone_into(&mut consumer_header.1);
Ok(exchange)
}

/// Build a credential-free `LineageWeave` temporal-context exchange.
///
/// # Errors
Expand Down Expand Up @@ -94,7 +119,7 @@ pub(crate) fn consumer_is_supported(consumer_code: &str) -> bool {
mod tests {
use super::{
LINEAGEWEAVE_CONSUMER_CODE, NARUON_CONSUMER_CODE, consumer_is_supported,
lineageweave_analysis_run_exchange,
lineageweave_analysis_run_collection_exchange, lineageweave_analysis_run_exchange,
};
use crate::{ANALYSIS_RUN_CONTRACT_VERSION, AnalysisRunRequest, ApiError};

Expand Down Expand Up @@ -132,4 +157,74 @@ mod tests {
Err(ApiError::InvalidWirePayload)
);
}

#[test]
fn lineageweave_collection_exchange_swaps_only_the_consumer_header() {
let exchange =
lineageweave_analysis_run_collection_exchange("https://tepp.example.test", None, None)
.expect("exchange");
assert_eq!(exchange.method, "GET");
assert_eq!(
exchange.target_url,
"https://tepp.example.test/v1/analysis-runs"
);
assert!(exchange.body.is_empty());
assert!(
exchange
.headers
.contains(&("tepp-consumer".into(), LINEAGEWEAVE_CONSUMER_CODE.into()))
);
assert!(
!exchange
.headers
.contains(&("tepp-consumer".into(), NARUON_CONSUMER_CODE.into()))
);
assert!(exchange.headers.iter().all(|(name, _)| {
!matches!(
name.to_ascii_lowercase().as_str(),
"authorization"
| "proxy-authorization"
| "cookie"
| "x-api-key"
| "idempotency-key"
)
}));

let paged = lineageweave_analysis_run_collection_exchange(
"https://tepp.example.test",
Some("tepp-run-1"),
Some("8"),
)
.expect("paged");
assert!(
paged
.headers
.contains(&("tepp-page-cursor".into(), "tepp-run-1".into()))
);
assert!(
paged
.headers
.contains(&("tepp-page-limit".into(), "8".into()))
);
assert_eq!(
lineageweave_analysis_run_collection_exchange("http://tepp.example.test", None, None),
Err(ApiError::InvalidWirePayload)
);
assert_eq!(
lineageweave_analysis_run_collection_exchange(
"https://tepp.example.test",
Some(""),
None
),
Err(ApiError::InvalidWirePayload)
);
assert_eq!(
lineageweave_analysis_run_collection_exchange(
"https://tepp.example.test",
None,
Some("99")
),
Err(ApiError::LimitExceeded)
);
}
}
Loading
Loading