Commit Graph

93 Commits

Author SHA1 Message Date
Your Name
df8d73b4e3 refactor(supply-api): declarify bootstrap server assembly 2026-04-16 07:24:13 +08:00
Your Name
b9b875ac39 refactor(supply-api): split bootstrap http assembly 2026-04-16 07:11:33 +08:00
Your Name
39c4a11ff9 refactor(supply-api): split runtime store bundle builders 2026-04-15 23:27:11 +08:00
Your Name
22575bdd82 refactor(supply-api): split background startup helpers 2026-04-15 22:58:12 +08:00
Your Name
6e5a36bda1 refactor(supply-api): split runtime assembly helpers 2026-04-15 22:31:50 +08:00
Your Name
56cb40c1f9 refactor(supply-api): normalize app server defaults 2026-04-15 21:54:49 +08:00
Your Name
bec2a7bd1d refactor(supply-api): precheck main env before config load 2026-04-15 20:14:59 +08:00
Your Name
5ae0861fc3 refactor(supply-api): guard unsupported env values 2026-04-15 19:24:20 +08:00
Your Name
d348d5a2c6 refactor(supply-api): normalize runtime startup defaults 2026-04-15 19:12:27 +08:00
Your Name
6940ff52b6 refactor(supply-api): layer runtime startup flow 2026-04-15 18:42:06 +08:00
Your Name
bdacc4452c refactor(supply-api): deduplicate bootstrap assembly 2026-04-15 17:30:10 +08:00
Your Name
1776862768 refactor(supply-api): remove panic-only helper paths
Return explicit errors from AlertAPI construction instead of panicking inside the library layer, and let main own process-level failure handling.

Also delete the unused config.MustLoad helper and lock the supported config loading paths with tests.
2026-04-15 15:38:57 +08:00
Your Name
0c370e9353 refactor(domain): simplify outbox retry policy
Reduce the domain outbox surface to the shared retry/backoff contract that is actually consumed by the runtime layer.

Also make batch compensation processing pick up retrying records explicitly and cover that path with tests.
2026-04-15 10:44:05 +08:00
Your Name
567446bb25 test(repo): cover untested core packages 2026-04-15 10:17:32 +08:00
Your Name
98b1c2a86f chore(supply-api): refresh idempotency bootstrap comments
Update stale main.go comments so they match the current single-path idempotency behavior and no longer describe the removed inline fallback path.
2026-04-14 12:35:01 +08:00
Your Name
88d842648d chore(repo): align integrity entrypoints with current state
Rewrite module READMEs around the current verified run and test paths, tighten repo_integrity_check.sh with fact-source checks, update supply-api migration baseline, and remove the platform-token-runtime audit query placeholder response.
2026-04-14 12:29:13 +08:00
Your Name
ab0b0cc031 fix(supply-api): close sms verify and audit flush gaps
Use a shared in-memory code store across mock, Tencent, and Aliyun SMS services so send and verify follow the same contract. Also surface batch flush failures through FlushNow and explicit error tracking hooks for audit buffering.
2026-04-14 12:22:10 +08:00
Your Name
ad8d4bda9e feat(supply-api): align schema with repository contract 2026-04-14 12:13:36 +08:00
Your Name
55a6e7424a refactor(supply-api): remove inline idempotency fallback 2026-04-14 12:00:17 +08:00
Your Name
6d7ef661e6 feat(supply-api): persist audit alerts 2026-04-14 11:52:45 +08:00
Your Name
d28f83a6a8 chore(repo): add integrity baseline check 2026-04-14 10:38:24 +08:00
Your Name
fc3c1fe0a8 docs(gates): consolidate legacy tok archives 2026-04-14 07:26:28 +08:00
Your Name
ec62c801d8 docs(gates): admit verified 2026-04 snapshots 2026-04-13 21:47:19 +08:00
Your Name
e54cba9feb docs(gates): admit local staging evidence 2026-04-13 21:45:35 +08:00
Your Name
af3b9943be chore(cleanup): resolve pending supply-api files 2026-04-13 21:20:24 +08:00
Your Name
ecdead0a03 docs(plan): define gate archive admission roadmap 2026-04-13 21:15:32 +08:00
Your Name
24e85cab43 docs(gates): backfill archive csv snapshots 2026-04-13 21:07:26 +08:00
Your Name
9ad3980ae2 docs(gates): add root archive index 2026-04-13 21:03:44 +08:00
Your Name
90d71eb4ca refactor(outbox): remove runner event copy 2026-04-13 20:59:14 +08:00
Your Name
64f99a45e6 refactor(compensation): use handler registry 2026-04-13 20:56:02 +08:00
Your Name
a94de1b32b refactor(outbox): share domain backoff policy 2026-04-13 20:54:38 +08:00
Your Name
7f8143e3ac chore(config): separate local override guidance 2026-04-13 20:52:53 +08:00
Your Name
10d79be2c3 docs(cleanup): add committable cleanup plan 2026-04-13 20:31:05 +08:00
Your Name
aecba5ff27 docs(review): add remediation plans and readiness artifacts
Add design, review, and production-readiness documents for the April remediation cycle.\nInclude supporting SQL and supply-api operational design notes so review conclusions and implementation guidance stay versioned together.
2026-04-13 18:54:45 +08:00
Your Name
a2f042f1c2 test(supply-api): expand e2e coverage and support unix socket dsn
Add broader e2e coverage for account, package, billing, tracing, and reliability scenarios.\nSupport Unix socket DSN formatting in config and cover it with unit tests.\nIgnore local assistant metadata and generated gate artifacts to reduce workspace noise.
2026-04-13 18:53:35 +08:00
Your Name
841d75191e refactor: 使用结构化日志替代标准 log 包
将所有 log.Printf/Println 调用替换为 logging.Logger 结构化日志输出:
- internal/middleware/auth.go: AUTH_WARNING 和 AUTH_ERROR 日志
- internal/middleware/middleware.go: Recovery 中间件 panic 日志
- internal/domain/account.go: emitAudit 审计错误日志
- internal/domain/settlement.go: emitAudit 审计错误日志
- internal/domain/package.go: emitAudit 审计错误日志
- internal/domain/compensation.go: 补偿处理器所有日志
- internal/compensation/compensation.go: 补偿执行器所有日志
- internal/outbox/outbox.go: OutboxProcessor 所有日志
- internal/iam/middleware/scope_auth.go: WILDCARD_SCOPE_ACCESS 审计日志

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 09:49:58 +08:00
Your Name
bf6fc09b88 refactor(cmd): main.go 使用结构化日志替代标准 log
1. 移除标准库 log 导入
2. 使用 jsonLogger 输出结构化 JSON 日志
3. 添加格式化日志方法 (Infof, Errorf, Fatalf)
4. Fatalf 现在会调用 os.Exit(1)

日志格式示例:
{"timestamp":"...","level":"INFO","service":"supply-api","message":"starting supply-api in prod mode"}

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 07:46:52 +08:00
Your Name
789707e4f3 feat(logging): 添加 slog-based 结构化日志支持
1. 添加 slog_logger.go 实现基于 Go 1.21+ slog 的结构化日志
2. 支持 trace_id、request_id、tenant_id 等标准字段注入
3. 添加日志标准化重构方案文档

推荐使用 Go 内置 log/slog,无需第三方依赖。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 07:41:37 +08:00
Your Name
826a17158c fix(e2e): 添加 GetBillingSummary mock 实现
修复 e2e 测试因 SettlementService 接口变更导致的编译错误。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 07:32:41 +08:00
Your Name
116eabf427 refactor(httpapi): 统一错误码格式
1. 创建 error_codes.go 定义标准化错误码常量
2. 替换所有硬编码错误码为常量引用
3. 修复 goroutine 未传递 context 的问题

错误码格式:
- HTTP 层通用错误: SUP_HTTP_XXXX
- 业务错误码: SUP_XXX_NNNN

修复:
- db_token_backend.go: goroutine 使用 ctx 而非 context.Background()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 23:04:59 +08:00
Your Name
413a3bf0fa feat(domain): 添加 SettlementService.GetBillingSummary 接口方法
问题:settlementService.GetBillingSummary 方法存在但未在接口中暴露
解决:
1. 在 SettlementService 接口添加 GetBillingSummary 方法
2. 添加 TestSettlementService_GetBillingSummary 测试

Coverage:
- GetBillingSummary: 0% -> 100%
- Total domain coverage: 72.0% -> 72.3%

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-12 22:58:41 +08:00
Your Name
2b1f4f10cd chore(supply-api): add compiled binary 2026-04-12 19:33:20 +08:00
Your Name
5ea6750cf3 test(supply-api): validate shipped config samples
Add regression tests for the shipped development and SMS sample configs, and fix the SMS example to match the runtime flat Config schema instead of nested provider blocks. Verified with fresh go test runs for ./internal/config and ./internal/sms before commit.
2026-04-11 11:31:05 +08:00
Your Name
2bc4a00ecd test(supply-api): add repository integration suite and runner
Add repository integration probes, repository policy tests, the compose-based integration runner, and the matching usage documentation. Align the runner environment with both repository and middleware integration test expectations, and verify with fresh repository tests, integration-tag test runs, bash -n, and docker-compose config before commit.
2026-04-11 11:25:19 +08:00
Your Name
ee569e7edb test(supply-api): add benchmark and test helper support
Add benchmark documentation and middleware benchmark coverage, fix the settlement benchmark mock to satisfy the current SettlementStore interface, and add reusable domain test helper packages. Verified with fresh go test runs for ./internal/testutil/... and go test -tags=slow -run '^$' ./internal/benchmark/... before commit.
2026-04-11 11:18:45 +08:00
Your Name
6a5730a261 feat(supply-api): restore domain outbox support and worker tests
Add the domain-level outbox processor implementation required by existing domain tests, and add regression coverage for compensation worker cancellation behavior. Verified with a fresh go test run for ./internal/domain before commit.
2026-04-11 10:45:17 +08:00
Your Name
b0ca154e08 chore(supply-api): add runtime schema sql assets
Add the outbox, partitioning, and token-status DDL files alongside the partition strategy regression test. These files map directly to already committed repository and middleware paths, and were verified with fresh repository, outbox, and middleware test runs before commit.
2026-04-11 10:29:15 +08:00
Your Name
193372ca95 test(supply-api): add sms module coverage and iam db service tests
Add the untracked SMS service package and its security-focused tests, plus database-backed IAM service unit coverage. This keeps the verification surface small and brings previously validated test/runtime support sources into version control as an isolated change.
2026-04-11 10:28:26 +08:00
Your Name
90fc95bc27 fix(supply-api): add missing runtime support sources
Check in the healthcheck, structured logging, outbox broker, partition manager, and token status repository files that the committed supply-api runtime already imports. Verified with fresh go test runs for cmd/supply-api, internal/httpapi, internal/pkg/logging, internal/repository, and internal/outbox.
2026-04-11 09:45:37 +08:00
Your Name
eefb68c5b3 test(supply-api): extend auth and iam guard coverage
Add nil and wildcard coverage for IAM claims helpers, ensure auth security tests run with authentication enabled, and make settlement mocks express pending-withdraw/error branches explicitly.
2026-04-11 09:34:13 +08:00