Repository navigation
Test: memory classifier and pattern promotion - #43
Merged
Merged
Conversation
Neither rule-based service had a direct test: a changed keyword list, tie break order, cluster size, promotion threshold or confidence cap would reclassify or over-trust stored memory silently. Includes tie cases so the TYPE_PRIORITY order is pinned, and scope checks that fail if another agent's observations leak into the owner's cluster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
services/api/tests/test_classifier.py(16 tests: classification by keyword signals and source, equal-score tie breaks, 280-character summary, case-insensitivity, legacy type map) andservices/api/tests/test_pattern_promotion.py(clustering of 3+ confirmed or twice-confirmed observations, rerun only confirms when the cluster grew, empty hypotheses, signal filter, agent scope, 60-character names, promote at 5 / deprecate at 3, confidence never above 0.95). Real sqlite files undertmp_path, no mocks.25 new tests pass; full suite (without test_module_contract.py) 406 passed. ruff, file sizes and package boundaries pass.
Mutations tried (each restored):
MAX_PATTERN_CONFIDENCE0.95 to 1.0 fails the clamp test;new_size >to>=fails the rerun test;TYPE_PRIORITYreversed fails two tie cases (the brief's listed cases did not catch it, so two equal-score cases were added).Reviewer fixes to the GLM draft:
test_maybe_promotecrashed (Pattern counts left unset, TypeError in the product when a promoted candidate reaches the contradiction check); the agent-scope test could not fail (one foreign observation never reaches a cluster of 3), now 2 owner + 1 other; the qualify test now checks no extra pattern row.Written by GLM (worker w22-mvy9gbum), reviewed by Claude.
🤖 Generated with Claude Code