workspace: allow not-found workdir cleanup
This commit is contained in:
parent
b583af4dd3
commit
f88ee692c9
|
|
@ -1,8 +1,8 @@
|
|||
---
|
||||
title: 'Allow not-found Workdir cleanup action'
|
||||
state: 'inprogress'
|
||||
state: 'done'
|
||||
created_at: '2026-07-13T11:43:33Z'
|
||||
updated_at: '2026-07-13T11:44:18Z'
|
||||
updated_at: '2026-07-13T11:51:11Z'
|
||||
assignee: null
|
||||
queued_by: 'yoi ticket'
|
||||
queued_at: '2026-07-13T11:44:18Z'
|
||||
|
|
|
|||
|
|
@ -39,4 +39,38 @@ Ticket を `yoi ticket` が queued にしました。
|
|||
State changed to `inprogress`.
|
||||
|
||||
|
||||
---
|
||||
|
||||
<!-- event: implementation_report author: hare at: 2026-07-13T11:51:11Z -->
|
||||
|
||||
## Implementation report
|
||||
|
||||
Fixed not-found Workdir cleanup plan classification.
|
||||
|
||||
Root cause:
|
||||
- Cleanup plan converted `WorkingDirectoryStatusKind::NotFound` with `format!("{:?}").to_lowercase()`, producing `notfound` instead of the canonical API/status label `not_found`.
|
||||
- The action classifier only recognized `missing` / `not_found`, so the candidate fell through to `workdir_dirty_discard`, which the frontend disables by design.
|
||||
|
||||
Changes:
|
||||
- Added explicit `workdir_status_kind_label` mapping for `WorkingDirectoryStatusKind`.
|
||||
- `NotFound` now maps to `not_found`, so cleanup plan candidates become `workdir_record_delete`.
|
||||
|
||||
Validation:
|
||||
- `cargo fmt --check`
|
||||
- `git diff --check`
|
||||
- `cargo check -q`
|
||||
- `cargo test -q -p yoi-workspace-server`
|
||||
- targeted cleanup plan test
|
||||
- `nix build .#yoi --no-link`
|
||||
|
||||
|
||||
---
|
||||
|
||||
<!-- event: state_changed author: "yoi ticket" at: 2026-07-13T11:51:11Z from: inprogress to: done reason: cli_state field: state -->
|
||||
|
||||
## State changed
|
||||
|
||||
State changed to `done`.
|
||||
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -1683,7 +1683,7 @@ fn build_runtime_cleanup_plan(
|
|||
let running_linked = !linked_running_worker_ids.is_empty();
|
||||
let observed_status = observed_workdirs
|
||||
.get(record.workdir_id.as_str())
|
||||
.map(|summary| format!("{:?}", summary.status).to_lowercase());
|
||||
.map(|summary| workdir_status_kind_label(&summary.status).to_string());
|
||||
let file_status = observed_status.unwrap_or_else(|| record.materialization_status.clone());
|
||||
let cleanliness = record.cleanliness.clone();
|
||||
let action = if matches!(file_status.as_str(), "missing" | "not_found") {
|
||||
|
|
@ -4287,6 +4287,16 @@ fn sync_runtime_workdir_observations(
|
|||
Ok(response.diagnostics)
|
||||
}
|
||||
|
||||
fn workdir_status_kind_label(status: &WorkingDirectoryStatusKind) -> &'static str {
|
||||
match status {
|
||||
WorkingDirectoryStatusKind::Active => "active",
|
||||
WorkingDirectoryStatusKind::CleanupPending => "cleanup_pending",
|
||||
WorkingDirectoryStatusKind::Corrupted => "corrupted",
|
||||
WorkingDirectoryStatusKind::NotFound => "not_found",
|
||||
WorkingDirectoryStatusKind::Unknown => "unknown",
|
||||
}
|
||||
}
|
||||
|
||||
fn workdir_status_from_runtime_miss(diagnostics: &[RuntimeDiagnostic]) -> &'static str {
|
||||
if diagnostics
|
||||
.iter()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user