D1: server correctness bundle — C7 + C20a#307
Merged
Conversation
4 tasks
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.
Summary
Two CRIT server-side findings from the C-audit, bundled because they share an envelope-shape concern (PATCH/POST responses lying about what they did).
C7 — PATCH /repos silently accepted rename and returned 200 unchanged
Root cause:
repoPatchRequesthad noNamefield. Go's default JSON decoder silently skipped the unknown field, the handler did nothing (every other validated field was nil), and the response was the unchanged repo. The CLI took 200 + repo object as success and rendered "Renamed to ".Worse, the CLI then overwrote the local git origin to point at the renamed-to URL — see
CX2on the CLI side (already shipped). C7 is the upstream cause.Fix: Add
Nameto the request struct and refuse with 422 ("renaming via REST is not yet supported"). Until rename is implemented as a real feature, refusal is correct UX.C20a — issueResponse envelope missing
assigneesRoot cause: After S63 wired POST
/issuesto processassignees[], the response envelope still didn't carry them. The CLI sent the assignees, the server attached them to the issue row, but the response saidassignees: null— CLI then couldn't render or verify.Fix: Add
Assignees []userEnvelopetoissueResponse(always populated, empty slice when none — gh-compat). New helperassigneeEnvelopesFor(ctx, issueID)mirrorslabelEnvelopesFor's pattern. All 4 presentIssue callsites (list, single GET, create, PATCH-reload) updated to pass the resolved slice.Test plan
TestRepos_PatchRejectsRename— regression for C7: PATCH{"name":"..."}returns 422 with the explanatory message.TestIssues_CreateWithLabelsAssigneesMilestone— extended to assertcreated.Assigneespopulated with the expected user (was only DB-side before).apiIssuetest struct gainsAssignees []apiUser.Notes
C20a unblocks the C20b CLI follow-up (CLI should defensively compare sent vs returned assignees). Out of scope for this PR; will land separately in D3d-tail.
C7 is the upstream half of CX2 (CLI-side already merged). After this lands, CLI can stop showing "Renamed to old-name" success lines.