Commit 5577ccb
chore(auth): v3.4 batch — 4 nit cleanup + drop JWT-era 410 stubs
Picks up 4 of the v3.3.6 §7 follow-up nit list + removes 2 leftover
JWT-era compatibility stubs. All in octo-server, no cross-repo
coupling. Strict scope per caster's principle: no compat for
nonexistent clients post-Phase 4.
## Changes (5 items, all runtime-branch-exclusive surfaces)
### nit-3 — botToken empty Bearer guard (bot_provision/bot_api.go)
Empty Bearer guard after TrimPrefix. Behavior alignment (early reject)
with verify-api-key's empty-field guard — robustness/symmetry, not
client compatibility.
### nit-6 — Remove unreachable botUID == "" dead code (bot_provision/bot_api.go)
gin's :uid param cannot be empty after the route matches; the guard
was carried over from the legacy JWT handler.
### nit-10 — Delete redundant deps_test.go (user/)
zz_external_setup_test.go's internal blank-import is a strict superset
of deps_test.go's 4-module subset. Updated zz header with supersedes
note. runtime-branch-only — main keeps deps_test.go (no zz on main).
### nit-11 — Fix stale test header (user/api_verify_apikey_test.go)
"6 cases" → 15 cases enumeration.
### Drop JWT-era 410 Gone stubs (bot_provision/bot_api.go)
Removed `r.GET("/.well-known/jwks.json", gone410Handler(...))` +
`r.POST("/v1/auth/token", gone410Handler(...))` + the
`gone410Handler` helper + 2 `TestGone410_*` test cases.
These stubs were registered to give pre-Phase 4 JWT-era daemon clients
a 410 + migration body instead of gin's default 404. But JWT was
removed in Phase 4 (决策一+二) and no real client ever ran the
pre-removal version (PoC-only). Compat scaffolding for nonexistent
clients — dropping it per caster's principle. gin default 404 on
unregistered URLs is functionally equivalent for the actually-zero
caller population.
Same reasoning as why nit-4 (JWT-shaped Bearer in-handler hint) was
also dropped — both branches assumed a JWT-era caller that doesn't
exist.
## Impact on main branch — 0
All 5 changes touch runtime-branch-exclusive surfaces:
- bot_provision/ module: does not exist on main
- /v1/auth/verify-api-key test: runtime-branch-only
- zz_external_setup_test.go: runtime-branch-only; deleting deps_test.go
on runtime branch leaves main's deps_test.go untouched
- 410 stubs were registered by bot_provision which doesn't exist on main
## Verification
- `go build ./...` PASS
- `go vet ./modules/user/... ./modules/bot_provision/...` PASS
- `go test -count=1 -p 1 -run 'TestAuthVerify|TestBotToken|TestGone410'
./modules/user/... ./modules/bot_provision/...` PASS (user 3.8s,
bot_provision 2.0s — TestGone410_* skipped since deleted)
- `go test -race -count=1 -p 1 -run 'TestAuthVerify|TestBotToken'
./modules/user/... ./modules/bot_provision/...` PASS (user 7.0s,
bot_provision 3.6s)
- 4 TestDestroyApply_* failures observed during full-package runs are
pre-existing flaky (verified on clean origin/feat/agent-runtime
without this PR) — redis login-locked state leaks across tests.
## State-space scan (D1-D13)
- D1 primitive call-site coverage: not applicable — no SQL changes
- D4 response shape: no changes
- D5 cross-PR contract: no changes
- D11 revocation chain: explicitly NOT extended. Bot retention after
owner ban remains per main branch semantic.
## Out of scope
- nit-5 owned_bots shape unify (cross-repo D10)
- nit-7 constant-time api_key compare (SQL semantic change)
- nit-8 account-ban gate on owned-bot loaders (reverted; preserves main
semantic)
- nit-9 robot composite index (separate migration PR)
- verifyCache sha256-ize redis key (security polish)
- nit-4 JWT-shaped Bearer in-handler hint (reverted; same reasoning as
410 stub removal — no real JWT-era client)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f39d91f commit 5577ccb
5 files changed
Lines changed: 18 additions & 117 deletions
File tree
- modules
- bot_provision
- user
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
118 | 121 | | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
| |||
187 | 186 | | |
188 | 187 | | |
189 | 188 | | |
190 | | - | |
191 | | - | |
| 189 | + | |
| 190 | + | |
192 | 191 | | |
193 | 192 | | |
194 | 193 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | 194 | | |
202 | 195 | | |
203 | 196 | | |
| |||
220 | 213 | | |
221 | 214 | | |
222 | 215 | | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | 216 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | 254 | | |
305 | 255 | | |
306 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
0 commit comments