Repository navigation
π fix(dashboard): the write-back kind table edits and keeps every override field - #17559
Conversation
β¦rride field Settings β Features' write-back per-kind matrix edited only min_level and require_label, but PUT /api/config/governor/features replaces the whole writeback.kinds map and markDirtyWritebackKinds rebuilt it from those two cells. Any edit there dropped every kind's unlabeled_min_level and own_only (and an own-only kind's min_level, whose cell is disabled), undoing what hive.yaml or the admin MCP writeback.kind_policy operation had set. - The table gains "Without label" (unlabeled_min_level: default, 0 (off), L1-L6) and "Hive-authored only" (own_only: default/yes/no) columns, each with a settingHelpMark; the matrix's one yamlHint names all four fields. - Each row carries the override it was rendered from (data-wb-override); the save handler starts from it and only a live, enabled control changes its field, so nothing the operator did not touch is dropped. - writeback.kind_policy's preview no longer warns that a dashboard save drops those fields; its test now asserts the warning is gone. - The two fields leave the settings parity allowlist, since the Settings UI now references them. No endpoint change: the GET already returns every override field. Refs hivecommons#17555 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
The input's data-setting-key value contains "<key>", so the fixture's [^>]* tag match ended at that '>' and never saw value="3" or disabled on the own-only row; a browser parses the quoted attribute fine. The handler was right; the fixture misread the row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
There was a problem hiding this comment.
Read the diff against the v6 tree plus the server side it relies on. The fix is sound and does what the body says; looks correct to me.
What I verified:
src/pkg/dashboard/api_governor_features_platform.go:265-290β the PUT handler already decodeswriteback.KindPolicyOverridewith all four fields and accepts a nil/empty override as "drop the kind", so the client-only fix is sufficient; no server change needed, as the body states.src/pkg/writeback/kinds.go:112-117β JSON tags aremin_level/require_label/unlabeled_min_level/own_only, matching the keysmarkDirtyWritebackKindsnow reads and writes, and matching whatf.writebackKinds(serialisedcfg.Writeback.Kinds) hands the renderer. So thedata-wb-overrideround-trip is byte-faithful.src/pkg/writeback/gate.go:504,508βUnlabeledMinLevelis only consulted when> 0, so the new "0 (off)" option is accurate, and the PUT's 0..6 range check admits it.esc()escapes"to", so the JSON indata-wb-overridecannot break out of the attribute.markDirtyWritebackKinds(config-sentinel.js): disabled or absent controls leave the rendered override untouched, which is exactly the path that used to drop an own-only kind'smin_leveland every kind'sunlabeled_min_level/own_only. The new node-driven test exercises that path against the real rendered markup, and the old handler returnsnullfor those kinds, so it fails without the fix.
One non-blocking note: the Min level / Opt-in label / Without label controls are rendered from the effective policy's own_only (p.own_only), not the select. Flipping Hive-authored only from yes to no therefore does not enable those cells until the page re-renders after save. Nothing is lost (the kept override is sent unchanged); it's just a save-then-edit two-step for that one transition.
Open question, not a finding: at the time of this review test (dashboard 4/4) and test (dashboard shuffle 3/3) are red while the run is still in progress, and the logs were not yet retrievable, so I could not tell whether that is the new test or the shuffle harness. Worth a look once the run completes.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Correctness review (head cd489b6). The production change is sound; the PR's own new test fails CI because of its HTML-parsing fixture, not the handler. 1.
|
Brings in hivecommons#17559 (write-back kind table). Clean merge; static/index.html still equals the manifest concatenation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1 Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Summary
Settings β Features' write-back per-kind matrix showed only two of the four override fields, but saving it rewrote the whole
writeback.kindsmap from the table. Any edit there silently erased every kind'sunlabeled_min_levelandown_only(and an own-only kind'smin_level). On knuckle that would undo thewriteback.kinds.base_refresh.unlabeled_min_level: 6the operator is about to set through the admin MCP. The table now shows and edits all four fields, and saving keeps every field nobody changed on the page. This is a dashboard-only change: no endpoint or config change.Refs #17555
What went wrong
PUT /api/config/governor/featuresreplaces the wholewritebackKindsmap it is sent.markDirtyWritebackKinds(static-src/js/config-sentinel.js) rebuilt each kind's override from just the Min level input and the Opt-in label select. Any field it had no control for came back missing, and so did the disabled min level of an own-only kind.writeback.kind_policyoperation (β¨ feat(adminmcp): change agent cadences and write-back kinds through preview and confirmΒ #17555) can set all four fields, so its preview had to warn that a later dashboard save would drop two of them. That broke dashboard/MCP parity.What changes
unlabeled_min_level: default, 0 (off), or L1 to L6, so only server-valid levels can be picked. Hive-authored only setsown_only: default, yes or no. Both default options show the value in force, the same way Opt-in label does. Each new column has its own?help mark. The matrix keeps oneyamlHint, which now names all four fields.data-wb-override). The save handler starts from that override, and only a live, enabled control changes its field. A field with no control on the row, or a disabled one, is sent unchanged. A kind with no fields left still sendsnull, as before.writeback.kind_policyno longer tells the operator that the dashboard dropsunlabeled_min_levelandown_only, because that is no longer true.writeback.kinds.<key>.*entries are removed because the Settings UI now references them. The parity test requires that.admin-mcp.md,operator-reference/sweeps-and-operations.md) and afixed-changelog fragment are updated to match.There is no server change. The Features GET already returns each kind's full override, and the PUT already validates levels 0β6 and known kinds.
Files
src/pkg/dashboard/static-src/js/config-sentinel.js: the table renderer and the save handler.src/pkg/dashboard/static-src/js/config-state.js: search words for the new fields.src/pkg/dashboard/static/index.html: regenerated fromstatic-src/manifest.txt. Concatenating the sources reproduces it byte for byte (cmpclean).src/pkg/dashboard/settings_parity_allowlist.txt: drops the two entries.src/pkg/adminmcp/tools_cadence_writeback_ops.goand_test.go: drop the warning and its expectation.src/docs/admin-mcp.md,src/docs/operator-reference/sweeps-and-operations.md,changelog.d/fixed-writeback-kind-table-parity.md.Tests
TestWritebackKindTableKeepsEveryOverrideField(pkg/dashboard, runs in node). It renders the table from a fixture, rebuilds browser-shaped rows from the rendered markup, and calls the real save handler. It checks three things. An untouched save sends every override back exactly. Editing one kind keepsbase_refresh's loneunlabeled_min_level: 6,sentinel'sown_only: falseandhold_gate_notice's{min_level: 3, own_only: true}. The new cells write their fields and clear them back to default. On the v6 tip this test fails: the columns don't exist, and the old handler returnsnullfor those three kinds.TestWritebackKindPolicyOpKeepsUntouchedKinds. It now asserts that the preview no longer says "would drop".TestSettingsDialogReferencesEveryHiveYAMLLeaf(allowlist entries removed),TestSettingHelpMarksAreDocsLinks(new marks link tosettings#features) andTestWritebackDashboardMarkup(id="wb-kind-table"unchanged).The repo's AGENTS.md says not to run tests locally, so CI is the verdict. Locally I ran only
gofmt -landnode --checkon the changed files.π€ Generated with Claude Code
https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1