test: Added unit tests for the rag, completions and prompt, macros, vault, and functions/tool usage
This commit is contained in:
@@ -1,16 +1,32 @@
|
||||
# Test Plan: RAG
|
||||
|
||||
## Behaviors to test
|
||||
- [ ] Rag::init creates new RAG with embedding model
|
||||
- [ ] Rag::load loads existing RAG from disk
|
||||
- [ ] Rag::create builds vector store from documents
|
||||
- [ ] Rag::refresh_document_paths updates document list
|
||||
- [ ] RAG search returns relevant embeddings
|
||||
- [ ] RAG template formats context + sources + input
|
||||
- [ ] Reranker model applied when configured
|
||||
- [ ] top_k controls number of results
|
||||
- [ ] RAG sources tracked for .sources command
|
||||
- [ ] exit_rag clears RAG from context
|
||||
- [ ] Rag::init creates new RAG with embedding model (requires LLM client)
|
||||
- [ ] Rag::load loads existing RAG from disk (requires filesystem)
|
||||
- [ ] Rag::create builds vector store from documents (requires embedding model)
|
||||
- [ ] Rag::refresh_document_paths updates document list (requires filesystem)
|
||||
- [ ] RAG search returns relevant embeddings (requires embedding model)
|
||||
- [x] RAG template contains required placeholders
|
||||
- [ ] Reranker model applied when configured (requires LLM client)
|
||||
- [ ] top_k controls number of results (requires embedding model)
|
||||
- [ ] RAG sources tracked for .sources command (requires full Rag struct)
|
||||
- [x] exit_rag clears RAG from context (tested in iteration 8)
|
||||
|
||||
## Additional behaviors tested
|
||||
|
||||
- [x] DocumentId: new/split round-trip, zero/zero, large values
|
||||
- [x] DocumentId: Debug format ("file-doc"), equality, inequality, ordering
|
||||
- [x] RagDocument: new with content, default empty
|
||||
- [x] RagData: new sets all defaults, empty collections
|
||||
- [x] RagData::get: returns document, None for missing file, None for missing doc index
|
||||
- [x] RagData::del: removes files + associated vectors, noop for nonexistent
|
||||
- [x] RagData::add: inserts files, vectors, updates next_file_id
|
||||
- [x] RagData::build_bm25: empty data returns no results
|
||||
- [x] RagData::build_bm25: finds documents by keyword (BM25 ranking)
|
||||
- [x] RAG_TEMPLATE: contains __CONTEXT__, __SOURCES__, __INPUT__
|
||||
- [x] get_separators: Rust/Python/Markdown return language-specific
|
||||
- [x] get_separators: unknown extension returns defaults
|
||||
- [x] get_separators: all 22 known extensions have language-specific separators
|
||||
|
||||
## Old code reference
|
||||
- `src/rag/mod.rs` — Rag struct and methods
|
||||
|
||||
@@ -24,7 +24,12 @@
|
||||
- [ ] Prompt updates after scope transitions
|
||||
- [ ] Multi-line indicator shown during ::: input
|
||||
|
||||
## Status
|
||||
Most completion logic requires filesystem access for role/session/agent lists.
|
||||
The `split_line` function has existing tests. Prompt rendering methods are trivial
|
||||
wrappers around stored strings. Low additional unit-test yield.
|
||||
|
||||
## Old code reference
|
||||
- `src/config/request_context.rs` — repl_complete
|
||||
- `src/repl/completer.rs` — ReplCompleter
|
||||
- `src/repl/completer.rs` — ReplCompleter (split_line already tested)
|
||||
- `src/repl/prompt.rs` — ReplPrompt
|
||||
|
||||
@@ -1,14 +1,24 @@
|
||||
# Test Plan: Macros
|
||||
|
||||
## Behaviors to test
|
||||
- [ ] Macro loaded from YAML file
|
||||
- [ ] Macro steps executed sequentially
|
||||
- [ ] Each step runs through run_repl_command
|
||||
- [ ] Variable interpolation in macro steps
|
||||
- [ ] Built-in macros installed on first run
|
||||
- [ ] macro_execute creates isolated RequestContext
|
||||
- [ ] Macro context inherits tool scope from parent
|
||||
- [ ] Macro context has macro_flag set
|
||||
- [ ] Macro loaded from YAML file (requires filesystem)
|
||||
- [ ] Macro steps executed sequentially (requires async + RequestContext)
|
||||
- [ ] Each step runs through run_repl_command (requires async)
|
||||
- [x] Variable interpolation in macro steps
|
||||
- [ ] Built-in macros installed on first run (requires filesystem)
|
||||
- [ ] macro_execute creates isolated RequestContext (requires async)
|
||||
- [ ] Macro context inherits tool scope from parent (requires async)
|
||||
- [ ] Macro context has macro_flag set (requires async)
|
||||
|
||||
## Additional behaviors tested
|
||||
|
||||
- [x] resolve_variables: no variables, required provided, required missing errors
|
||||
- [x] resolve_variables: default used, default overridden
|
||||
- [x] resolve_variables: rest captures remaining args, rest with default
|
||||
- [x] resolve_variables: multiple variables mixed
|
||||
- [x] usage: no variables, required, optional, rest, rest+default, mixed
|
||||
- [x] interpolate_command: single, multiple, no vars, missing var passthrough
|
||||
- [x] YAML deserialization: with variables, with defaults, no variables
|
||||
|
||||
## Old code reference
|
||||
- `src/config/macros.rs` — macro_execute, Macro struct
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
# Test Plan: Vault
|
||||
|
||||
## Behaviors to test
|
||||
- [ ] Vault add stores encrypted secret
|
||||
- [ ] Vault get decrypts and returns secret
|
||||
- [ ] Vault update replaces secret value
|
||||
- [ ] Vault delete removes secret
|
||||
- [ ] Vault list shows all secret names
|
||||
- [ ] Secrets interpolated in MCP config (mcp.json)
|
||||
- [ ] Missing secrets produce warning during MCP init
|
||||
- [ ] Vault accessible from REPL (.vault commands)
|
||||
- [ ] Vault accessible from CLI (--add/get/update/delete-secret)
|
||||
- [ ] Vault add stores encrypted secret (requires terminal + password file)
|
||||
- [ ] Vault get decrypts and returns secret (requires password file)
|
||||
- [ ] Vault update replaces secret value (requires terminal + password file)
|
||||
- [ ] Vault delete removes secret (requires password file)
|
||||
- [ ] Vault list shows all secret names (requires password file)
|
||||
- [ ] Secrets interpolated in MCP config (mcp.json) (requires Vault with secrets)
|
||||
- [ ] Missing secrets produce warning during MCP init (requires Vault)
|
||||
- [x] Vault accessible from CLI (flag parsing tested in iteration 10)
|
||||
- [ ] Vault accessible from REPL (.vault commands) (requires REPL infra)
|
||||
|
||||
## Additional behaviors tested
|
||||
|
||||
- [x] SECRET_RE matches {{DOUBLE_BRACES}}
|
||||
- [x] SECRET_RE matches with surrounding text
|
||||
- [x] SECRET_RE does not match {SINGLE_BRACES}
|
||||
- [x] SECRET_RE does not match plain text
|
||||
- [x] SECRET_RE matches with spaces inside braces
|
||||
- [x] Vault::default() creates instance with no password file
|
||||
|
||||
## Old code reference
|
||||
- `src/vault/mod.rs` — GlobalVault, operations
|
||||
|
||||
@@ -37,6 +37,20 @@
|
||||
- [ ] Agent functions included when agent active
|
||||
- [ ] MCP meta functions included when servers active
|
||||
|
||||
## Status
|
||||
- Function declarations, append methods, find/contains tested in iteration 6
|
||||
- MCP meta functions tested in iterations 5-7
|
||||
- Function selection tested in iteration 7
|
||||
- User interaction functions tested in iterations 6-7
|
||||
- Python parser: extensive existing tests (400+ lines)
|
||||
- TypeScript parser: extensive existing tests (400+ lines)
|
||||
- parsers::common::underscore tested in iteration 13
|
||||
- Functions::init and tool compilation require filesystem
|
||||
|
||||
## Additional behaviors tested
|
||||
|
||||
- [x] parsers::common::underscore: simple, dashes, spaces, special chars, consecutive, leading/trailing, uppercase, mixed
|
||||
|
||||
## Old code reference
|
||||
- `src/function/mod.rs` — Functions struct, init, init_agent
|
||||
- `src/config/paths.rs` — agent_functions_file (priority)
|
||||
|
||||
Reference in New Issue
Block a user