Verify PersonalityLearner instantiation works correctly after AdaptationRate import fix. Tests confirm no NameError occurs. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
101 lines
4.6 KiB
Markdown
101 lines
4.6 KiB
Markdown
---
|
|
wave: 1
|
|
depends_on: []
|
|
files_modified:
|
|
- src/memory/__init__.py
|
|
autonomous: false
|
|
---
|
|
|
|
# Gap Closure Plan 1: Fix PersonalityLearner Initialization
|
|
|
|
**Objective:** Fix the missing `AdaptationRate` import that breaks PersonalityLearner initialization and blocks the personality learning pipeline.
|
|
|
|
**Gap Description:** PersonalityLearner.__init__() on line 56 of src/memory/__init__.py attempts to use `AdaptationRate` to configure learning rate, but this enum is not imported in the module. This causes a NameError when creating a PersonalityLearner instance, which blocks the entire personality learning system.
|
|
|
|
**Root Cause:** The `AdaptationRate` enum is defined in `src/memory/personality/adaptation.py` but not imported at the top of `src/memory/__init__.py`.
|
|
|
|
## Tasks
|
|
|
|
```xml
|
|
<task name="add-missing-import" id="1">
|
|
<objective>Add AdaptationRate import to src/memory/__init__.py</objective>
|
|
<context>PersonalityLearner.__init__() uses AdaptationRate on line 56 to convert the learning_rate string config to an AdaptationRate enum. Without this import, instantiation fails with NameError. This is a blocking issue for all personality learning functionality.</context>
|
|
<action>
|
|
1. Open src/memory/__init__.py
|
|
2. Locate line 23: from .personality.adaptation import PersonalityAdaptation, AdaptationConfig
|
|
3. Change to: from .personality.adaptation import PersonalityAdaptation, AdaptationConfig, AdaptationRate
|
|
4. Save file
|
|
</action>
|
|
<verify>
|
|
python3 -c "from src.memory import PersonalityLearner; pl = PersonalityLearner(None)"
|
|
</verify>
|
|
<done>
|
|
- AdaptationRate appears in import statement on line 23
|
|
- Import statement includes: PersonalityAdaptation, AdaptationConfig, AdaptationRate
|
|
- PersonalityLearner(None) completes without NameError
|
|
- No syntax errors in src/memory/__init__.py
|
|
</done>
|
|
</task>
|
|
|
|
<task name="verify-import-chain" id="2">
|
|
<objective>Verify all imports in adaptation module are properly exported</objective>
|
|
<context>Ensure AdaptationRate is exported from the adaptation module so it can be imported in __init__.py. Verify the __all__ list at the end of __init__.py includes AdaptationRate.</context>
|
|
<action>
|
|
1. Open src/memory/personality/adaptation.py and verify AdaptationRate class exists (lines 27-32)
|
|
2. Open src/memory/__init__.py and locate __all__ list (around lines 858-876)
|
|
3. If AdaptationRate is not in __all__, add it to the list
|
|
4. Save src/memory/__init__.py
|
|
</action>
|
|
<verify>
|
|
python3 -c "from src.memory import AdaptationRate; print(AdaptationRate)"
|
|
</verify>
|
|
<done>
|
|
- AdaptationRate class exists in src/memory/personality/adaptation.py
|
|
- AdaptationRate appears in __all__ list in src/memory/__init__.py
|
|
- AdaptationRate can be imported directly from src.memory module
|
|
- No import errors
|
|
</done>
|
|
</task>
|
|
|
|
<task name="test-personality-learner-init" id="3">
|
|
<objective>Test PersonalityLearner initialization</objective>
|
|
<context>Verify that PersonalityLearner can now be properly instantiated without config, which will verify that the AdaptationRate import fix unblocks the class initialization.</context>
|
|
<action>
|
|
1. Run test: python3 -c "from src.memory import PersonalityLearner; pl = PersonalityLearner(None); print('PersonalityLearner initialized successfully')"
|
|
2. Verify output shows successful initialization
|
|
3. Verify no NameError or AttributeError exceptions
|
|
</action>
|
|
<verify>
|
|
python3 -c "from src.memory import PersonalityLearner; pl = PersonalityLearner(None); assert pl is not None"
|
|
</verify>
|
|
<done>
|
|
- PersonalityLearner can be instantiated with no config
|
|
- PersonalityLearner(None) completes without NameError
|
|
- PersonalityLearner instance is created and ready for use
|
|
- No errors logged during initialization
|
|
</done>
|
|
</task>
|
|
```
|
|
|
|
## Implementation Details
|
|
|
|
**Change Required:**
|
|
- Add import in src/memory/__init__.py line 23 (after `from .personality.adaptation import PersonalityAdaptation, AdaptationConfig`):
|
|
```python
|
|
from .personality.adaptation import PersonalityAdaptation, AdaptationConfig, AdaptationRate
|
|
```
|
|
|
|
**Verification:**
|
|
- PersonalityLearner(None) creates successfully with no config
|
|
- No NameError when accessing AdaptationRate in PersonalityLearner.__init__
|
|
- Personality learner can be instantiated and used
|
|
|
|
## Must-Haves for Verification
|
|
|
|
- [ ] AdaptationRate is imported from adaptation module in __init__.py
|
|
- [ ] Import statement appears on line 23 (or nearby import block)
|
|
- [ ] AdaptationRate is in __all__ export list
|
|
- [ ] PersonalityLearner can be instantiated without NameError
|
|
- [ ] PersonalityLearner(None) completes successfully
|
|
- [ ] No new errors introduced in existing tests
|