Files
3c75f03a76 feat(server): store each run's code change and serve it to the issue page (MUL-7651)
A run's diff arrives from the daemon as it ends and lands in task_code_change:
one row per run, scope and repository. "run" is the run's own change;
"branch" is the delivered branch against where its line of work started,
which backs the issue-wide view when no pull request can supply it. The
patch goes to object storage; a patch over 1 MB never arrives and the row
keeps only the file list.

- POST /api/daemon/tasks/{taskId}/code-changes stores them. First write
  wins, so a retried upload changes nothing. Remote URLs lose any embedded
  credentials; commits, statuses and sizes are validated and clamped.
- GET /api/issues/{id}/code-changes lists summaries, and
  /code-changes/{changeId} returns one with its file list and patch.
- GET /api/issues/{id}/pull-requests/{prId}/diff reads a linked GitHub PR's
  files through the GitHub App and assembles them into one patch.
- code_changes:created tells open issue pages to refetch.
- No foreign keys: issue delete and workspace delete remove the rows and
  their stored patches.
- .patch and .diff join the text preview whitelist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-09-27 04:26:58 +08:00
..