[SimEdit]: Allow editing simulations from Simulation Details#225
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da7f400f70
ℹ️ 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".
There was a problem hiding this comment.
Pull request overview
Key Findings
- The v1 “editable fields” implemented in both frontend and backend omit several
fields listed as editable in Issue #70 (notablycompilerand git provenance
fields), which is a scope/acceptance-criteria mismatch for a PR that closes
#70. (See comments inSimulationUpdate+EDITABLE_FIELDS.) - Frontend API typing now includes
simulationType: 'master', but the backend
SimulationTypeenum does not, creating an API contract drift that can lead
to 422s if the UI ever sends that value. - Backend PATCH currently mutates
updated_at/last_updated_byeven for an empty
PATCH body; this should be treated as a no-op.
This PR adds a narrow edit/save flow to the Simulation Details page, improves
read-only field display via truncation + hover titles, and introduces a backend
PATCH endpoint to persist allowed metadata updates for existing simulations.
Changes:
- Added backend
PATCH /simulations/{id}with a newSimulationUpdateschema
and associated API/schema tests. - Wired Simulation Details page to an edit mode (form state + save/cancel) and
compare selection toggle with a max selection limit. - Improved UI display for long read-only fields via truncation and hover titles.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/types/simulation.ts | Introduces typed status/type unions and a SimulationUpdate payload type. |
| frontend/src/features/simulations/SimulationsPage.tsx | Extends type/status color mappings for new enum values. |
| frontend/src/features/simulations/SimulationDetailsPage.tsx | Adds save flow, local simulation state, and compare toggle wiring. |
| frontend/src/features/simulations/routes.tsx | Passes compare-selection state into details route. |
| frontend/src/features/simulations/components/SimulationTypeBadge.tsx | Updates the “unknown” label text. |
| frontend/src/features/simulations/components/SimulationDetailsView.tsx | Adds editable form UI/state, save/cancel controls, and truncating readonly components. |
| frontend/src/features/simulations/api/api.ts | Adds updateSimulation() PATCH client method. |
| frontend/src/components/shared/SimulationStatusBadge.tsx | Expands supported statuses and normalizes display logic. |
| backend/tests/features/simulation/test_schemas.py | Adds validation coverage for the new SimulationUpdate schema. |
| backend/tests/features/simulation/test_api.py | Adds API coverage for simulation PATCH behavior and auth/error cases. |
| backend/app/features/simulation/schemas.py | Adds SimulationUpdate schema (extra-forbid, partial fields). |
| backend/app/features/simulation/api.py | Adds PATCH endpoint and refactors simulation detail query helper. |
Description
Truncate overflowing simulation detail fields, preserve the full values on hover, and wire the simulation details page to the edit/save flow.
Closes #70
Checklist
Deployment Notes (if any)