Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
75 lines
2.4 KiB
Rust
75 lines
2.4 KiB
Rust
use super::WriteAclOperation;
|
|
use super::record_acl_failure;
|
|
use anyhow::anyhow;
|
|
use pretty_assertions::assert_eq;
|
|
use std::io;
|
|
use std::path::Path;
|
|
|
|
#[test]
|
|
fn records_each_acl_operation_with_its_native_error_chain() {
|
|
let path = Path::new("project/.git");
|
|
let native_error = io::Error::from_raw_os_error(5);
|
|
// The native wording is platform-dependent; the code and cause chain are not.
|
|
let native_message = native_error.to_string();
|
|
let error = anyhow::Error::new(native_error)
|
|
.context("open ACL target (READ_CONTROL | WRITE_DAC)")
|
|
.context("prepare protected path");
|
|
let detail = format!(
|
|
"project/.git: prepare protected path: open ACL target (READ_CONTROL | WRITE_DAC): {native_message}"
|
|
);
|
|
|
|
let mut errors = Vec::new();
|
|
let mut log = Vec::new();
|
|
for operation in [
|
|
WriteAclOperation::Check,
|
|
WriteAclOperation::Grant,
|
|
WriteAclOperation::Deny,
|
|
] {
|
|
record_acl_failure(&mut errors, operation, path, &error, |message| {
|
|
log.push(message.to_owned());
|
|
Ok(())
|
|
})
|
|
.expect("record ACL failure");
|
|
}
|
|
assert_eq!(
|
|
(errors, log),
|
|
(
|
|
vec![
|
|
format!("write ACE check failed on {detail}"),
|
|
format!("write ACE failed on {detail}"),
|
|
format!("deny ACE failed on {detail}"),
|
|
],
|
|
vec![
|
|
format!("write ACE check failed on {detail}; continuing"),
|
|
format!("write ACE grant failed on {detail}"),
|
|
format!("deny ACE failed on {detail}"),
|
|
],
|
|
)
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn log_failure_preserves_acl_failure_and_previous_roots() {
|
|
let mut errors = vec!["previous root failed".to_string()];
|
|
let error = anyhow!("SetSecurityInfo failed: 87").context("grant write ACL");
|
|
let log_error = record_acl_failure(
|
|
&mut errors,
|
|
WriteAclOperation::Grant,
|
|
Path::new("virtual-drive/project"),
|
|
&error,
|
|
|_| Err(anyhow!("log unavailable")),
|
|
)
|
|
.expect_err("report log failure");
|
|
assert_eq!(
|
|
(errors, log_error.to_string()),
|
|
(
|
|
vec![
|
|
"previous root failed".to_string(),
|
|
"write ACE failed on virtual-drive/project: grant write ACL: SetSecurityInfo failed: 87"
|
|
.to_string(),
|
|
],
|
|
"log unavailable".to_string(),
|
|
)
|
|
);
|
|
}
|