fix: audit low-risk batch - orphan self-heal, tenant scope, contract alignment - #33
Merged
Merged
Conversation
…alignment - repository: self-heal orphaned idempotency rows instead of 500, scope _get_by_id and delete cleanup by tenant_id - api: reuse single now in recall to avoid expiry TOCTOU, require min_length=1 on explain query to match OpenAPI - config: fail fast on invalid DMA_ANALYZER_KIND with allowed values - sdk: reject naive expires_at client-side with ValidationError - mcp: include created_at/updated_at/expires_at in tool payloads
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Summary
External audit (50 tests green, tracker clean) found 12 latent issues. This PR fixes the low-risk, verifiable batch. High-severity idempotency cross-agent leak (B1) and request-size bypass (B2) are reported but left out - they need migration / design review.
Fixed
repository.py:create_or_getnow catches RuntimeError from stalememory_id, deletes the orphan row, treats as new write instead of 500. Verified by deleting memory row directly and replaying key._get_by_idnow filtersAND tenant_id=?,deletescopes idempotency + memories deletes by tenant. Defense-in-depth (ids are uuid4 hex, not exploitable today).main.py:recallcaptures singlenowfor filter + rendering. Previously filter used one now, each result rendered with fresh now, could return expired with status expired.explain querynowmin_length=1to matchopenapi/dma-v1.yaml:100-103. Empty query now 422, was 200.DMA_ANALYZER_KINDnow raises with allowed values instead of silent fallback to plain.client.remembernow raises ValidationError for naive datetime instead of wasted 422 round-trip._memory()now includes created_at/updated_at/expires_at ISO strings.Verification
make check: 46 + 4 passed, ruff clean, pyright 0 errors across 5 packagesOut of scope (reported separately)