feat(smart-clean): add structured targetPaths to ActionItem for execution

ActionItem now carries optional targetPaths so plan.execute can use
plan-carried targets instead of reconstructing execution intent from
findings. This improves execution reliability and enables proper restore
mappings for recovery items.

- Add targetPaths field to ActionItem domain model
- Update plan execution to prefer plan-carried targets with finding fallback
- Expand safe cache path fragments for direct-trash execution
- Add gate review documentation for ATL-211/212/215
- Bump protocol version to 0.3.0
This commit is contained in:
zhukang
2026-03-13 00:49:32 +08:00
parent 11405a4b55
commit 1d4dbeb370
15 changed files with 303 additions and 37 deletions

View File

@@ -31,4 +31,29 @@ final class AtlasProtocolTests: XCTestCase {
XCTAssertEqual(decoded.response, envelope.response)
}
func testPreviewResponseRoundTripsStructuredPlanTargets() throws {
let plan = ActionPlan(
title: "Review 1 selected finding",
items: [
ActionItem(
id: UUID(uuidString: "10000000-0000-0000-0000-000000000099") ?? UUID(),
title: "Move container cache to Trash",
detail: "Sandboxed cache path",
kind: .removeCache,
recoverable: true,
targetPaths: ["/Users/test/Library/Containers/com.example.sample/Data/Library/Caches/cache.db"]
)
],
estimatedBytes: 1_024
)
let envelope = AtlasResponseEnvelope(
requestID: UUID(),
response: .preview(plan)
)
let data = try JSONEncoder().encode(envelope)
let decoded = try JSONDecoder().decode(AtlasResponseEnvelope.self, from: data)
XCTAssertEqual(decoded.response, envelope.response)
}
}