Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)

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>
This commit is contained in:
andrea.difonzo
2026-11-17 12:37:52 +01:00
parent e37a0deba9
commit 7c1c6dfa8d
10306 changed files with 748026 additions and 748088 deletions

View File

@@ -0,0 +1,88 @@
use super::*;
use pretty_assertions::assert_eq;
#[tokio::test]
async fn selection_frequency_persists_after_handoff_and_flush() {
let home = tempfile::tempdir().expect("temporary home");
let mut usage = MentionUsage::load(home.path(), HistoryPersistence::SaveAll);
usage.record("skill://status");
usage.record("skill://status");
let mut replacement = MentionUsage::load(home.path(), HistoryPersistence::SaveAll);
replacement.inherit(&mut usage);
replacement.flush().await;
assert_eq!(
MentionUsage::load(home.path(), HistoryPersistence::SaveAll).frequencies(),
HashMap::from([("skill://status".to_owned(), 2)])
);
}
#[tokio::test]
async fn changing_storage_keeps_usage_separate_and_flushes_prior_writes() {
let first_home = tempfile::tempdir().expect("first temporary home");
let second_home = tempfile::tempdir().expect("second temporary home");
let mut first = MentionUsage::load(first_home.path(), HistoryPersistence::SaveAll);
first.record("skill://first");
let mut second = MentionUsage::load(second_home.path(), HistoryPersistence::SaveAll);
second.inherit(&mut first);
second.record("skill://second");
second.flush().await;
assert_eq!(
(
MentionUsage::load(first_home.path(), HistoryPersistence::SaveAll).frequencies(),
MentionUsage::load(second_home.path(), HistoryPersistence::SaveAll).frequencies(),
),
(
HashMap::from([("skill://first".to_owned(), 1)]),
HashMap::from([("skill://second".to_owned(), 1)]),
)
);
}
#[test]
fn old_selections_expire() {
let mut usage = MentionUsage::default();
usage.record("skill://status");
for _ in 0..HISTORY_LIMIT {
usage.record("skill://other");
}
assert_eq!(
usage.frequencies(),
HashMap::from([("skill://other".to_owned(), HISTORY_LIMIT)])
);
}
#[test]
fn selection_replaces_malformed_history() {
let home = tempfile::tempdir().expect("temporary home");
let path = home.path().join(FILE_NAME);
std::fs::write(&path, "[\"truncated").expect("write malformed history");
persist_selection(&path, "skill://status".to_owned()).expect("persist selection");
assert_eq!(
MentionUsage::load(home.path(), HistoryPersistence::SaveAll).frequencies(),
HashMap::from([("skill://status".to_owned(), 1)])
);
}
#[test]
fn contended_lock_does_not_prevent_later_selections() {
let home = tempfile::tempdir().expect("temporary home");
let path = home.path().join(FILE_NAME);
let lock = File::create(path.with_extension("lock")).expect("create lock file");
lock.lock().expect("hold lock");
assert_eq!(
persist_selection(&path, "skill://blocked".to_owned())
.expect_err("lock contention")
.kind(),
io::ErrorKind::WouldBlock
);
drop(lock);
persist_selection(&path, "skill://status".to_owned()).expect("persist selection");
assert_eq!(
MentionUsage::load(home.path(), HistoryPersistence::SaveAll).frequencies(),
HashMap::from([("skill://status".to_owned(), 1)])
);
}