Skip to content
Merged
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
36 changes: 36 additions & 0 deletions crates/tracedecay/src/daemon/production_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,42 @@ impl ProductionProjectCompositionHarnessV1 {
})
}

/// Await optional attribution for the exact current publication without
/// making it a prerequisite for ordinary composition or graph readiness.
pub async fn await_test_attribution(
&self,
project_root: impl AsRef<Path>,
cancellation: &tracedecay_runtime_core::cancellation::CancellationToken,
) -> Result<tracedecay_domain::ProviderEvaluationStateV1> {
let graph = self.server(project_root)?.cg().await;
let target = graph.configuration_runtime().configuration_target();
let scope = tracedecay_code_index_runtime::resolved_scope_for_project(
graph.project_root(),
&target.project_id,
)
.map_err(|error| TraceDecayError::Config {
message: format!("production-composition code-index scope is invalid: {error:?}"),
})?;
let resources = self
.resources
.as_ref()
.ok_or_else(|| TraceDecayError::Config {
message: "production-composition harness is shut down".to_owned(),
})?;
let schedulers = &resources.invocation.code_index_schedulers;
let Some(current) = schedulers.latest_text_serving_for_scope(&scope).await else {
return Ok(tracedecay_domain::ProviderEvaluationStateV1::Unavailable);
};
Ok(schedulers
.await_test_attribution_for_scope(
graph.project_root(),
&scope,
&current.metadata().manifest().generation_id,
cancellation,
)
.await)
}

pub async fn project_data_root(&self, project_root: impl AsRef<Path>) -> Result<PathBuf> {
Ok(self
.server(project_root)?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@ fn assert_unknown_handle_markdown(response: &JsonRpcResponse) {

async fn published_cycle(fixture: &ProductionCompositionFixture, document_uri: &str) -> Value {
let deadline = Instant::now() + Duration::from_secs(60);
let cancellation = tracedecay_runtime_core::cancellation::CancellationToken::new();
let attribution = tokio::time::timeout_at(
deadline.into(),
fixture
.harness
.await_test_attribution(&fixture.project_root, &cancellation),
)
.await
.expect("current generation attribution must settle before the cycle deadline")
.expect("production attribution readiness");
assert_eq!(
attribution,
tracedecay_domain::ProviderEvaluationStateV1::Partial,
"the current generation must expose conservative test attribution"
);
loop {
let response = call(
fixture,
Expand Down
Loading