Skip to content

test(cortex): pin forget batching and a retry that finds the events gone - #314

Merged
M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/forget-batches-and-gone-retry
Oct 23, 2026
Merged

M3gA-Mind merged 1 commit into
tinyhumansai:mainfrom
M3gA-Mind:test/forget-batches-and-gone-retry

Conversation

@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Summary

Test only. Two pieces of forget_events had no test.

  • Batching. A removal names at most FORGET_BATCH (100) event ids per request, so 250 ids go as 100, 100 and 50.
  • Gone on retry. On the hosted wire a transient failure is retried. Removing named events is idempotent, so a retry answered 404 means an earlier send already removed them, and that counts as success. A 404 on the first send is still an error.

The new test runs a hosted engine against a small backend. That backend fails each batch's first send with 503 and answers its retry 404. Forgetting 250 ids must succeed, and the recorded request bodies must name 100, 100, 100, 100, 50 and 50 ids (each batch sent twice).

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 a_forget_is_sent_in_batches_and_a_retry_that_finds_them_gone_succeeds:
    • unchanged code: 1 passed.
    • break-check 1, FORGET_BATCH set to 125: FAILED, left: [125, 125, 125, 125], right: [100, 100, 100, 100, 50, 50].
    • break-check 2, the "404 on a retry is success" arm removed: FAILED with NotFound("[HTTP_404] …").
    • restored by copy after each: 1 passed.

Tests

New a_forget_is_sent_in_batches_and_a_retry_that_finds_them_gone_succeeds in the hosted 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

forget_events sends at most FORGET_BATCH (100) ids per request, and a
hosted retry that answers 404 means an earlier send already removed
them, which is success. Neither was tested. The new test forgets 250 ids
against a backend that fails each batch's first send with 503 and
answers its retry 404.
@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 47 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: a7a53267-ad6d-4d12-9e38-e8fe63415c68
📥 Commits

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

📒 Files selected for processing: 1
  • crates/tinymemory-integrations/src/cortex/engine/mod_hosted_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 23, 2026 •

Copy link
Copy Markdown

Tiny Sweeper review

Reviewed head: 0ab030f90752abf4f4fec324843d8b4833b450ba

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

Diagnostics and supporting details

Full summary

Pull request purpose (title): test(cortex): pin forget batching and a retry that finds the events gone. 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

A single new test, `a_forget_is_sent_in_batches_and_a_retry_that_finds_them_gone_succeeds`, is added to the hosted engine test file. It stands up an axum router on `/memory/forget`, captures each request body, and alternates responses by call count: odd sends get 503, even sends get 404. It then calls `engine.log.forget_events("user:alice/app:learnings", &ids)` with 250 ids and asserts the captured per-request `memory_ids` lengths equal `[100, 100, 100, 100, 50, 50]`. No production paths are modified. The critique lane noted a fragility, not a defect: the `% 2` alternation keys off handler call count rather than batch identity, so the test's expectation holds only while each batch is sent exactly twice — it would misfire if `FORGET_BATCH` or `HOSTED_FORGET_ATTEMPTS` changed. The critique lane also observed the code index is behind this pull request (indexed at `1f4681b009b7`) and retrieved context may be out of date. The latest-push-delta evidence is unavailable; no base-to-head diff comparison was trusted.

Features

None identified with supported citations.

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
  • Lane summary: The test exercises `Log::forget_events` batching (250 ids → 100/100/50) and the hosted retry-then-404-is-success path against a hand-rolled double, and its expected `[100, 100, 100, 100, 50, 50]` matches the loop in `forget_batch`: each batch's first send answers 503, the retry answers 404, and `attempt > 1` turns that into `Ok`. The only gap I noticed is that the `% 2` alternation is tied to the handler's call count rather than to the batch, so the test passing depends on exactly two sends per batch — it holds for the chosen input but would misfire if `FORGET_BATCH` or `HOSTED_FORGET_ATTEMPTS` changed; that is a fragility of the new test, not a defect in this change. _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: Security lane answered with no findings, noting the change is test-only in a `_tests.rs` file, touches no production path, credential or attacker input, and satisfies the repository `_tests.rs` naming rule.
  • Lane summary: New test-only code in a `_tests.rs` sibling: it wires a local axum route, sends 250 ids through `forget_events`, and asserts the batches are 100/100/50 with a hosted retry that accepts the 404. It touches no production path, credential or attacker input, and the file naming satisfies the repository's `_tests.rs` rule. No defects found. _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
  • Lane summary: The diff adds one new hosted test, `a_forget_is_sent_in_batches_and_a_retry_that_finds_them_gone_succeeds`, which pins the documented batching contract in `Log::forget_events` (100-id `FORGET_BATCH` chunks) and the idempotent-removal retry path (transient fault then 404 is success), asserting exact batch sizes `[100, 100, 100, 100, 50, 50]` against captured request bodies. No production code changed, and the test exercises real behaviour through the engine rather than a mock, so the absence of a production change needing coverage is not a defect. 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: Commits lane answered reporting 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
  • Lane summary: The test added matches the description: it drives 250 ids through `forget_events` against a backend that fails each first send with 503 and answers the retry 404, asserting the recorded batch sizes [100, 100, 100, 100, 50, 50], which is exactly the batching and gone-on-retry behaviour the body claims. The summary line's "100, 100 and 50" is loose phrasing about per-batch sizing rather than a claim the diff fails to support, and the change is a pure test addition with no API change. 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.000367
  • Tokens: 140586 input · 3914 output · 41472 cached · 152 embedding
  • Updated: 2026-10-23T00:03:24Z
Head State Pass summary
0ab030f90752 ready for maintainer review 0 active finding(s), 0 resolved finding(s) (at 2026-10-23T00:03:24Z)

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.0004

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Oct 23, 2026
@M3gA-Mind
M3gA-Mind merged commit 8b919fd 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