Skip to content

fix(memory): validate merged configuration 🤖🤖🤖 - #279

Open
Sampoornnagpal wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
Sampoornnagpal:fix/memory-validate-config-merge
Open

fix(memory): validate merged configuration 🤖🤖🤖#279
Sampoornnagpal wants to merge 2 commits into
NVIDIA-NeMo:mainfrom
Sampoornnagpal:fix/memory-validate-config-merge

Conversation

@Sampoornnagpal

@Sampoornnagpal Sampoornnagpal commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

MemoryConfig.merge_with() bypasses Pydantic validation: enabled="false" remains truthy, invalid owners are accepted, and nested embedding dictionaries remain plain dictionaries that fail when used by the manager.

Validate the merged data through the configuration class. Preserve the documented top-level replacement behavior and the original frozen configuration.

Validation

All four new cases fail before the fix. uv run pytest -q packages/nooa-memory/tests/memory/test_memory_config.py packages/nooa-memory/tests/memory/test_memory_skill.py packages/nooa-memory/tests/memory/test_memory_owner_roles.py — 19 passed, including the MemorySkill call site of merge_with().

Windows/Python 3.12 with external import-only helpers for the existing fcntl/SIGUSR2 blockers (#84/#85). No live model calls; helpers are not included and do not validate locking or signals.

Related issues

No matching open issue found.

Checklist

  • Ruff lint and formatting pass.
  • Regression and related tests pass.
  • Docstring states validation behavior.
  • SPDX header check passes.

Summary by CodeRabbit

  • Bug Fixes

    • Configuration overrides are now validated before being applied, improving handling of type conversions and invalid values.
    • Nested embedding settings correctly replace prior values while restoring applicable defaults.
    • Original configuration remains unchanged when overrides are applied.
  • Tests

    • Added coverage for configuration validation, boolean coercion, nested settings, invalid owner values, and unsupported embedding backends.

Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3fd2d121-e923-44c5-b63f-17c2899a7a8a

📥 Commits

Reviewing files that changed from the base of the PR and between 7fabf0c and 5272499.

📒 Files selected for processing (1)
  • packages/nooa-memory/tests/memory/test_memory_config.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/nooa-memory/tests/memory/test_memory_config.py

Included review availability: Your plan provides up to 12 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

MemoryConfig.merge_with now validates merged configuration data. Tests cover coercion, nested replacement, default restoration, immutability, and invalid values.

Changes

Memory configuration validation

Layer / File(s) Summary
Validated configuration merging
packages/nooa-memory/src/nooa_memory/config.py, packages/nooa-memory/tests/memory/test_memory_config.py
merge_with validates merged model data through model_validate. Tests verify coercion, nested embedding replacement, default restoration, original-object immutability, and rejection of invalid values.

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

Merge Risk: ⚪ Minimal · up to 52724

Configuration merges now validate and coerce override data while preserving replacement semantics and original configuration immutability. The covered behavior is ready to merge.

🚥 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 clearly identifies the main change: validating the merged memory configuration. The emoji adds minor noise but does not make the title unclear or unrelated.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Signed-off-by: Sampoorn Nagpal <nagpalsampoorn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant