fix: preserve standalone WanGP API bootstrap - #35
Merged
Conversation
PR Review — Loreframe StudioRisk: low Automated review from Findings
Changed files
CONTRIBUTING checklist
Posted by the repo PR review workflow. Re-runs on each push to the PR. |
Owner
Author
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b44b516. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
El muro WanGP del PR #31 reutiliza correctamente la instancia cargada por HocusPocus, pero dejó sin bootstrap a la API Python documentada. En un proceso externo,
shared.api.init()encontraba el muro sin enlazar y fallaba antes de poder importar WanGP.Solución
services/generation/bootstrap.pycomo segundo y único bootstrap explícito, reservado ashared.api.init().sys.modules["wgp"]cuando ya existe.bind_wgpidempotente para la misma instancia y rechaza una segunda instancia.get_wgp, sin imports implícitos.Tests
1559 passed, 22 warnings.30 passed.compileall: OK.verify_clean_repo: PASS.check_documentation_links: PASS.check_brand_contract: PASS.check_dependency_contract: PASS.scripts/architecture_contracts.py: PASS.Cobertura añadida
sys.modules;shared.api.init()con módulo falso.Alcance
PR independiente del router Recipes. No modifica
_launch_runtime.py, UI, rutas HTTP, vendor WanGP ni archivos de generación del usuario.Note
Medium Risk
Touches the singleton WanGP runtime boundary and the only non-launch
wgpimport path; mistakes could break standalone integrations or double-bind runtimes, but behavior is heavily gated and tested.Overview
Restores the documented standalone Python API after the WanGP “wall” left
shared.api.init()unable to import and bindwgpin external processes.Adds
services/generation/bootstrap.pywithget_or_bootstrap_wgp: reuses an already-bound instance orsys.modules["wgp"], otherwise performs the single allowedimportlibload, verifies the module root matchesinit(root=...), and binds that exact singleton.shared.apiruntime setup now delegates to this helper instead of inline bind logic.bind_wgp/get_wgpgain locking, rejectNoneand a second distinct runtime, and point unbound callers at launch orshared.api.init(). Architecture docs, API.md, andtest_architecture_contractstreat bootstrap as the second explicit allowlistedwgpimport beside_launch_runtime.py. New tests cover singleton reuse, root mismatch, failed imports, and end-to-endinit()without launch.Reviewed by Cursor Bugbot for commit b44b516. Configure here.