fix(page-data): deliver WeChat surveys when agent pre-binds pages
Memind CI / Test, build, and release guards (push) Failing after 5s
Memind CI / Test, build, and release guards (push) Failing after 5s
Include already_bound auto-bind skips and request-scoped relative paths when building Page Data delivery artifacts, so pre-bound survey pages are verified and linked instead of failing the finish guard. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import test from 'node:test';
|
||||
import {
|
||||
buildPageDataCollectFailureText,
|
||||
buildPageDataCollectRepairPrompt,
|
||||
buildPageDataDeliveryArtifactsFromBindResult,
|
||||
collectPageDataDeliveryArtifacts,
|
||||
evaluatePageDataFinishGuard,
|
||||
evaluatePageDataFinishGuardAsync,
|
||||
@@ -306,6 +307,34 @@ test('evaluatePageDataFinishGuard flags html when dataset is not registered', as
|
||||
}
|
||||
});
|
||||
|
||||
test('buildPageDataDeliveryArtifactsFromBindResult includes already_bound pages for this request only', () => {
|
||||
const publishDir = fs.mkdtempSync(path.join(os.tmpdir(), 'page-data-guard-bind-result-'));
|
||||
const previousBase = process.env.H5_PUBLIC_BASE_URL;
|
||||
process.env.H5_PUBLIC_BASE_URL = 'https://m.tkmind.cn';
|
||||
try {
|
||||
fs.mkdirSync(path.join(publishDir, 'public'), { recursive: true });
|
||||
fs.writeFileSync(path.join(publishDir, 'public', 'new-survey.html'), SURVEY_HTML, 'utf8');
|
||||
fs.writeFileSync(path.join(publishDir, 'public', 'stale-survey.html'), SURVEY_HTML, 'utf8');
|
||||
const autoBind = {
|
||||
bound: [],
|
||||
skipped: [{ relativePath: 'public/new-survey.html', reason: 'already_bound' }],
|
||||
errors: [],
|
||||
};
|
||||
const artifacts = buildPageDataDeliveryArtifactsFromBindResult(
|
||||
autoBind,
|
||||
publishDir,
|
||||
{},
|
||||
['public/new-survey.html'],
|
||||
);
|
||||
assert.equal(artifacts.length, 1);
|
||||
assert.equal(artifacts[0].relativePath, 'public/new-survey.html');
|
||||
} finally {
|
||||
if (previousBase == null) delete process.env.H5_PUBLIC_BASE_URL;
|
||||
else process.env.H5_PUBLIC_BASE_URL = previousBase;
|
||||
fs.rmSync(publishDir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('collectPageDataDeliveryArtifacts uses Portal base when H5_PUBLIC_BASE_URL points at Vite', () => {
|
||||
const publishDir = fs.mkdtempSync(path.join(os.tmpdir(), 'page-data-guard-portal-url-'));
|
||||
const previousBase = process.env.H5_PUBLIC_BASE_URL;
|
||||
|
||||
Reference in New Issue
Block a user