Files
hfb_sys/docs/VERIFICATION.txt
T

65 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
性能优化验证记录
变更分支/字段:main;财务仪表盘重复聚合、财务明细分页 order_id 两阶段查询、rental_orders 待线下出款覆盖索引。
原始 dashboard.go SHA-256:ecc1df350998a45778f3cf607a25ed75d67deb23dd6b1d04ec6cef5e5131c752
四个验证产物:
/Users/yml/codes/hfb_sys/docs/MODIFIED_FILE
/Users/yml/codes/hfb_sys/docs/DIFF_FILE
/Users/yml/codes/hfb_sys/docs/VERIFICATION.txt
/Users/yml/codes/hfb_sys/docs/ROLLBACK.sh
BASELINE
命令:HFB_ADMIN_FINANCE_TEST_DSN='hfb:secret@tcp(127.0.0.1:13306)/hfb_finance_perf?charset=utf8mb4&parseTime=True&loc=Local' HFB_ADMIN_FINANCE_PROFILE_OUTPUT='/tmp/hfb-finance-dashboard-optimization/baseline.json' go test ./internal/modules/adminfinance -run '^TestProfileDashboardOnMySQL$' -count=1 -v
输入:50 万 rental_orders、50 万 order_checkouts、60 万 payment_orders、100 万 wallet_ledger,时间分布 70 天,查询 2026-08-29 至 2026-09-04。
字面输出/结果:dashboard duration=7.936473625s daily_items=7;PASS;退出状态 0。
MODIFIED
命令:HFB_ADMIN_FINANCE_TEST_DSN='hfb:secret@tcp(127.0.0.1:13306)/hfb_finance_perf?charset=utf8mb4&parseTime=True&loc=Local' HFB_ADMIN_FINANCE_PROFILE_OUTPUT='/tmp/hfb-finance-dashboard-optimization/modified.json' go test ./internal/modules/adminfinance -run '^TestProfileDashboardOnMySQL$' -count=1 -v
输入:与 BASELINE 相同数据库、相同 7 天区间。
字面输出/结果:dashboard duration=1.625048875s daily_items=7;PASS;退出状态 0;cmp -s baseline.json modified.json 的退出状态 0;SQL 数 31 -> 26。
ROLLBACK
命令:cp docs/MODIFIED_FILE /tmp/hfb-dashboard-rollback-copy.go && ./docs/ROLLBACK.sh /tmp/hfb-dashboard-rollback-copy.go && cmp /tmp/hfb-dashboard-rollback-copy.go /tmp/hfb-finance-dashboard-optimization/dashboard.go.original
输入:优化后的 MODIFIED_FILE 副本。
字面输出/结果:rollback_cmp_exit=0;退出状态 0;副本恢复为原始 dashboard.go;MODIFIED_FILE 保持优化后行为和内容。
TESTS
命令:go test ./...;go vet ./...
字面输出/结果:后端全量测试 PASS;go vet PASS;退出状态均为 0。
MIGRATION
命令:goose -dir migrations mysql 'hfb:secret@tcp(127.0.0.1:13306)/hfb_sys?parseTime=true' up;SHOW INDEX FROM rental_orders WHERE Key_name='idx_rental_orders_offline_pending_amount';goose -dir migrations mysql 'hfb:secret@tcp(127.0.0.1:13306)/hfb_sys?parseTime=true' down。
输入:本地 Docker MySQL 的 migration 62 数据库。
字面输出/结果:goose: successfully migrated database to version: 63;索引三列均出现;Down 输出 OK 000063_finance_pending_disbursement_index.sql;删除后恢复原状态;退出状态 0。
资金出款操作人筛选验证
变更分支/字段:main;adminfinance.DisbursementQuery.Operator/OperatorID、`operator`/`operator_id` 请求参数及资金出款筛选表单。
原始 `disbursement_list.go` SHA-256:478ffe515a3f452759e191e0b32f8bc22c1ac2f2dde520092cc6c5ee716f1e7c
四个验证产物:
/Users/yml/codes/hfb_sys/docs/MODIFIED_FILE
/Users/yml/codes/hfb_sys/docs/DIFF_FILE
/Users/yml/codes/hfb_sys/docs/VERIFICATION.txt
/Users/yml/codes/hfb_sys/docs/ROLLBACK.sh
BASELINE
命令:`go test ./internal/modules/adminfinance -run '^TestDisbursementListCombinesPlatformSettlementsAndWithdrawals$' -count=1 -v`
输入:HEAD 基线代码,SQLite 内存测试数据。
字面输出/结果:`=== RUN TestDisbursementListCombinesPlatformSettlementsAndWithdrawals`、`--- PASS: TestDisbursementListCombinesPlatformSettlementsAndWithdrawals (0.01s)`、`PASS`、`ok hfb_sys/backend/internal/modules/adminfinance 0.420s`;退出状态 0。
MODIFIED
命令:`go test ./internal/modules/adminfinance -run '^TestDisbursementListCombinesPlatformSettlementsAndWithdrawals$' -count=1 -v`
输入:增加操作人昵称筛选断言的修改代码,SQLite 内存测试数据。
字面输出/结果:`=== RUN TestDisbursementListCombinesPlatformSettlementsAndWithdrawals`、`--- PASS: TestDisbursementListCombinesPlatformSettlementsAndWithdrawals (0.01s)`、`PASS`、`ok hfb_sys/backend/internal/modules/adminfinance 0.200s`;退出状态 0;按操作人“财务甲”返回 7 条且全部匹配;支持 `operator_id` 精确匹配。
ROLLBACK
命令:`cp docs/MODIFIED_FILE /tmp/hfb-finance-disbursement-filter/rollback-copy.go && ./docs/ROLLBACK.sh /tmp/hfb-finance-disbursement-filter/rollback-copy.go && cmp /tmp/hfb-finance-disbursement-filter/rollback-copy.go /tmp/hfb-finance-disbursement-filter/disbursement_list.go.original`
输入:修改后的 `MODIFIED_FILE` 副本。
字面输出/结果:`rollback_cmp_exit=0`;退出状态 0;副本恢复为原始 `disbursement_list.go`,`MODIFIED_FILE` 保持修改后内容(SHA-256 `fac88ec3f2137c68f79a281f24aadb2ddf80922452219716112ae45bdc24d459`)。
TESTS
命令:`go test ./...`;`npm run typecheck`
字面输出/结果:后端全量测试 PASS;前端 vue-tsc 类型检查 PASS;退出状态均为 0。