Commit 7757628
authored
release: promote dev to main (P6 backend-unblocked + trace-by-id fix) (#21)
* feat(cli): add P6 backend-unblocked CLI surfaces (issue #16) (#19)
* plan(p6): add domain coverage P6 backend-unblocked CLI plan
Mirrors issue #16 scope (7 command surfaces) as 4 grouped implementation
phases with TDD per the user's request. Backend evidence: digitopvn/goclaw
PR #37 + PR #44. Verified beta tag containing PR #44 is v3.12.0-beta.20.
Phases:
1. Scope Lock — contract re-verification, drift sweep
2. Traces Follow + Providers Reconnect (PR #37)
3. Sessions Branch + Follow (PR #44 chat)
4. Channels Writers Test (PR #44 channels)
5. Activity + Logs Runtime Aggregate (PR #44 aggregation)
6. Tests + Docs sweep with out-of-scope red-team
7. Ship Readiness — single PR to dev
Out-of-scope list retained verbatim from issue #16: traces replay,
generic logs aggregate, WS/SSE chat history, watch loops.
* feat(cli): add P6 backend-unblocked CLI surfaces (issue #16)
Seven one-shot HTTP commands wired to backend PRs #37 and #44
(gateway tag v3.12.0-beta.20+). TDD: failing tests landed before each
implementation slice; all suites green under -count=1.
PR #37 surfaces:
- traces follow --session-key|--agent [--since --limit --include-spans
--status --channel]: GET /v1/traces/follow
- providers reconnect <id>: POST /v1/providers/{id}/reconnect
PR #44 surfaces:
- sessions branch <key> --up-to-index N [--new-session-key --label
--metadata k=v]: POST /v1/chat/sessions/{key}/branch.
--up-to-index=0 preserved literally on the wire (bypasses buildBody
int-zero skip).
- sessions follow <key> [--cursor N --limit N]: one-shot cursor-based
history poll, NOT a watch loop. --cursor=0 preserved in raw query.
- channels writers test <id> --group-id G --user-id U: POST writers/test
with body containing exactly two keys.
- activity aggregate --group-by {action|actor_type|entity_type|actor_id}
[--from --to --limit + scope filters]: subcommand of existing activityCmd.
- logs aggregate [--group-by {level|source} --level --source --from]:
ring-buffer summary, distinct from logs tail.
Shared formatLastSeen helper type-switches RFC3339-string vs epoch-millis
last_seen so neither aggregate command renders scientific notation in
table view.
All path params url.PathEscape'd; all flag validation runs before HTTP
call; central error handler honored (no direct error printing).
Docs: README + docs/codebase-summary + CHANGELOG updated.
Closes #16
* fix(cli): render trace details by id with validation + exit-code mapping (issue #17) (#20)
Closes #17.
Bug surface: `goclaw traces get <id>` was unreadable in TTY mode (dumped raw JSON),
silently swallowed unmarshal errors (empty `{}`), accepted any raw id including
path-traversal sequences (`..`, `/`, control chars), and collapsed every server
failure to exit code 1 regardless of HTTP status.
Fixes:
- `cmd/traces.go`
- `tracesGetCmd.RunE`: validate id allowlist before HTTP, decode payload with
error surfacing, render header card + span tree + events list for TTY,
pass-through JSON for `-o json` / piped stdout.
- `validateTraceID`: regex allowlist `^[A-Za-z0-9._-]+$` + reserved-token reject
(`.`, `..`, empty/whitespace). Returns typed `*client.APIError{Code: INVALID_REQUEST}`
so the central error handler maps it to exit code 4.
- `renderTraceTable` + `buildSpanTree`: insertion-ordered span tree, orphan spans
attach to virtual root. No relink walk, cycle-safe (cycles silently drop).
- `internal/client/http.go`
- Retry loop bug: previously closed `resp.Body` on every iteration including the
final attempt, then `io.ReadAll` after the loop failed with
"read on closed response body". This collapsed typed `APIError` into an opaque
wrapped error and lost the exit-code mapping for 5xx/429. Fixed by skipping
the per-iteration close on the final attempt; outer `defer` handles cleanup.
Exit-code contract for `traces get`:
- 0 success / 2 permission denied / 3 not-found /
4 malformed id (pre-HTTP) / 5 server failure / 6 rate-limit.
Tests: 10 new tests in `cmd/traces_get_test.go` lock the wire contract,
table+JSON rendering, exit-code mapping per HTTP status, and the
"malformed id makes zero HTTP calls" invariant (parameterized table).
Fixture `cmd/testdata/trace_detail_get.json` is a scrubbed stub with
`_TODO_refresh` marker; refresh against live gateway before merging to default.
Docs: CHANGELOG `[Unreleased]` Fixed entry, README `Reading a Trace by ID`
section with exit-code table, `docs/codebase-summary.md` traces bullet updated.
* docs: add planning artifacts for P6 backend-unblocked CLI and skill scaffold1 parent 445c939 commit 7757628
57 files changed
Lines changed: 8065 additions & 10 deletions
File tree
- cmd
- testdata
- docs
- internal/client
- plans
- 260417-1254-goclaw-claude-skill
- 260527-1412-domain-coverage-p6-backend-unblocked
- reports
- 260528-1357-fix-trace-details-by-id
- reports
- reports
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
49 | 62 | | |
50 | 63 | | |
51 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
94 | 139 | | |
95 | 140 | | |
96 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
0 commit comments