Files
multica/server/internal
835c5437a9 MUL-6971 fix(issues): stop rejecting description edits against a stale baseline (#7926)
* fix(issues): stop rejecting description edits against a stale baseline

The description editor autosaves on a 1.5s debounce and sent the base it
had adopted; the server rejected the write whenever that base was not
byte-identical to the stored Markdown. Two ways that fired with no second
writer present:

- The editor normalizes its base (`normalizeMarkdown` = trim) while the
  server compares raw bytes, so any description stored with surrounding
  whitespace — every CLI/integration write that keeps a trailing newline —
  rejected EVERY edit, permanently.
- A save whose own echo arrived while the editor was dirty could not
  advance the base (ContentEditor refuses external syncs on a dirty
  document), so the next autosave carried a base the server had already
  moved past. Entering the conflict state then fed the local draft back in
  as the base, wedging the editor for the rest of the session.

The guard also never covered the writers most likely to race a human here:
mobile omits text baselines deliberately, and the CLI/agent path sends no
base at all. It mostly rejected the user's own autosave.

Descriptions are now last-write-wins. `description_base` stays in the
request because it is also the channel-media merge metadata — dropping it
would make media the editor had adopted impossible to delete.

Title and comment baselines are untouched: both save explicitly, send an
un-normalized base, and are not reachable by either failure above.

Co-authored-by: multica-agent <[email protected]>

* test(issues): build the new description-baseline test on the shared fixtures

The test landed on the legacy pattern this package is trying to stop
growing: `insertWorkflowTestIssue` plus a hand-written cleanup, raw SQL to
seed the column under test, and a recorder/status quartet. Rebuild it on
`dbfx.Issue` and `testutil.Call(...).Want(...)`, which own the cleanup and
print the request line and response body on a mismatch.

Behaviour is unchanged — still red against the pre-fix handler with the
reported 409, green after it. The assertions added to the surrounding
legacy test stay in their host's style; the rule covers new tests.

Co-authored-by: multica-agent <[email protected]>

---------

Co-authored-by: J <[email protected]>
Co-authored-by: multica-agent <[email protected]>
2026-09-02 16:39:57 +08:00
..