Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
20dafd1
chore(deps): update dependency @rsbuild/core to v2.3.2
renovate[bot] Nov 11, 2026
fa5b97a
build(plugin): regenerate embedded host bundles
ScriptedAlchemy Nov 11, 2026
34a8ab7
Merge master and regenerate Rsbuild host bundles
ScriptedAlchemy Nov 11, 2026
a88e154
Merge master fixture repairs into dependency update
ScriptedAlchemy Nov 11, 2026
40a0850
test(global-db): retire cancellation fixture before reopening
ScriptedAlchemy Nov 11, 2026
615a768
Merge master into Rsbuild dependency update
ScriptedAlchemy Nov 12, 2026
84621f4
fix(runtime): finish settled owners after their runtime stops
ScriptedAlchemy Nov 13, 2026
83d5147
test(dashboard): use the production runtime scheduler
ScriptedAlchemy Nov 13, 2026
6a8f7c6
chore(deps): reconcile rsbuild update with master
ScriptedAlchemy Nov 13, 2026
7ebf369
fix(diagnostics): appoint compiler before runtime publication
ScriptedAlchemy Nov 13, 2026
23652f5
test(automation): capture retained settlement retry failures
ScriptedAlchemy Nov 13, 2026
6eed4ad
test(automation): remove temporary settlement trace capture
ScriptedAlchemy Nov 13, 2026
726a34a
test(mcp): trace blocked composition publication phases
ScriptedAlchemy Nov 13, 2026
f7ee667
chore(code-index): trace evidence pack durability phases
ScriptedAlchemy Nov 13, 2026
45673b1
Merge master into renovate/rsbuild-core-2.x-lockfile
ScriptedAlchemy Nov 13, 2026
b279332
test(storage): reuse canonical schema cancellation fixture
ScriptedAlchemy Nov 13, 2026
60b83f4
test(automation): trace retained owner publication phases
ScriptedAlchemy Nov 13, 2026
2fcb6d2
test(mcp): restrict publication diagnostics to owning modules
ScriptedAlchemy Nov 13, 2026
83e251e
chore(automation): trace exact ledger append durability phases
ScriptedAlchemy Nov 14, 2026
4b587bd
perf(test): avoid duplicate dashboard relation projections
ScriptedAlchemy Nov 14, 2026
753a4b5
test(mcp): remove completed publication timing capture
ScriptedAlchemy Nov 14, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,15 @@ fn settle_bound_owner_with_budget(
mut state: RetainedBoundSettlement,
budget: Duration,
) -> Result<RetainedOwnerValue<(AutomationSettledTerminal, AutomationRunLedgerRecord)>> {
#[cfg(test)]
let _capture = state.phase_hook.as_ref().map(|_| {
tracedecay_runtime_core::logging::FormattedTracingCapture::start_with_span_timings()
});
#[cfg(test)]
let _capture_span = state.phase_hook.as_ref().map(|_| {
tracing::info_span!("daemon.automation.retained_owner", run_id = %state.ledger.run_id)
.entered()
});
let started = std::time::Instant::now();
let mut delay = Duration::from_millis(25);
loop {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ pub(super) fn ensure_run_ledger_eof_guard(file: &mut std::fs::File) -> std::io::
}
}

#[tracing::instrument(name = "hosts.automation.run_ledger.sync", level = "trace", skip_all)]
pub(super) fn sync_run_ledger_file_and_parent(path: &Path, file: &std::fs::File) -> Result<()> {
#[cfg(test)]
exact_lookup::scan_receipt::record_sync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,18 @@ fn publish_under_ledger_lock(
}
};

ledger
.seek(SeekFrom::Start(pre_append_eof))
.map_err(TraceDecayError::from)?;
copy_exact_payload(&mut spool, &mut ledger, publication.payload_len)?;
ledger.write_all(b"\n").map_err(TraceDecayError::from)?;
{
let _span = tracing::trace_span!(
"hosts.automation.run_ledger.append_payload",
bytes = publication.payload_len
)
.entered();
ledger
.seek(SeekFrom::Start(pre_append_eof))
.map_err(TraceDecayError::from)?;
copy_exact_payload(&mut spool, &mut ledger, publication.payload_len)?;
ledger.write_all(b"\n").map_err(TraceDecayError::from)?;
}
sync_run_ledger_file_and_parent(ledger_path, &ledger)?;
verify_published_range(&mut ledger, &mut spool, &intent)?;
clear_append_intent(dashboard_root)?;
Expand Down Expand Up @@ -1115,7 +1122,11 @@ fn publish_append_intent_bytes(
tracedecay_private_fs::framed_log::DirectorySyncPolicy::Strict,
)
.map_err(TraceDecayError::from)?;
let actual = read_append_intent_bytes(dashboard_root)?.ok_or_else(|| {
let actual = {
let _span = tracing::trace_span!("hosts.automation.run_ledger.intent_readback").entered();
read_append_intent_bytes(dashboard_root)
}?
.ok_or_else(|| {
config_error("automation run append intent disappeared after durable publication")
})?;
if actual != bytes {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,12 @@ impl CodeIndexPreparationPort for DaemonCodeIndexPreparationV1 {
segment_size_bytes,
page_count,
} => {
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_commit").entered();
let _span = tracing::trace_span!(
"code_index.generation.publish.evidence_commit",
bytes = segment_size_bytes,
pages = page_count,
)
.entered();
// The existing pack authority validates every page and the
// complete digest, but names it only inside this session.
if files.evidence.commit(
Expand Down Expand Up @@ -985,8 +989,15 @@ impl TemporaryEvidencePackV1 {
)
})?;
let final_path = root.join(format!("segment-{digest_hex}.json"));
match final_path.symlink_metadata() {
let existing = {
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_lookup").entered();
final_path.symlink_metadata()
};
match existing {
Ok(metadata) => {
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_reuse").entered();
if !metadata.file_type().is_file()
|| metadata.len() != segment_size_bytes
|| DaemonCodeIndexPublicationStoreV1::state_digest_file(&final_path)?
Expand All @@ -1005,21 +1016,38 @@ impl TemporaryEvidencePackV1 {
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
Err(error) => return Err(DaemonCodeIndexPublicationStoreV1::unavailable(error)),
}
self.file
.as_ref()
.ok_or_else(|| {
DaemonCodeIndexPublicationStoreV1::unavailable(
"sealed evidence pack temporary file is already closed",
)
})?
.sync_all()
.map_err(DaemonCodeIndexPublicationStoreV1::unavailable)?;
drop(self.file.take());
{
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_file_sync").entered();
self.file
.as_ref()
.ok_or_else(|| {
DaemonCodeIndexPublicationStoreV1::unavailable(
"sealed evidence pack temporary file is already closed",
)
})?
.sync_all()
.map_err(DaemonCodeIndexPublicationStoreV1::unavailable)?;
}
{
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_file_close").entered();
drop(self.file.take());
}
let staged_path = staging_root.join(format!("segment-{digest_hex}.json"));
std::fs::rename(&self.path, &staged_path)
.map_err(DaemonCodeIndexPublicationStoreV1::unavailable)?;
{
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_rename").entered();
std::fs::rename(&self.path, &staged_path)
.map_err(DaemonCodeIndexPublicationStoreV1::unavailable)?;
}
self.published_path = Some(staged_path);
DaemonCodeIndexPublicationStoreV1::sync_directory(staging_root)?;
{
let _span =
tracing::trace_span!("code_index.generation.publish.evidence_directory_sync")
.entered();
DaemonCodeIndexPublicationStoreV1::sync_directory(staging_root)?;
}
Ok(true)
}

Expand Down
7 changes: 6 additions & 1 deletion crates/tracedecay-code-index/src/production/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2345,7 +2345,12 @@ where
/// from the files the edit changed and never decodes it; a generation
/// without one, or an edit that needs every file's resolution, is built
/// whole.
#[tracing::instrument(name = "code_index.build.and_publish", level = "trace", skip_all)]
#[tracing::instrument(
name = "code_index.build.and_publish",
level = "trace",
skip_all,
fields(project_id = %self.config.project_id)
)]
pub fn build_and_publish(
&mut self,
request: CodeIndexBuildRequestV1,
Expand Down
39 changes: 31 additions & 8 deletions crates/tracedecay-daemon-service/src/invocation/primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tracedecay_agent_hosts::agents::context_scout::{
ContextScoutMutationResultV1, ContextScoutMutationSettlementOutcomeV1,
ContextScoutPublicMutationV1, ContextScoutRecentStateV1,
};
use tracedecay_application::diagnostics_producer::TypeScriptProducerStatusHandleV1;
use tracedecay_application::diagnostics_producer::TypeScriptProducerStateV1;
use tracedecay_application::primitives::{
ProductionPrimitiveOpenRequestV1, open_production_primitive_runtime,
};
Expand All @@ -19,6 +19,7 @@ use tracedecay_contracts::context_scout::{
ContextScoutSuggestionProjectionV1, ContextScoutSurfaceRequestV1,
};
use tracedecay_domain::sha256_hex_suffix;
use tracedecay_lsp::TypeScriptCompilerAdmission;
use tracedecay_runtime_core::cancellation::CancellationToken;
use tracedecay_tool_catalog::ApplicationSurfaceOperation;

Expand Down Expand Up @@ -1380,9 +1381,10 @@ impl DaemonPrimitiveRuntimeRegistrar {
&self,
project_root: PathBuf,
request: ProductionPrimitiveOpenRequestV1,
) -> Result<TypeScriptProducerStatusHandleV1, DaemonPrimitiveRuntimeRegistrationError> {
mut compiler_admission: Option<TypeScriptCompilerAdmission>,
) -> Result<Option<TypeScriptProducerStateV1>, DaemonPrimitiveRuntimeRegistrationError> {
request.validate_registration_root(&project_root)?;
let retained = self
let (retained, compiler_producer, already_current) = self
.service
.project_runtimes
.register_or_reconcile_with(
Expand All @@ -1398,11 +1400,28 @@ impl DaemonPrimitiveRuntimeRegistrar {
.await
.map_err(DaemonPrimitiveRuntimeRegistrationError::from)
},
PrimitiveProjectRuntime::clone,
|runtime| {
// The registry projects under its publication lock. Appoint
// the producer before a read can observe this runtime, so
// discovery is pending rather than falsely unsupported.
let already_current = request.validate_retained(runtime)?;
let producer = if already_current {
compiler_admission.take().map(|admission| {
TypeScriptProducerStateV1::new(runtime.compiler_status(), admission)
})
} else {
None
};
Ok::<_, DaemonPrimitiveRuntimeRegistrationError>((
runtime.clone(),
producer,
already_current,
))
},
)
.await?;
if request.validate_retained(&retained)? {
return Ok(retained.compiler_status());
.await??;
if already_current {
return Ok(compiler_producer);
}

// A sibling can retain this root's store owner after route eviction.
Expand All @@ -1419,7 +1438,11 @@ impl DaemonPrimitiveRuntimeRegistrar {
.map_err(Into::into)
},
|| async { Ok(replacement.clone()) },
PrimitiveProjectRuntime::compiler_status,
|runtime| {
compiler_admission.map(|admission| {
TypeScriptProducerStateV1::new(runtime.compiler_status(), admission)
})
},
)
.await
}
Expand Down
121 changes: 64 additions & 57 deletions crates/tracedecay-global-db/src/tests/schema_install_cancellation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,64 +183,71 @@ async fn unpublished_existing_wal_is_refused_without_deleting_foreign_bytes() {
assert_eq!(std::fs::read(&wal).unwrap(), foreign_wal);
}

#[tokio::test(flavor = "multi_thread")]
async fn cancelled_daemon_attach_preserves_published_schema_and_reopens() {
let store = RegisteredStore::create();
let (outcome, total_polls) = store.attach_cancelled_at(usize::MAX).await;
outcome.unwrap();
let installed = store.external_schema_objects();
assert!(
installed
.iter()
.any(|(object, _)| object == "table:code_projects"),
"a completed attach installs the registered schema: {installed:?}"
);
#[test]
fn cancelled_daemon_attach_preserves_published_schema_and_reopens() {
tracedecay_runtime_core::native_runtime::default_builder()
.build()
.expect("schema cancellation runtime")
.block_on(async {
let store = RegisteredStore::create();
let (outcome, total_polls) = store.attach_cancelled_at(usize::MAX).await;
outcome.unwrap();
let installed = store.external_schema_objects();
assert!(
installed
.iter()
.any(|(object, _)| object == "table:code_projects"),
"a completed attach installs the registered schema: {installed:?}"
);

let stride = (total_polls / 20).max(1);
let mut cancelled = Vec::new();
let mut completed = Vec::new();
for cancel_at in std::iter::once(1)
.chain((2..total_polls).step_by(stride))
.chain([total_polls + 10])
{
// The reference admission, then each successful reopen below, leave
// this family closed with the exact baseline schema. Creating another
// family would repeat initialization without exercising another
// cancellation point. Keep real runtime retirement and reopening
// around every sampled admission.
let before_admission = store.external_schema_objects();
assert_eq!(before_admission, installed);
let (outcome, _) = store.attach_cancelled_at(cancel_at).await;
let objects = store.external_schema_objects();
match outcome {
Err(error) => {
assert!(
error.is_store_open_cancelled(),
"cancel at poll {cancel_at}/{total_polls} must fail typed: {error:?}"
);
assert_eq!(
objects, before_admission,
"cancel at poll {cancel_at}/{total_polls} must preserve the published schema"
);
cancelled.push(cancel_at);
}
Ok(()) => {
assert_eq!(
objects, installed,
"an admission completed before cancel at poll {cancel_at}/{total_polls} preserves the published schema"
);
completed.push(cancel_at);
let stride = (total_polls / 20).max(1);
let mut cancelled = Vec::new();
let mut completed = Vec::new();
for cancel_at in std::iter::once(1)
.chain((2..total_polls).step_by(stride))
.chain([total_polls + 10])
{
// The reference admission, then each successful reopen below, leave
// this family closed with the exact baseline schema. Creating another
// family would repeat initialization without exercising another
// cancellation point. Keep real runtime retirement and reopening
// around every sampled admission.
let before_admission = store.external_schema_objects();
assert_eq!(before_admission, installed);
let (outcome, _) = store.attach_cancelled_at(cancel_at).await;
let objects = store.external_schema_objects();
match outcome {
Err(error) => {
assert!(
error.is_store_open_cancelled(),
"cancel at poll {cancel_at}/{total_polls} must fail typed: {error:?}"
);
assert_eq!(
objects, before_admission,
"cancel at poll {cancel_at}/{total_polls} must preserve the published schema"
);
cancelled.push(cancel_at);
}
Ok(()) => {
assert_eq!(
objects, installed,
"an admission completed before cancel at poll {cancel_at}/{total_polls} preserves the published schema"
);
completed.push(cancel_at);
}
}
let (reopened, _) = store.attach_cancelled_at(usize::MAX).await;
reopened.unwrap_or_else(|error| {
panic!(
"reopen after cancel at poll {cancel_at}/{total_polls} failed: {error:?}"
)
});
assert_eq!(store.external_schema_objects(), installed);
}
}
let (reopened, _) = store.attach_cancelled_at(usize::MAX).await;
reopened.unwrap_or_else(|error| {
panic!("reopen after cancel at poll {cancel_at}/{total_polls} failed: {error:?}")
assert!(
cancelled.contains(&1),
"a cancel before admission starts must stop it; cancelled at {cancelled:?}"
);
assert!(completed.contains(&(total_polls + 10)));
});
assert_eq!(store.external_schema_objects(), installed);
}
assert!(
cancelled.contains(&1),
"a cancel before admission starts must stop it; cancelled at {cancelled:?}"
);
assert!(completed.contains(&(total_polls + 10)));
}
Loading
Loading