close guardrail gaps and fix the scoring pipeline top to bottom

Constraint resolver: aggregate mass/footprint across a combo instead of
pairwise-only checks, treat medium/atmosphere as agreement not supply/demand,
reduce multi-provider checks by best/sum instead of AND-ing every provider,
fail closed on unrecognized mutex values, add a propulsion-viability
(thrust-to-weight) rule. Seed data updated to match (nuclear/solar-sail
footprint floors, water-medium exclusions, explicit ground/gravity providers).

Domain metric units were stored globally per metric name instead of
per-domain, silently corrupting cost_efficiency for every domain but the
first one seeded — fixed with a schema migration.

Stub estimator's cost_efficiency/safety/availability/reliability were a
backwards formula and flat constants; replaced with heuristics grounded in
each entity's thrust_profile/energy_form/infrastructure.

LLM estimate_physics() now receives each metric's unit and expected range
instead of a bare name, fixing wildly miscalibrated estimates traced back to
the prompt's own hardcoded example anchoring the model to the wrong order of
magnitude. Sharpened the safety-estimation and plausibility-review prompts.
Deduped provider parsing logic into llm/parsing.py.

Web pipeline form can now pick an LLM provider per run instead of only via
server env var.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-26 00:13:16 -05:00
parent 63295ab80e
commit 434df718d7
18 changed files with 836 additions and 175 deletions

View File

@@ -51,6 +51,7 @@ CREATE TABLE IF NOT EXISTS domain_metric_weights (
norm_min REAL,
norm_max REAL,
lower_is_better INTEGER NOT NULL DEFAULT 0,
unit TEXT,
UNIQUE(domain_id, metric_id)
);
@@ -134,6 +135,16 @@ def _migrate(conn: sqlite3.Connection) -> None:
conn.execute(
"ALTER TABLE domain_metric_weights ADD COLUMN lower_is_better INTEGER NOT NULL DEFAULT 0"
)
if "unit" not in cols:
conn.execute("ALTER TABLE domain_metric_weights ADD COLUMN unit TEXT")
# Best-effort backfill from the old (metric-name-global) unit column —
# only correct for domains that happen to agree on that metric's unit.
# Seed data re-applies each domain's real per-domain unit on next load.
conn.execute(
"""UPDATE domain_metric_weights
SET unit = (SELECT m.unit FROM metrics m WHERE m.id = domain_metric_weights.metric_id)
WHERE unit IS NULL"""
)
# Create domain_constraints table if missing (added after initial schema)
tables = {r[0] for r in conn.execute(