Add domain CRUD, energy density constraint, LLM status, reset results, score display fixes

Domain management:
- Add domain list/detail/form templates and full CRUD routes (domains.py)
- Add metric bound add/edit/delete via HTMX partials (_metrics_table.html)

Energy density constraint (Rule 6 in ConstraintResolver):
- Hard-block combos where power source provides <25% of platform's required Wh/kg
- Warn (conditional) when under-density but within 4x
- Solar Sail exempt (no stored energy); Airplane requires 400 Wh/kg, Spaceship 2000 Wh/kg
- Add energy_density_wh_kg provides to all 8 stored-energy power sources in seed data
- 3 new constraint resolver tests

LLM-complete status:
- Pipeline Pass 4 now sets combo status to llm_reviewed after successful LLM review
- update_combination_status guards against downgrading: scored won't overwrite
  llm_reviewed or reviewed; llm_reviewed won't overwrite reviewed
- Add badge-llm_reviewed CSS style (light blue)

Reset results:
- Repository.reset_domain_results() deletes combination_results, combination_scores,
  and pipeline_runs for a domain; pipeline re-evaluates on next run
- POST /results/<domain>/reset route with flash confirmation
- "Reset results" danger button with JS confirm dialog in results list

Fix composite score 0 displaying as --- (Jinja2 falsy 0.0 bug):
- Change `if r.composite_score` to `if r.composite_score is not none`

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 11:13:00 -06:00
parent ee885b2390
commit 8dfe3607b1
20 changed files with 675 additions and 67 deletions

View File

@@ -34,6 +34,7 @@ PLATFORMS: list[Entity] = [
Dependency("force", "force_required_watts", "100000", "watts", "range_min"),
Dependency("infrastructure", "runway", "true", None, "requires"),
Dependency("environment", "medium", "air", None, "requires"),
Dependency("physical", "energy_density_wh_kg", "400", "Wh/kg", "range_min"),
],
),
Entity(
@@ -111,6 +112,7 @@ PLATFORMS: list[Entity] = [
Dependency("force", "force_required_watts", "1000000", "watts", "range_min"),
Dependency("infrastructure", "launch_facility", "true", None, "requires"),
Dependency("environment", "medium", "space", None, "requires"),
Dependency("physical", "energy_density_wh_kg", "2000", "Wh/kg", "range_min"),
],
),
Entity(
@@ -139,6 +141,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("environment", "atmosphere", "standard", None, "requires"),
Dependency("physical", "mass_kg", "50", "kg", "range_min"),
Dependency("force", "thrust_profile", "high_continuous", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "1500", "Wh/kg", "provides"),
],
),
Entity(
@@ -150,6 +153,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("infrastructure", "fuel_infrastructure", "charging_station", None, "requires"),
Dependency("physical", "mass_kg", "10", "kg", "range_min"),
Dependency("force", "thrust_profile", "moderate_continuous", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "200", "Wh/kg", "provides"),
],
),
Entity(
@@ -161,6 +165,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("infrastructure", "fuel_infrastructure", "hydrogen_station", None, "requires"),
Dependency("physical", "mass_kg", "30", "kg", "range_min"),
Dependency("force", "thrust_profile", "high_continuous", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "600", "Wh/kg", "provides"),
],
),
Entity(
@@ -172,6 +177,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("infrastructure", "fuel_infrastructure", "none", None, "requires"),
Dependency("physical", "mass_kg", "0", "kg", "range_min"),
Dependency("force", "thrust_profile", "low_continuous", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "200", "Wh/kg", "provides"),
],
),
Entity(
@@ -184,6 +190,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("physical", "mass_kg", "2000", "kg", "range_min"),
Dependency("force", "thrust_profile", "extreme_continuous", None, "provides"),
Dependency("material", "radiation_shielding", "true", None, "requires"),
Dependency("physical", "energy_density_wh_kg", "500000", "Wh/kg", "provides"),
],
),
Entity(
@@ -196,6 +203,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("environment", "atmosphere", "standard", None, "requires"),
Dependency("physical", "mass_kg", "500", "kg", "range_min"),
Dependency("force", "thrust_profile", "high_continuous", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "400", "Wh/kg", "provides"),
],
),
Entity(
@@ -220,6 +228,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("infrastructure", "fuel_infrastructure", "ammunition", None, "requires"),
Dependency("physical", "mass_kg", "100", "kg", "range_min"),
Dependency("force", "thrust_profile", "high_burst", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "200", "Wh/kg", "provides"),
],
),
Entity(
@@ -232,6 +241,7 @@ POWER_SOURCES: list[Entity] = [
Dependency("physical", "mass_kg", "0", "kg", "range_min"),
Dependency("environment", "ground_surface", "true", None, "requires"),
Dependency("force", "thrust_profile", "low_continuous", None, "provides"),
Dependency("physical", "energy_density_wh_kg", "200", "Wh/kg", "provides"),
],
),
]