mindspace: close authority boundaries

This commit is contained in:
john
2026-07-27 15:34:35 +08:00
parent dfab78c75a
commit e94052ff24
78 changed files with 11962 additions and 2162 deletions
@@ -57,6 +57,17 @@ function createSetup(overrides = {}) {
},
};
const scheduleService = { id: 'schedule' };
const mindSpacePublicFinish = {
async prepareWechatHtmlDelivery() {
return { confirmedArtifacts: [] };
},
async ensureWechatFreshPageThumbnails() {
return { ok: true };
},
async prepareWechatPageDataDelivery() {
return { outcome: { action: 'skip' } };
},
};
const sessionSnapshotService = {
isEnabled() {
return true;
@@ -92,7 +103,7 @@ function createSetup(overrides = {}) {
},
usersRoot: '/users',
wechatMpConfig: { enabled: true },
authPool: pool,
mindSpacePublicFinish,
userAuth,
sessionAccess,
tkmindProxy,
@@ -136,10 +147,6 @@ function createSetup(overrides = {}) {
},
};
},
resolveMindSpaceRuntimeConfigFn(h5Root, env) {
calls.push(['runtime-config', h5Root, env]);
return { storageRoot: '/storage' };
},
resolveAnalyticsOwnerSegmentFn(user) {
calls.push(['owner-segment', user]);
return 'segment';
@@ -229,11 +236,14 @@ test('preserves WeChat service configuration and proxy callbacks', async () => {
);
const { wechatOptions } = setup.getCaptured();
assert.deepEqual(wechatOptions.pageDataFinishGuard, {
pool: setup.pool,
h5Root: '/app',
storageRoot: '/storage',
});
assert.equal(
wechatOptions.pageDataFinishGuard,
setup.options.mindSpacePublicFinish,
);
assert.equal(
wechatOptions.htmlDeliveryAuthority,
setup.options.mindSpacePublicFinish,
);
assert.equal(
wechatOptions.apiFetch,
setup.tkmindProxy.apiFetch,
@@ -450,7 +460,7 @@ test('preserves subscription timer work, logs, and unref', async () => {
test('keeps optional integrations disabled and contains timer failures', async () => {
const setup = createSetup({
env: {},
authPool: null,
mindSpacePublicFinish: null,
scheduleService: null,
subscriptionService: {
async processAutoRenewals() {
@@ -484,6 +494,11 @@ test('keeps optional integrations disabled and contains timer failures', async (
setup.disabledWechatOptions.pageDataFinishGuard,
null,
);
assert.equal(
setup.disabledWechatOptions
.htmlDeliveryAuthority,
null,
);
assert.equal(
setup.disabledWechatOptions.scheduleService,
null,