Repository navigation
fix(story): get_project_story reads the domain remember writes (#721, slice 5) - #918
Conversation
… slice 5) get_project_story passed an explicit `domain` unresolved to get_memories_for_domain, so get_project_story(domain="cortex-cowork") told the story of a scope no write used (remember stores it under `cortex`) and domain="SciFact" missed `scifact`. Resolve it with resolve_explicit_domain, like remember, recall, recall_hierarchical and narrative; a blank domain counts as no domain. Refs #721 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYuQsAuzcbRgNg9VmJZ
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Claude finished @cdeust's task in 1m 22s —— View job PR #918 review (1 of 3)
Blockers: none. Notes, no action before merge: one test passes without the fix, no test covers I did not run the tests; the review comes from reading the code. Verdict: approve |
Review 1/3: PR #918 (
|
The `unit` check (run 42280181055, job 128106929303) failed the scoped mutation gate: slice 5 changed `get_project_story.handler`, so every mutant of that function is in scope, and 10 survived on lines the slice did not touch. Two were a real test gap: no test called the handler with default arguments, so neither the default limit of 5 chapters nor the per-day bucket key of the default "week" period was checked. A new contract test covers both. The other eight are equivalent by construction and are registered in memory/mutation-equivalents.json: a None or "" `directory` is falsy either way, and every `period` variant (None, "XXweekXX", "WEEK", or "week" dropped from the allowed tuple) is rewritten to "week" by the guard on the next statement. Refs #721 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018kyZYuQsAuzcbRgNg9VmJZ
|
CI autopilot : correction du gate de mutation poussée (652b848).
Generated by Claude Code |
|
Claude finished @cdeust's task in 3m 2s —— View job PR #918 review (2 of 3)
Blocker: in Accepted: the new default-arguments test, and the other six registry entries. I could not run the tests; this review comes from reading the code. Verdict: block |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 652b848381
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "mutant": "mcp_server.handlers.get_project_story.x_handler__mutmut_39", | ||
| "removed": "if period not in (\"day\", \"week\", \"month\", \"all\"):", | ||
| "added": "if period not in (\"day\", \"XXweekXX\", \"month\", \"all\"):", | ||
| "kind": "equivalent-by-construction", | ||
| "rationale": "The guard maps any `period` outside its tuple to \"week\". Removing \"week\" from the tuple only changes what happens to `period == \"week\"`, which the guard then rewrites to \"week\": the same value. Every other input takes the same branch as before, so no input distinguishes the variants.", |
There was a problem hiding this comment.
Remove the distinguishable period-guard mutation exemptions
These guard mutations are not equivalent: replacing "week" with "XXweekXX" also makes period="XXweekXX" pass validation, and the adjacent exemption does the same for period="WEEK". The original handler normalizes both inputs to "week"; the mutants preserve them and, with memories present, use the all-history cutoff and monthly buckets instead. Invalid-period fallback is already an explicit contract in test_invalid_period_falls_back_and_distinguishes_expired_rows, but it currently tests only "decade". Registering these mutants makes scripts/mutation_equivalents.py::classify accept genuine coverage gaps. Remove both exemptions and extend the fallback test to cover the newly accepted values.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Corrigé dans 997a395 : mes justifications pour les mutants 39 et 40 étaient fausses. Avec "week" remplacé par "XXweekXX" ou "WEEK" dans la liste de la garde, cette valeur passe la validation et n'est plus ramenée à "week".
- J'ai retiré les deux entrées de
memory/mutation-equivalents.json. test_invalid_period_falls_back_and_distinguishes_expired_rowscouvre maintenant"decade","WEEK"et"XXweekXX".- Le gate de mutation local (
GITHUB_BASE_REF=main python scripts/ci_mutation_diff.py) tue maintenant les mutants 39 et 40 : 0 échec, 6 équivalents acceptés.
Les mutants 25 et 26 restent enregistrés. Ils ne modifient que la valeur par défaut de period ; la liste de la garde, intacte, ramène "XXweekXX" ou "WEEK" à "week".
Generated by Claude Code
Review 2/3: PR #918, commit
|
| Original | Mutant 40 | |
|---|---|---|
| Guard | rewrites to "week" |
lets "WEEK" through |
_period_cutoff (:111) |
one week back | the 2000-01-01 "all" cutoff |
Bucket keys (:134) |
per day, %Y%m%d |
per month, %Y%m |
Response period |
"week" |
"WEEK" |
Mutant 39 does the same with "XXweekXX". The schema enum (:58) does not save the claim, because the handler never checks the enum and the gate's unit tests call the handler directly. As registered, the scoped mutation gate passes on two real survivors that guard a time window. That is a false green in CI.
Fix: parametrize test_invalid_period_falls_back_and_distinguishes_expired_rows (test_project_story_contract.py:160) over ["decade", "WEEK", "XXweekXX"], then delete both entries. With either mutant, the 2001 row survives and the reported period changes.
Accepted
- The new test
test_defaults_bucket_the_last_week_by_day_and_keep_five_chapters(:116) is deterministic. It kills the default-max_chaptersmutants (6, 4,None) and the default-period mutants ("day","month"). - Entries 5, 7, 20, 22, 25 and 26 are truly equivalent:
if directory:cannot tellNonefrom"", and any default outside the tuple is rewritten to"week".
Notes, no action before merge
- The rationales for entries 20, 22, 25 and 26 say "on the next statement", but the guard is two statements later, after
max_chapters(:240). The equivalence still holds.
I could not run the tests in this session; the findings come from reading the code. The Pipeline run was still in progress when I posted this.
Verdict: block
|
Claude finished @cdeust's task in 2m 11s —— View job PR #918 review (2 of 3)
Blockers: none.
Notes, no action before merge
Verdict: approve |
Review 2/3: PR #918, the commits after
|
Summary
Refs #721 (tranche 5 — ne ferme pas l'issue).
Cause racine :
get_project_storypassait l'argumentdomainbrut àget_memories_for_domain, alors querememberécrit sousresolve_explicit_domain(domain).get_project_story(domain="cortex-cowork")racontait donc un scope où aucune écriture n'a lieu (rememberstocke souscortex) etdomain="SciFact"manquaitscifact. Même défaut que celui corrigé pournarrativedans #915. Ledomainde ce handler est bien un scope mémoire (il ne sert qu'àget_memories_for_domain), pas un domaine de profil.Correctif : le handler résout le domaine avec
resolve_explicit_domainavant de lire le store ; un domaine blanc ouNonecompte comme absence de domaine (lecture des mémoires chaudes).Type of change
Test plan
tests_py/handlers/test_project_story_domain_scope.py(nouveau, 9 tests) : 9 passent avec le correctif, 6 échouent sans (vérifié en retirant le correctif localement).pytest tests_py/handlers: 1881 passed, 81 skipped (PostgreSQL absent).ruff check/ruff format --checksur les fichiers modifiés : OK.python scripts/check_craftsmanship.py: OK.Audit notes
Non vérifié localement : suite PostgreSQL, gate de mutation, benchmarks (
torchnon téléchargeable dans cette session, hôtedownload-r2.pytorch.orgrefusé par le proxy). Leruffutilisé est celui de l'environnement, pas forcément la version deuv.lock.Breaking changes
Aucun pour un domaine déjà canonique. Un
domainblanc (" ") lit désormais les mémoires chaudes au lieu d'un scope vide.Reviewer checklist
Generated by Claude Code