Skip to content

test(optimizer): add unit tests for appendix note consolidation - #459

Open
Lanre Shittu (Shizoqua) wants to merge 1 commit into
microsoft:mainfrom
Shizoqua:test/appendix-consolidation
Open

Lanre Shittu (Shizoqua) wants to merge 1 commit into
microsoft:mainfrom
Shizoqua:test/appendix-consolidation

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

Summary

consolidate_appendix_notes in skillopt/optimizer/skill_aware.py compacts the skill-aware Execution Notes Appendix with one optimizer call. The trainer calls it when the appendix grows past skill_aware_consolidate_threshold, and its contract is that a failure never loses notes. It had no tests.

Changes

New tests/test_appendix_consolidation.py (test-only, no source changes). The optimizer call is a fake chat_fn, so no model is contacted.

  • fewer than two notes (after stripping blanks) return without calling the model
  • the request: one call with stage="appendix_consolidate", retries=2, the given max_completion_tokens, and the stripped notes numbered in the user message
  • compacted notes are returned, including from a fenced reply and from {"note": ...} / {"content": ...} objects
  • the original notes come back on an exception, a prose or empty reply, an empty or blank result, a wrong key, and a result longer than the input
  • a result as long as the input is accepted

CHANGELOG.md: entry under Tests.

Verification

17 tests pass. Each of these changes to the function makes at least one test fail: allowing one note through to the model, dropping the length check, making it strict (<), returning [] on failure, re-raising the exception, and changing the stage, retries or token budget. Full suite: 2446 passed, 12 skipped, 4 xfailed. ruff check and ruff format --check pass on the new file.

consolidate_appendix_notes compacts the skill-aware Execution Notes
Appendix with one optimizer call and must never lose notes when that
call fails. It had no tests.

Cover the skipped call for fewer than two notes, the request it sends
(numbered notes, budget, retries, stage), fenced and note-object
replies, and that an exception, a prose or empty reply, an empty or
wrong-key result, or a result longer than the input returns the
original notes. The optimizer call is a fake, so no model is used.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant