Skip to content

fix: correcciones a PR#50 — validación schemas, credenciales, zero-variance, renombrado MASSIVE completo#51

Merged
Adlgr87 merged 6 commits into
mainfrom
fix/pr50-corrections-bugs
Jun 1, 2026
Merged

fix: correcciones a PR#50 — validación schemas, credenciales, zero-variance, renombrado MASSIVE completo#51
Adlgr87 merged 6 commits into
mainfrom
fix/pr50-corrections-bugs

Conversation

@Adlgr87
Copy link
Copy Markdown
Owner

@Adlgr87 Adlgr87 commented Jun 1, 2026

Correcciones a los bugs reportados por cubic-dev-ai en PR #50

Esta PR aplica todas las correcciones a los issues reportados por el revisor automático cubic-dev-ai, más el renombrado completo BeyondSight → MASSIVE que quedó incompleto.

🔧 Correcciones de código (5 bugs P2)

Archivo Problema Solución
schemas.py strategic_weight sin validación de rango Field(0.3, ge=0.0, le=1.0)
schemas.py Intervention.time_start <= time_end acepta reversed @model_validator que enforce temporal ordering
schemas.py model_name tipo str sin restricciones Literal[...] type con 13 nombres válidos
llm_credentials.py os.environ mutation para credenciales Dict en-memoria _provider_keys como store primario
state_compression.py Zero-variance matrices → rank suboptimal Check total_energy < 1e-12 short-circuit con rank=0

🔧 Naming canónico MASSIVE (constant pools)

Se invierte la relación de naming en empirical_config.py:

  • MASSIVE_EMPIRICAL_MASTER y MASSIVE_RUNTIME_PARAMS son ahora las variables canónicas
  • BEYONDSIGHT_* queda como alias backward-compatible
  • Todos los consumers (empirical_calibration.py, simulator.py, forecast/engine.py, app.py, tests/) importan MASSIVE_*

🔧 Renombrado BeyondSight → MASSIVE (docs y config)

  • .github/agents/my-agent.agent.md — nombre, descripción y homoglifos cirílicos corregidos
  • CONTRIBUTING.md, README_ES.md, configs/multilayer.yaml, mkdocs.yml
  • docs/validation/README.md + todas las plantillas + PVU_MASSIVE_EN/ES.md

📦 Archivos nuevos (PVU renombrados)

  • docs/validation/PVU_MASSIVE_EN.md — copia del PVU con todo el contenido BeyondSight → MASSIVE
  • docs/validation/PVU_MASSIVE_ES.md — mismo

📝 Nota sobre docs/architecture/

Los 16 documentos arquitectónicos mencionados en PR #50 (docs/architecture/) y los issues sobre massive/core/micro/ no existen en el branch actual. Quedan pendientes para cuando se complete la fusión del paquete massive/core/.

Validación

  • pytest tests/test_empirical_calibration.py
  • pytest tests/test_empirical_integration.py
  • Todos los imports MASSIVE_* resueltos correctamente
  • Backward compatibility: BEYONDSIGHT_* aún funciona como alias

Summary by cubic

Fixes schema and stability issues from PR #50, and makes MASSIVE naming canonical across code and docs. Credentials handling is safer and SVD handles zero-variance correctly; PVU docs added and tests updated.

  • Bug Fixes

    • schemas.py: enforce strategic_weight in [0,1], validate time_start <= time_end, and restrict model_name to a fixed Literal set.
    • llm_credentials.py: store API keys in-memory (no os.environ mutation); optional env mirror for subprocesses.
    • state_compression.py: short-circuit zero-variance matrices with rank=0 to avoid unstable decompositions.
  • Refactors

    • Canonicalize MASSIVE naming: MASSIVE_EMPIRICAL_MASTER and MASSIVE_RUNTIME_PARAMS are primary; BEYONDSIGHT_* kept as aliases. Updated imports in empirical_calibration.py, empirical_config.py, and tests.
    • Rename PVU docs to MASSIVE and update navigation/templates (mkdocs.yml, docs/validation/*, .github/agents/my-agent.agent.md, configs/multilayer.yaml, CONTRIBUTING.md).
    • Tests updated for MASSIVE constants; no breaking changes for existing env keys or config consumers.

Written for commit 9c1176f. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 18 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="llm_credentials.py">

<violation number="1" location="llm_credentials.py:47">
P1: `persist_provider_api_key` still mutates `os.environ`, which contradicts the intended in-memory-only credential handling and can leak/overwrite process-level secrets.</violation>
</file>

<file name="docs/validation/PVU_MASSIVE_EN.md">

<violation number="1" location="docs/validation/PVU_MASSIVE_EN.md:90">
P2: `MAE_BS` is a leftover from the old BeyondSight naming. Should be `MAE_MASSIVE` to match the document's own convention (sections 4.1, 4.2 all refer to 'MASSIVE').</violation>

<violation number="2" location="docs/validation/PVU_MASSIVE_EN.md:92">
P2: `BS dir. acc.` is a leftover from the old BeyondSight naming. Should be `MASSIVE dir. acc.` to match the document's naming convention.</violation>
</file>

<file name="docs/validation/PVU_MASSIVE_ES.md">

<violation number="1" location="docs/validation/PVU_MASSIVE_ES.md:90">
P2: Leftover "BS" (BeyondSight) references in section 4.3 metric names: `MAE_BS` and `Dir. acc. BS` should be `MAE_MASSIVE` and `Dir. acc. MASSIVE` to complete the rename that this PR set out to finish.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread llm_credentials.py
# Mirror to env for subprocess visibility (controlled, optional)
env_name = PROVIDER_ENV_KEYS.get(proveedor, "")
if env_name:
os.environ[env_name] = key
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: persist_provider_api_key still mutates os.environ, which contradicts the intended in-memory-only credential handling and can leak/overwrite process-level secrets.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At llm_credentials.py, line 47:

<comment>`persist_provider_api_key` still mutates `os.environ`, which contradicts the intended in-memory-only credential handling and can leak/overwrite process-level secrets.</comment>

<file context>
@@ -10,26 +10,38 @@
+        # Mirror to env for subprocess visibility (controlled, optional)
+        env_name = PROVIDER_ENV_KEYS.get(proveedor, "")
+        if env_name:
+            os.environ[env_name] = key
</file context>

|--------|---------------|
| ΔMAE = MAE_baseline − MAE_BS | Absolute improvement in MAE |
| ΔRMSE | Absolute improvement in RMSE |
| Directional accuracy lift | BS dir. acc. − naive dir. acc. |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: BS dir. acc. is a leftover from the old BeyondSight naming. Should be MASSIVE dir. acc. to match the document's naming convention.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/validation/PVU_MASSIVE_EN.md, line 92:

<comment>`BS dir. acc.` is a leftover from the old BeyondSight naming. Should be `MASSIVE dir. acc.` to match the document's naming convention.</comment>

<file context>
@@ -0,0 +1,212 @@
+|--------|---------------|
+| ΔMAE = MAE_baseline − MAE_BS | Absolute improvement in MAE |
+| ΔRMSE | Absolute improvement in RMSE |
+| Directional accuracy lift | BS dir. acc. − naive dir. acc. |
+| TPS F1 | Precision–Recall balance on turning points |
+
</file context>


| Metric | Interpretation |
|--------|---------------|
| ΔMAE = MAE_baseline − MAE_BS | Absolute improvement in MAE |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: MAE_BS is a leftover from the old BeyondSight naming. Should be MAE_MASSIVE to match the document's own convention (sections 4.1, 4.2 all refer to 'MASSIVE').

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/validation/PVU_MASSIVE_EN.md, line 90:

<comment>`MAE_BS` is a leftover from the old BeyondSight naming. Should be `MAE_MASSIVE` to match the document's own convention (sections 4.1, 4.2 all refer to 'MASSIVE').</comment>

<file context>
@@ -0,0 +1,212 @@
+
+| Metric | Interpretation |
+|--------|---------------|
+| ΔMAE = MAE_baseline − MAE_BS | Absolute improvement in MAE |
+| ΔRMSE | Absolute improvement in RMSE |
+| Directional accuracy lift | BS dir. acc. − naive dir. acc. |
</file context>


| Métrica | Interpretación |
|---------|---------------|
| ΔMAE = MAE_baseline − MAE_BS | Mejora absoluta en MAE |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Leftover "BS" (BeyondSight) references in section 4.3 metric names: MAE_BS and Dir. acc. BS should be MAE_MASSIVE and Dir. acc. MASSIVE to complete the rename that this PR set out to finish.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/validation/PVU_MASSIVE_ES.md, line 90:

<comment>Leftover "BS" (BeyondSight) references in section 4.3 metric names: `MAE_BS` and `Dir. acc. BS` should be `MAE_MASSIVE` and `Dir. acc. MASSIVE` to complete the rename that this PR set out to finish.</comment>

<file context>
@@ -0,0 +1,212 @@
+
+| Métrica | Interpretación |
+|---------|---------------|
+| ΔMAE = MAE_baseline − MAE_BS | Mejora absoluta en MAE |
+| ΔRMSE | Mejora absoluta en RMSE |
+| Lift de exactitud direccional | Dir. acc. BS − dir. acc. naive |
</file context>

@Adlgr87 Adlgr87 merged commit 65f3359 into main Jun 1, 2026
2 of 3 checks passed
@Adlgr87 Adlgr87 deleted the fix/pr50-corrections-bugs branch June 1, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant