Code review section on Settings General tab sticks on 'loading…' forever (unset self-approval knob never leaves the prefill sentinel) #605
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#605
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Code review section on Settings → General sticks on "loading…" forever
What's broken
On the repo Settings page, General tab, the "Code review" section never renders its toggle — it shows the fallback
loading…permanently. The "Save code review" button stays disabled. Affects any repo whose settings TOML has no[review] allow_self_approvalkey — i.e. every fresh/unedited repo, because unset is the common case.Mechanism (static analysis, no local repro)
Two pieces of the #586 implementation disagree about what
nullmeans:web/src/lib/repoReview.jsextractSelfApproval()(lines 27–42): by its own documented contract, an unset knob returnsnull("null = unset (renders checked: the server default is allowed)"). Only explicittrue/falseliterals read.web/src/pages/Settings.jsxprefill effect (lines 153–159): usesgetSelf() === nullas the "not yet prefilled" sentinel:For an unset knob the effect runs, seeds
null, and the condition stays true forever — the signal never leaves the sentinel value.web/src/pages/Settings.jsxline 427 gates the toggle on the same sentinel:getSelf()is permanentlynull, so the toggle never renders and the section showsloading…forever. Line 448'sdisabled={getSelf() === null}keeps the save button disabled for the same reason.The sibling feature-toggles section does NOT have this bug because
extractFeatures()(web/src/lib/repoFeatures.jsline 39) returns a concrete object ({ issues: true, … }) for unset, nevernull— the prefill seed is distinguishable from "unseeded".Note the dirty check (
selfDirty(), line 245:getSelf() !== getSelfBase()) happens to work with nulls (both null → not dirty), so the only visible symptom is the eternal loading fallback + disabled save.Fix options (implementer's call)
The clean shape is separating "not yet seeded" from "unset" so the default-ON contract in
repoReview.jsis preserved:getSelf/getSelfBasetoundefined(unseeded) instead ofnull; the prefill effect checksgetSelf() === undefined; the<Show>gate becomesgetSelf() !== undefined; the save button's disabled check likewise.nullthen means only "unset → render checked" per the module contract.selfSeededboolean signal set true after the first successful seed; gate the<Show>and button on it. Slightly more state, same effect.Either way, keep
extractSelfApproval()'s null-for-unset contract untouched —withSelfApproval()'s append path and the headless tests inweb/test/unit/(if any cover repoReview) rely on it. A regression test asserting "unset TOML → toggle renders checked (not loading)" belongs in the unit suite, mirroring the settingsNav/repoReview headless-test pattern.Acceptance criteria
[review]section (or noallow_self_approvalkey) shows the toggle rendered checked on Settings → General — neverloading….allow_self_approval = falserenders unchecked;= truerenders checked.Fixed by #610 (merged): prefill sentinel is now undefined (unseeded) with null keeping its unset→checked contract — all four getSelf() reads swapped, contract module untouched, no-clobber preserved. Saving an untouched unset knob writes allow_self_approval=true (semantically identical under default-ON). Verified: 1564 unit green (smoke excluded, pre-existing), vite/esbuild green, independent review APPROVE.