···11+# Phase 2 — Issues and Browse
22+33+- **Date**: 2026-05-02
44+- **Status**: In Progress
55+66+## Goal
77+88+Implement issue list/create/view/close/reopen/edit/comment and browse commands, using Constellation backlinks for cross-PDS queries and Tangled issue/state/comment records for writes.
99+1010+## Investigation Notes
1111+1212+- TS CLI uses Constellation `/links` and reads the `linking_records` response field.
1313+- `sh.tangled.repo.issue` links to a repo through `.repo`; comments and state records link to an issue through `.issue`.
1414+- Issue state uses `sh.tangled.repo.issue.state.open` and `.closed`.
1515+- Repository AT-URI cannot be guessed from owner/name; it must be found by listing the owner DID's `sh.tangled.repo` records and matching `name`.
1616+1717+## Plan
1818+1919+1. Add Constellation client tests for request shape and response mapping.
2020+2. Add issue identifier tests for `1`, `#1`, and rkey resolution.
2121+3. Implement AT-URI parsing and repository AT-URI resolution.
2222+4. Implement issue service operations against PDS plus Constellation.
2323+5. Implement body input helper and `issue` CLI commands.
2424+6. Implement `browse` URL construction and opener command.
2525+7. Validate with unit tests, lint/build, and a real create/comment/close/reopen flow on `onev.cat/tang-playground` or the current repo if the playground context is not locally available.
2626+2727+## Validation Log
2828+2929+- Completed: unit tests cover Constellation `/links` request/response mapping, AT-URI parsing, issue identifier resolution for `1` / `#1` / rkey, body input, and browse URL construction.
3030+- Completed: `go test ./...` passed.
3131+- Completed: `PATH="$(go env GOPATH)/bin:$PATH" make lint` passed with 0 issues.
3232+- Completed: `make build` passed and `./bin/tang --help` lists `issue` and `browse`.
3333+- Completed: `GOOS=linux GOARCH=amd64 go build ./cmd/tang` passed.
3434+- Completed: real login using `~/Desktop/tang` succeeded for `onev.cat`.
3535+- Completed: real E2E in a temporary git context with remote `git@tangled.org:onev.cat/tang-playground.git`:
3636+ - `tang issue create --body ... --json=uri,title,state` created `at://did:plc:kl2ejrmz5zmxnno3ll4luz76/sh.tangled.repo.issue/3mkuteffbxa2b`.
3737+ - `tang issue comment 3mkuteffbxa2b --body ...` succeeded.
3838+ - `tang issue close 3mkuteffbxa2b` succeeded.
3939+ - `tang issue reopen 3mkuteffbxa2b` succeeded.
4040+ - `tang issue view 3mkuteffbxa2b --json=issue` returned the created title and `open` state.
4141+- Completed: `tang issue list --state all --limit 5 --json=number,title,state` in `tang-playground` returned 1 indexed issue.
4242+- Completed: `tang browse` in the temporary `tang-playground` git context exited successfully and opened the repository page through the system browser.
4343+- Completed: AppView check with `curl https://tangled.org/onev.cat/tang-playground/issues/1` found the created issue title and open state.
4444+4545+## Notes
4646+4747+- After `tang issue close`, an immediate AppView HTML check still showed `open`. The CLI writes `sh.tangled.repo.issue.state` records successfully, but AppView state consumption or indexing appears delayed or incomplete. The issue was reopened after this check, and the final AppView state is open.
4848+- New issue records may take a short time to appear through Constellation. CLI commands that receive a direct rkey use a session-DID fallback so create/comment/close/reopen flows can continue before indexing catches up.
4949+5050+## Completion
5151+5252+Phase 2 is complete. The only uncertainty is AppView's immediate consumption of issue state records, recorded above as a protocol/AppView limitation rather than a CLI blocker.