oliver-zehentleitner / maity

clean-up: web shell: sign-in probe through api.js, one withNext, swallowed errors, no older-hub bootstrap path

Sign in to report

tsk-58cxde7nt4be Review Maity Coder Claude 003

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

#4 Shell (sign-in page): a raw fetch around api.js, a second public-page probe and a swallowed error (design/debt).

  • Where: app.js:452-462 calls window.fetch(address + "?as=public", {method: "HEAD"}), checks r.headers.get("etag") and ends in an empty .catch.
  • It is the only fetch outside api.js. It re-splits the path itself (:454 with OWN_WORDS) instead of using parseRoute/route.js, and it infers "a public page exists" from an ETag header. A failure vanishes silently.
  • For /owner/slug, drawing() has already asked M.visitor.page (GET /public/pages/...) the same question.
  • :2443-2444 also copies the view-word list of visitor.js, ["board","team","organisation","why"] (visitor.js:197).
  • Proposal: pass "where" into renderLogin and reuse the answer of visitor.page, or call M.api.get on /public/pages/... (already in PUBLIC_PATH, api.js:6106). Export the view-word list from visitor.js.
  • Effort S-M. Risk low-medium, because this runs before sign-in.

#5 Shell: two withNext rules that behave differently (duplication).

  • Where: app.js:362 defines M.withNext as route + "?next=" + encodeURIComponent(back). site-chrome.js:103-107 has a local withNext that keeps an existing query and fragment.
  • The exported version yields "?...?next=" on any route that already has a query. Its callers include not-found.js, visitor.js, invite.js and report.js.
  • Proposal: keep the query-aware version as M.route.withNext and delete both copies.
  • Effort S. Risk low.

#8 Shell: swallowed errors and small duplicate helpers (debt/duplication).

  • app.js:1137: the GET .../roles of agentOwnersForm has an empty .catch, so a failed read silently hides custom roles. That goes against views.md e1699490.
  • app.js:1801: leadChat.found(...) is called with an empty callback.
  • M.withMembers is assigned twice, at app.js:1956 and :2636.
  • pullsUrl (:289) and actionsUrl (:294) repeat the same repository-URL cleanup (see also tsk for the project views, finding #31).
  • refusalWords at site-io.js:83-86 copies refusal at auth-pages.js:39-43 (and register.js:156).
  • isObject exists four times: site-io.js:28, auth-pages.js:23, json-io.js:14, landing.js:89.
  • Proposal: show the roles failure in the hint line, drop the second withMembers, use one forge URL helper, and export refusal and isObject once (json-io.js).
  • Effort S. Risk low.

#9 Shell boot: the "older hub" fallback for /bootstrap (debt, contradicts context).

  • Where: app.js:2325-2330 ("an older hub 404 leaves them to their own routes"), the fixture knob MAITY_FIXTURE_NO_BOOTSTRAP (api.js:5847-5851, 5978-5985, the swallow at 5996), its smoke case (web/tools/smoke.js:15765-15772) and e2e step (web/tools/e2e.py:687-688), and decision 884b01fe (web/context/views.md:5985-6018).
  • This contradicts views.md e1699490: alpha, no compatibility layers. The hub always serves /bootstrap (hub routes/bootstrap.py:63).
  • Proposal: keep the fallback only for real failures (refusal, limit, no answer) and let a 404 surface as an error. Drop the knob, the smoke case and the e2e step, and update 884b01fe.
  • Effort S. Risk low.
  • Open question for the lead: 884b01fe is a recorded decision. Confirm that it may be narrowed as above.

Notes

  1. Maity Coder Claude 003 · Nov 25, 2026, 21:16 UTC

    Split (lotse, 2026-11-25 21:15Z): this card ships in two PRs.

    • PR A, now (#5, #8): one query- and fragment-aware withNext, the second M.withMembers dropped, one forge-URL helper, isObject and the refusal wording exported once, and the roles read failure said. Branch claude003/shell-cleanup-a.
    • PR B, after launch, not started (#4, #9): this path runs before sign-in and is the first thing a new visitor sees.
    • #4: the sign-in page's public-page probe goes through api.js (reusing visitor.page's answer or M.api.get on /public/pages/…) instead of a raw fetch HEAD, and failures are said. The view-word list is exported once from visitor.js.
    • #9: 884b01fe is narrowed, as lotse confirmed. A 404 from /bootstrap surfaces as an error, and the fallback stays only for refusal, limit and no answer. The MAITY_FIXTURE_NO_BOOTSTRAP knob, its smoke case and the e2e step go. 884b01fe is updated in its own context commit.

    The card is reported only after PR B.

  2. Maity Coder Claude 003 · Nov 28, 2026, 09:11 UTC

    PR A: draft PR 2258 (https://github.com/oliver-zehentleitner/maity/pull/2258), branch claude003/shell-cleanup-a, head b4ced819 (5ef30581 plus a merge of main c0ea455a). Web check, smoke and the changelog check are green after the merge; e2e is left to CI. lotse opened the PR because opening it from this clone, and maity checkpoint, are blocked by the NOTES_MERGE_WORKTREE stub (tsk-c55vrwabp6wc), which is why this is a note and not a checkpoint.

    Next: wait for the review results on PR 2258 and answer them on the same branch (merge main, never rebase). PR B (findings 4 and 9) waits until after the launch and the Claude freeze. The card is reported only after PR B.

  3. Maity Coder Claude 003 · Nov 28, 2026, 09:27 UTC

    PR 2258 (PR A): both legs approve head b4ced819: A2809 (maity-review-codex-001) and A2810 (maity-review-agy-001). It waits for ci-ok, MERGE-READY and lotse's merge. I won't push to it.

    P3 nits for PR B to pick up (from A2810, not done in A):

    • app.js:1237: the roles failure reads err.message || String(err) with no nullish guard (use (err && err.message) || String(err), as json-io.js does), and the appended span has no live role.
    • route.js withNext appends next= without checking for an existing next=. No caller can reach that today. Guard it or say why not, when PR B touches the sign-in path.