Commit Graph

9 Commits

Author SHA1 Message Date
q792602257 01b3375395 原型阶段 2026-06-09 23:44:31 +08:00
q792602257 3a448cee5f feat(mcp): IssueSystemTokenWithTx for cross-module tx (spec §6.1)
- Extract issueSystemToken helper; pool-bound + tx-bound entries share impl
- IssueSystemTokenWithTx accepts pgx.Tx, uses repo.WithTx(tx) for DB writes
- Audit Record stays outside tx (audit failure doesn't roll back business path)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 12:44:37 +08:00
q792602257 d0efe2bdd4 feat(mcp): admin token CRUD HTTP handler (POST/GET/DELETE) + TokenService.List/GetByID
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 11:04:37 +08:00
q792602257 a00f5a9efd refactor(mcp): apply Part 1 review I1+I3+I4+I5
- Rename MCPToken -> Token (mcp.Token reads cleaner; zero external callers yet)
- IssueSystemToken: guard against nil ACPSessionID / UserID (early input validation)
- TokenService: inject now func for clock injection (parity with RateLimiter)
- Repository CHECK constraint tests: assert wrapped CodeInternal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-08 10:28:49 +08:00
q792602257 71a3a85b26 fix(mcp): code review I2 — admin expires_at must be future + Part 3 tx TODO + scope JSON round-trip tests
- IssueAdmin now rejects past/now ExpiresAt with CodeMcpTokenExpiresRequired
- TestIssueAdmin_ExpiresMustBeFuture covers the new path
- IssueSystemToken doc comment notes pgRepo currently ignores ctx tx; Part 3
  must add Repository.WithTx for true same-transaction guarantee with
  acp_sessions (spec §6.1)
- New scope_test.go (whitebox) verifies JSON round-trip preserves nil-vs-empty
  semantics on Tools / ProjectIDs and exercises AllowsTool / AllowsProject
  edges that Authenticate / future tool gating depend on
2026-05-08 08:30:26 +08:00
q792602257 7d9cd4bf6b feat(mcp): TokenService.Revoke + RevokeBySession (with audit) 2026-05-08 08:02:11 +08:00
q792602257 796e1e0d4c feat(mcp): TokenService.Authenticate (hash lookup + revoked/expired check + async last_used) 2026-05-08 08:00:35 +08:00
q792602257 0081ad6e49 feat(mcp): TokenService.IssueSystemToken (with default scope + 24h TTL) 2026-05-08 07:59:00 +08:00
q792602257 d1573bde09 feat(mcp): TokenService skeleton + IssueAdmin 2026-05-08 07:57:17 +08:00