test(audit): check that captured memories keep their project tag - #562
Merged
Merged
Conversation
A new memory invariant, `captured-memories-keep-a-project`: every memory a hook captured (tagged `source:auto-capture`) and every task state must still carry a `project:` tag, because every writer of those adds one. A memory of that kind without one lost it afterwards, which is what `kg rename-project --from X --to X --apply` did to every memory of project X (#519). It is keyed on the writers' own constants, not on names. It cannot see a memory a person wrote without a project, a commit captured before the tag existed, or a wrong but present project. Two graph-repair fixtures now carry the project tag every real writer adds. Refs #519
`captured-memories-keep-a-project` flagged a captured memory that a person had deliberately turned into a global one (`remember` with `replace`, `namespace: 'global'` and no project tag), including after export and import into another graph. The global namespace is now excluded: a rename never changes a memory's namespace, so #519's damage is still caught. A captured session summary, not only a commit, is now tested as a violation too. Refs #519
The data cannot tell a deliberate removal from damage: a replace record describes an earlier write, not the later change that took the tag away. So `npm run audit:memory` now reports every memory a hook captured, and every task state, that has no project tag. To make a captured memory global on purpose, replace it without the capture tag too; it is then a person's own memory and is not checked. Refs #519
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 a
npm run audit:memorycheck that reports every captured memory — a commit, a session summary or a task state — that has lost itsproject:tag, so a memory that silently drops out of its project is caught in the data, not only in a diff.replaced_historydoes not excuse a current memory that lacks a project.Refs #519