feat: Implement Phase 9.78e instance_v2 migration with unified registry

Major achievements:
-  UserDefinedBoxFactory implementation with unified registry integration
-  Constructor execution for user-defined boxes (Person init working)
-  Import path fixes across interpreter modules
-  unwrap_instance helper function for InstanceBox operator support

Technical details:
- Modified UnifiedBoxRegistry to handle empty box_types() factories
- Implemented constructor execution in execute_new for InstanceBox
- Added unwrap_instance helper to handle InstanceBox wrapping in operators
- Updated CURRENT_TASK.md with detailed progress tracking

Next: Fix 4 operator functions to complete InstanceBox operator support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-20 00:21:20 +09:00
parent 5a50cf6415
commit e5e381aa83
9 changed files with 274 additions and 70 deletions

View File

@ -90,10 +90,22 @@ impl UnifiedBoxRegistry {
}
drop(cache);
// Fallback: linear search through all factories
// Linear search through all factories
for factory in &self.factories {
if factory.box_types().contains(&name) && factory.is_available() {
return factory.create_box(name, args);
if !factory.is_available() {
continue;
}
// For factories that advertise types, check if they support this type
let box_types = factory.box_types();
if !box_types.is_empty() && !box_types.contains(&name) {
continue;
}
// Try to create the box (factories with empty box_types() will always be tried)
match factory.create_box(name, args) {
Ok(boxed) => return Ok(boxed),
Err(_) => continue, // Try next factory
}
}