Repository navigation
fix(issues): remove a weight with null and publish 0 as a weight - #1805
Conversation
issue.update offered null for the weight in its schema and read it as
the field left out, so a weight could be set to 0 but never removed.
The pointer it was decoded into cannot tell a JSON null from an absent
key. toolutil.Nullable[T] can: absent leaves the value alone, null
removes it and any value, 0 included, sets it. It publishes the schema
the pointer did, and UnmarshalParams coerces a numeric string into it
as it did into the pointer.
issue.update sends a null weight through client-go's ResetWeight, which
writes {"weight": null}. issue.work_item_update and group.epic_update
send weightWidget {weight: null} through the request option of
toolutil.ApplyWorkItemWidgets, because client-go's weight widget is
tagged omitempty and GitLab refuses a widget without the key. Measured
on GitLab EE 19.5.0: that is the only body that removes an epic's
weight, 0 is stored as the weight 0, and {} is refused.
The weight GitLab answers with is read off the captured response as a
pointer wherever an issue is published: the issue outputs, search and
the merge request issue lists through toolutil.IssueBasicExtra, the
issues of a link and the related issues, the issues of a project and a
group milestone and a to-do's target. client-go decodes it into an
int64, so 0 and null both read as 0, and the outputs tagged it
omitempty, so a weight of 0 was never published. The issue card shows
the weight, 0 included.
The clearing gate probes a field typed Nullable with null rather than
0, since its 0 is a value, and the 1:1 audit declares the six captured
weights as kept for their null.
Closes #1390
Signed-off-by: José M. Requena Plens <mail@jmrp.io>
…h ways gobco found three conditions of the raw request walk and two of the body edit walk that no test made go both ways. Two are redundant and go: an assignment and a declaration always name a target, so bind never sees an empty left-hand side, and a variable assigned itself adds an alias that gives it the place it already holds, which assign leaves alone. The other three are cases no fixture had: a raw request built straight into a field, which binds no variable, so a call of Do that reads it back through a method is not told it, and a body edit whose Drop is returned by a function of the package's own, whose arguments are not read as the keys it drops. Signed-off-by: José M. Requena Plens <mail@jmrp.io>
gobco reported two conditions of toolutil evaluated one way only, and neither can go the other. A meta call names an action the envelope's enum lists before the handler runs, so the tier check needs no lookup guard: the zero route an unknown action would read prunes nothing. And titleLink is handed a title that is the address whenever the title is blank, so a blank title beside an address never reaches the code span branch. Signed-off-by: José M. Requena Plens <mail@jmrp.io>
The weight of issue.update, issue.work_item_update and group.epic_update now takes null, and the issue outputs publish a weight of 0, which moves the tool snapshots, the tool reference of the issue and group pages in both languages, llms, the token footprint, the report-only 1:1 baseline and the testing reference. Signed-off-by: José M. Requena Plens <mail@jmrp.io>
|
Sorry @jmrplens, your pull request is larger than the review limit of 150,000 diff characters |
Summary
Pre-merge checks:
|
|



issue.updateoffered null for the weight in its schema and read it as the field left out, so a weight could be set to 0 but never removed. The pointer it decoded into cannot tell a JSON null from an absent key.I added
toolutil.Nullable[T], a three-state input: absent leaves the value alone, null removes it, and any value, 0 included, sets it. It publishes the same schema the pointer did (["null","integer"]throughTypeSchemas), andUnmarshalParamscoerces a numeric string into it as it did into the pointer.issue.updatesends a null weight through client-go'sResetWeight, which writes{"weight": null}.issue.work_item_updateandgroup.epic_updatesendweightWidget {weight: null}through the request option oftoolutil.ApplyWorkItemWidgets, because client-go's weight widget is taggedomitemptyand GitLab refuses a widget without the key. I measured it on GitLab EE 19.5.0: that is the only body that removes an epic's weight, 0 is stored as the weight 0, and{}is refused.The weight GitLab answers with is now read off the captured response as a pointer wherever an issue is published: the issue outputs, search and the merge request issue lists through
toolutil.IssueBasicExtra, the issues of a link and the related issues, the issues of a project and a group milestone, and a to-do's target. client-go decodes it into anint64, so 0 and null both read as 0 (upstream register "A measure GitLab sends as null decodes as 0"), and the outputs tagged itomitempty, so a weight of 0 was never published. client-go v3.46.1 still decodesIssue.Weight,IssueRelation.WeightandTodoTarget.Weightasint64and still tags the weight widgetomitempty, so both the captures and the request option stay. The issue card shows the weight, 0 included.The clearing gate probes a field typed
Nullablewith null rather than 0, since its 0 is a value, and the 1:1 audit declares the six captured weights as kept for their null, beside the group board's weight capture the client-go bump added.The issue package's action IDs are written out rather than concatenated, which gremlins reported as 17 uncovered mutants, and
TestActionIDs_AreTheDomainPlusTheSpecNameholds each to the domain plus its spec name.Two more commits take the two packages the layer touches that held conditions gobco found evaluated one way only, all of them older than the layer, to every condition evaluated both ways (
GOBCO_GATE=all). In the 1:1 audit'ssdkwalk, two are redundant and go (an assignment always names a target; a variable assigned itself adds an alias that changes nothing) and three get the fixtures they lacked: a raw request built straight into a field, and a body edit whose Drop a function of the package's own returns. Intoolutil, two cannot go the other way and go: the meta dispatcher's tier check guarded a route lookup the envelope's action enum already guarantees, andtitleLinkchecked for a blank title its callers never hand it beside an address.This is the first layer of a three-layer stack on main, after the client-go v3.46.1 bump (#1671) and Go 1.27.4 (#1800). Its last commit regenerates what the layer moves: the tool snapshots, the tool reference of the issue and group pages in both languages, llms, the token footprint, the report-only 1:1 baseline and the testing reference.
What I ran on this layer's head, with Go 1.27.4: the unit suite with the snapshot parity on,
golangci-lint run --build-tags e2eon the touched packages, every target of the Generated artifacts job,check-request-inventory,check-e2e-static,make audit-1to1,check-file-headersandcheck-dco, andGOBCO_GATE=allontoolutil(4596 of 4596 conditions) andcmd/audit_1to1/internal/sdk(1572 of 1572). At the stack's top, 100% statement coverage and gremlins at Lived 0, Not covered 0 and Timed out 0 on every package this layer touches:toolutil(2184 killed),cmd/audit_1to1/internal/sdk(848),issues(228),epics(199),workitems(114),groupmilestones(81),milestones(71),issuelinks(50) andtodos(50). The complete Docker runs of the stack's top passed on GitLab 19.5.4, on a tree that differs from it only in a 1:1 audit declarations file the server binary does not build:make test-e2e-ce(common and ce, 1450 tests, no failures, the one declared skip, the throttle probe, run last on the same stack and passed) andmake test-e2e-ee(common and ee, licensed Ultimate, 1802 tests, no skips, no failures). The weight scenarios need a licensed instance, so they ran in the EE run, on every surface:TestIssue_Update_WeightNullRemovesTheWeight,TestIssue_Update_WeightZeroIsAWeight,TestWorkItems_Update_WeightNullRemovesTheWeightandTestEpics_Update_WeightNullRemovesTheWeight.Closes #1390
Part of #1306