fix(scenarios): stop wiping a scenario's interface on every update (WM-4599) - #91
Open
Uğur Oruç (Ketcap) wants to merge 1 commit into
Open
fix(scenarios): stop wiping a scenario's interface on every update (WM-4599)#91Uğur Oruç (Ketcap) wants to merge 1 commit into
Uğur Oruç (Ketcap) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Stops scenarios.update()/scenarios.create() from unintentionally clearing a scenario’s on-demand interface by no longer emitting a default empty metadata.input_spec/metadata.output_spec unless an interface source is actually provided in the blueprint.
Changes:
- Updated
normalizePayload()to only includemetadatawhenblueprint.interfaceor legacyblueprint.iois present. - Added/adjusted unit tests to verify
metadatais omitted for non-interface updates and that explicit empty interfaces still clear as intended. - Minor test formatting cleanup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/endpoints/scenarios.ts |
Makes metadata emission conditional so unrelated PATCH updates don’t wipe the scenario interface. |
test/scenarios.spec.ts |
Updates existing expectations and adds new cases covering “no metadata unless interface is supplied” and “explicit empty interface clears”. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uğur Oruç (Ketcap)
force-pushed
the
fix/scenarios-update-wipes-interface-wm-4599
branch
from
August 31, 2026 20:26
e524911 to
0c8cb71
Compare
…M-4599)
normalizePayload always built `metadata: {input_spec: [], output_spec: []}` and
sent it on every PATCH, even when the caller passed no `interface`/`io`. The
backend's COALESCE only falls back to the existing value on SQL NULL, and an
empty array is not NULL, so any unrelated update — a rename, a folder move, a
scheduling tweak — silently cleared the scenario's on-demand inputs/outputs.
The key is now emitted only when the caller actually supplies one of those
sources; clearing on purpose still works via an explicit empty interface.
Uğur Oruç (Ketcap)
force-pushed
the
fix/scenarios-update-wipes-interface-wm-4599
branch
from
August 31, 2026 20:52
0c8cb71 to
d6c9ce8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[AI code generation]
Summary
normalizePayloadno longer builds a defaultmetadata: {input_spec: [], output_spec: []}; the key is emitted only when the caller suppliesblueprint.interfaceorblueprint.ioJSON.stringifydrops onlyundefined), and the backend'sCOALESCE(new_value, existing_value)only falls back on SQL NULL — so every unrelatedscenarios_update(rename, folder move, scheduling tweak) silently cleared a scenario's on-demand inputs/outputsinterface: { input: [], output: [] }metadata: {input_spec: [], output_spec: []}expectation — that assertion encoded the bugFixes https://make.atlassian.net/browse/WM-4599
Test plan
npx tsc --noEmitpassesnpx eslintpasses on changed files (one pre-existingjest/expect-expectwarning on an untouched test)npx prettier --checkpasses on changed filesnpx jest test/scenarios.spec.ts— 20/20 pass, including 4 new cases: nometadataon a plain rename; nometadataon a blueprint without an interface; interface hoisted intometadatawhen present; explicit empty interface still clearsnpx jestrun matches the pre-change baseline exactly (193 pre-existing integration-test failures, no live API key), with +4 passing