|
| 1 | +# ObjectState Documentation Audit |
| 2 | + |
| 3 | +## Summary |
| 4 | +Found **3 critical documentation bugs** in README.md where examples reference non-existent API methods. |
| 5 | + |
| 6 | +## Issues Found |
| 7 | + |
| 8 | +### ❌ Issue 1: `undo()` and `redo()` methods don't exist |
| 9 | +**Location**: README.md lines 124-125 |
| 10 | +**Current (WRONG)**: |
| 11 | +```python |
| 12 | +ObjectStateRegistry.undo() |
| 13 | +ObjectStateRegistry.redo() |
| 14 | +``` |
| 15 | + |
| 16 | +**Actual API**: |
| 17 | +```python |
| 18 | +ObjectStateRegistry.time_travel_back() # Go one step back |
| 19 | +ObjectStateRegistry.time_travel_forward() # Go one step forward |
| 20 | +``` |
| 21 | + |
| 22 | +**Fix**: Replace with correct method names |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +### ❌ Issue 2: `get_branch_history()` returns Snapshot objects, not with `.id` attribute |
| 27 | +**Location**: README.md line 133 |
| 28 | +**Current (CORRECT)**: `history = ObjectStateRegistry.get_branch_history()` |
| 29 | +**But line 134 is WRONG**: |
| 30 | +```python |
| 31 | +ObjectStateRegistry.time_travel_to_snapshot(history[5].id) |
| 32 | +``` |
| 33 | + |
| 34 | +**Actual**: `Snapshot` objects DO have `.id` attribute ✓ (This is correct) |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +### ❌ Issue 3: Missing `atomic()` context manager documentation |
| 39 | +**Location**: README.md lines 128-130 |
| 40 | +**Current**: Shows `atomic()` usage |
| 41 | +**Status**: ✓ CORRECT - `atomic()` method exists and works as documented |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## Additional Findings |
| 46 | + |
| 47 | +### ✓ Correct API Methods (verified in code): |
| 48 | +- `ObjectStateRegistry.register(state)` ✓ |
| 49 | +- `ObjectStateRegistry.unregister(state)` ✓ |
| 50 | +- `ObjectStateRegistry.get_by_scope(scope_id)` ✓ |
| 51 | +- `ObjectStateRegistry.get_all()` ✓ |
| 52 | +- `state.update_parameter(field, value)` ✓ |
| 53 | +- `state.save()` ✓ |
| 54 | +- `state.restore_saved()` ✓ |
| 55 | +- `ObjectStateRegistry.atomic(label)` ✓ |
| 56 | +- `ObjectStateRegistry.get_branch_history()` ✓ |
| 57 | +- `ObjectStateRegistry.time_travel_to_snapshot(id)` ✓ |
| 58 | +- `ObjectStateRegistry.time_travel_to_head()` ✓ |
| 59 | +- `ObjectStateRegistry.create_branch(name, description)` ✓ |
| 60 | +- `ObjectStateRegistry.switch_branch(name)` ✓ |
| 61 | +- `ObjectStateRegistry.list_branches()` ✓ |
| 62 | +- `ObjectStateRegistry.export_history_to_dict()` ✓ |
| 63 | +- `ObjectStateRegistry.import_history_from_dict(data)` ✓ |
| 64 | +- `ObjectStateRegistry.save_history_to_file(path)` ✓ |
| 65 | +- `ObjectStateRegistry.load_history_from_file(path)` ✓ |
| 66 | + |
| 67 | +### ✓ ObjectState class methods (verified): |
| 68 | +- `state.dirty_fields` ✓ |
| 69 | +- `state.save()` ✓ |
| 70 | +- `state.restore_saved()` ✓ |
| 71 | +- `state.update_parameter(field, value)` ✓ |
| 72 | + |
| 73 | +## Recommended Fixes |
| 74 | + |
| 75 | +1. **Replace `undo()`/`redo()` with `time_travel_back()`/`time_travel_forward()`** |
| 76 | +2. **Add note about time-travel semantics** (not traditional undo/redo) |
| 77 | +3. **Consider adding convenience aliases** if backward compatibility needed |
| 78 | + |
| 79 | +## Status |
| 80 | +Ready for implementation |
| 81 | + |
0 commit comments