Skip to content

Refine case-hash grouping semantics and analysis UI#157

Open
tomvothecoder wants to merge 8 commits into
E3SM-Project:mainfrom
tomvothecoder:codex/issue-136-case-hash-hybrid
Open

Refine case-hash grouping semantics and analysis UI#157
tomvothecoder wants to merge 8 commits into
E3SM-Project:mainfrom
tomvothecoder:codex/issue-136-case-hash-hybrid

Conversation

@tomvothecoder
Copy link
Copy Markdown
Collaborator

@tomvothecoder tomvothecoder commented Mar 30, 2026

Summary

  • keep Case identity and uniqueness unchanged in this PR
  • treat case_hash as optional per-execution grouping metadata within an existing case
  • preserve each execution's case_hash on Simulation
  • expose case_hash on nested case simulation summaries used by case pages
  • refine the case-analysis UI so Case Hash is visible in both case-detail and All Cases execution summaries
  • closes [Enhancement]: Evaluate CASE_HASH as the canonical Case identifier #136

Scope

This PR stays focused on case_hash-aware case analysis without changing top-level case identity.

Included:

  • preserving and surfacing case_hash for grouping related executions within one case
  • removing warning-style drift framing where multiple hashes within one case are expected grouping metadata
  • adding case_hash to nested case summary responses so case-detail views can group executions without extra fetches
  • updating the case-detail UI to support grouped and flat execution views, compact metadata, and clearer Case Hash terminology
  • showing Case Hash in the All Cases simulation summaries table to distinguish executions more clearly

Not included:

  • changing case uniqueness semantics
  • moving reference semantics to be per-Case Hash
  • backend schema or migration changes beyond the grouping behavior already in scope
  • compare-page redesign

Implementation notes

  • backend/app/features/ingestion/ingest.py treats case_hash as within-case grouping metadata rather than failed consistency signaling
  • Simulation.case_hash storage remains unchanged
  • SimulationSummaryOut includes optional case_hash, and case endpoints populate it from nested simulations
  • frontend/src/features/simulations/CaseDetailsPage.tsx now:
    • uses cleaner Case Hash display terminology
    • compresses case summary and reference context into denser, more scannable layouts
    • supports both Grouped by Case Hash and All executions views
    • keeps selection and compare state shared across views
    • groups missing hashes into a neutral fallback bucket
    • avoids per-group reference semantics that are deferred to later work
  • frontend/src/features/simulations/CasesPage.tsx now shows Case Hash in expanded simulation summaries
  • frontend/src/features/simulations/caseUtils.ts provides shared fallback labeling and grouping helpers for the updated UI

User impact

  • users can distinguish executions more easily from both the case-detail page and the All Cases page
  • case-detail pages are more compact and easier to scan when many execution groups exist
  • grouped execution browsing remains available without implying new per-group reference behavior yet

Testing

  • cd backend && uv run pytest tests/features/ingestion/test_ingest.py tests/features/simulation/test_api.py tests/features/simulation/test_schemas.py
  • make backend-test
  • make frontend-lint
  • pnpm --dir frontend run type-check

Notes

  • pnpm --dir frontend run type-check still fails from pre-existing unrelated artifact typing errors in browse/compare/simulation detail views; this PR does not change those files.

Refs #136

@tomvothecoder tomvothecoder changed the title Draft: Add hybrid CASE_HASH support for issue #136 Add hybrid CASE_HASH support Apr 14, 2026
@tomvothecoder tomvothecoder force-pushed the codex/issue-136-case-hash-hybrid branch from 1e30535 to 44af70e Compare April 14, 2026 21:04
@tomvothecoder tomvothecoder requested a review from Copilot April 14, 2026 21:05
@tomvothecoder tomvothecoder self-assigned this Apr 14, 2026
@tomvothecoder tomvothecoder marked this pull request as ready for review April 14, 2026 21:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds hybrid support for CASE_HASH by parsing it from env_case.xml, persisting
it on simulations, and exposing it via simulation schemas/API while keeping
case-name-based grouping authoritative and emitting warnings on hash drift.

Changes:

  • Parse CASE_HASH into ingestion metadata and persist it on Simulation.
  • Add simulations.case_hash via Alembic migration and expose caseHash in
    SimulationCreate/SimulationOut.
  • Add drift-detection logic that warns on conflicting hashes for the same case
    name (without changing grouping), plus test updates.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
backend/app/features/ingestion/ingest.py Tracks CASE_HASH observations during ingestion and logs drift warnings.
backend/app/features/ingestion/parsers/case_docs.py Parses CASE_HASH from env_case.xml into metadata.
backend/app/features/ingestion/parsers/parser.py Plumbs parsed case_hash into ParsedSimulation.
backend/app/features/ingestion/parsers/types.py Extends ParsedSimulation with optional case_hash.
backend/app/features/simulation/models.py Adds nullable case_hash column to ORM model.
backend/app/features/simulation/schemas.py Exposes case_hash on create/out schemas with descriptions.
backend/migrations/versions/20260414_000000_add_case_hash_to_simulations.py Adds case_hash column to simulations table.
backend/tests/features/ingestion/parsers/test_case_docs.py Verifies CASE_HASH is parsed (or None on read error).
backend/tests/features/ingestion/test_ingest.py Verifies persistence of case_hash and drift warning behavior.
backend/tests/features/simulation/test_api.py Asserts caseHash is returned by simulation GET endpoint.
backend/tests/features/simulation/test_schemas.py Updates schema tests to include caseHash/case_hash.

Comment thread backend/app/features/ingestion/ingest.py
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 44af70e685

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread backend/app/features/ingestion/ingest.py Outdated
@tomvothecoder tomvothecoder requested a review from Copilot May 20, 2026 21:55
@tomvothecoder tomvothecoder changed the title Add hybrid CASE_HASH support Refine case-hash grouping semantics and analysis UI May 20, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

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.

[Enhancement]: Evaluate CASE_HASH as the canonical Case identifier

2 participants