oliver-zehentleitner / maity
clean-up: web shell: Settings view out of app.js, one scope table, dead projectViews
tsk-k1qt4bt2hpgf Open
From the web clean-up audit, area 17 (tsk-hgnbapyw7hnh), read at 80647565. The numbers are the audit finding numbers (sent to lotse, seq 125424). Line numbers are from 80647565, so re-check them on current main.
#1 Shell: app.js holds the whole project Settings view (design).
- web/js/app.js:536-1297 holds the forms: repositoryForm, linksForm, blindRemoveForm, onboardingForm, projectPanel, imagesForm, signingForm, memoryPanel, keepTheWhyForm, agentOwnersForm, doneAuthorityForm, memberAgentsForm, keepTheWhyDefaultsForm, badgeForm.
- app.js:1805-1842 holds M.views.settings and its module state, settingsFocus and settingsSaved.
- That is about 1300 of the 2671 lines of the file, and they have nothing to do with the router, header or boot. The other parts of Settings are already their own modules: ticker-settings.js, project-names.js, restricted.js, forge.js, public-page.js.
- Proposal: move all of it into js/project-settings.js, which registers M.views.settings. ctx.openSettings (:1698) can carry the focus in the route instead of the module-level settingsFocus.
- Effort M. Risk low, since this is a pure move and the smoke tests reach Settings.
#2 Shell (Settings): six copies of "policy select + reason + save" (duplication).
- The copies: app.js signingForm :942, memoryPanel :1045-1064, keepTheWhyForm :1076, doneAuthorityForm :1175, keepTheWhyDefaultsForm :1232, badgeForm :1256.
- Each one builds a select from [value,label] and sets the current value, adds a required reason, and on submit does: unchanged, return. Empty reason, focus it. Otherwise save({policy:{k:v}, reason}).
- Proposal: one policySelectForm({key, options, current, words, reason, extra}). Do it together with #1.
- Effort S-M. Risk low.
#3 Shell: drawing() lists the scopes in five places, and two of them already disagree (design).
- The places: app.js:2481 (the known list), :2484 (the viewName list), :2503-2538 (the dispatch chain), :2556-2572 (the title chain), :1748-1749 (the header labels). parseRoute (:110-152) also knows the scopes.
- "invitations" is in the :2484 list but not in the known list at :2481. Adding a scope means editing five places.
- Proposal: one SCOPES table ({view, title, header, formColumn} per scope) that the dispatch, viewName, title and header all read.
- Effort M. Risk medium: smoke and e2e assert titles and view class names.
#7 Shell: projectViews is a leftover read (debt).
- app.js:1858-1863 is "async function projectViews(me)" with no await. It only maps full_name to p.
- It is awaited at :2428 and :2453 and stored at :2458. It is read at app.js:1390, inbox.js:113, chats.js:69 and chats.js:149 as ctx.projectViews[p.full_name] (with an empty-object fallback), which always gives back p itself.
- The comment describes a per-project read that no longer exists.
- Proposal: pass p to M.projectMark directly, and remove projectViews and ctx.projectViews.
- Effort S. Risk low.
Order:
- tsk-chtvqs62cd10 (Settings in sub-tabs, PR #1741) restructures the same Settings code. Start after it merges, and re-check #1 and #2 against what it left.
- tsk-hyfqc0sp2bvc (PR #1582) edits the same Promise.all in render() that awaits projectViews. Do #7 after it merges.
- tsk-hnknmvw1w6yq (outside_roles form) touches agentOwnersForm in the same block.