Create a tag at a given commit from the UI (commit view action), server-side via the WAL ref-update path #253
Labels
No labels
actions
bug
cli
duplicate
enhancement
fork
forum
git storage
help wanted
insights
invalid
issues
moderation
oidc
ownership transfer
packages
pr/merge protection rules
projects
pull requests
question
releases
sponsorships
tags
webhooks
wiki
wontfix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
crueber/walhub#253
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What's requested
Users should be able to create a tag pointing at a given commit from the UI — most naturally as an action on the commit detail view (
/:owner/:name/commit/:sha), with the tag name (and lightweight vs annotated choice) supplied by the user. Today tags can only arrive via git push.Current state (code evidence)
refs/tags/*into a WAL PUSH entry). The releases feature requires the tag to already exist:resolveTag(internal/releases/service.go:29-39) errorsunknown revisionwhenrefs/tags/<tag>is absent — so a release cannot create the tag, and there is no "new tag" UI anywhere (ReleaseNew.jsxpicks from existing tags via the tags ref stream, :16-17).EntryKindRefUpdate(internal/store/proto/types.go:47) carries aRefTransaction(updates, push options, atomic flag — types.go:148-152), andRefUpdatesupports symbolic targets and peeled shas (NewPeeled, types.go:144) — the peeled field is exactly what an annotated tag needs.publish.go:319already builds RefUpdate entries.refs/tags/<name>at the commit sha — expressible as a RefUpdate today). An annotated tag requires a tag object in the object store (type/tagger/message), which the current WAL entry kinds don't carry — PUSH brings objects+refs together, but there's no server-side "write object then move ref" path for tags.web/src/pages/Commit.jsx) has mode pills and check details but no per-commit action affordances; the tags list rides the same ref stream the picker uses (repoClient.tags({n:100}),ReleaseNew.jsx:16).Proposed design
POST …/api/tags(repo-scoped, following the repo API route twins pattern) with{name, sha, message?, ref_type: "lightweight"|"annotated"}. AuthWrite-gated (same as push). Server-side:EntryKindRefUpdatetransaction creatingrefs/tags/<name>at the given sha (CAS old-oid zero = create, matching the RefUpdate contract, types.go:141).internal/gitwraps it) and publish it as a PUSH-shaped entry, or (c) v1 ships lightweight-only and returns 422 for annotated with a clear message. Recommendation: (c) for the first cut unless (b) falls out cheaply — honest scope, no half-supported tag objects.refs/prefix rules, no~^:?*[\, no whitespace — the import parser's ref validation inservice.go:152-158is a reusable precedent); uniqueness (CAS create semantics → 409 on existing tag); sha must resolve in the repo (404 otherwise).Commit.jsx, an action affordance (pill/menu item alongside the diff-mode controls) opening a small inline form: tag name, optional message (message present ⇒ annotated request), submit → POST → navigate or toast. Also worth exposing the same action onCommits.jsxrows if it's cheap — but the commit detail view is the required surface per this request.ReleaseNewpicks from the tags stream — no change needed), the ref picker's tags stream, and bundle strategies' tag filters. Tag-created events should ride the existing ref-event publishing (internal/events) so notifications/webhooks see tag creation the same way they see pushed tags — verify the event producer keys on ref kind, not transport.Acceptance criteria
…/api/tagscreates a lightweight tag at a given sha; it appears in the tags ref stream,refsList(tags), and resolves via…/api/resolve/<tag>.NewPeeledrecorded, shows tagger/message in git) or explicitly rejected 422 with a documented message — no silent lightweight downgrade.PR #262 (branch fix/issue-253) implements this: POST /{o}/{r}/api/tags (both lanes) via new internal/tags, lightweight-only v1 (annotated → 422, follow-up), P6 write + policy create-check, 400/404/409 mapping, Create-tag affordance on Commit.jsx + SDK repo.tagsApi.create. internal/tags at 98.4% coverage, -race clean, end-to-end WAL round-trip incl. restart-replay proven in cmd/walhub test. Ready for review — not merging.
Review of PR #262 (fix/issue-253) — verified in scratch worktree /tmp/pr262 at
a938607(+1 fix pushed as7841369). No browser drive per task note (shared daemon blocks loopback); verdict rests on tests + reasoning.BUG FOUND + FIXED (pushed to origin/fix/issue-253 as
7841369):FOLLOW-UP FILED: PR claimed annotated support is 'the tracked follow-up' but no issue existed — filed #263 (annotated tag creation: tag-object write path under frozen proto rules, options (a)/(b) from #253).
VERIFIED OK (file:line):
TESTS (scratch worktree):
Minor nits (non-blocking, not fixed): policy check runs after git resolveCommit (one wasted subprocess on policy-denied requests); no DOM-level test for the Commit form (SDK + e2e cover the path; DOM kept thin per law 11).
MERGE RECOMMENDATION: ready to merge (pending CI). Do NOT merge from this review — left unmerged per instructions.
Fixed by PR #262 incl. review reportError fix (seams, CAS create, auth matrix verified; 98.4% coverage), merged. Closing.