Skip to content

feat: Build Summary card, VEHICLE_THRESHOLDS, matrix cost estimator (#40, #33, #39)#115

Open
sfc-gh-preszke wants to merge 20 commits into
devfrom
feat/sfc-gh-preszke-feat
Open

feat: Build Summary card, VEHICLE_THRESHOLDS, matrix cost estimator (#40, #33, #39)#115
sfc-gh-preszke wants to merge 20 commits into
devfrom
feat/sfc-gh-preszke-feat

Conversation

@sfc-gh-preszke
Copy link
Copy Markdown
Contributor

@sfc-gh-preszke sfc-gh-preszke commented May 14, 2026

Summary

Closes #40, #33, #39.

Build Summary Card (#40)

Replaces the opaque ~95% pin in the Region Builder UI with a structured Build Summary card driven by a regex-based parser over SYSTEM$GET_SERVICE_LOGS.

  • server/logParser.tsparseOrsBuildLogs(logs)BuildSummary (phase, LM step, current variant, ETA, CH progress, memory, warnings)
  • /api/regions/:region/build-progress rewritten with structured summary + phaseLegacy backward compat
  • /api/regions/:region/logs tail endpoint (capped 500, default 100, ANSI-stripped)
  • BuildSummaryCard React component wired into Active Provisioning + Provisioned Regions rows
  • 6 Vitest tests against captured ORS LM-completion fixture

VEHICLE_THRESHOLDS (#33)

Adds a per-vehicle reference table to all 6 skill schemas for vehicle-aware demo pipelines.

  • VEHICLE_THRESHOLDS seeded with car/ebike/hgv/escooter across DWELL_ANALYSIS, ROUTE_DEVIATION, FLEET_INTELLIGENCE_TAXIS, FLEET_INTELLIGENCE_FOOD_DELIVERY, RETAIL_CATCHMENT, ROUTE_OPTIMIZATION
  • Dwell DT_SLA_ALERTS + GEOFENCE_POLYGONS wired to per-vehicle SLA/geofence values via CONFIG.VEHICLE_TYPE
  • Route-deviation: replaces hardcoded 20% threshold with VEHICLE_THRESHOLDS.DEVIATION_PCT
  • Control App: GET /api/fleet-config/thresholds + "Thresholds in use" panel on Live Operations
  • SKILL.md + AGENTS.md updated; cleanup blocks drop VEHICLE_THRESHOLDS

Matrix Cost Estimator (#39)

Calibration-backed pre-flight cost estimation for H3 matrix builds.

  • ESTIMATE_MATRIX_COST proc returns cell count, matrix rows, WH/SPCS credits, duration, confidence for road_filter ON and OFF
  • MATRIX_COST_CALIBRATION table with formula-derived seeds for res 5–10 across 4 profiles
  • REFRESH_MATRIX_COST_CALIBRATION proc + nightly task fits coefficients from build history
  • MatrixBuilder UI: "Estimate cost" button, side-by-side ON/OFF cards, red/yellow/green threshold gating (>25 credits or >100M pairs requires acknowledgement)
  • Validated: NewYork RES8 RF=ON within +0.5% cells / +1.1% pairs; Poland RES5 RF=OFF within −9% cells

Deploy

Image bumped to v1.0.180 and pushed; ors_control_app_service.yaml updated; service SUSPEND → FROM @stage → RESUME. Live at:
https://er3bf4-pm-fleet.snowflakecomputing.app

Test plan

  • npx vitest run tests/logParser.test.ts → 6/6 passing
  • npx tsc -b clean
  • npx tsc -p tsconfig.server.json --noEmit clean
  • npm run build clean
  • Image v1.0.180 built linux/amd64 + pushed
  • Service spec updated and resumed (RUNNING)
  • Matrix cost estimator: NewYork RES8 estimates validated against actuals
  • VEHICLE_THRESHOLDS seeded in all 6 schemas
  • /api/fleet-config/thresholds returns thresholds for active vehicle type
  • Manual: trigger fresh small-region provision and observe Build Summary transitions
  • Manual: verify Live Operations "Thresholds in use" panel reflects CONFIG.VEHICLE_TYPE changes

.... Generated with Cortex Code

Replace hardcoded branch names with feat/<GITHUB_LOGIN>-feat pattern,
detected at session start via 'gh api user --jq .login'.
…+ tests (#40)

Adds server/logParser.ts which parses ORS service log tails into a
structured BuildSummary (phase, LM N/4, current variant, ETA, CH
progress, memory, warnings). Pure regex, never throws — falls back to
{phase:'unknown', progress:0} on any error. Foundation for the new
Build Summary card in Region Builder.
…uctured summary (#40)

Replaces the ad-hoc log scrape in /api/regions/:region/build-progress
with parseOrsBuildLogs(). The endpoint now returns the full BuildSummary
shape (phase, lm.stepIndex, lm.etaMs, ch.fractionDone, memory, warnings)
plus a phaseLegacy alias so the existing UI keeps working until the new
BuildSummaryCard component lands.
…oint (#40)

New on-demand endpoint for the BuildSummaryCard 'Show recent logs'
disclosure. Tail capped at 500 lines, default 100. Strips ANSI escape
codes before returning. Kept separate from build-progress so the 5s
poll path stays cheap.
…#40)

New React component renders the structured BuildSummary returned by
/api/regions/:region/build-progress: phase label, LM step badge, memory
pressure badge, progress bar, elapsed/ETA, profile chips, and an
on-demand log tail (fetched only when the user expands). Reuses the
existing progress-bar classes; adds .build-summary-* styles.
#40)

Replaces the inline progress block in the Active Provisioning Jobs row
with the new BuildSummaryCard, and renders the same card under each
Provisioned Region row when a build is still in flight (service up,
graphs not yet ready). Tightens the buildProgress state type to the
imported BuildSummary shape.
….179 (#40)

Ships the Build Summary card (parseOrsBuildLogs, enriched
build-progress, /logs tail endpoint, BuildSummaryCard component, and
RegionBuilder wiring) to the deployed control app.
…#33)

- Add VEHICLE_THRESHOLDS reference table seeded with car/ebike/hgv/escooter
  in all 6 skill schemas (DWELL_ANALYSIS, ROUTE_DEVIATION, FLEET_INTELLIGENCE_TAXIS,
  FLEET_INTELLIGENCE_FOOD_DELIVERY, RETAIL_CATCHMENT, ROUTE_OPTIMIZATION).
- Wire dwell DT_SLA_ALERTS and GEOFENCE_POLYGONS to per-vehicle SLA / geofence
  values via active CONFIG.VEHICLE_TYPE; fall back to legacy defaults.
- Replace hardcoded 20% deviation threshold in route-deviation with lookup
  against VEHICLE_THRESHOLDS.DEVIATION_PCT (LOCATION_TYPE='*').
- Control App: add GET /api/fleet-config/thresholds and surface a "Thresholds
  in use" panel on Live Operations; remove hardcoded 30 min SLA.
- Document the pattern in dwell-analysis/route-deviation SKILL.md and AGENTS.md;
  extend cleanup blocks to drop VEHICLE_THRESHOLDS.

Note: ors_control_app image rebuild is required to surface the new endpoint
and panel; deferred to a separate ops change.
Adds calibration-backed pre-flight cost estimation:

- ESTIMATE_MATRIX_COST proc returns cell count, matrix rows, WH credits,
  SPCS credits, duration, and confidence for BOTH road_filter ON and OFF
- MATRIX_COST_CALIBRATION table with formula-derived seeds for res 5-10
  across driving-car, driving-hgv, cycling-regular, foot-walking
- REFRESH_MATRIX_COST_CALIBRATION proc + nightly task fits coefficients
  from MATRIX_BUILD_JOBS history
- MatrixBuilder UI: "Estimate cost" button, side-by-side ON/OFF cards,
  red/yellow/green threshold gating (>25 credits or >100M pairs requires
  explicit acknowledgement)
- Validation: NewYork RES8 RF=ON predicted within +0.5% cells / +1.1%
  pairs of actuals; Poland RES5 RF=OFF within -9% cells
….180 (#33)

Includes the new GET /api/fleet-config/thresholds endpoint and the
"Thresholds in use" Live Operations panel that consume VEHICLE_THRESHOLDS.
@sfc-gh-preszke sfc-gh-preszke changed the title feat(build-routing-solution): Build Summary card with live ORS log diagnostics (#40) feat: Build Summary card, VEHICLE_THRESHOLDS, matrix cost estimator (#40, #33, #39) May 14, 2026
- Replace single-branch rule with two long-lived branches per user:
  feat/<login>-feat (dev) and feat/<login>-test (test/verification)
- Each branch lives in its own clone on disk; no branch switching inside a clone
- PRs into dev now originate from feat/<login>-test only
- Add Sync Between Branches section with 5 named on-demand operations
  (promote dev->test, promote test->dev, cherry-pick both directions, status)
- Add Connection Binding section: shared ~/.snowflake/connections.toml +
  per-clone .env exporting SNOWFLAKE_CONNECTION_NAME and CORTEX_BRANCH_ROLE
- Update Do NOT bullets for new model
- Add Account/Env field to friction-log and skill-execution-log templates
- New docs/dev/two-clone-setup.md one-time setup guide
…IONS (#45)

LIST_REGIONS() previously returned only regions provisioned via
PROVISION_REGION_WRAPPER (which inserts into REGION_ORS_MAP). The default
SanFrancisco region ships via openrouteservice.yaml at install time and
never flowed through that path, so it was hidden from the API.

- 03_region_management.sql: seed REGION_ORS_MAP with the default
  SanFrancisco row immediately after its DDL. Idempotent MERGE preserves
  any user edits across module re-runs. PBF_URL/COMPUTE_SIZE/INSTANCE_FAMILY
  left NULL since the default PBF ships pre-staged and compute is configured
  via openrouteservice.yaml.
- LIST_REGIONS(): add is_default field so SQL/CLI consumers can distinguish
  the built-in region from user-provisioned ones.
- server/index.ts: filter the seeded SanFrancisco row from the per-region
  enrichment loops in /api/regions/provisioned, /api/matrix/regions, and
  /api/regions to preserve the synthetic 'default'/IS_DEFAULT=true contract
  the React clients (FunctionTester, ServiceManager, RegionBuilder,
  MatrixBuilder, MatrixViewer) depend on.
- available-functions.md: document new is_default field and that the built-in
  default region is now returned.
Adds OPENROUTESERVICE_APP.CORE.VERSION_INFO DDL to 01_core_infra.sql
(before any CREATE SERVICE so the ors_control_app /api/health poll
never compiles against a missing object) and a Step 6 sub-step that
seeds 4 rows (openrouteservice, vroom, routing_gateway, ors_control_app)
from image-versions.env via a heredoc'd snow sql -q MERGE. Includes a
backfill snippet for environments already deployed.

Verified on dev account: table created, 4 rows seeded with current
image tags, COMMENT tag picked up by routing-solution-cleanup.

Closes #57.
…89)

The inventory regex at server/index.ts:1816 was missing CYCLING_MOUNTAIN
even though it is a supported routing profile (validated at line 1079
and present in VIEWER_PROFILE_PATTERNS at line 1885). Without this entry,
any *_CYCLING_MOUNTAIN_MATRIX_RES* table was silently dropped from the
Matrix Inventory.
Even though the server now emits ISO-formatted timestamps, the client
timeAgo function had no protection against new Date() returning Invalid
Date (e.g. empty string slipping past truthy check, or stale cached
non-ISO values). Add Number.isNaN(d.getTime()) guard and a negative-secs
guard (clock skew); both return em-dash to match existing rendering.
…JOBS (#89)

The Matrix Inventory's "Build Time" column was always rendered as em-dash
because execution_time_secs was hardcoded to 0 in the inventory endpoint
mapper. LEFT JOIN MATRIX_BUILD_JOBS (latest COMPLETE job per
region/profile/resolution) and project DATEDIFF(STARTED_AT, COMPLETED_AT)
as EXECUTION_TIME_SECS so the UI can show real build durations.
Cancelling a matrix build previously left four orphan tables behind
(_LIST_, _WORK_QUEUE_, _MATRIX_RAW_, _MATRIX_) created by
ENSURE_MATRIX_TABLES at build start. The empty _MATRIX_ table was
masked from the inventory only by the ROW_COUNT > 0 filter; the rest
polluted INFORMATION_SCHEMA.

Drop the four tables in /api/matrix/cancel AFTER the statement_handle
has been awaited via cancelStatement, so the DROP cannot race the
in-flight async INSERT. Cleanup intentionally lives in the Express
endpoint, not in CANCEL_MATRIX_BUILD, because the SQL proc returns
before the statement is actually cancelled. The MATRIX_BUILD_JOBS row
is preserved (status CANCELLED) for history; only the data tables are
removed.
Includes fixes for:
- CYCLING_MOUNTAIN profile in matrix inventory regex
- timeAgo NaN guard
- execution_time_secs populated from MATRIX_BUILD_JOBS
- orphan sibling tables dropped on matrix cancel
Image v1.0.181 includes the SanFrancisco-row dedup logic in /api/regions,
/api/regions/provisioned, and /api/matrix/regions paired with the SQL fix
in commit e3adb63 (LIST_REGIONS now returns the default SanFrancisco row).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant