feat(platform): close AI expense value loop

Add tenant-safe value, telemetry, connector, commercial, and production-readiness foundations.
This commit is contained in:
caoxiaozhu
2026-07-17 14:14:08 +08:00
parent 242d68c36f
commit 787bc3a481
507 changed files with 82072 additions and 6344 deletions

View File

@@ -111,7 +111,10 @@ def test_create_risk_rule_revision_endpoint_keeps_active_version(tmp_path) -> No
assert payload["working_version"] == "v0.1.1"
assert revision["version"] == "v0.1.1"
assert revision["base_version"] == "v0.1.0"
assert revision["generation_request"]["natural_language"] == "票据城市与申报目的地不一致时,要求补充说明。"
assert (
revision["generation_request"]["natural_language"]
== "票据城市与申报目的地不一致时,要求补充说明。"
)
assert payload["config_json"]["last_operation"]["action"] == "create_revision"
@@ -133,7 +136,11 @@ def test_regenerate_risk_rule_endpoint_returns_updated_detail(tmp_path, monkeypa
assert asset is not None
config = dict(asset.config_json or {})
config["generation_status"] = "completed"
config["last_operation"] = {"action": "regenerate", "actor": actor, "at": "2026-05-30T00:00:00+00:00"}
config["last_operation"] = {
"action": "regenerate",
"actor": actor,
"at": "2026-05-30T00:00:00+00:00",
}
asset.config_json = config
self.db.add(asset)
self.db.flush()
@@ -209,7 +216,7 @@ def test_manager_can_toggle_risk_rule_enabled_endpoint(tmp_path, monkeypatch) ->
assert response.status_code == 200
assert response.json()["config_json"]["enabled"] is False
assert response.json()["config_json"]["last_operation"]["actor"] == "manager"
assert response.json()["config_json"]["last_operation"]["actor"] == "username:manager"
def _create_rule(session_factory: sessionmaker[Session], tmp_path) -> str:
@@ -225,6 +232,7 @@ def _create_rule(session_factory: sessionmaker[Session], tmp_path) -> str:
rule_title="差旅规则草稿",
natural_language="差旅报销事由缺失时,提示补充说明。",
),
tenant_id="default",
actor="pytest",
)