oliver-zehentleitner / maity

clean-up: web instance admin: one settings-form helper, sections loaded at once, one paged list

Sign in to report

tsk-4e7ctx876pqg Open

From the web clean-up audit, area 17 (tsk-hgnbapyw7hnh), read at 80647565 (findings sent to lotse, seq 125544). Line numbers are from 80647565, so re-check them on current main.

#66 Admin settings (limits, registration, sign-in, mail): one load/diff/save skeleton written four times, with uneven error handling (duplication/design).

  • Where:
  • admin-limits.js:51-58 and 102-133
  • admin-registration.js:64-71 and 150-197
  • admin-sign-in.js:54-60 and 165-199
  • instance-admin.js:40-45 and 93-120
  • All four do the same steps:
  1. GET the setting.
  2. Lock a value whose source is env.
  3. Patch only what changed, or say "unchanged".
  4. Save through M.stepUp.run(patch); a cancelled step-up is done().
  5. Show field errors and redraw.
  • "Source" has three catalog families: limits.source., reg.source. and mail.source. admin-sign-in.js:34-39 and 174-186 borrow limits., and public-page.js:166/181 borrows meat.saving and meat.not_saved.
  • Load failures are uneven. Limits (:55), registration (:70) and sign-in (:60) let the GET throw to the wrapper at instance-admin.js:233-234, which leaves a heading and an empty status line. Maintenance (:43-44) and mail (:44-45) catch their own failure.
  • Proposal:
  • One M.settingsForm helper: read, env lock with its source line, diff patch, step-up save.
  • Shared catalog keys settings.source.* and settings.saving/saved/unchanged.
  • Each section keeps only its field definitions.
  • Move mailSection and infoSection out of instance-admin.js into admin-mail.js.
  • Effort M-L. Risk medium: many smoke paths.

#68 Instance admin: sections load one after another, and four settings are read twice (slow path).

  • Where: instance-admin.js:230-235, :185 and :187-192, and site-io.js:38-39 and :194 (comment at :281-282).
  • A for-await loop waits for each section in turn: Users, Limits, Reports, Mail, Registration with its pending list, Sign-in, Pages, Maintenance with its changes, Health.
  • The nav row is appended only after all of them (:244).
  • Inside Pages, siteIo.section reads landing, legal, registration, site-values and auth-pages first, and then the editors read their own settings again. Registration also reads its setting again.
  • Proposal: draw the nav first, start every section at once with Promise.allSettled, each with its own error slot (views.md:2390 still holds), and let site-io read lazily, on export or check.
  • Effort S-M. Risk low-medium: smoke may assume every section is ready once views.instanceAdmin resolves.

#70 Admin users / reports / maintenance / instance-admin: paged-list and tab-row scaffolding copied (duplication).

  • Where:
  • admin-users.js:77-92 and 152-173, against admin-reports.js:75-89 and 106-121
  • the cursor list again at admin-maintenance.js:124-147
  • the nav/pick tab row twice in instance-admin.js: 188-201 and 227-248
  • Users and reports share filterNow, query, the seq stale-answer guard, cursor concatenation, shownFilter and load-more.
  • admin-reports.js:187 borrows the CSS class users-filter.
  • Proposal: one M.pagedList({path, params, draw}) that handles seq and cursor, one M.sectionTabs(parts, open) used twice, and the CSS class renamed to admin-filter.
  • Effort M. Risk low-medium.

Order: #66 uses the field-refusal helper of tsk-d2mm4pwvwzza. Do that card first, or include the admin part of it here.