Skip to content

πŸ› fix(dashboard): the write-back kind table edits and keeps every override field - #17559

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/writeback-kind-table-parity
Nov 10, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/writeback-kind-table-parity

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

Settings β†’ Features' write-back per-kind matrix showed only two of the four override fields, but saving it rewrote the whole writeback.kinds map from the table. Any edit there silently erased every kind's unlabeled_min_level and own_only (and an own-only kind's min_level). On knuckle that would undo the writeback.kinds.base_refresh.unlabeled_min_level: 6 the 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/features replaces the whole writebackKinds map 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.
  • The admin MCP writeback.kind_policy operation (✨ 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

  • Two new columns. Without label sets unlabeled_min_level: default, 0 (off), or L1 to L6, so only server-valid levels can be picked. Hive-authored only sets own_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 one yamlHint, which now names all four fields.
  • Saving keeps what you didn't touch. Each row carries the override it was rendered from (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 sends null, as before.
  • The MCP preview warning is gone. writeback.kind_policy no longer tells the operator that the dashboard drops unlabeled_min_level and own_only, because that is no longer true.
  • Settings parity allowlist. The two writeback.kinds.<key>.* entries are removed because the Settings UI now references them. The parity test requires that.
  • Docs (admin-mcp.md, operator-reference/sweeps-and-operations.md) and a fixed- 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 from static-src/manifest.txt. Concatenating the sources reproduces it byte for byte (cmp clean).
  • src/pkg/dashboard/settings_parity_allowlist.txt: drops the two entries.
  • src/pkg/adminmcp/tools_cadence_writeback_ops.go and _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

  • New: 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 keeps base_refresh's lone unlabeled_min_level: 6, sentinel's own_only: false and hold_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 returns null for those three kinds.
  • Updated: TestWritebackKindPolicyOpKeepsUntouchedKinds. It now asserts that the preview no longer says "would drop".
  • Existing guards this touches: TestSettingsDialogReferencesEveryHiveYAMLLeaf (allowlist entries removed), TestSettingHelpMarksAreDocsLinks (new marks link to settings#features) and TestWritebackDashboardMarkup (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 -l and node --check on the changed files.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…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>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 10, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 10, 2026
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>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 decodes writeback.KindPolicyOverride with 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 are min_level / require_label / unlabeled_min_level / own_only, matching the keys markDirtyWritebackKinds now reads and writes, and matching what f.writebackKinds (serialised cfg.Writeback.Kinds) hands the renderer. So the data-wb-override round-trip is byte-faithful.
  • src/pkg/writeback/gate.go:504,508 β€” UnlabeledMinLevel is 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 &quot;, so the JSON in data-wb-override cannot 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's min_level and every kind's unlabeled_min_level/own_only. The new node-driven test exercises that path against the real rendered markup, and the old handler returns null for 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

@hivecommons-hive

hivecommons-hive Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

Review findings from adjudicator (folded here because this head already carries its hive review):

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. TestWritebackKindTableKeepsEveryOverrideField fails β€” fixture regex stops at <key> (in-scope, blocks CI)

CI (test (dashboard 4/4), dashboard shuffle 3/3) fails the first untouched-save assertion: hold_gate_notice comes back as {own_only: true} without min_level: 3. I reproduced it in node and traced it to the fixture, src/pkg/dashboard/writeback_kind_table_parity_test.go:68:

const input = /<input[^>]*class="wb-kind-level"[^>]*>/.exec(m[3]);

The rendered input carries data-setting-key="writeback.kinds.<key>.min_level" (config-sentinel.js:151), so [^>]* stops at the > of <key> and the match never reaches value="3" or disabled. The fake row therefore reports {value: '', disabled: false}, and level() in markDirtyWritebackKinds (config-sentinel.js:196-199) correctly does delete ov.min_level for an enabled, empty control. A real DOM parses > inside a quoted attribute fine, so the handler itself keeps the field as intended β€” I confirmed all three save scenarios pass once the fixture regex tolerates quoted >:

    const input = /<input(?:[^>"]|"[^"]*")*class="wb-kind-level"(?:[^>"]|"[^"]*")*>/.exec(m[3]);

Optional: selRe at line 73 has the same [^>]*> hazard; it only works today because the options follow the truncated match. Same quoted-attribute pattern would make it robust.

Everything else I checked holds: esc() encodes " so data-wb-override round-trips (debug-logs.js:571-577); KindPolicyOverride fields are omitempty pointers so JSON.parse never sees null fields, and the trailing == null sweep is a harmless safety net; unlabeled_min_level: 0 survives (+'0' is 0, not nullish) and the PUT accepts it (api_governor_features_platform.go:274-278); null for a kind with no fields is still skipped server-side (:272).

Review findings from reviewer-2 (folded here because this head already carries its hive review):

The production change looks correct to me; the one thing blocking this is that the PR's own new test fails in CI, and the failure is in the test fixture, not in the handler.

What I verified

  • markDirtyWritebackKinds (static-src/js/config-sentinel.js:192-213): starts each row from data-wb-override, and level()/flag() return early on a missing or disabled control, so an own-only kind's disabled min_level cell is left alone. That is the right fix for the "whole-map PUT drops fields it has no control for" bug.
  • Server side already accepts all four fields: writeback.KindPolicyOverride (src/pkg/writeback/kinds.go:112-117) and the PUT validation at src/pkg/dashboard/api_governor_features_platform.go:272-279 already handle unlabeled_min_level and own_only. So "no server change" in the body holds.
  • Dropping the dashboardLossy warning from tools_cadence_writeback_ops.go is consistent with the above.

Finding β€” the new test's fixture truncates the <input> tag (medium; CI red)

test (dashboard 4/4) and test (dashboard shuffle 3/3) fail on TestWritebackKindTableKeepsEveryOverrideField with:

hold_gate_notice: { own_only: true }        // actual
hold_gate_notice: { min_level: 3, own_only: true }  // expected

Cause is in writeback_kind_table_parity_test.go, parseRows:

const input = /<input[^>]*class="wb-kind-level"[^>]*>/.exec(m[3]);

The rendered input contains the literal attribute data-setting-key="writeback.kinds.<key>.min_level", and [^>]* stops at the > of <key>. I reproduced it in node against the PR head's markup: the match ends right after data-setting-key="writeback.kinds.<key> and disabled[ >] tests false, value= is never seen. The fixture therefore hands the handler an enabled, empty level control, and level() correctly does delete ov.min_level. In a browser the input really is disabled, so the handler keeps min_level: 3 β€” the test is reporting a bug the code does not have.

Fix is fixture-only: match attributes quote-aware, e.g. /<input(?:[^>"]|"[^"]*")*class="wb-kind-level"(?:[^>"]|"[^"]*")*>/, or scan to <\/td>. The <select ...> regex in the same function has the same [^>]* shape and is only saved by class= being the first attribute; worth tightening at the same time.

Since this is a fork branch I can't push the one-line fix; once the fixture is corrected the remaining dashboard slices should go green (the other failing checks on this head are the cancelled superseded runs).

Evidence bundle `#17559e368b96` sha256:f4948e77bb4bf9f6e2e333445656e97636198b2ade5b52b1102c86b391613bdb β€” download from the dashboard or `hivectl review evidence #17559`.

@hivecommons-hive
hivecommons-hive Bot merged commit 9077899 into hivecommons:v6 Nov 10, 2026
70 of 71 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at e368b96.

Danathar added a commit to Danathar/hive that referenced this pull request Nov 10, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant