Skip to content

fix(share): tighten arc-paste edge + share-create UX - #47

Merged
bfirestone merged 4 commits into
mainfrom
fix/arc-paste-home-page
May 1, 2026
Merged

fix(share): tighten arc-paste edge + share-create UX#47
bfirestone merged 4 commits into
mainfrom
fix/arc-paste-home-page

Conversation

@bfirestone

Copy link
Copy Markdown
Contributor

Summary

Three independent fixes that surfaced while reviewing the share-page experience end-to-end. Each commit is self-contained.

8a439e7 — Preserve quick-label comment_type through the popover

When a quick-label without a preset body (Nit / Issue / Suggestion / Question) routed the user into the comment popover for body text, the picked taxonomy was dropped — every saved annotation became a generic comment. Visually identical, taxonomically wrong, and arc share comments --json exposed the bug downstream too.

Fix: hold the picked label on the page state (pendingCommentType) and read it in handlePopoverSave before falling back to the suggestedText inference. Confirmed end-to-end: the JSON bundle now reports "comment_type": "nit" etc.

ffc0c6earc-paste: default-deny non-share routes at edge and in binary

arc-paste only legitimately serves /share/<id>, /api/paste/*, /_app/*, and /robots.txt. Previously the embedded SPA fallback handed back the arc app shell at /, and the SPA's /api/v1/* boot probes fell through to that fallback and returned HTML — which the browser then failed to JSON.parse.

Fix: default-deny at both layers (Caddyfile and the Echo router in main.go). Defense in depth so dev (no Caddy) and prod behave identically. Refactored run() to extract newRouter() so the same wiring is exercised in tests; new tests cover the / 404 and JSON-shaped 404 on /api/v1/*.

3103f62arc share create: drop --local/--share, add --remote, single URL by kind

The CLI used to print both the reviewer URL and the author URL on every successful create. Copy-pasting the wrong line handed recipients author privileges via the &t= token; for local shares the reviewer URL was actively misleading because nobody can reach a localhost link.

  • Output is now one URL line, branching on share kind:
    • localPreview URL (local-only — not reachable by others):
    • sharedAuthor URL (keep private — open it, then use the in-page Share link button to copy a reviewer URL):
  • Reviewer URL is no longer CLI-printed in either mode. Authors get one by opening the link and clicking the in-page Share link button (already exists — copyShareLink strips &t=).
  • --local was a no-op (already the default) → dropped.
  • --share was the daily-driver "use my configured remote default" flag → renamed --remote (cleaner alongside --server; avoids the arc share create … --share --server foo stutter).
  • --server <url> unchanged; still wins and forces shared mode.
  • resolveServer signature simplified from (local, share, override) to (remote, override).

No backwards-compat alias — branch owner confirmed.

Test plan

  • go test -count=1 ./cmd/arc/... ./arc-paste/... — passes locally
  • bun run check && bun run test in web/ — svelte-check clean, 64 unit tests pass
  • make build — frontend + binaries build with --webui tag
  • Quick-label save: select text on a share, click quick-label icon → pick "Nit" → type a body → save. Inspect via arc share comments <id> --json; confirm "comment_type": "nit". Repeat for Issue / Suggestion / Question.
  • arc-paste edge lockdown: curl -i https://<arcpaste-host>/ → 404; curl -i https://<arcpaste-host>/api/v1/projects → 404 with Content-Type: application/json; curl -i https://<arcpaste-host>/share/<id> → 200.
  • share-create local: ./bin/arc share create /tmp/plan.md → exactly one URL line labeled Preview URL.
  • share-create remote: ./bin/arc share create /tmp/plan.md --server http://localhost:7433 → exactly one URL line labeled Author URL.
  • dropped flags: ./bin/arc share create plan.md --local and --share both error with unknown flag.
  • reviewer URL flow: open the printed Author URL → click in-page Share link button → confirm clipboard URL contains #k=… and not &t=.

bfirestone added 4 commits May 1, 2026 10:16
When a quick-label without a preset (Nit/Issue/Suggestion/Question) routed
the user into the comment popover for body text, the picked taxonomy was
dropped — every saved annotation became a generic 'comment'. The popover
save now reads a held `pendingCommentType` first, falling back to the
suggestedText inference only when nothing was explicitly picked.
arc-paste only owns /share/<id>, /api/paste/*, /_app/* and /robots.txt.
Previously the embedded SPA fallback served the arc app shell at /, and
the SPA's /api/v1/* boot probes fell through to that fallback and returned
HTML — which the browser then failed to JSON.parse. Lock the surface down
both at Caddy and in the Echo router so dev (no Caddy) and prod behave
identically. Adds tests covering the / 404, /api/v1/* JSON 404, and the
existing share-create path against the same router used in production.
… kind

`arc share create` previously printed both the reviewer URL and the author
URL on every successful create. Copy-pasting the wrong line handed
recipients author privileges via the &t= token, and for --local shares
the printed reviewer URL was actively misleading — a localhost link
isn't reachable by anyone else.

Output now branches on share kind:
  - local  -> "Preview URL (local-only — not reachable by others):"
  - shared -> "Author URL (keep private — open it, then use the in-page
              Share link button to copy a reviewer URL):"

Reviewer URL is no longer printed by the CLI in either mode. The author
opens the link and copies a `#k=…`-only URL via the existing in-page
Share-link button (web/src/routes/share/[id]/+page.svelte:copyShareLink),
which already strips &t=.

Flag surface tightened:
  - --local was a no-op (default) -> dropped
  - --share renamed to --remote (cleaner reads next to --server foo,
    avoids the awkward "share … --share" stutter)
  - --server <url> unchanged; still wins over --remote and forces shared

`resolveServer` signature simplified from (local, share, override) to
(remote, override). New unit tests assert the URL output for both kinds
and the absence of the old "Share URL" / "send to reviewers" lines.
Runbook and config doc comment updated to match.
- gofmt cmd/arc/share_test.go (struct field alignment)
- wrap two over-120-char lines in cmd/arc/share.go (revive line-length-limit)
- handle db.Close() error explicitly in arc-paste/main_test.go (revive unhandled-error)
@bfirestone
bfirestone merged commit 876e40f into main May 1, 2026
3 checks passed
@bfirestone
bfirestone deleted the fix/arc-paste-home-page branch May 1, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant