feat(growth): 建立C端增长与权益服务闭环

- growth模块:新增游客承接、行为漏斗、推荐实验和站内生命周期运营
- 额度账本:事务预占、幂等结算、全站并发与字符预算保护
- 聊天与记忆:接入回答反馈、可控记忆和持久化异步提取
- 迁移020与回归:覆盖账号隔离、计数器死锁和真实MySQL并发场景
This commit is contained in:
湛兮
2026-10-28 21:17:45 +08:00
parent b34c996684
commit 73d56bddb8
21 changed files with 3050 additions and 50 deletions
+3
View File
@@ -1,5 +1,6 @@
/** NPC 继续生成的真实路由回归:不插入用户台词、保留上一段,并沿用租约与鉴权。 */
import "./digital-env";
import { growthFixture } from "./growth-fixture";
import test, { type TestContext } from "node:test";
import assert from "node:assert/strict";
import { randomUUID } from "node:crypto";
@@ -37,6 +38,8 @@ async function exercise(
rolledBack = false;
const query = async (q: { sql: string }, args: unknown[]) => {
const sql = q.sql;
const growth = growthFixture(sql, args);
if (growth) return growth;
if (sql.startsWith("SELECT body FROM dh_profiles")) {
assert.deepEqual(args, ["user:1"]);
return [nsfwEnabled === undefined ? [] : [{ body: { nsfwEnabled } }], []];