Attach image stays in the menu, disabled, with its reason under (i)

Cycle: v3/attach_image_reason; Mode: one-shot; Record/index: this file, plans index

Debug mode: enabled (project marker .railspike_debug_on)

Effort study: railspike-effort, protocol P2, reference R1; cycle ledger. Standing enrollment.

Extended estimates: disabled (no real alternatives or work units)

Cycle estimate: 0.15 (intake, after reading image_upload.js and the composer)

Status: implemented and verified locally; next permitted action: maintainer review (PR), then a look on his iPhone after deploy.

Original request

Feedback item PF-20261104-F25, "Explain unavailable image attachment": show whether Attach image is unavailable only because the user is not logged in.

Later sources, same outcome:

  • 2026-11-25, ilyag (https://zenmemes.com/threads/thread-20261125084959-342240dd): "i'm once again logged into an approved account but have no attach image feature. if it's not available, it should at least report why to help troubleshoot."

  • 2026-11-28, ilyag (https://zenmemes.com/threads/thread-20261128192437-bc5ea4b6): "Whenever an option could be in the menu it should be shown disabled (most of the time?) Example: attach image". After Claude suggested keeping the item, disabled, with the reason under it: "Exactly. Let's save space and make the reason hidden under an I icon, please. Is this one-shot?" Claude answered yes, and that instances with images turned off should still leave the button out.

The general rule for other menus is PF-20261129-F18 and is not part of this cycle.

Authorization

The maintainer's scheduled daily task (stored prompt, run 2026-11-29): "Pick the most salient unclaimed backlog item(s) that are one-shot eligible ... Claim the item first ... Implement it following the repo's one-shot conventions, then open the PR." Together with his "Exactly ... make the reason hidden under an I icon" in the thread, that authorizes this one-shot through an open PR and a thread reply. Exclusions: merging, deploying, any change to what the server allows, and the general disabled-options rule (F18).

Claim: https://zenmemes.com/threads/thread-20261128192437-bc5ea4b6#reply-20261129163209-765f5a4107e508b245e9cb04b10a99dd (zenmemes.com has no backlog claims thread configured, so the claim: reply went in the source thread).

Outcome and work type

Application change. In the composer's "…" menu, Attach image is always listed when the instance allows images. While this browser can't attach one, it shows disabled with a small (i) beside it; tapping (i) shows the reason in one short line:

  • offline;

  • the page isn't on HTTPS (or the browser lacks signing support);

  • no key in this browser (guest);

  • this browser's key is waiting for approval;

  • this key isn't allowed to upload images;

  • the check couldn't finish (timeout or error), with a retry on the next focus or reconnect as today;

  • while the check runs, "Checking…".

When images are off for the instance, nothing changes: the server doesn't render the item.

Approach and risks

  • Considered: (A) reason as a title tooltip only: invisible on iPhone, where the reports came from. (B) a disabled item plus a <details> (i) toggle in the same menu, native, no extra script for the toggle. (C) reason as a second line in the disabled item: what the maintainer asked to avoid ("save space"). Chose B.

  • refreshEligibility() keeps its control flow; each early return records a short reason code that render() turns into text. The eligibility answers and assertEligible() don't change.

  • Disabled buttons don't receive taps, so the (i) sits beside the item, not inside it. It is a sibling in the menu list, pulled up to the item's right edge with CSS, so the existing .compose-action-menu-list > button rules keep styling Attach image.

  • Risk: theme rules for generic summary may decorate the (i). Check in Gloss, Word 97, Ochre and Bubblegum at 390 px.

  • First paint: the menu is closed on first paint, and the server renders the item disabled (not hidden), so there is no layout change when the check answers.

Reuse decisions

  • public/assets/image_upload.js (refreshEligibility, displayEligibility, render) extended in place.

  • templates/partials/composer.php keeps its menu item; drops hidden, adds disabled and the (i) disclosure next to it.

  • The (i) reuses the compose-options-help round badge from compose.css (the Markdown "?" in Options).

  • tests/browser/image_upload_eligibility.mjs extended; it already mocks /api/get_profile.

Completion conditions

On /compose/thread and the reply composer: a guest, a pending key, an unallowed key and an offline browser each see Attach image disabled in the "…" menu, and (i) shows the matching reason; an approved, allowed key sees it enabled as today, including the early offer for a remembered key. Images off: no item. Deploy with Deploy now; no schema change.

Concepts touched

None (photo details concept unchanged).

Verification and recovery plan

  • Browser test: extend tests/browser/image_upload_eligibility.mjs to render the menu placement and assert disabled/enabled and the reason text for each case; confirm the new assertions fail on the old script.

  • Existing browser tests that touch the menu item: image_content_browser.mjs, compose_layout_stability.mjs, image_photo_details.mjs.

  • ./v3 test --smoke plus any PHP test that renders the composer's image item.

  • Screenshots of the open menu at 390 px in Gloss, Word 97, Ochre, Bubblegum.

  • Not replayable here: the maintainer's iPhone with a pending device key. Reported unverified.

  • Recovery: revert the commit.

Starting revisions and branch

feat/attach_image_reason from origin/main dcfb654f9526.

Planning commit: 08ad8ee (plan and index entry only, before any implementation).

Debug log: attach_image_reason_debug_log.md

Study history

  • 2026-11-29 UTC, intake and execution entry: 0.15, recorded after reading image_upload.js and composer.php (not a clean intake). Claude, single exposed rater. Scope v1, reference R1, hashes not re-verified.

Dated execution history

  • 2026-11-29: item claimed in the source thread; plan written and committed (08ad8ee).

  • 2026-11-29: image_upload.js: displayEligibility() takes a reason code and, for a failed check, a Details text; each early return of refreshEligibility() passes its code (off, offline, insecure, nocrypto, guest, pending, not-allowed, error, checking). render() keeps the menu item listed unless images are off, disables it while not eligible, and fills the (i) disclosure. The dropzone placement keeps its old show-only-when-eligible rule. The check itself and assertEligible() are unchanged.

  • 2026-11-29: composer.php: the menu item renders disabled instead of hidden, followed by <details class="image-upload-why"> with the compose-options-help badge as its summary. Without JavaScript the reason reads "Attaching an image needs JavaScript."

  • 2026-11-29: compose.css: the (i) summary is a full-width, 44 px row pulled up over the disabled item, so a tap anywhere on the item opens the reason below it. Badge at the right edge.

  • 2026-11-29: failure path: a failed or timed-out check shows "Couldn't check whether this key can attach images. It checks again when you come back to this page." with a closed Details naming the step (image eligibility check (GET /api/get_profile)), the HTTP status and server error or the error name, the wait, online state, browser and time.

  • 2026-11-29, discovery (pre-existing, fixed because the tests cover this change): tests/browser/image_content_browser.mjs failed on main at three places unrelated to this change: the network error text now lives in the hidden technical details, the thread page shows a compressed display copy (image_loading) with the original behind a.post-image__original and a one-year cache header, and an accepted reply now navigates to the thread with created_post_id. tests/browser/compose_layout_stability.mjs timed out on main waiting for networkidle, which the page never reaches; it now waits for load and two frames.

Study history, closeout:

  • 2026-11-29 UTC: retrospective scope assessment 0.20: the change itself was as planned; two stale browser tests on main added work. Claude, single exposed rater. Maintainer judgment pending; measured time unknown.

Outcome

Delivered as planned. Attach image stays in the "…" menu, disabled, with its reason behind (i), on the New post page and in reply composers. Not done: the general rule for other menus (PF-20261129-F18).

Verification

  • node tests/browser/image_upload_eligibility.mjs: PASS. New menu cases: allowed (enabled, no reason), guest (with Choose a name link), pending, not allowed, failed check (reason plus Details naming the step and HTTP 500), offline, images off (not listed). Fails against the old script.

  • node tests/browser/image_content_browser.mjs (Chromium): PASS after the fixes above; its eligibility checks now assert the disabled item and the pending reason.

  • node tests/browser/compose_layout_stability.mjs: PASS (Light, Word 97, Chicago, Midnight at 390 and 1280 px, approved and not; phone fit in every theme). No layout shift when eligibility answers.

  • node tests/browser/image_photo_details.mjs: PASS.

  • ./v3 test --smoke LocalAppSmokeTest WriteApiSmokeTest: 721 run, 721 passed. The full suite was not run.

  • Screenshots of the open menu with a pending key at 390 px in Gloss, Word 97, Ochre, Bubblegum, Light and Engagify, closed and with the reason open: the badge sits at the item's right edge, the reason wraps under it, nothing overflows.

  • Not verified: the maintainer's iPhone with a pending device key (the reported condition), WebKit, and production.

Final review

Diff: image_upload.js, composer.php, compose.css, three browser tests, the feedback item and index, this record, its debug log and ledger. Reuses the compose-options-help badge and the existing eligibility check; no new dependency, flag or schema change. PF-20261104-F19's invalid Evidence value is fixed here too (same one-line fix as the triage PR #470) because ./v3 feedback index refuses to write while main has that problem.

Commit/merge/publication status

Completion commit 1c891b8 on feat/attach_image_reason; PR https://github.com/gulkily/v3/pull/471 opened 2026-11-29; not merged or deployed. This handoff commit records those references.

Attribution: Claude · 2026-11-29 UTC · Model: claude-opus-5-5