fix(share): tighten arc-paste edge + share-create UX - #47
Merged
Conversation
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)
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three independent fixes that surfaced while reviewing the share-page experience end-to-end. Each commit is self-contained.
8a439e7— Preserve quick-labelcomment_typethrough the popoverWhen 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, andarc share comments --jsonexposed the bug downstream too.Fix: hold the picked label on the page state (
pendingCommentType) and read it inhandlePopoverSavebefore falling back to the suggestedText inference. Confirmed end-to-end: the JSON bundle now reports"comment_type": "nit"etc.ffc0c6e—arc-paste: default-deny non-share routes at edge and in binaryarc-pasteonly 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. Refactoredrun()to extractnewRouter()so the same wiring is exercised in tests; new tests cover the/404 and JSON-shaped 404 on/api/v1/*.3103f62—arc share create: drop--local/--share, add--remote, single URL by kindThe 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 alocalhostlink.Preview URL (local-only — not reachable by others):Author URL (keep private — open it, then use the in-page Share link button to copy a reviewer URL):copyShareLinkstrips&t=).--localwas a no-op (already the default) → dropped.--sharewas the daily-driver "use my configured remote default" flag → renamed--remote(cleaner alongside--server; avoids thearc share create … --share --server foostutter).--server <url>unchanged; still wins and forces shared mode.resolveServersignature 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 locallybun run check && bun run testinweb/— svelte-check clean, 64 unit tests passmake build— frontend + binaries build with--webuitagarc share comments <id> --json; confirm"comment_type": "nit". Repeat for Issue / Suggestion / Question.curl -i https://<arcpaste-host>/→ 404;curl -i https://<arcpaste-host>/api/v1/projects→ 404 withContent-Type: application/json;curl -i https://<arcpaste-host>/share/<id>→ 200../bin/arc share create /tmp/plan.md→ exactly one URL line labeledPreview URL../bin/arc share create /tmp/plan.md --server http://localhost:7433→ exactly one URL line labeledAuthor URL../bin/arc share create plan.md --localand--shareboth error withunknown flag.#k=…and not&t=.