fix(config): generate unique default identifiers - #2201
Conversation
🤖 Open Code ReviewTarget: PR #2201 ✅ OpenCodeReview: No comments generated. Looks good to me. Generated by cloud-assistant via Open Code Review. |
|
Good catch to check. I reran this with the exact test setup: Pydantic v2 |
|
|
Fixed the CWD dependency in 7e8769c: both tests now resolve the fixture relative to |
✅ Automated Test Results: PASSEDAll tests passed (4/4 executed). memos_python_core/changed-repo-python: 4/4. Duration: 5s [advisory, non-gating] AI-generated tests on branch test/auto-gen-2d018f7ca2c29a15-20260808102020: 61/61 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
Description
MOSConfig.session_idandGeneralMemCubeConfig.cube_idcurrently calluuid.uuid4()when their modules are loaded. Pydantic then treats those generated strings as static defaults, so separate config instances created in the same process reuse the same identifier.This switches both fields to
default_factory. Explicit IDs and existing serialized configs keep the same behavior; only omitted IDs now get a fresh UUID per instance.No dependencies are added. I couldn't find an existing issue or PR for this, and the contribution guide says small bug fixes can go directly to a PR.
Related Issue (Required): N/A
Type of change
How Has This Been Tested?
Local verification:
uv run --frozen --with 'pytest==8.3.5' pytest tests/configs/ -q— 39 passeduv run --frozen --extra mem-reader --with 'pytest==8.3.5' pytest tests/mem_os/ -q— 36 passed (3 existing Pydantic serialization warnings)uv run --frozen --with 'poetry>=2,<3' --with 'ruff==0.11.13' make format— Ruff passed; 617 files unchangedgit diff --check origin/dev-v2.0.29...HEAD— passedChecklist
@WeiminLee when you have a moment, could you take a look?
Reviewer Checklist