-
Notifications
You must be signed in to change notification settings - Fork 0
Remediation
Remediation is a separate flow from diagnosis:
Diagnostic → Suggestion → Fixer / FixPlan → RemediationReceipt
use diagprint::{Applicability, Edit, Suggestion, TextRange};
let suggestion = Suggestion::new("Replace deprecated value")
.applicability(Applicability::MachineApplicable)
.edit(Edit::replace("config.toml", TextRange::new(10, 13), "old", "new"));pub enum Applicability { MachineApplicable, MaybeIncorrect, HasPlaceholders, Manual }Only guarded, MachineApplicable structured edits are eligible for automatic application.
use diagprint::Fixer;
let check = Fixer::new().check(&diagnostic)?; // validate, write nothing
let report = Fixer::new().backups(true).apply(&diagnostic)?; // apply validated fixes
Fixer::new().backups(true).apply_interactive(&diagnostic)?; // ask firstBefore any write it validates applicability, expected source contents, edit ranges, UTF-8 boundaries, overlapping edits, duplicate insertion points and filesystem state. Stale edits are rejected, never guessed.
- validate every affected file
- prepare all resulting contents
- create recovery state
- perform the writes
- roll back observed failures
- optionally run post-fix verification
- roll back if verification fails
Warning
Portable crash-atomic multi-file writes are not claimed.
Fix plans can declare structured, declarative verification. diagprint never runs arbitrary shell commands during application or verification. Suggestions can carry advisory commands, which are never executed automatically:
use diagprint::SuggestedCommand;
let command = SuggestedCommand::new("cargo check")
.explanation("Verify the project after applying the edit");A successful guarded remediation receipt can be bound to an exact transition in tamper-evident history, then replayed later without reapplying anything:
diagprint replay .diagprint/history <FINGERPRINT>
diagprint replay .diagprint/history <FINGERPRINT> --format json
diagprint history remediation-verify .diagprint/historyReplay separates observed lifecycle evidence from causal claims: remediation causation, recurrence root cause and Git causation stay NOT ESTABLISHED. Spec: docs/forensics-remediation-replay-v1.md, receipts: docs/receipt-v1.md.
🩺 diagprint · a Cybercore Tech project · MIT OR Apache-2.0
🏠 cybercoretech.net ·
✉️ dev@cybercoretech.net ·
🔒 security@ ·
💬 Discord ·
🐛 Issues ·
☕ Buy Me a Coffee
⚡ Start
- 📥 Installation
- 🚀 Quick Start
- 🧪 Examples
🧱 Build
📤 Ship
🔧 Fix
- 🔧 Remediation
- 🛡️ Safety Model
🔬 Investigate
🛠️ Project
- 🛠️ Contributing
- 🗺️ Roadmap