BOHICA-LABS / BOHICA-LABS/vsdd-factory

enhancement(stub-architect): warn when planned class_name collides with autoload-eligible singleton name (Godot 4)

Open
#282 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2
Forks
1
Avg merge
6h 43m
Merged PRs (30d)
29

Description

## Summary

Godot 4 raises a hard parse error when a script declares `class_name X` AND is registered as an autoload with the singleton name `X`. The error surfaces only at runtime / scene-load time, not at lint time, and the agent-pipeline trail is:

1. `stub-architect` creates a new script with `class_name SingletonCandidate extends Node` (intuitive — class is named, autoload-friendly).
2. Implementer (subsequent dispatch) decides to register the script as an autoload to wire it into production (per BC requirements).
3. Implementer adds the autoload entry in `project.godot` and tries to launch tests.
4. Godot fails with: `class_name 'X' is already a registered singleton (autoload)` or similar.
5. Implementer has to make a corrective commit removing `class_name`.

Observed twice in this session. The pattern is predictable: stub-architect can't know in advance whether the consumer will register the class as an autoload, but for stories that involve scene orchestration / global flow controllers, the autoload outcome is highly likely.

## Suggested mitigation

Option A — stub-architect agent prompt update: For Godot projects, when generating a script whose responsibilities look singleton-like (global flow controllers, manager-pattern classes, EventBus-style hubs), DEFAULT to NOT declaring `class_name`. Add a code comment explaining: "no class_name — autoload candidate; would collide with the singleton registration."

Option B — orchestrator brief should call this out upfront when dispatching stub-architect for any story that has autoload-candidate responsibilities. The brief currently doesn't anticipate the autoload outcome.

Option C — a static check that warns when `project.godot` adds an autoload whose name matches an existing `class_name`. This catches the collision at the autoload-registration step rather than at scene-load.

## Related

- #266 (per-story-delivery Rust-idiom hardcoding) — sibling about Godot-specific gotchas not flagged in the canonical workflow
- #268 (stub-architect parser-not-just-lint) — sibling about stub-architect failure modes

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.