Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
48e91c8
chore(deps): update dependency bazel_lib to v3.8.0
renovate[bot] Nov 12, 2026
04fa9a3
Merge remote-tracking branch 'origin/master' into renovate/bazel_lib-3.x
ScriptedAlchemy Nov 12, 2026
7ce5a95
ci(windows): materialize runfiles for build-time js_binary tools
ScriptedAlchemy Nov 12, 2026
74898a2
fix(build): publish Windows launcher runfiles manifest
ScriptedAlchemy Nov 13, 2026
ad5ad61
fix(daemon): appoint compiler before publishing primitive reads
ScriptedAlchemy Nov 13, 2026
6770f7d
test(lsp): capture receipt admission phases on ACK failure
ScriptedAlchemy Nov 13, 2026
08d036e
test(daemon): simplify compiler registration pause predicate
ScriptedAlchemy Nov 13, 2026
f1b0e62
chore(lsp): retain analyzer initialization failure diagnostics
ScriptedAlchemy Nov 13, 2026
6a26df8
test(daemon): require a completed terminal maintenance page
ScriptedAlchemy Nov 13, 2026
89bdbf2
Merge master into repair branch
ScriptedAlchemy Nov 13, 2026
6912e0d
style(test): format routed hover capability assertion
ScriptedAlchemy Nov 13, 2026
9c8fd8f
fix(lsp): retain stderr through startup settlement
ScriptedAlchemy Nov 13, 2026
c0e6443
test(lsp): capture analyzer initialize progress
ScriptedAlchemy Nov 13, 2026
37aa238
test(lsp): remove temporary startup tracing
ScriptedAlchemy Nov 13, 2026
18c5974
test(runtime): retain fake daemon startup failure context
ScriptedAlchemy Nov 13, 2026
b97776f
test(toolchain): measure native analyzer launch phases
ScriptedAlchemy Nov 13, 2026
eea72bf
test(toolchain): remove temporary analyzer launch tracing
ScriptedAlchemy Nov 13, 2026
186cab9
chore(deps): integrate master repairs into bazel library update
ScriptedAlchemy Nov 14, 2026
d97ff00
fix(sessions): release receipt readers before native publication
ScriptedAlchemy Nov 14, 2026
02d1064
style(sessions): format candidate relation publication call
ScriptedAlchemy Nov 14, 2026
87ade1f
test(sessions): bind receipt probe through local store trait
ScriptedAlchemy Nov 14, 2026
8e1bdbe
Merge master into bazel_lib and receipt ownership repairs
ScriptedAlchemy Nov 14, 2026
4e39cf8
test(daemon): remove completed startup measurement
ScriptedAlchemy Nov 14, 2026
650db8c
test(cli): trace retained daemon startup ownership
ScriptedAlchemy Nov 14, 2026
dbc74e7
chore: integrate qualified dependency and runtime fixes
ScriptedAlchemy Nov 14, 2026
2a8f480
test(automation): remove completed settlement timing capture
ScriptedAlchemy Nov 14, 2026
f3e9976
fix: reconcile relation receipts with dashboard cleanup
ScriptedAlchemy Nov 14, 2026
0f37277
chore(observability): trace delivery receipt admission phases
ScriptedAlchemy Nov 14, 2026
e2b1ef8
test(lsp): capture receipt and spool admission phases
ScriptedAlchemy Nov 14, 2026
7c139c3
style(observability): wrap delivery publication trace
ScriptedAlchemy Nov 14, 2026
350ca0b
test(runtime): remove completed startup and receipt captures
ScriptedAlchemy Nov 14, 2026
51f1fca
test(global-db): reuse the restored workflow cancellation fixture
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
9 changes: 8 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ module(name = "tracedecay", version = "0.0.0")

bazel_dep(name = "platforms", version = "1.1.0")
bazel_dep(name = "bazel_skylib", version = "1.9.2")
bazel_dep(name = "bazel_lib", version = "3.7.2")
bazel_dep(name = "bazel_lib", version = "3.8.0")
# Its sibling-script fast path must publish the batch launcher's manifest to
# the shell payload, whose path does not own the .bat.runfiles tree.
single_version_override(
module_name = "bazel_lib",
patches = ["//scripts:bazel/patches/windows-launcher-runfiles-manifest.patch"],
patch_strip = 1,
)
bazel_dep(name = "rules_python", version = "2.5.1")
bazel_dep(name = "rules_rust", version = "0.75.0")
# Rustc adds every dependency search directory to PATH on Windows; large
Expand Down
11 changes: 9 additions & 2 deletions crates/tracedecay-application/src/lsp_runtime/semantic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,15 @@ impl UpstreamCapabilityInitializationAuthority for CompositeUpstreamCapabilities
// answered `Unavailable`. A rustup host without the
// `rust-analyzer` component is exactly that shape: the proxy is
// on PATH, so the language routes, and only the spawn fails.
let Ok(current) = initializer.upstream_capabilities().await else {
continue;
let current = match initializer.upstream_capabilities().await {
Ok(current) => current,
Err(error) => {
tracing::debug!(
%error,
"routed analyzer initialization did not publish capabilities"
);
continue;
}
};
capabilities.supports_diagnostics |= current.supports_diagnostics;
capabilities.semantic.extend(current.semantic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,28 @@ impl BoundedDeliverySettlementRecorderV1 {
})
}

#[tracing::instrument(
name = "observability.delivery_recorder.admit",
level = "trace",
skip_all,
fields(receipt_id = tracing::field::Empty)
)]
pub fn try_record(
&self,
settlement: DeliverySettlementV1,
) -> Result<DeliverySettlementRecordOutcomeV1, &'static str> {
tracing::trace!(phase = "validate", "delivery receipt admission");
settlement.validate()?;
let receipt = DeliveryRecorderSourceReceiptV1::new(settlement, self.identity.clone())
.map_err(map_spool_admission_error)?;
tracing::Span::current().record("receipt_id", tracing::field::debug(receipt.receipt_id));
tracing::trace!(phase = "admission_lock", "delivery receipt admission");
let _admission = self
.core
.admission
.lock()
.map_err(|_| "delivery_settlement_recorder_lock_poisoned")?;
tracing::trace!(phase = "check_lifecycle", "delivery receipt admission");
if self.core.state.load(Ordering::Acquire) != RECORDER_RUNNING {
return Err("delivery_settlement_recorder_closed");
}
Expand All @@ -152,6 +162,7 @@ impl BoundedDeliverySettlementRecorderV1 {
}
// A full wake queue is safe: the durable receipt is already visible to
// the active worker's bounded scan and periodic restart replay.
tracing::trace!(phase = "wake", "delivery receipt admission");
match self.core.wake.try_send(()) {
Ok(()) | Err(mpsc::error::TrySendError::Full(())) => {
Ok(DeliverySettlementRecordOutcomeV1::Enqueued)
Expand Down
31 changes: 31 additions & 0 deletions crates/tracedecay-application/src/observability/delivery_spool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,25 @@ impl DeliveryRecorderSpoolV1 {
Ok(spool)
}

#[tracing::instrument(
name = "observability.delivery_spool.append",
level = "trace",
skip_all,
fields(receipt_id = ?receipt.receipt_id)
)]
pub fn append(
&self,
receipt: &DeliveryRecorderSourceReceiptV1,
) -> Result<bool, DeliveryRecorderSpoolError> {
tracing::trace!(phase = "validate", "delivery spool append");
receipt.validate()?;
tracing::trace!(phase = "state_lock", "delivery spool append");
let mut state = self
.state
.lock()
.map_err(|_| DeliveryRecorderSpoolError::LockPoisoned)?;
let path = self.receipt_path(receipt.receipt_id);
tracing::trace!(phase = "read_existing", "delivery spool append");
if let Some(bytes) = read_bounded(&path, MAX_RECEIPT_BYTES).map_err(map_read_error)? {
if !state.receipt_paths.contains(&path) {
return Err(DeliveryRecorderSpoolError::Corrupt);
Expand All @@ -170,25 +179,39 @@ impl DeliveryRecorderSpoolV1 {
if state.receipt_paths.len() >= MAX_PENDING_RECEIPTS {
return Err(DeliveryRecorderSpoolError::Full);
}
tracing::trace!(phase = "encode", "delivery spool append");
let bytes = canonical_json_bytes(receipt)
.map_err(|_| DeliveryRecorderSpoolError::InvalidReceipt)?;
if bytes.is_empty() || bytes.len() > MAX_RECEIPT_BYTES {
return Err(DeliveryRecorderSpoolError::InvalidReceipt);
}
tracing::trace!(
phase = "publish",
bytes = bytes.len(),
"delivery spool append"
);
atomic_write(&path, "delivery", &bytes, DIRECTORY_POLICY)
.map_err(|_| DeliveryRecorderSpoolError::Io)?;
state.receipt_paths.insert(path);
tracing::trace!(phase = "completed", "delivery spool append");
Ok(true)
}

#[tracing::instrument(
name = "observability.delivery_spool.pending",
level = "trace",
skip_all
)]
pub fn pending(
&self,
limit: usize,
) -> Result<Vec<DeliveryRecorderSourceReceiptV1>, DeliveryRecorderSpoolError> {
tracing::trace!(phase = "state_lock", "delivery spool pending read");
let state = self
.state
.lock()
.map_err(|_| DeliveryRecorderSpoolError::LockPoisoned)?;
tracing::trace!(phase = "read_batch", "delivery spool pending read");
let mut receipts = Vec::new();
for path in state
.receipt_paths
Expand Down Expand Up @@ -218,14 +241,21 @@ impl DeliveryRecorderSpoolV1 {
/// Removes settled receipts and syncs the spool directory once for all of
/// them. A removal lost before that sync only replays a settled receipt,
/// which settlement answers idempotently.
#[tracing::instrument(
name = "observability.delivery_spool.acknowledge",
level = "trace",
skip_all
)]
pub fn acknowledge(
&self,
receipt_ids: &[[u8; 16]],
) -> Result<usize, DeliveryRecorderSpoolError> {
tracing::trace!(phase = "state_lock", "delivery spool acknowledgement");
let mut state = self
.state
.lock()
.map_err(|_| DeliveryRecorderSpoolError::LockPoisoned)?;
tracing::trace!(phase = "unlink_batch", "delivery spool acknowledgement");
let mut removed = 0;
for receipt_id in receipt_ids {
let path = self.receipt_path(*receipt_id);
Expand All @@ -245,6 +275,7 @@ impl DeliveryRecorderSpoolV1 {
removed += 1;
}
if removed > 0 {
tracing::trace!(phase = "sync_directory", "delivery spool acknowledgement");
sync_directory(&self.root, DIRECTORY_POLICY)
.map_err(|_| DeliveryRecorderSpoolError::Io)?;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1717,15 +1717,6 @@ 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 @@ -1074,10 +1074,36 @@ mod published_artifact_ceiling {

let stride = (total_polls / 12).max(1);
let mut cancelled_published = 0;
// Each convergence joins its exact runtime retirement. Reuse the
// canonically initialized store, restoring the upgrade's inputs and
// proving the entire workflow state before admitting a fresh runtime.
let store = &reference.store;
for cancel_at in (1..total_polls).step_by(stride) {
let daemon_store = DaemonPublishedStore::create().await;
let store = &daemon_store.store;
store.run(BULK_ROWS);
{
let mut connection = Connection::open(&store.path).unwrap();
let transaction = connection.transaction().unwrap();
republish(&transaction, &before.table_sql, &before.digest);
{
let mut insert = transaction
.prepare(
"INSERT INTO workflow_artifact_payloads
(rowid, payload_digest, byte_length, payload)
VALUES (?1, ?2, ?3, ?4)",
)
.unwrap();
for (rowid, digest, byte_length, payload) in &before.artifacts {
insert
.execute(rusqlite::params![rowid, digest, byte_length, payload])
.unwrap();
}
}
transaction.commit().unwrap();
}
assert_eq!(
store.state(),
before,
"poll {cancel_at} must start from the published workflow state"
);
let (outcome, _) = converge_cancelled_at(&store.path, cancel_at).await;
let state = store.state();
match outcome {
Expand Down
5 changes: 4 additions & 1 deletion crates/tracedecay-lsp/src/analyzer/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,8 +717,11 @@ impl StdioLspClient {
result = initialize => match result {
Ok(response) => response,
Err(error) => {
// Termination settles the stderr reader as well as the child.
// Include its final captured bytes in the startup failure.
let terminated = process.terminate().await;
let error = enrich_start_error(command, error, &process.stderr());
return match process.terminate().await {
return match terminated {
Ok(_) => StdioLspClientStartupSettlement::Failed(error),
Err(reap_error) => StdioLspClientStartupSettlement::ReapFailed(
TraceDecayError::Config {
Expand Down
19 changes: 3 additions & 16 deletions crates/tracedecay-runtime-core/src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,34 +279,21 @@ impl FormattedTracingCapture {
/// before the first captured event.
#[must_use]
pub fn start() -> Self {
Self::start_with_output(false, false)
Self::start_with_output(false)
}

/// Also writes each line to stderr so a terminated measurement retains
/// the events emitted before its deadline.
#[must_use]
pub fn start_with_stderr() -> Self {
Self::start_with_output(true, false)
Self::start_with_output(true)
}

/// Captures span admission and completion timings as well as events,
/// retaining live stderr if the measurement is terminated before reporting.
#[must_use]
pub fn start_with_span_timings() -> Self {
Self::start_with_output(true, true)
}

fn start_with_output(stderr: bool, span_timings: bool) -> Self {
fn start_with_output(stderr: bool) -> Self {
let bytes = std::sync::Arc::new(Mutex::new(Vec::new()));
let subscriber = tracing_subscriber::fmt()
.with_max_level(tracing::Level::TRACE)
.with_ansi(false)
.with_span_events(if span_timings {
tracing_subscriber::fmt::format::FmtSpan::NEW
| tracing_subscriber::fmt::format::FmtSpan::CLOSE
} else {
tracing_subscriber::fmt::format::FmtSpan::NONE
})
.with_writer(CaptureBuffer(std::sync::Arc::clone(&bytes), stderr));
let guard = if stderr {
set_tracing_capture(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,6 @@ async fn commit_deferred_begins<'a>(
}

async fn drain_staged_completions<'a>(
database: &RegisteredGlobalDbLeaseV1,
access: &SessionTemporalAccess<'_, RegisteredGlobalDb>,
store: &SessionTemporalStore<'_, tracedecay_global_db::RegisteredGlobalDb>,
state: &'a SessionTemporalRefreshWakeState,
Expand Down Expand Up @@ -1654,31 +1653,12 @@ async fn drain_staged_completions<'a>(
}
}
}
let snapshot =
match native_runtime::timeout(policy.operation_deadline, database.as_ref().read_snapshot())
.await
{
Err(error) => {
record_deadline_failure(report, "snapshot", error);
return;
}
Ok(Ok(snapshot)) => snapshot,
Ok(Err(error)) => {
report.last_error = Some(format!("{error:?}"));
report.retryable_errors += 1;
report.observe_retry(SessionTemporalRefreshRetryClass::Storage);
return;
}
};
let mut applied = Vec::with_capacity(survivors.len());
for item in survivors {
match native_runtime::timeout(
policy.operation_deadline,
access.apply_candidate_relation_projection(
&snapshot,
&item.projection,
&state.completion_control(),
),
access
.apply_candidate_relation_projection(&item.projection, &state.completion_control()),
)
.await
{
Expand All @@ -1691,9 +1671,6 @@ async fn drain_staged_completions<'a>(
}
}
}
// The commit below is a writer phase; the verification snapshot must not
// hold its WAL read slot through it.
drop(snapshot);
if applied.is_empty() {
return;
}
Expand Down Expand Up @@ -2320,7 +2297,6 @@ pub async fn run_session_temporal_refresh_pass(
committed.await;
let drained: Pin<Box<dyn Future<Output = ()> + Send + '_>> =
Box::pin(drain_staged_completions(
database,
&access,
&store,
state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,12 +868,10 @@ async fn grouped_completion_revalidates_evidence_after_staging() {
.unwrap()
.remove(0)
.unwrap();
let snapshot = database.read_snapshot().await.unwrap();
let verified = access
.apply_candidate_relation_projection(&snapshot, &relation_projection, &control)
.apply_candidate_relation_projection(&relation_projection, &control)
.await
.unwrap();
drop(snapshot);
let generation =
tracedecay_domain::SessionProjectionGenerationV1::new(verified.generation).unwrap();
let validation_snapshot = database.read_snapshot().await.unwrap();
Expand Down
Loading
Loading