Skip to content

Add hybrid CASE_HASH support#157

Open
tomvothecoder wants to merge 5 commits intoE3SM-Project:mainfrom
tomvothecoder:codex/issue-136-case-hash-hybrid
Open

Add hybrid CASE_HASH support#157
tomvothecoder wants to merge 5 commits intoE3SM-Project:mainfrom
tomvothecoder:codex/issue-136-case-hash-hybrid

Conversation

@tomvothecoder
Copy link
Copy Markdown
Collaborator

@tomvothecoder tomvothecoder commented Mar 30, 2026

Summary

Why not group by CASE_HASH yet?

Issue #136 now has confirmed real-world evidence that CASE_HASH can be consistent across some executions and drift across others for the same logical case. Making it the sole grouping key now would risk splitting one logical case into multiple SimBoard cases.

This change implements the safe hybrid path:

  • store CASE_HASH
  • make it available for diagnostics and future evaluation
  • retain existing case-name grouping when hashes conflict or are missing

Testing

  • uv run pytest tests/features/ingestion/parsers/test_case_docs.py tests/features/ingestion/test_ingest.py tests/features/simulation/test_schemas.py tests/features/simulation/test_api.py
  • make backend-test

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
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