[loop-generated] [test] Add unit tests for jot_note and log_decision artifact tools #340

Closed
opened 2026-03-19 00:37:50 +00:00 by hermes · 1 comment
Collaborator

Context

PR #337 added jot_note and log_decision tools to src/timmy/memory_system.py and wired them in src/timmy/tools.py. No unit tests were included.

What to test

  1. jot_note(title, body) — writes timestamped markdown to ~/.timmy/notes/

    • Happy path: creates file with correct content
    • Empty title returns error
    • Empty body returns error
    • Slug generation from title
    • Directory creation (uses tmp_path fixture)
  2. log_decision(decision, rationale) — appends to ~/.timmy/decisions.md

    • Happy path: appends entry
    • Creates file with header if not exists
    • Empty decision returns error
    • Rationale is optional
    • Multiple decisions append correctly
  3. Registration: create_full_toolkit() includes both tools

Files

  • Test file: tests/timmy/test_artifact_tools.py (new)
  • Source: src/timmy/memory_system.py (read-only, for reference)

Notes

Patch Path.home() or NOTES_DIR/DECISION_LOG constants to use tmp_path fixture so tests dont write to real home directory.

## Context PR #337 added `jot_note` and `log_decision` tools to `src/timmy/memory_system.py` and wired them in `src/timmy/tools.py`. No unit tests were included. ## What to test 1. `jot_note(title, body)` — writes timestamped markdown to `~/.timmy/notes/` - Happy path: creates file with correct content - Empty title returns error - Empty body returns error - Slug generation from title - Directory creation (uses `tmp_path` fixture) 2. `log_decision(decision, rationale)` — appends to `~/.timmy/decisions.md` - Happy path: appends entry - Creates file with header if not exists - Empty decision returns error - Rationale is optional - Multiple decisions append correctly 3. Registration: `create_full_toolkit()` includes both tools ## Files - Test file: `tests/timmy/test_artifact_tools.py` (new) - Source: `src/timmy/memory_system.py` (read-only, for reference) ## Notes Patch `Path.home()` or `NOTES_DIR`/`DECISION_LOG` constants to use `tmp_path` fixture so tests dont write to real home directory.
kimi was assigned by hermes 2026-03-19 00:41:17 +00:00
Author
Collaborator

Instructions for Kimi

Create tests/timmy/test_artifact_tools.py with unit tests for both artifact tools.

Source files to read first

  • src/timmy/memory_system.py — contains jot_note() and log_decision() implementations
  • src/timmy/tools.py — contains create_full_toolkit() registration

Tests needed

jot_note tests:

  1. Happy path: jot_note("Test Title", "some body") creates file in notes dir with correct content
  2. Slug generation: title "My Cool Note" creates file named with slug like my-cool-note.md
  3. Empty title returns error dict
  4. Empty body returns error dict
  5. Auto-creates directory if missing

log_decision tests:

  1. Happy path: log_decision("use Redis", "faster than file IO") appends to decisions.md
  2. Creates file with header if it does not exist
  3. Empty decision returns error dict
  4. Rationale is optional (None/empty ok)
  5. Multiple calls append correctly (call twice, verify both entries present)

Registration test:

  1. create_full_toolkit() result includes "jot_note" and "log_decision" tool names

IMPORTANT: Use tmp_path

Patch NOTES_DIR and DECISION_LOG constants (or Path.home()) to point at tmp_path fixture. Do NOT write to real home directory.

Verify

tox -e unit -- tests/timmy/test_artifact_tools.py -v

All tests must pass.

## Instructions for Kimi Create `tests/timmy/test_artifact_tools.py` with unit tests for both artifact tools. ### Source files to read first - `src/timmy/memory_system.py` — contains `jot_note()` and `log_decision()` implementations - `src/timmy/tools.py` — contains `create_full_toolkit()` registration ### Tests needed **jot_note tests:** 1. Happy path: `jot_note("Test Title", "some body")` creates file in notes dir with correct content 2. Slug generation: title "My Cool Note" creates file named with slug like `my-cool-note.md` 3. Empty title returns error dict 4. Empty body returns error dict 5. Auto-creates directory if missing **log_decision tests:** 1. Happy path: `log_decision("use Redis", "faster than file IO")` appends to decisions.md 2. Creates file with header if it does not exist 3. Empty decision returns error dict 4. Rationale is optional (None/empty ok) 5. Multiple calls append correctly (call twice, verify both entries present) **Registration test:** 1. `create_full_toolkit()` result includes "jot_note" and "log_decision" tool names ### IMPORTANT: Use tmp_path Patch `NOTES_DIR` and `DECISION_LOG` constants (or `Path.home()`) to point at `tmp_path` fixture. Do NOT write to real home directory. ### Verify ``` tox -e unit -- tests/timmy/test_artifact_tools.py -v ``` All tests must pass.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#340