Skip to content

fix: preserve conflictResolution in JSX insert-fragment normalization #6143

Description

@webstudio-issue-reporter

User story

As a Webstudio user, I want to insert an authored JSX fragment that reuses existing design tokens without creating duplicate tokens or rewriting the project design system.

Summary

The insert-fragment tool detects token conflicts and requires conflictResolution, but its JSX input normalizer discards that field before invoking the runtime mutation.

What the agent tried

  1. Inspect the insert-fragment schema and author a native JSX fragment that references existing named design tokens.
  2. Call insert-fragment in dry-run mode with parentInstanceId, fragment, mode replace, and conflictResolution ours.
  3. Confirm that the submitted JSON contains conflictResolution ours and retry the identical dry-run.

Expected behavior

The JSX normalizer should preserve conflictResolution and the runtime should reuse the existing tokens according to the ours choice.

Actual result

Both calls returned CONFLICT stating that an explicit conflictResolution was required, even though the submitted input included conflictResolution ours.

Recovery attempts

  1. Verified the generated JSON includes the supported field and enum value.
  2. Inspected the advertised insert-fragment contract and the stable runtime input contract.
  3. Worked around the defect by removing token declarations from the JSX insertion and planning semantic token attachment after insertion.

User impact

Token-driven page authoring cannot use the documented one-step JSX workflow. The workaround adds many mutation calls and risks temporary styling drift.

Technical context

CLI version 0.290.0. The JSX normalization helper returns parentInstanceId, compiled fragment, mode, and insertIndex but omits conflictResolution, while the downstream runtime correctly checks for the missing field and rejects conflicting named tokens.

Agent environment

  • Client: Codex
  • Provider: OpenAI
  • Model: unknown
  • Reasoning effort: unknown
  • Trigger: automatic-friction
  • Category: schema-or-docs-mismatch

Technical runtime

  • CLI: 0.290.0
  • Node.js: 26.0.0
  • Operating system: darwin 25 (arm64)
  • Execution mode: mcp
  • API contract: public-api:iqd6ok

Acceptance criteria

  1. The JSX insert-fragment normalizer preserves conflictResolution and contentMode from the user input.
  2. Dry-run and committed calls accept ours, theirs, and merge.
  3. A regression test inserts JSX referencing an existing named token with differing declarations and confirms the selected resolution.
  4. The exposed tool schema and runtime behavior remain aligned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions