installer v1 (C+D): Windows EXE installer trio + build script + local Hub E2E

This commit is contained in:
gti
2026-09-23 17:44:48 -03:00
parent 91c4030b06
commit a9aded1e49
19 changed files with 792 additions and 16 deletions
+8 -4
View File
@@ -65,7 +65,11 @@ def load_dotenv(path: Path) -> None:
def load_executor():
spec = importlib.util.spec_from_file_location("firebird_write_executor", PROJECT_ROOT / "scripts" / "firebird_write_executor.py")
# The frozen service host has no repo tree; the installer writes
# GTI_WRITE_EXECUTOR_PATH pointing at the extracted executor next to
# agent.env. Falls back to the dev/repo path for source runs.
executor_path = os.environ.get("GTI_WRITE_EXECUTOR_PATH") or (PROJECT_ROOT / "scripts" / "firebird_write_executor.py")
spec = importlib.util.spec_from_file_location("firebird_write_executor", executor_path)
module = importlib.util.module_from_spec(spec)
sys.modules[spec.name] = module
spec.loader.exec_module(module)
@@ -91,7 +95,7 @@ class Config:
self.requested_writes = requested
self.firebird_writes = requested and self.fiscal_mode == "AUTO_APPLY"
self.poll_interval_seconds = float(env.get("POLL_INTERVAL_SECONDS", "5"))
self.agent_version = env.get("AGENT_VERSION", "1.1.0")
self.agent_version = env.get("AGENT_VERSION", "1.1.1")
self.schema_fingerprint = env.get("SCHEMA_FINGERPRINT", REFERENCE_SCHEMA_V1)
self.state_db = env.get("AGENT_STATE_DB", str(AGENT_ROOT / "agent_state.sqlite"))
# Pilot write authorization: both must be explicitly set by the installer for
@@ -192,7 +196,7 @@ def execute_job(job, config, executor, state, env):
result_summary = {
"coverage": coverage,
"fiscal_mode": getattr(config, "fiscal_mode", None),
"release_version": env.get("AGENT_VERSION") or "1.1.0",
"release_version": env.get("AGENT_VERSION") or "1.1.1",
"products_processed": summary["processed"],
"writes_attempted": summary["writes_attempted"],
"writes_succeeded": summary["writes_succeeded"],
@@ -300,7 +304,7 @@ def run(config, env, *, max_iterations=None, stopper=None):
def enforce_startup_preflight(env):
"""Full read-only preflight at startup (Hub, auth, Firebird, capabilities, company context, guards). Fail closed."""
from gti_fiscal_agent.preflight import run_preflight
report = run_preflight(env, agent_version=env.get("AGENT_VERSION") or "1.1.0")
report = run_preflight(env, agent_version=env.get("AGENT_VERSION") or "1.1.1")
logger.info("startup preflight: %s", json.dumps({k: report[k] for k in ("PREFLIGHT", "blockers", "fiscal_mode", "effective_firebird_writes")}, ensure_ascii=False))
print(json.dumps({"PREFLIGHT": report["PREFLIGHT"], "blockers": report["blockers"]}, ensure_ascii=False))
if report["PREFLIGHT"] != "PASS":