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.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import typer
|
||||
|
||||
|
||||
def require_server_profile(cfg, command: str) -> None:
|
||||
"""Rifiuta i comandi di scrittura vectordb sul profilo workstation (exit 4).
|
||||
|
||||
Va chiamata subito dopo il caricamento della config e PRIMA di aprire qualunque
|
||||
connessione, cosi' su workstation non si tenta mai la connessione diretta al vectordb.
|
||||
"""
|
||||
if cfg.profile == "workstation":
|
||||
typer.secho(
|
||||
f"ERRORE: `{command}` e' un comando solo-server (scrive nel vectordb centrale). "
|
||||
f"Sulla postazione locale (profile: workstation) il vectordb si LEGGE via REST, "
|
||||
f"non si ricostruisce. Esegui questo comando sul server di produzione "
|
||||
f"(profile: server).",
|
||||
fg=typer.colors.RED, err=True,
|
||||
)
|
||||
raise typer.Exit(code=4)
|
||||
|
||||
|
||||
|
||||
def has_vector_write_rest(cfg) -> bool:
|
||||
return cfg.vector_write_rest is not None and bool(cfg.vector_write_rest.api_key.strip())
|
||||
|
||||
|
||||
def require_vector_write_allowed(cfg, command: str) -> None:
|
||||
"""Permette scritture vectordb da workstation solo con API key REST writer.
|
||||
|
||||
Senza `vector_write_rest`, la workstation resta read-only e i comandi di indexing sono
|
||||
eseguibili solo sul server con connessione diretta al vectordb.
|
||||
"""
|
||||
if cfg.profile == "workstation" and not has_vector_write_rest(cfg):
|
||||
typer.secho(
|
||||
f"ERRORE: `{command}` e' un comando solo-server se manca `vector_write_rest`: "
|
||||
f"scrive nel vectordb centrale. Sulla postazione locale serve la sezione "
|
||||
f"`vector_write_rest` con una API key di upsert; in alternativa esegui il "
|
||||
f"comando sul server di produzione (profile: server).",
|
||||
fg=typer.colors.RED, err=True,
|
||||
)
|
||||
raise typer.Exit(code=4)
|
||||
Reference in New Issue
Block a user