Skip to content

fix: Resolve #1529 - fix: Resolve #1528 - fix: enforce ALLOWED_UPDATE_FIELDS in update_memory (#770)#1530

Closed
washim0988-art wants to merge 3 commits into
moorcheh-ai:mainfrom
washim0988-art:fix/bounty-1529-1784491168
Closed

fix: Resolve #1529 - fix: Resolve #1528 - fix: enforce ALLOWED_UPDATE_FIELDS in update_memory (#770)#1530
washim0988-art wants to merge 3 commits into
moorcheh-ai:mainfrom
washim0988-art:fix/bounty-1529-1784491168

Conversation

@washim0988-art

@washim0988-art washim0988-art commented Jul 19, 2026

Copy link
Copy Markdown

Resolves #1529

Built autonomously by Cloud Agent.
Bounty payout address: Gq46qirFLJY3qptAWkAmAeDfGVAE4MYYGTcRmpKjsyR

Summary by CodeRabbit

  • Bug Fixes
    • Improved memory record updates by enforcing a supported-field allowlist and raising an error for unknown update keys (no partial updates).
    • Clearer failures when updating a record that doesn’t exist.
    • Update operations now propagate validation errors directly.
  • New Features
    • Added a publicly available allowlist constant for supported update fields.

Signed-off-by: washim0988-art <islowashin@gmail.com>
@github-actions github-actions Bot added the bounty This issue has a bounty attached to it label Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3eaf75f1-6064-43e3-b100-764b31765e0d

📥 Commits

Reviewing files that changed from the base of the PR and between a645740 and 43cd4f9.

📒 Files selected for processing (1)
  • fix_1529.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • fix_1529.py

📝 Walkthrough

Walkthrough

Adds an allowlist for memory record updates, initializes optional fields to None, reports missing records, and changes update_memory to receive a repository and propagate update exceptions.

Changes

Memory update flow

Layer / File(s) Summary
Record model and repository
fix_1529.py
MemoryRecord uses explicit optional fields and the shared ALLOWED_UPDATE_FIELDS allowlist; the repository raises for missing records before delegating valid updates.
Update entry point
fix_1529.py
update_memory accepts a repository and propagates update errors; the executable example constructs and supplies the repository.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is specific and directly describes the main change: enforcing ALLOWED_UPDATE_FIELDS in update_memory.
Linked Issues check ✅ Passed The changes match the linked issue goals by whitelisting update fields, preventing unsupported updates, and erroring on missing records.
Out of Scope Changes check ✅ Passed No clear out-of-scope code changes are evident; the edits all support whitelist enforcement and safer record updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@fix_1529.py`:
- Around line 36-44: Update update_memory to accept an existing
MemoryRecordRepository argument instead of creating one internally, and remove
the unconditional add_record call so missing-record validation remains
reachable. Remove the ValueError catch-and-print behavior and let
repository.update_record exceptions propagate to the caller; update the
invocation to pass the repository dependency.
- Around line 11-17: Update the update method to use a module-level or
class-level ALLOWED_UPDATE_FIELDS constant instead of defining
allowed_update_fields locally, and preserve validation against that constant.
Change the ValueError text for unsupported keys to the downstream-required
message “Unknown update field”.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ca63e8d-00ca-46ba-8932-97e104f7cba6

📥 Commits

Reviewing files that changed from the base of the PR and between 32d83bd and 7ac0e9c.

📒 Files selected for processing (1)
  • fix_1529.py

Comment thread fix_1529.py Outdated
Comment thread fix_1529.py Outdated
Refactor MemoryRecord to use constants for allowed fields and improve error handling. Update update_memory function to accept repository as an argument.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@fix_1529.py`:
- Around line 15-21: Update update to validate all keys in updates against
ALLOWED_UPDATE_FIELDS before mutating any attributes, preserving atomicity when
invalid keys are present. Collect the invalid keys and raise ValueError
containing the complete invalid-key list; only apply setattr after validation
succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 26186169-56d1-4ba2-a7ed-fdf5dd2b83a3

📥 Commits

Reviewing files that changed from the base of the PR and between 7ac0e9c and a645740.

📒 Files selected for processing (1)
  • fix_1529.py

Comment thread fix_1529.py Outdated
Validate update keys before applying changes to ensure atomic updates. Improved error handling for unknown fields.
@Xenogents

Copy link
Copy Markdown
Collaborator

I believe this is a duplicate

@Xenogents Xenogents closed this Jul 21, 2026
@washim0988-art
washim0988-art deleted the fix/bounty-1529-1784491168 branch July 21, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bounty This issue has a bounty attached to it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants