Skip to content

fix(cli): merge partial scenario updates - #7

Open
92Infinitus92 wants to merge 2 commits into
developfrom
fix/scenario-merge-patch
Open

fix(cli): merge partial scenario updates#7
92Infinitus92 wants to merge 2 commits into
developfrom
fix/scenario-merge-patch

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator
  • Merge only the fields supplied to PATCH /v1/scenarios/{id}.
  • Preserve omitted fields such as overrides and tags.
  • Keep full-document PATCH upsert compatibility.
  • Treat the path ID as authoritative.
  • Reject invalid, incomplete, or unknown fields without mutating state.
  • Add regression coverage for partial updates and consecutive edits.

This backend change should be merged before LimeChain/surfpool-web-ui#8, because the Studio PR sends partial PATCH bodies.

Greptile Summary

The PR updates scenario PATCH handling to merge partial updates while preserving omitted fields and retaining full-document upsert compatibility.

  • Makes the path ID authoritative for updates and upserts.
  • Validates malformed, incomplete, and unknown fields before mutating scenario state.
  • Adds regression tests for partial updates, consecutive edits, field preservation, and invalid requests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/cli/src/http/mod.rs Implements validated partial PATCH merging and full-document upserts, with the previously reported unknown-field bypass now fixed before mutation.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[PATCH /v1/scenarios/id] --> B{Scenario exists?}
    B -->|Yes| C[Merge supplied fields into stored scenario]
    B -->|No| D[Parse full document for upsert]
    C --> E[Force ID from request path]
    D --> E
    E --> F{Valid Scenario with known fields?}
    F -->|Yes| G[Replace or insert scenario]
    F -->|No| H[Return 400 without mutation]
Loading

Reviews (2): Last reviewed commit: "fix(cli): reject unknown scenario upsert..." | Re-trigger Greptile

Comment thread crates/cli/src/http/mod.rs
@92Infinitus92
92Infinitus92 requested a review from failfmi August 18, 2026 08:58
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