Skip to content

test(cortex): pin that erasing only a proxied tenant's node never purges it - #313

Merged
M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/proxied-exact-reach-erase
Oct 23, 2026
Merged

M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/proxied-exact-reach-erase

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Summary

Test only. On the proxied wire, an erase that targets a tenant's user:<id> node purges the whole tenant (POST v1/tenant/purge) only when it reaches every descendant and every kind. A narrower erase goes scope by scope. The kinds case is already tested. The exact-reach case, the tenant node only with no descendants, was not. Without it, losing the descendants check would let a single-scope erase wipe the tenant's whole memory.

The new test stores a learning at user:alice and one at user:alice/agent:helper, then erases Reach::exact("user:alice"). No purge may be sent, and the agent's learning below must survive.

Related issue

None. Found in an edge-case audit (a coverage gap; the behaviour is correct).

API or behavior changes

None.

Validation

Commands actually run, with their outcome:

  • N/A: cargo fmt --all -- --check. rustfmt --check (edition 2024) passed on the touched file. CI runs the full check.
  • N/A: cargo clippy --all-targets --all-features -- -D warnings. Left to CI.
  • N/A: cargo build --all-targets --all-features. Left to CI.
  • cargo test -p tinymemory-integrations --lib erasing_only_the_tenant_node_does_not_purge_the_tenant:
    • break-check, with && req.reach.descendants removed from is_whole_tenant: FAILED on the "no tenant purge" assertion. Restored by copy.
    • unchanged code: 1 passed.

Tests

New erasing_only_the_tenant_node_does_not_purge_the_tenant in the proxied engine tests.

Documentation

Not needed (test only).

Checklist

  • The change is focused on one logical change
  • No new #[allow(...)], #[ignore], or relaxed lints
  • No secrets, tokens, or .env contents in the diff or the description

…ges it

On the proxied wire an erase of a tenant's user node purges the whole
tenant only when it also reaches every descendant and every kind. The
kinds case was tested; the exact-reach case was not, so dropping the
descendants check went unnoticed.
@coderabbitai

coderabbitai Bot commented Oct 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

This review includes 1 billable file and costs up to $0.25.

Or wait 52 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9faa2f6e-94df-4c43-9e6e-a46a3b1c3c80
📥 Commits

Reviewing files that changed from the base of the PR and between 4f5145c and a1ec38b.

📒 Files selected for processing: 1
  • crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@tinysweeper

tinysweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: a1ec38b9016f8310191a48bea8d6994faf2fb1da

Verdict: Ready for maintainer review · Priority: none
Coverage: Reviewed 1 of 1 files.
Pull request purpose (title): test(cortex): pin th…

Diagnostics and supporting details

Full summary

Pull request purpose (title): test(cortex): pin that erasing only a proxied tenant's node never purges it. Tiny Sweeper completed its review; deterministic results follow.

Review snapshot

Change surface Files Review signal Count
Production 0 Active findings 0
Tests 1 Noted findings 0
Documentation 0 Resolved findings 0
Configuration 0 Pending checks/questions 0

Completeness: Complete
Test assessment: No supported feature-to-test mapping was available; this does not mean tests are absent or passed.

What changed

Adds one test, `erasing_only_the_tenant_node_does_not_purge_the_tenant`, to the proxied engine test module. It stores a learning at `user:alice` and one at `user:alice/agent:helper` under the same tenant, erases only the `user:alice` node with `Reach::exact`, and asserts no purge request was sent, the descendant learning survives (event count drops from 2 to 1), and all requests still name the tenant. The test uses existing helpers in the same file; no production code is modified.

Features

  • Added — Narrower-erasure regression test for proxied tenant node: Locks in the invariant that an exact-reach erase of a tenant's own node is treated as narrower than a whole-tenant request, so removing the `descendants` check would fail the "no tenant purge" assertion rather than silently wiping a tenant's memory. (crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs async fn a_narrower_erasure_forgets_each_scopes_events() {, crates/tinymemory-integrations/src/cortex/engine/mod_proxied_tests.rs)

Tests

No supported feature-to-test mapping was produced. Test execution is not inferred.

Findings

No active actionable findings.

Before merge

None.

Agent review details

critique

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The critique lane is answered with no defects found; it verified `Reach::exact` sets descendants false, the `EraseRequest::new` and `tenant_of` semantics, and that the `alice` handle points at the same tenant log the doubled engine writes to.
  • Lane summary: The new test looks sound: it stores one learning at the tenant's own node and one below it, erases only the tenant node with Reach::exact (which the newly added validation in erase.rs treats as narrower than a whole-tenant request, so no purge), and asserts the purge list is empty while the subtree learning survives. I verified Reach::exact sets descendants false, EraseRequest::new and tenant_of semantics, and that `alice` is a live handle into the same tenant log that the doubled engine writes to, so event_count observations are consistent. One thing I could not check: the proxy double's `purged` field and its route handling beyond line 102 of testing/proxied.rs, and whether `erase` on an exact tenant node actually goes through the per-scope forget path rather than the proxy's `v1/tenant/purge` — but the assertions mirror the existing, passing sibling test `a_narrower_erasure_forgets_each_scopes_events`. No defects found. _The code index is behind this pull request (indexed at `1f4681b009b7`), so retrieved context may be out of date._

security

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The security lane is answered with nothing to report: the test uses only doubles and existing helpers, introducing no untrusted input path, network call, or repository rule.
  • Lane summary: The new test in `mod_proxied_tests.rs` adds a narrower-erasure case: it stores two learnings under one tenant, erases only the tenant node, and asserts no tenant purge, one surviving event, and correct tenant naming. It uses only test doubles and existing helpers; no untrusted input path, network call, or repository rule is introduced. Nothing to report. _The code index is behind this pull request (indexed at `1f4681b009b7`), so retrieved context may be out of date._

tests

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The tests lane is answered with no findings, noting the change adds only a test and therefore cannot regress production behavior silently.
  • Lane summary: The diff adds only a test to `mod_proxied_tests.rs`; it changes no production behaviour, so there is nothing here that could regress silently. The new test asserts on real observable outcomes (`proxy.purged` is empty, `alice.event_count()` drops from 2 to 1, `all_named(&proxy, "alice")` still holds), so it earns its keep and pins the invariant that erasing the tenant node alone does not purge the tenant. No findings. _The code index is behind this pull request (indexed at `1f4681b009b7`), so retrieved context may be out of date._

commits

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The commits lane is answered and found no sensitive content in committed files.
  • Lane summary: No sensitive content in committed files. _The code index is behind this pull request (indexed at `1f4681b009b7`), so retrieved context may be out of date._

description

  • Conclusion: Success
  • Scope reviewed: all assigned evidence
  • Positive: The description lane is answered with nothing reportable: the test follows repository conventions and the description matches the diff.
  • Lane summary: The PR adds one test to the proxied engine test module: it stores two learnings under `user:alice`, erases with `Reach::exact("user:alice")`, and asserts no tenant purge was sent, the descendant survives, and every request still names the tenant. The test uses helpers already defined in the same file, follows the repository's test-file and naming conventions, and the description matches what the diff does. Nothing reportable. _The code index is behind this pull request (indexed at `1f4681b009b7`), so retrieved context may be out of date._
Evidence and run details
  • Models: ladder/vectors-oai3, deepseek-v4.1-flash
  • Spend: $0.000267
  • Tokens: 106257 input · 2274 output · 31232 cached · 113 embedding
  • Updated: 2026-10-22T23:50:09Z
Head State Pass summary
a1ec38b9016f ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-22T23:50:09Z)

tinysweeper 0.1.2

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tinysweeper found nothing blocking. Approving.

Diagnostics

Total spend: $0.0003

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 22, 2026
@M3gA-Mind
M3gA-Mind merged commit 0544a41 into tinyhumansai:main Oct 23, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant