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>
67 lines
2.4 KiB
Rust
67 lines
2.4 KiB
Rust
use super::*;
|
|
use akode_utils_absolute_path::AbsolutePathBuf;
|
|
use pretty_assertions::assert_eq;
|
|
use tempfile::tempdir;
|
|
use tokio::fs as tokio_fs;
|
|
|
|
#[tokio::test]
|
|
async fn build_memory_tool_developer_instructions_renders_embedded_template() {
|
|
let temp = tempdir().unwrap();
|
|
let codex_home = AbsolutePathBuf::from_absolute_path(temp.path()).unwrap();
|
|
let memories_dir = codex_home.join("memories");
|
|
tokio_fs::create_dir_all(&memories_dir).await.unwrap();
|
|
tokio_fs::write(
|
|
memories_dir.join("memory_summary.md"),
|
|
"Short memory summary for tests.",
|
|
)
|
|
.await
|
|
.unwrap();
|
|
|
|
let instructions = build_memory_tool_developer_instructions(&codex_home, MemoryVersion::V1)
|
|
.await
|
|
.unwrap();
|
|
|
|
assert!(instructions.contains(&format!(
|
|
"- {}/memory_summary.md (already provided below; do NOT open again)",
|
|
memories_dir.display()
|
|
)));
|
|
assert!(instructions.contains("Short memory summary for tests."));
|
|
assert_eq!(
|
|
instructions
|
|
.matches("========= MEMORY_SUMMARY BEGINS =========")
|
|
.count(),
|
|
1
|
|
);
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn v2_reads_only_its_own_summary_without_falling_back_to_v1()
|
|
-> Result<(), Box<dyn std::error::Error>> {
|
|
let home = tempdir()?;
|
|
let codex_home = AbsolutePathBuf::from_absolute_path(home.path())?;
|
|
let v1 = codex_home.join("memories");
|
|
let v2 = codex_home.join("memories_v2");
|
|
tokio_fs::create_dir_all(&v1).await?;
|
|
tokio_fs::write(v1.join("memory_summary.md"), "v1\nlegacy content").await?;
|
|
assert_eq!(
|
|
build_memory_tool_developer_instructions(&codex_home, MemoryVersion::V2).await,
|
|
None
|
|
);
|
|
tokio_fs::create_dir_all(&v2).await?;
|
|
tokio_fs::write(v2.join("memory_summary.md"), "v1\nnew pipeline content").await?;
|
|
let instructions = build_memory_tool_developer_instructions(&codex_home, MemoryVersion::V2)
|
|
.await
|
|
.expect("v2 instructions");
|
|
assert!(instructions.contains("new pipeline content"));
|
|
assert!(!instructions.contains("legacy content"));
|
|
assert!(instructions.contains("do not retrieve history speculatively"));
|
|
assert!(instructions.contains(&format!("{}/rollout_summaries/", v2.display())));
|
|
assert!(
|
|
build_memory_tool_developer_instructions(&codex_home, MemoryVersion::V1)
|
|
.await
|
|
.expect("v1 instructions")
|
|
.contains("legacy content")
|
|
);
|
|
Ok(())
|
|
}
|