docs: Documentation for the RESTful API POC

This commit is contained in:
2026-05-01 14:45:13 -06:00
parent ca03f6f9d7
commit 7ea3044a37
73 changed files with 2 additions and 2 deletions
@@ -0,0 +1,69 @@
# Iteration 8 — Test Implementation Notes
## Plan file addressed
`docs/testing/plans/08-request-context.md`
## Tests created
### src/config/request_context.rs (22 new tests, 51 total in file)
| Test name | What it verifies |
|---|---|
| `state_empty_context` | Empty context → empty StateFlags |
| `state_with_role_only` | Role set → ROLE flag |
| `state_with_empty_session` | Empty session → SESSION_EMPTY flag |
| `state_flags_combine_role_and_session` | Multiple flags combine correctly |
| `role_info_errors_when_no_role` | No role → error |
| `role_info_succeeds_with_role` | Role present → exports prompt |
| `agent_info_errors_when_no_agent` | No agent → error |
| `rag_info_errors_when_no_rag` | No RAG → error |
| `use_role_obj_errors_when_agent_active` | Agent blocks role assignment |
| `exit_rag_clears_rag` | exit_rag() sets rag to None |
| `discontinuous_last_message_sets_continuous_false` | Marks last message non-continuous |
| `discontinuous_last_message_noop_when_none` | No last message → no-op |
| `before_chat_completion_sets_last_message` | Creates LastMessage with empty output |
| `role_like_mut_returns_none_when_empty` | No active scope → None |
| `role_like_mut_returns_role_when_only_role` | Role only → returns role |
| `role_like_mut_prefers_session_over_role` | Session takes priority |
| `working_mode_cmd` | CMD mode flags correct |
| `working_mode_repl` | REPL mode flags correct |
| `session_file_returns_yaml_path` | Correct .yaml suffix |
| `session_file_with_subdir` | subdir/name → nested path |
| `is_compressing_session_false_when_no_session` | No session → false |
| `is_compressing_session_false_with_default_session` | Default session → false |
**Total: 22 new tests (272 total in suite)**
## Bugs discovered
None.
## Observations for future iterations
1. **Rag struct has no Default**: Rag requires an AppConfig, name,
embedding model, and HNSW index. Can't create test instances
without heavy setup. RAG-related state tests (state with RAG,
exit_rag with actual RAG) deferred.
2. **role_like_mut priority is session > agent > role > None**:
The session-over-role priority is verified. Agent priority
can't be easily tested without agent init (filesystem).
3. **StateFlags is a bitflags type**: Tested empty, individual
flags (ROLE, SESSION_EMPTY), and combinations. The SESSION
flag (non-empty session) requires adding messages to a session
which needs more setup — deferred.
4. **info() and sysinfo() require model provider config**: These
format system info strings that include model details. Testing
requires a valid model provider configuration.
5. **The RequestContext test file now has 51 tests** spanning
iterations 1, 4, 5, 7, and 8. It's the most heavily tested
module, which matches its role as the central state container.
## Next iteration
Plan file 09: REPL Commands — REPL command handlers, state
assertions, argument parsing.