Skip to content

test(office): cover /api/eco proxy serving upstream data (DL-17a7) - #102

Merged
Icaro0310 merged 2 commits into
mainfrom
dl-17a7-office-eco-panel
Nov 9, 2026
Merged

Icaro0310 merged 2 commits into
mainfrom
dl-17a7-office-eco-panel

Conversation

@Icaro0310

@Icaro0310 Icaro0310 commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

DL-17a7 — Office eco panel

Diagnóstico

O painel eco do devin-office (#eco no index.html) já está operacional na VM. A cadeia completa funciona:

  1. devin-office daemon no laptop coleta via ecomon.collect_eco() → serve /api/eco-raw na :8788
  2. devin-vm-rtunnel.service faz -R 8788:localhost:8788 → VM alcança o daemon no loopback (sshd escutando :8788)
  3. OFFICE_ECO_URL=http://127.0.0.1:8788/api/eco-raw no env PM2 do devin-office → hub.py faz proxy em /api/eco
  4. Frontend faz fetch("/api/eco") → applyEco(data?.eco) → renderEcoPanel + toolRows (arms do canvas)

Verificado ao vivo na VM: GET http://127.0.0.1:8790/api/eco retorna {"eco": {"icaro-hpelitebookfolio1040g3": {probes, tools, units, meta}}, "office": {...}} com probe.live=true. Screenshot do painel renderizado com dados reais anexado na sessão.

O gap real

A missão DL-17a7 (backlog de antes do fix de 2026-11-06) reportava "nada serve esse endpoint" — resolvido na época pelo rtunnel+daemon. O que faltava era cobertura de teste: test_hub.py só assertava o caso disabled (ECO_URL vazio → eco=None). Nenhum teste travava a regressão do proxy funcionando.

O que este PR adiciona

  • test_ecosystem_proxy_returns_upstream_data — sobe um servidor HTTP upstream real servindo um payload eco, aponta OFFICE_ECO_URL para ele, e assert que GET /api/eco retorna esse payload sob a chave "eco" junto ao office state. Teste de integração do caminho real (não mock interno).
  • test_ecosystem_proxy_reports_unreachable_upstream — fallback quando o upstream está fora: eco = {"error": "ecosystem API unreachable"}.
  • Helper _eco_upstream(payload) — ThreadingHTTPServer que serve JSON fixo (substituto do daemon /api/eco-raw).

Testes

packages/office: 63 passed (test_hub.py: 7/7)

Sem mudança de código de produção — só testes. Deploy VM não afetado (hub.py/index.html já corretos e divergentes de propósito: flat vs devin_office.*).


Devin Review

The eco side panel was reported empty, but the live chain works:
office daemon /api/eco-raw -> rtunnel :8788 -> OFFICE_ECO_URL ->
hub /api/eco -> #eco panel. The only gap was coverage: test_hub.py
only asserted the disabled case (ECO_URL unset).

Add an integration test that stands up a real upstream HTTP server
serving an eco payload, points OFFICE_ECO_URL at it, and asserts
GET /api/eco returns that payload under the "eco" key alongside
the office state. Plus a fallback test for an unreachable upstream.

Generated with [Devin](https://devin.ai) & QA Engineer Icaro Galvao

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Static scan (advisory) — result: EXECUTED

Deterministic scan of 1 changed file(s) — gitleaks 8.30.1 · semgrep 1.182.1 · ruff 0.17.3. Findings are advisory evidence for the judge, not a lane verdict.

gitleaks — 0 finding(s)

semgrep — 0 finding(s)

ruff (E9,F,S) — 6 finding(s)

  • packages/office/tests/test_hub.py:38 S104 — Possible binding to all interfaces
  • packages/office/tests/test_hub.py:41 S104 — Possible binding to all interfaces
  • packages/office/tests/test_hub.py:51 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.
  • packages/office/tests/test_hub.py:54 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.
  • packages/office/tests/test_hub.py:61 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.
  • packages/office/tests/test_hub.py:105 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment thread packages/office/tests/test_hub.py Resolved
@Icaro0310

Copy link
Copy Markdown
Owner Author

devin-judge (ACP, high model): approve — {"samples": 1, "blocks": 0, "probs": [{"secrets": 0.02, "unsafe_code": 0.04, "deception": 0.03}]}

Addresses Devin Review finding: CONTRIBUTING.md requires a CHANGELOG
entry for every PR.

Generated with [Devin](https://devin.ai) & QA Engineer Icaro Galvao

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Static scan (advisory) — result: EXECUTED

Deterministic scan of 2 changed file(s) — gitleaks 8.30.1 · semgrep 1.182.1 · ruff 0.17.3. Findings are advisory evidence for the judge, not a lane verdict.

gitleaks — 0 finding(s)

semgrep — 0 finding(s)

ruff (E9,F,S) — 6 finding(s)

  • packages/office/tests/test_hub.py:38 S104 — Possible binding to all interfaces
  • packages/office/tests/test_hub.py:41 S104 — Possible binding to all interfaces
  • packages/office/tests/test_hub.py:51 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.
  • packages/office/tests/test_hub.py:54 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.
  • packages/office/tests/test_hub.py:61 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.
  • packages/office/tests/test_hub.py:105 S310 — Audit URL open for permitted schemes. Allowing use of file: or custom schemes is often unexpected.

@Icaro0310

Copy link
Copy Markdown
Owner Author

devin-judge (ACP, high model): approve — {"samples": 1, "blocks": 0, "probs": [{"secrets": 0.03, "unsafe_code": 0.08, "deception": 0.04}]}

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

gate-resolved-via: fallback — 1 blocking thread(s) cleared by replies citing verified fix commits, with the Devin Review status on 85a0c46 re-verified clean:

  • thread PRRT_kwDOUzxHgc61SyHb via commit 85a0c46

Threads left unresolved — the findings stay visible.
gate-fallback-pairs: PRRT_kwDOUzxHgc61SyHb|commit:85a0c46 head:85a0c460f7d7cff171656f4f74d13efcfff4559d

@Icaro0310
Icaro0310 merged commit 1eed463 into main Nov 9, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant