Repository navigation
test: memory quality evaluation harness (#35) - #46
Merged
Merged
Conversation
`the_config_dir_can_be_overridden` set PNM_CONFIG_DIR with a comment claiming the test was single-threaded. It is not: libtest runs tests in parallel, and the override intermittently leaked into `the_default_dir_follows_pnm_rather_than_assuming_xdg`, which then saw /tmp/elsewhere. Split the override into `PnmConfig::dir_from` and test that instead; nothing in the suite sets an environment variable now. Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
`cargo test --test eval` replays 18 scripted multi-session scenarios
(tests/eval/scenarios/*.json) against the real Store — signing,
verification, ranking, lifecycle — over the in-process fake VTA, and
prints a scored markdown report: per dimension (precision, staleness,
contradiction, minimisation, repairability, poisoning) the hard checks
passed, precision, recall, MRR and repair operations.
Steps cover multiple writers, saves with basis/confidence/evidence and
expiry/review dates, status changes, forget, and raw tamper/plant/copy;
probes carry hard checks (top, absent, expectEmpty, refused, stale,
describe, fence) that fail the run, or are `soft` — scored and listed as
known gaps without failing it. Shaped after LongMemEval where it
applies (knowledge updates, abstention, temporal validity).
The fake keyspace moves to tests/common so the roundtrip tests and the
harness share it. CI runs the evaluation as part of `cargo test` (a
failed hard check fails the build) and again with EVAL_SUMMARY=1 to put
the report in the job summary.
The harness was mutation-checked: weighting inferences like statements,
or letting retracted / expired memories through recall, each fails a
hard check. Doing that found that only an empty-query probe catches the
latter, since a zero status weight already hides them from a query.
Its first run also found two ranking defects, recorded as soft probes:
query terms match as substrings ("run" in "runner"), and there is no
stopword list ("what is the for" matches three memories).
Closes #35
Signed-off-by: Glenn Gore <glenn.g@affinidi.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.
Closes #35.
What it is
cargo test --test evalreplays 18 scripted multi-session scenarios (tests/eval/scenarios/*.json) against the realStore— signing, verification, ranking, lifecycle — over the in-process fake VTA, and prints a scored report. Format and metrics are documented intests/eval/README.md.verifiedbeats unsupportedProbes carry hard checks (
top,absent,expectEmpty,refused,stale,describe,fence) that fail the run, and are scored for precision / recall / MRR against hand-labelled relevant keys. Asoftprobe is scored and listed as a known gap without failing the run.Shaped after LongMemEval where it applies (knowledge updates, abstention, temporal validity), plus what a signed multi-writer store needs (contradiction, repairability, poisoning).
Current report
All hard checks pass. (Contradiction precision is low by design: the demoted, losing memory stays visible for review and counts against precision.)
Findings — two ranking defects, recorded as soft probes
runmatches "Test runner",testmatches "latest" — a memory that merely contains the letters can outrank the one that answers.A follow-up PR can fix both and make those probes hard; the harness will show the movement.
Does it catch regressions?
Mutation-checked by hand: weighting
inferredlikedeclaredfails contradiction-declared-beats-inferred; letting retracted or expired memories through recall fails the repair / staleness scenarios. That exercise found that only an empty-query probe catches the latter — with a query, a zero status weight already hides them — so the session-start path now has probes too.CI
Runs as part of
cargo test(a failed hard check fails the build), and again in a labelled step withEVAL_SUMMARY=1to put the report in the job summary. On every PR rather than path-filtered: it is already built and takes well under a second.Also in this PR
tests/common/so roundtrip tests and the harness share it.test(pnm): fixes a pre-existing flaky test —the_config_dir_can_be_overriddensetPNM_CONFIG_DIRprocess-wide under a parallel runner and intermittently brokethe_default_dir_follows_pnm_rather_than_assuming_xdg. Now tested through a puredir_from.No plugin-visible change, so no version bump.
Acceptance