Files
ThothII/harness/tests/test_cli_phase_meta.py
T
marcopan fc5fbe6b65 refactor(harness): renaming prodotto tht (Onda -1)
Thoth (tht) è il prodotto, PSD è il cliente. Nessun riferimento al contesto
clinico nel codice.

Rinomine:
- comando+package nsp→tht (dir nsp/→tht/, 46 import, pyproject entry point)
- gate nsp-gate.js→tht-gate.js (+ rewrite token, relayIfNspFails→relayIfThtFails)
- workspace chirone.{example,test}.yaml→tht.{example,test}.yaml (generici)
- env THOTH_→THT_ (19 var) + NSP_ stragglers (NSP_HARNESS_ROOT, NSP_SESSION)
- commenti/docstring chirone/psdwp3/policlinico neutralizzati ('the reference
  implementation', 'the DWH')

Aggiunto [tool.setuptools.packages.find] include=['tht*'] (necessario: l'auto-
discovery rompeva con tht/ + workspaces/ come top-level multipli).

.env operatore aggiornato in-place (prefissi THT_, valori preservati, gitignored).

Verifica: pytest 109 passed, npm test 14 pass, tht phase meta --json OK, zero
residui nsp/THOTH_/NSP_/chirone nel package.
2026-06-27 10:33:16 +02:00

33 lines
1.1 KiB
Python

"""L1: tht phase meta --json -- the gate reads workflow facts from here (F2).
Kills the JS/Python drift (no mirrored constants): workflow.yaml is the single source.
"""
import json
from typer.testing import CliRunner
from tht.cli import app
runner = CliRunner()
def test_phase_meta_json_returns_workflow_data():
result = runner.invoke(app, ["phase", "meta", "--json"])
assert result.exit_code == 0
data = json.loads(result.stdout)
assert data["max_phase"] == 8
assert len(data["phases"]) == 8
# F8 must be present — this is the exact JS-drift bug (PHASE_NAMES truncated to 7).
assert data["phases"][7]["name"] == "datamart"
assert data["phases"][7]["num"] == 8
assert "advance" in data["phases"][0]
assert "artifacts_out" in data["phases"][0]
def test_phase_meta_each_phase_carries_id_and_name():
result = runner.invoke(app, ["phase", "meta", "--json"])
data = json.loads(result.stdout)
for i, p in enumerate(data["phases"], start=1):
assert p["num"] == i
assert p["id"], f"phase {i} missing id"
assert p["name"], f"phase {i} missing name"