Files
Aether/apps/aether-gateway/src/tests/architecture/admin_billing.rs
fawney19 4fc95adfb9 refactor: 大规模模块拆分与重组,新增 aether-admin crate
- 新建独立 aether-admin crate 承载 admin 相关共享契约与纯辅助函数
- 拆分 ai_pipeline 下 kiro/private_envelope/conversion/planner 等大文件为子模块目录
- 重组 admin handlers 各业务域(billing/oauth/provider/system/users 等)为目录结构,移除 shared.rs/builders.rs 等反模式
- 移除 ai_pipeline runtime adapters 旧实现(claude/openai/gemini/kiro/vertex/antigravity 等),改由 provider transport 统一承载
- 移除 control_facade/execution_facade/auth_snapshot_facade 等冗余 facade 层
- 拆分 query/billing 与 query/monitoring 模块、state/runtime/payments 与 security 模块
- 扩展架构测试覆盖 admin_billing/admin_model/admin_users 等新模块
- 删除 docs/architecture/refactor-execution-plan.md 已完成的执行计划文档
2026-04-09 00:10:38 +08:00

149 lines
5.0 KiB
Rust

use super::*;
#[test]
fn admin_billing_wallets_boundaries_are_split() {
let wallets_mod =
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/wallets/mod.rs");
for pattern in ["mod mutations;", "mod reads;", "mod routes;", "mod shared;"] {
assert!(
wallets_mod.contains(pattern),
"handlers/admin/billing/wallets/mod.rs should register {pattern}"
);
}
let shared_mod =
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/wallets/shared/mod.rs");
for pattern in [
"mod normalizers;",
"mod payloads;",
"mod requests;",
"mod responses;",
"mod support;",
] {
assert!(
shared_mod.contains(pattern),
"handlers/admin/billing/wallets/shared/mod.rs should register {pattern}"
);
}
let mutations_mod = read_workspace_file(
"apps/aether-gateway/src/handlers/admin/billing/wallets/mutations/mod.rs",
);
for pattern in [
"mod adjust;",
"mod complete_refund;",
"mod fail_refund;",
"mod process_refund;",
"mod recharge;",
] {
assert!(
mutations_mod.contains(pattern),
"handlers/admin/billing/wallets/mutations/mod.rs should register {pattern}"
);
}
let reads_mod =
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/wallets/reads/mod.rs");
for pattern in [
"mod detail;",
"mod ledger;",
"mod list;",
"mod refund_requests;",
"mod refunds;",
"mod transactions;",
] {
assert!(
reads_mod.contains(pattern),
"handlers/admin/billing/wallets/reads/mod.rs should register {pattern}"
);
}
for path in [
"apps/aether-gateway/src/handlers/admin/billing/wallets/shared/core.rs",
"apps/aether-gateway/src/handlers/admin/billing/wallets/mutations/core.rs",
"apps/aether-gateway/src/handlers/admin/billing/wallets/reads.rs",
] {
assert!(
!workspace_file_exists(path),
"{path} should be removed after wallets boundaries are split"
);
}
}
#[test]
fn admin_billing_collectors_owner_is_split() {
let collectors_mod =
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/collectors/mod.rs");
for pattern in ["mod reads;", "mod support;", "mod writes;"] {
assert!(
collectors_mod.contains(pattern),
"handlers/admin/billing/collectors/mod.rs should register {pattern}"
);
}
for path in [
"apps/aether-gateway/src/handlers/admin/billing/collectors/support.rs",
"apps/aether-gateway/src/handlers/admin/billing/collectors/reads.rs",
"apps/aether-gateway/src/handlers/admin/billing/collectors/writes.rs",
] {
assert!(
workspace_file_exists(path),
"{path} should exist after collectors owner split"
);
}
assert!(
!workspace_file_exists("apps/aether-gateway/src/handlers/admin/billing/collectors.rs"),
"handlers/admin/billing/collectors.rs should be removed after collectors owner split"
);
let collectors_support =
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/collectors/support.rs");
assert!(
!collectors_support.contains("pub(super) use super::super::{"),
"handlers/admin/billing/collectors/support.rs should not keep wildcard bridge re-export from billing root"
);
}
#[test]
fn admin_billing_presets_owner_is_split() {
let presets_mod =
read_workspace_file("apps/aether-gateway/src/handlers/admin/billing/presets/mod.rs");
for pattern in ["mod apply;", "mod support;"] {
assert!(
presets_mod.contains(pattern),
"handlers/admin/billing/presets/mod.rs should register {pattern}"
);
}
for path in [
"apps/aether-gateway/src/handlers/admin/billing/presets/support.rs",
"apps/aether-gateway/src/handlers/admin/billing/presets/apply.rs",
] {
assert!(
workspace_file_exists(path),
"{path} should exist after presets owner split"
);
}
assert!(
!workspace_file_exists("apps/aether-gateway/src/handlers/admin/billing/presets.rs"),
"handlers/admin/billing/presets.rs should be removed after presets owner split"
);
}
#[test]
fn admin_billing_wallets_support_uses_wrapped_request_context() {
let wallets_support = read_workspace_file(
"apps/aether-gateway/src/handlers/admin/billing/wallets/shared/support.rs",
);
assert!(
wallets_support.contains("use crate::handlers::admin::request::AdminRequestContext;"),
"handlers/admin/billing/wallets/shared/support.rs should consume wrapped AdminRequestContext"
);
assert!(
!wallets_support.contains("GatewayPublicRequestContext"),
"handlers/admin/billing/wallets/shared/support.rs should not keep raw GatewayPublicRequestContext seam"
);
}