Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions docs/architecture/rfcs/goal-workspace-surface-v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,15 @@ status. This is named local source qualification, not Linux CI, an installed-hos
upgrade, model task completion, kernel attribution or full-cost acceptance. V10
thresholds and the remaining real-team/product milestones retain their owners.

**Follow-up: source coverage for research-record search.**
The original search scenario opened the compiled bundle in both lanes. Its
assertions could pass while the source coverage reporter dropped all of its
scripts. The source lane now opens Vite and forwards data requests to the
same disposable paged-history owner used by the packaged lane. A PASS
requires native history reads without mutation; source coverage also requires
execution of the instrumented research-record browser module. This narrows
the coverage gap without changing the historical V10 timing results.

**Checkpoint 2026-10-11 (M1 proposed at `6c3c0c104` in [#6191](https://github.com/loopx-project/loopx/pull/6191), subsequently merged).**
Verified subset: V1 reducer fixtures written from Section 5.3, mutation checks
and the packaged page on synthetic status; V2 strip and Board sharing the work
Expand Down
6 changes: 6 additions & 0 deletions docs/architecture/rfcs/goal-workspace-surface-v0.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,12 @@ HTTP 写请求只尝试一次。
安装宿主升级、模型任务完成、内核归因或完整成本验收。V10 阈值及剩余真实团队和产品
里程碑仍由各自既有 owner 验收。

**补充:研究记录搜索的源码覆盖。**
原搜索场景在两条分线都打开编译后的页面,导致场景断言通过,但源码覆盖报告丢弃了
它的全部脚本。现在源码分线打开 Vite,并将数据请求转发给打包分线使用的同一个一次性
历史分页后端。两条分线均须实际读取历史且不修改来源,才能记为 PASS;源码覆盖还要求
研究记录浏览模块带插桩执行。此次补齐覆盖缺口,历史 V10 耗时结果仍保持原判定。

**检查点 2026-10-11(M1 在 [#6191](https://github.com/loopx-project/loopx/pull/6191) 的 `6c3c0c104` 提出,后续已合并)。**
已验证的子集:V1 的按第 5.3 节编写的 reducer fixture、变异检查及合成状态打包页面;
V2 的指标条与看板共用工作判定;V4 的真实隔离 Chat 动作服务与注册表 authority 上的停止、
Expand Down
7 changes: 6 additions & 1 deletion examples/personal-workspace-browser/research-history.md
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ receipt. Downloads do not launch research or change source state. While history
loading or no records match, downloading is unavailable; retry after a download
failure or refresh the history after a read failure.

The synthetic packaged regression exercises native paged history, an old negative
The synthetic browser regression exercises native paged history, an old negative
revision after 75 other findings, status filtering, full/filtered JSON and Markdown downloads,
original-version comparison (including unmeasured versus zero), partial/stale
coverage, interrupted reads/downloads and retry, Goal isolation and
Expand All @@ -418,8 +418,13 @@ desktop/narrow layouts without dispatching an Agent:
node --experimental-strip-types --test apps/presentation/dashboard/src/features/personal-workspace/research-record-search.test.mjs apps/presentation/dashboard/src/features/personal-workspace/research-record-versions.test.mjs
node --experimental-strip-types --test apps/presentation/dashboard/src/features/personal-workspace/research-record-export.test.mjs apps/presentation/dashboard/src/features/personal-workspace/research-record-report.test.mjs
LOOPX_PERSONAL_WORKSPACE_PACKAGED=1 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-record-search node examples/personal-workspace-browser-smoke.mjs
LOOPX_DASHBOARD_COVERAGE=1 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-record-search node examples/personal-workspace-browser-smoke.mjs
```

Both browser modes use the same disposable history owner and require readback
with no source mutation. The coverage command uses Vite and must map executed
code from the research-record browser module into the Dashboard source report.

From the worktree root:

```sh
Expand Down
52 changes: 39 additions & 13 deletions examples/personal-workspace-browser/research-record-search.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import {mkdtemp, readFile, rm} from "node:fs/promises";
import {tmpdir} from "node:os";
import {resolve} from "node:path";
import {resolveTestPython} from "../../scripts/test-python.mjs";
import {outputDir, repoRoot} from "./fixture.mjs";
import {outputDir, packaged, repoRoot} from "./fixture.mjs";
import {startHistoryOwner} from "./research-history.mjs";
import {fetchWorkspaceBackend} from "./scenario-context.mjs";

async function readEmptyScope(page, results, message) {
const search = results.getByRole('searchbox');
Expand All @@ -25,7 +26,8 @@ async function readEmptyScope(page, results, message) {

export const researchRecordSearchScenario = {
id: "research-record-search",
async run({browser, collectCoverage}) {
requiresBackendReadback: true,
async run({browser, collectCoverage, url}) {
const temporary = await mkdtemp(resolve(tmpdir(), "loopx-record-search-"));
let owner, page;
try {
Expand Down Expand Up @@ -67,8 +69,18 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
page = await browser.newPage({viewport: {width: 1440, height: 900}});
if (collectCoverage) await page.coverage.startJSCoverage({resetOnNavigation: false});
await page.addInitScript(() => {if (!localStorage.getItem("loopx-pw-locale")) localStorage.setItem("loopx-pw-locale", "en");});
const url = `${owner.base}/chat/?goalId=synthetic-record-search&view=research&statusUrl=%2Fstatus.json`;
await page.goto(url);
const entry = packaged ? new URL("/chat/", owner.base) : new URL(url);
entry.searchParams.set("goalId", "synthetic-record-search");
entry.searchParams.set("view", "research");
entry.searchParams.set("statusUrl", "/status.json");
if (!packaged) {
// Keep Vite modules and their source maps while using the same history owner.
await page.route(target => target.origin === entry.origin && (target.pathname === "/status.json"
|| target.pathname.startsWith("/api/") || target.pathname.startsWith("/extension-")), async route => {
await route.fulfill({response: await fetchWorkspaceBackend(route, owner.base)});
});
}
await page.goto(entry.href);
const history = page.locator(".research-history");
await page.waitForFunction(() => document.querySelector('.research-history')?.getAttribute('aria-busy') === 'false');
await page.screenshot({path: resolve(outputDir, "research-record-first-1440.png"), animations: "disabled"});
Expand Down Expand Up @@ -263,7 +275,7 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
assert.equal(await results.locator("li").count(), 50, "A changed query resets display paging");
// Fresh interrupted load searches only the explicitly partial snapshot.
await page.route("**/api/chat/explore-results?*", route => new URL(route.request().url()).searchParams.has("cursor")
? route.fulfill({status: 503, json: {error: "Synthetic page interruption"}}) : route.continue());
? route.fulfill({status: 503, json: {error: "Synthetic page interruption"}}) : route.fallback());
const periodBookmark = new URL(page.url());
periodBookmark.searchParams.set("research_goal", "synthetic-record-search");
periodBookmark.searchParams.set("research_phase", "2");
Expand Down Expand Up @@ -304,7 +316,9 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
const phases = history.locator(".research-phase");
assert.equal(await phases.count(), 3);
assert.equal(await phases.nth(2).getAttribute("aria-pressed"), "true", "Recovery applies the original period bookmark");
await page.goto(url.replace("synthetic-record-search", "synthetic-other-research"));
const otherGoal = new URL(entry);
otherGoal.searchParams.set("goalId", "synthetic-other-research");
await page.goto(otherGoal.href);
const openOtherSearch = history.getByRole("button", {name: "Search research records", exact: true});
await openOtherSearch.evaluate(button => {
// Hold the frame from this one search activation until the reader moves focus.
Expand Down Expand Up @@ -354,13 +368,13 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
assert(other.records.every(record => record.goal_id === other.goal_id));
await search.fill("amber-v1");
await readEmptyScope(page, results, "No matching records. Try another term or clear the filters.");
await page.goto(url);
await page.goto(entry.href);
await history.getByRole("button", {name: "Search research records", exact: true}).click();
await search.fill("amber-v1");
await results.getByRole("status", {name: /^1 matches in 79 loaded records/}).waitFor();
let firstRecord, pageMode = "replay";
await page.route("**/api/chat/explore-results?*", async route => {
const response = await route.fetch();
const response = await fetchWorkspaceBackend(route, owner.base);
const historyPage = await response.json();
if (new URL(route.request().url()).searchParams.has("cursor")) {
if (pageMode === "short") historyPage.items.pop();
Expand Down Expand Up @@ -391,7 +405,7 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
let release, observed;
const hold = new Promise(resolve => {release = resolve;});
const seen = new Promise(resolve => {observed = resolve;});
await page.route("**/api/chat/explore-results?*", async route => {observed(); await hold; await route.continue();});
await page.route("**/api/chat/explore-results?*", async route => {observed(); await hold; await route.fallback();});
await history.getByRole("button", {name: "Refresh history", exact: true}).click();
await seen;
await page.waitForFunction(() => [...document.querySelectorAll(".research-record-filters button")].some(button => button.textContent.includes("Download matches") && button.disabled));
Expand All @@ -400,8 +414,6 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
await page.waitForFunction(() => document.querySelector('.research-history')?.getAttribute('aria-busy') === 'false');
await page.unroute("**/api/chat/explore-results?*");
assert.equal(await downloadButton.isEnabled(), true);
const readback = await (await page.request.get(`${owner.base}/fixture/readback`)).json();
assert(readback.source_unchanged && readback.mutation_attempts === 0);
await page.evaluate(() => localStorage.setItem("loopx-pw-locale", "zh-CN"));
await page.reload();
await history.getByRole("button", {name: "搜索研究记录", exact: true}).click();
Expand Down Expand Up @@ -432,10 +444,24 @@ Path(sys.argv[2]).write_text(json.dumps({'goal_id':other,'display_name':'Other s
assert.match(reportText, /\*\*数值:\*\* 未知/);
assert.match(reportText, /\*\*数值:\*\* 0/);
assert.match(reportText, /质量下降 — original negative evidence/);
return {coverageEntries: collectCoverage ? await page.coverage.stopJSCoverage() : [], note: "packaged evidence search/export through native paged history; full and filtered downloads, original revisions, coverage/staleness, original revision comparison, download/read recovery, Goal isolation and narrow viewport"};
const readback = await (await page.request.get(`${owner.base}/fixture/readback`)).json();
assert.ok(readback.ok && readback.history_reads >= 2, "Search uses the real paged history owner");
assert.ok(readback.source_unchanged && readback.mutation_attempts === 0, "Search leaves the source untouched");
const coverageEntries = collectCoverage ? await page.coverage.stopJSCoverage() : [];
if (collectCoverage) {
assert.ok(coverageEntries.some(entry => new URL(entry.url).pathname === "/src/features/personal-workspace/research-record-browser.tsx"
&& entry.source && entry.functions.some(fn => fn.ranges.some(range => range.count > 0))),
"Research-record search must execute instrumented Dashboard source in the coverage lane");
}
return {coverageEntries, backendReadbackVerified: true, note: "evidence search/export through native paged history; full and filtered downloads, original revisions, coverage/staleness, original revision comparison, download/read recovery, Goal isolation and narrow viewport"};
} catch (error) {
if (page && !page.isClosed()) await page.screenshot({path: resolve(outputDir, "research-record-search-failed.png")});
throw error;
} finally {await page?.close(); await owner?.close(); await rm(temporary, {recursive: true, force: true});}
} finally {
await page?.unrouteAll({behavior: "ignoreErrors"}).catch(() => {});
await page?.close();
await owner?.close();
await rm(temporary, {recursive: true, force: true});
}
},
};
Loading