Skip to content

Test: memory classifier and pattern promotion - #43

Merged
alexeybe1kin merged 1 commit into
mainfrom
glm/memorygate-classifier-promotion-tests
Nov 1, 2026
Merged

alexeybe1kin merged 1 commit into
mainfrom
glm/memorygate-classifier-promotion-tests

Conversation

@alexeybe1kin

@alexeybe1kin alexeybe1kin commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

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) and services/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 under tmp_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_CONFIDENCE 0.95 to 1.0 fails the clamp test; new_size > to >= fails the rerun test; TYPE_PRIORITY reversed 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_promote crashed (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

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>
@alexeybe1kin
alexeybe1kin merged commit 960bb79 into main Nov 1, 2026
3 checks passed
@alexeybe1kin
alexeybe1kin deleted the glm/memorygate-classifier-promotion-tests branch November 1, 2026 20:51
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