@firstpick/pi-package-webui 0.8.6 → 0.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -606
- package/bin/pi-webui-launcher.mjs +22 -0
- package/bin/pi-webui-update-supervisor.mjs +86 -0
- package/bin/pi-webui.mjs +562 -524
- package/index.ts +8 -5
- package/lib/component-update-state.mjs +21 -0
- package/lib/git-workflow-preferences.mjs +17 -2
- package/lib/optional-feature-catalog.mjs +1 -0
- package/lib/sampling-parameter-capabilities.mjs +160 -0
- package/lib/session-summary-preferences.mjs +16 -1
- package/lib/subagent-launch-slots.mjs +14 -2
- package/lib/trust-boundaries.mjs +3 -0
- package/lib/update/executor.mjs +99 -0
- package/lib/update/journal.mjs +175 -0
- package/lib/update/owners.mjs +70 -0
- package/lib/update/plan.mjs +134 -0
- package/lib/update/resolver.mjs +168 -0
- package/lib/update/supervisor.mjs +238 -0
- package/lib/update/verify.mjs +52 -0
- package/lib/update-commands.mjs +25 -13
- package/lib/webui-workspaces.mjs +17 -1
- package/package.json +4 -4
- package/public/app.js +1543 -109
- package/public/index.html +146 -48
- package/public/middle-button-drag-scroll.mjs +154 -0
- package/public/sampling-parameter-controls.mjs +361 -0
- package/public/service-worker.js +3 -1
- package/public/styles.css +512 -1
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-deck-component-updates.spec.mjs +20 -22
- package/tests/browser/middle-button-drag-scroll.spec.mjs +145 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +68 -23
- package/tests/browser/sampling-tooltip.spec.mjs +228 -0
- package/tests/browser/update-reconnect.spec.mjs +92 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/common-options-submenus-interaction-static.test.mjs +172 -0
- package/tests/common-options-submenus-markup-static.test.mjs +152 -0
- package/tests/component-update-api-static.test.mjs +22 -61
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-component-updates-static.test.mjs +13 -237
- package/tests/durable-rpc-supervisor-harness.test.mjs +3 -1
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/feature-system-prompt-optional-feature-static.test.mjs +49 -0
- package/tests/fixtures/fake-pi.mjs +68 -1
- package/tests/fixtures/update/tree-timeout-descendant.mjs +6 -0
- package/tests/fixtures/update/tree-timeout-parent.mjs +11 -0
- package/tests/git-footer-context-menu-static.test.mjs +58 -0
- package/tests/http-endpoints-harness.test.mjs +68 -18
- package/tests/middle-button-drag-scroll-static.test.mjs +24 -0
- package/tests/middle-button-drag-scroll.test.mjs +170 -0
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +4 -4
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +217 -24
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-migration-frontend.test.mjs +13 -5
- package/tests/persistent-ui-layout-static.test.mjs +13 -2
- package/tests/prompt-routing-tab-status.test.mjs +8 -0
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +34 -0
- package/tests/rpc-supervisor-host.test.mjs +11 -2
- package/tests/safety-guard-auto-review-harness.test.mjs +117 -0
- package/tests/safety-guard-auto-review-static.test.mjs +34 -0
- package/tests/sampling-native-controls-user-flow.test.mjs +752 -0
- package/tests/sampling-parameter-capabilities.test.mjs +167 -0
- package/tests/sampling-parameter-controls.test.mjs +241 -0
- package/tests/session-sampling-helper.test.mjs +228 -0
- package/tests/session-sampling-http.test.mjs +168 -0
- package/tests/session-sampling-ui-static.test.mjs +370 -0
- package/tests/session-summary-core.test.mjs +24 -11
- package/tests/side-panel-section-height-removal-static.test.mjs +34 -0
- package/tests/side-panel-section-reorder-static.test.mjs +3 -3
- package/tests/staged-content-hash-contract.test.mjs +52 -11
- package/tests/subagent-launch-slots.test.mjs +18 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/ui-layout-settings.test.mjs +18 -1
- package/tests/update-api-harness.test.mjs +111 -0
- package/tests/update-commands.test.mjs +15 -45
- package/tests/update-executor-process-tree-harness.test.mjs +22 -0
- package/tests/update-journal-harness.test.mjs +59 -0
- package/tests/update-lock-multiprocess-harness.test.mjs +46 -0
- package/tests/update-owners.test.mjs +27 -0
- package/tests/update-plan.test.mjs +58 -0
- package/tests/update-resolver.test.mjs +56 -0
- package/tests/update-supervisor-harness.test.mjs +57 -0
- package/tests/update-tab-restore-harness.test.mjs +24 -0
- package/tests/update-verify.test.mjs +31 -0
- package/tests/workspace-files-live-updates-static.test.mjs +13 -4
- package/webui-rpc-helper.mjs +119 -0
|
@@ -10,7 +10,7 @@ const [pkgRaw, html, css, app, server, extension, readme, startScript, manifestR
|
|
|
10
10
|
readFile(join(root, "public", "index.html"), "utf8"),
|
|
11
11
|
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
12
12
|
readFile(join(root, "public", "app.js"), "utf8"),
|
|
13
|
-
readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
|
|
13
|
+
readFile(join(root, "bin", "pi-webui.mjs"), "utf8").then((value) => value.replace(/\r\n/g, "\n")),
|
|
14
14
|
readFile(join(root, "index.ts"), "utf8"),
|
|
15
15
|
readFile(join(root, "README.md"), "utf8"),
|
|
16
16
|
readFile(join(root, "dev", "scripts", "start-webui.sh"), "utf8"),
|
|
@@ -268,6 +268,10 @@ assert.match(css, /@media\s*\([^)]*max-width[^)]*\)\s*\{[\s\S]*?\.subagent-termi
|
|
|
268
268
|
assert.match(readme, /exactly six telemetry cards: PI, measured token speed, context, model, effort, and input\/output tokens from a bounded recent session scan; unavailable or legacy evidence remains `—` or `unknown` rather than an estimate/, "README should document each subagent telemetry card, bounded scan scope, and honest unknown behavior");
|
|
269
269
|
assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
|
|
270
270
|
assert.match(html, /data-side-panel-section="session"[\s\S]*data-side-panel-section="subagents"[\s\S]*data-side-panel-section="queue"/, "Subagents should appear between Session and Queue in the side panel");
|
|
271
|
+
assert.match(html, /data-side-panel-section="sampling"[\s\S]*class="side-panel-section-label">Sampling parameters<\/span>[\s\S]*id="samplingParametersSupport"[\s\S]*id="samplingParametersControls"[\s\S]*id="samplingParametersPreserved"[\s\S]*id="applySamplingParametersButton"[\s\S]*id="resetSamplingParametersButton"[\s\S]*id="samplingParametersStatus"/, "Sampling parameters should be a labelled side-panel section with native controls, hidden-key preservation status, apply/reset actions, and live status");
|
|
272
|
+
assert.match(app, /sampling: \["Sampling parameters", \["sidePanelSectionSampling"\]\]/, "mobile More settings should reuse the canonical native sampling controls");
|
|
273
|
+
assert.doesNotMatch(html, /id="samplingParametersInput"|Session override \(JSON object\)/, "mobile reuse should not expose the removed raw JSON editor");
|
|
274
|
+
assert.match(css, /\.sampling-parameters \{[\s\S]*container: sampling-parameters \/ inline-size;[\s\S]*@container sampling-parameters \(max-width: 22rem\)[\s\S]*\.sampling-parameter-editor,[\s\S]*grid-template-columns: minmax\(0, 1fr\)/, "native sampling controls should collapse to one column in narrow side-panel/mobile hosts");
|
|
271
275
|
assert.match(html, /data-side-panel-section="queue"[\s\S]*id="createPromptListButton"[\s\S]*>Create prompt list<\/button>/, "Queue section should expose prompt-list creation");
|
|
272
276
|
assert.match(html, /id="loadPromptListButton"[\s\S]*>Load List<\/button>[\s\S]*id="runLoadedPromptListButton"[^>]*disabled[^>]*>Run<\/button>/, "Queue section should expose load and run controls for saved prompt lists");
|
|
273
277
|
assert.match(html, /id="promptListDialog"[\s\S]*id="promptListAddPromptButton"[\s\S]*\+ Add follow-up prompt/, "prompt-list dialog should add follow-up prompt rows");
|
|
@@ -352,7 +356,7 @@ assert.ok(
|
|
|
352
356
|
Math.min(optionsReloadIndex, optionsNameIndex) < optionsRemoteIndex && optionsRemoteIndex < Math.max(optionsReloadIndex, optionsNameIndex),
|
|
353
357
|
"Open Remote should render between Reload Pi and Name Session",
|
|
354
358
|
);
|
|
355
|
-
assert.match(html, /id="optionsConversationModeButton"[^>]*data-command="\/talk"[^>]*hidden[\s\S]*?<span>Start Conversation<\/span>/, "Options menu should include the feature-gated Natural Conversation toggle");
|
|
359
|
+
assert.match(html, /id="optionsConversationModeButton"[^>]*data-command="\/talk"[^>]*hidden[\s\S]*?<span>Start Natural Conversation<\/span>/, "Options menu should include the feature-gated Natural Conversation toggle");
|
|
356
360
|
assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-chip"[\s\S]*hidden>Voice: off<\/button>/, "composer should expose a hidden-until-active conversation status chip");
|
|
357
361
|
const workflowModeButtonHtml = html.match(/<button\s+id="workflowModeButton"[\s\S]*?<\/button>/)?.[0] || "";
|
|
358
362
|
const workflowOverlayOpenButtonHtml = html.match(/<button\s+id="workflowOverlayOpenButton"[\s\S]*?<\/button>/)?.[0] || "";
|
|
@@ -703,8 +707,182 @@ assert.match(server, /"\/api\/git-operation\/resolve-with-agent"[\s\S]*openGitCo
|
|
|
703
707
|
assert.match(app, /async function pullGitChangesDialog\(\)[\s\S]*api\("\/api\/git-changes\/pull", \{ method: "POST"/, "git changes modal should post to the pull endpoint from the Pull button");
|
|
704
708
|
assert.match(app, /async function pullGitFooterSync\(tabId = activeTabId\)[\s\S]*api\("\/api\/git-changes\/pull", \{ method: "POST", body: \{ remote: "origin" \}, tabId \}\)[\s\S]*requestGitFooterWebuiPayload\(tabContext, \{ force: true \}\)/, "incoming-only footer Sync should pull directly from origin and refresh the footer payload");
|
|
705
709
|
assert.doesNotMatch(app.match(/async function pullGitFooterSync[\s\S]*?\n\}/)?.[0] || "", /git-workflow\/push|appConfirmText/, "the direct footer pull path should neither push nor open a confirmation");
|
|
706
|
-
assert.match(
|
|
707
|
-
assert.match(
|
|
710
|
+
assert.match(html, /id="gitPullErrorDialog"[\s\S]*aria-labelledby="gitPullErrorDialogTitle"[\s\S]*id="gitPullErrorOutput"[\s\S]*id="gitPullErrorRecovery"[^>]*hidden[\s\S]*id="gitPullErrorReviewButton"[\s\S]*id="gitPullErrorRebaseButton"[\s\S]*id="gitPullErrorMergeButton"[\s\S]*id="gitPullErrorCopyButton"[\s\S]*id="gitPullErrorCloseButton"/, "footer pull failures should use a labelled native dialog with review, rebase, merge, copy, and close actions");
|
|
711
|
+
assert.match(css, /\.extension-dialog\.git-pull-error-dialog[\s\S]*\.git-pull-error-output \{[\s\S]*user-select: text;[\s\S]*white-space: pre-wrap;[\s\S]*\.git-pull-error-recovery-actions \{[\s\S]*flex-wrap: wrap;/, "Git pull error output and recovery actions should remain readable, selectable, and responsive");
|
|
712
|
+
assert.match(app, /function gitFailureDisplayText\(response[\s\S]*result\.stderr = ""[\s\S]*formatGitCommandResult\(result\)[\s\S]*seen\.has\(key\)/, "Git pull error formatting should remove exact duplicate stderr while retaining unique command details");
|
|
713
|
+
assert.match(app, /function openGitPullErrorDialog\(message, \{ code = "", tabId = null, syncValue = "" \} = \{\}\)[\s\S]*code === "DIVERGED"[\s\S]*This does not mean conflicts exist[\s\S]*gitPullErrorRecovery\.hidden = !diverged[\s\S]*gitPullErrorCloseButton\?\.classList\.toggle\("primary", !diverged\)[\s\S]*gitPullErrorDialog\.showModal\(\)/, "DIVERGED pull errors should explain conflict uncertainty and expose native recovery actions while standard errors retain a primary Close action");
|
|
714
|
+
assert.match(app, /async function integrateGitPullDivergence\(mode\)[\s\S]*appConfirmText[\s\S]*danger: !merge[\s\S]*gitFooterSyncInFlightByTab\.add\(tabId\)[\s\S]*\/api\/git-changes\/integrate[\s\S]*body: \{ mode, confirmed: true \}[\s\S]*gitPullErrorContext\.requestId !== requestId[\s\S]*response\.code === "CONFLICTS"[\s\S]*openGitChangesDialog\(tabId\)[\s\S]*freshAheadValue[\s\S]*gitFooterSyncInFlightByTab\.delete\(tabId\)/, "merge and rebase recovery should require confirmation, reject stale responses, serialize per-tab mutations, use fresh ahead counts, and route actual conflicts to Git Changes");
|
|
715
|
+
assert.match(app, /function reviewGitPullDivergence\(\)[\s\S]*closeGitPullErrorDialog\(\)[\s\S]*openGitChangesDialog\(tabId\)/, "review recovery should open Git Changes without integrating");
|
|
716
|
+
assert.match(app, /async function copyGitPullErrorOutput\(\)[\s\S]*copyText\(gitPullErrorText\)[\s\S]*Error output copied to the clipboard/, "Git pull error dialog should copy the complete displayed output");
|
|
717
|
+
assert.match(app, /async function pullGitFooterSync[\s\S]*if \(!response\.ok\)[\s\S]*gitFailureDisplayText\(response[\s\S]*openGitPullErrorDialog\(message, \{ code: response\.code \|\| "", tabId, syncValue \}\)/, "footer pull failures should route structured, deduplicated details into the native dialog");
|
|
718
|
+
|
|
719
|
+
const gitFailureDisplayStart = app.indexOf("function gitFailureDisplayText(");
|
|
720
|
+
const gitFailureDisplayEnd = app.indexOf("\nfunction setGitPullErrorBusy(", gitFailureDisplayStart);
|
|
721
|
+
assert.ok(gitFailureDisplayStart >= 0 && gitFailureDisplayEnd > gitFailureDisplayStart, "Git failure display formatter should remain a standalone helper");
|
|
722
|
+
const gitFailureDisplayContext = {
|
|
723
|
+
formatGitCommandResult(result) {
|
|
724
|
+
const lines = [`$ ${result?.command || "git"}`];
|
|
725
|
+
if (result?.stdout?.trim()) lines.push("", result.stdout.trim());
|
|
726
|
+
if (result?.stderr?.trim()) lines.push("", result.stderr.trim());
|
|
727
|
+
if (result?.exitCode !== 0) lines.push("", `[exit: ${result?.exitCode}]`);
|
|
728
|
+
return lines.join("\n");
|
|
729
|
+
},
|
|
730
|
+
};
|
|
731
|
+
vm.runInNewContext(`${app.slice(gitFailureDisplayStart, gitFailureDisplayEnd)}\nthis.formatFailure = gitFailureDisplayText;`, gitFailureDisplayContext);
|
|
732
|
+
const repeatedStderr = "fatal: Not possible to fast-forward, aborting.";
|
|
733
|
+
const deduplicatedPullError = gitFailureDisplayContext.formatFailure({
|
|
734
|
+
error: repeatedStderr,
|
|
735
|
+
hint: "Local and remote branches have diverged.",
|
|
736
|
+
data: { command: "git pull --ff-only origin", stderr: repeatedStderr, stdout: "", exitCode: 128 },
|
|
737
|
+
});
|
|
738
|
+
assert.equal(deduplicatedPullError.split(repeatedStderr).length - 1, 1, "identical pull stderr should appear exactly once");
|
|
739
|
+
assert.match(deduplicatedPullError, /git pull --ff-only origin[\s\S]*\[exit: 128\]/, "deduplication should preserve command and exit details");
|
|
740
|
+
|
|
741
|
+
const gitPullErrorDialogStart = app.indexOf("function setGitPullErrorBusy(");
|
|
742
|
+
const gitPullErrorDialogEnd = app.indexOf("\nasync function pullGitFooterSync(", gitPullErrorDialogStart);
|
|
743
|
+
assert.ok(gitPullErrorDialogStart >= 0 && gitPullErrorDialogEnd > gitPullErrorDialogStart, "Git pull error dialog helpers should remain isolated from the pull request helper");
|
|
744
|
+
const copiedPullErrors = [];
|
|
745
|
+
const integrationRequests = [];
|
|
746
|
+
const integrationConfirmations = [];
|
|
747
|
+
const reviewedPullTabs = [];
|
|
748
|
+
const refreshedPullTabs = [];
|
|
749
|
+
const resumedPushes = [];
|
|
750
|
+
let integrationResponse = { ok: true, data: { changes: { summary: { ahead: 2 } } } };
|
|
751
|
+
const nativePullErrorDialog = { open: false, showModal() { this.open = true; }, close() { this.open = false; }, setAttribute() {} };
|
|
752
|
+
const nativePullErrorTitle = { textContent: "" };
|
|
753
|
+
const nativePullErrorDescription = { textContent: "" };
|
|
754
|
+
const nativePullErrorOutput = { textContent: "" };
|
|
755
|
+
const nativePullErrorStatus = { textContent: "", classList: { add() {}, remove() {} } };
|
|
756
|
+
const nativePullErrorRecovery = { hidden: true };
|
|
757
|
+
const nativePullErrorButton = () => ({ disabled: false, focus() {}, classList: { toggle() {} } });
|
|
758
|
+
const nativePullErrorMergeButton = nativePullErrorButton();
|
|
759
|
+
const nativePullErrorRebaseButton = nativePullErrorButton();
|
|
760
|
+
const nativePullErrorReviewButton = nativePullErrorButton();
|
|
761
|
+
const nativePullErrorCopyButton = nativePullErrorButton();
|
|
762
|
+
const nativePullErrorCloseButton = nativePullErrorButton();
|
|
763
|
+
const gitPullErrorDialogContext = {
|
|
764
|
+
gitPullErrorText: "",
|
|
765
|
+
gitPullErrorContext: { code: "", tabId: null, syncValue: "", busy: false, requestId: 0 },
|
|
766
|
+
activeTabId: "tab-pull",
|
|
767
|
+
tabs: [{ id: "tab-pull", title: "feature/sync" }, { id: "tab-rebase", title: "feature/rebase" }],
|
|
768
|
+
gitFooterSyncInFlightByTab: new Set(),
|
|
769
|
+
elements: {
|
|
770
|
+
gitPullErrorDialog: nativePullErrorDialog,
|
|
771
|
+
gitPullErrorDialogTitle: nativePullErrorTitle,
|
|
772
|
+
gitPullErrorDialogDescription: nativePullErrorDescription,
|
|
773
|
+
gitPullErrorOutput: nativePullErrorOutput,
|
|
774
|
+
gitPullErrorStatus: nativePullErrorStatus,
|
|
775
|
+
gitPullErrorRecovery: nativePullErrorRecovery,
|
|
776
|
+
gitPullErrorMergeButton: nativePullErrorMergeButton,
|
|
777
|
+
gitPullErrorRebaseButton: nativePullErrorRebaseButton,
|
|
778
|
+
gitPullErrorReviewButton: nativePullErrorReviewButton,
|
|
779
|
+
gitPullErrorCopyButton: nativePullErrorCopyButton,
|
|
780
|
+
gitPullErrorCloseButton: nativePullErrorCloseButton,
|
|
781
|
+
},
|
|
782
|
+
window: { alert() { throw new Error("native dialog should avoid alert fallback"); } },
|
|
783
|
+
queueMicrotask: (callback) => callback(),
|
|
784
|
+
copyText: async (text) => copiedPullErrors.push(text),
|
|
785
|
+
addEvent() {},
|
|
786
|
+
gitFooterCurrentBranch: () => "feature/sync",
|
|
787
|
+
appConfirmText: async (message, options) => { integrationConfirmations.push({ message, options }); return true; },
|
|
788
|
+
api: async (path, options) => { integrationRequests.push({ path, options }); return integrationResponse; },
|
|
789
|
+
gitFailureDisplayText: () => "integration conflict output",
|
|
790
|
+
openGitChangesDialog: (tabId) => reviewedPullTabs.push(tabId),
|
|
791
|
+
activeTabContext: (tabId) => ({ tabId }),
|
|
792
|
+
isCurrentTabContext: () => false,
|
|
793
|
+
renderFooter() {},
|
|
794
|
+
requestGitFooterWebuiPayload: (context) => refreshedPullTabs.push(context.tabId),
|
|
795
|
+
gitFooterSyncCounts: () => ({ ahead: 1, behind: 0 }),
|
|
796
|
+
pushGitFooterSync: async (tabId, value) => resumedPushes.push({ tabId, value }),
|
|
797
|
+
};
|
|
798
|
+
vm.runInNewContext(`${app.slice(gitPullErrorDialogStart, gitPullErrorDialogEnd)}\nthis.openPullError = openGitPullErrorDialog; this.copyPullError = copyGitPullErrorOutput; this.reviewPullError = reviewGitPullDivergence; this.integratePullError = integrateGitPullDivergence;`, gitPullErrorDialogContext);
|
|
799
|
+
gitPullErrorDialogContext.openPullError("network unavailable\n\ncheck the connection", { code: "DIVERGED", tabId: "tab-pull", syncValue: "⇡1 · ⇣2" });
|
|
800
|
+
assert.equal(nativePullErrorDialog.open, true, "Git pull error dialog should open natively");
|
|
801
|
+
assert.equal(nativePullErrorTitle.textContent, "Branches diverged", "DIVERGED popup should use a specific title");
|
|
802
|
+
assert.match(nativePullErrorDescription.textContent, /does not mean conflicts exist/, "DIVERGED popup should distinguish divergence from conflicts");
|
|
803
|
+
assert.equal(nativePullErrorRecovery.hidden, false, "DIVERGED popup should reveal recovery actions");
|
|
804
|
+
assert.equal(integrationRequests.length, 0, "opening divergence recovery must not mutate Git state");
|
|
805
|
+
assert.equal(nativePullErrorOutput.textContent, "network unavailable\n\ncheck the connection", "Git pull error dialog should display complete output");
|
|
806
|
+
await gitPullErrorDialogContext.copyPullError();
|
|
807
|
+
assert.deepEqual(copiedPullErrors, ["network unavailable\n\ncheck the connection"], "Git pull error copy action should preserve the complete output");
|
|
808
|
+
assert.equal(nativePullErrorStatus.textContent, "Error output copied to the clipboard.", "Git pull error dialog should announce copy success");
|
|
809
|
+
gitPullErrorDialogContext.reviewPullError();
|
|
810
|
+
assert.deepEqual(reviewedPullTabs, ["tab-pull"], "Review changes should open Git Changes for the originating tab");
|
|
811
|
+
assert.equal(integrationRequests.length, 0, "Review changes must remain non-mutating");
|
|
812
|
+
|
|
813
|
+
gitPullErrorDialogContext.openPullError("diverged", { code: "DIVERGED", tabId: "tab-pull", syncValue: "⇡1 · ⇣2" });
|
|
814
|
+
assert.equal(await gitPullErrorDialogContext.integratePullError("merge"), true, "confirmed merge recovery should succeed");
|
|
815
|
+
assert.deepEqual(JSON.parse(JSON.stringify(integrationRequests[0])), { path: "/api/git-changes/integrate", options: { method: "POST", body: { mode: "merge", confirmed: true }, tabId: "tab-pull" } }, "merge recovery should use the confirmed integration contract");
|
|
816
|
+
assert.equal(integrationConfirmations[0].options.confirmLabel, "Merge changes", "merge recovery should be the primary confirmed action");
|
|
817
|
+
assert.equal(integrationConfirmations[0].options.danger, false, "merge confirmation should use the normal primary style");
|
|
818
|
+
assert.deepEqual(refreshedPullTabs, ["tab-pull"], "successful integration should refresh the originating footer");
|
|
819
|
+
assert.deepEqual(resumedPushes, [{ tabId: "tab-pull", value: "⇡2" }], "successful integration should resume the existing confirmed push flow with the fresh outgoing count");
|
|
820
|
+
|
|
821
|
+
integrationResponse = { ok: false, code: "CONFLICTS", error: "conflicts created", data: { command: "git rebase @{upstream}", exitCode: 1 } };
|
|
822
|
+
gitPullErrorDialogContext.openPullError("diverged", { code: "DIVERGED", tabId: "tab-rebase", syncValue: "⇡2 · ⇣1" });
|
|
823
|
+
assert.equal(await gitPullErrorDialogContext.integratePullError("rebase"), false, "conflicted rebase recovery should stop");
|
|
824
|
+
assert.deepEqual(JSON.parse(JSON.stringify(integrationRequests[1].options.body)), { mode: "rebase", confirmed: true }, "rebase recovery should use the confirmed integration contract");
|
|
825
|
+
assert.equal(integrationConfirmations[1].options.confirmLabel, "Rebase commits", "rebase should remain an explicit alternative");
|
|
826
|
+
assert.equal(integrationConfirmations[1].options.danger, true, "rebase confirmation should warn that local commit IDs will be rewritten");
|
|
827
|
+
assert.deepEqual(reviewedPullTabs, ["tab-pull", "tab-rebase"], "actual conflicts should open the existing Git Changes panel");
|
|
828
|
+
assert.equal(resumedPushes.length, 1, "conflicted integration must not continue to push");
|
|
829
|
+
|
|
830
|
+
const pullGitFooterSyncStart = app.indexOf("async function pullGitFooterSync(");
|
|
831
|
+
const pullGitFooterSyncEnd = app.indexOf("\nasync function pullThenPushGitFooterSync(", pullGitFooterSyncStart);
|
|
832
|
+
assert.ok(pullGitFooterSyncStart >= 0 && pullGitFooterSyncEnd > pullGitFooterSyncStart, "footer pull should remain a standalone async frontend helper");
|
|
833
|
+
const pullGitFooterSyncSource = app.slice(pullGitFooterSyncStart, pullGitFooterSyncEnd);
|
|
834
|
+
const pullFailureEvents = [];
|
|
835
|
+
const pullFailureDialogs = [];
|
|
836
|
+
const pullFailureContext = {
|
|
837
|
+
gitFooterSyncInFlightByTab: new Set(),
|
|
838
|
+
activeTabContext: (tabId) => ({ tabId }),
|
|
839
|
+
hideFooterTooltip() {},
|
|
840
|
+
isCurrentTabContext: () => false,
|
|
841
|
+
renderFooter() {},
|
|
842
|
+
api: async () => ({ ok: false, code: "DIVERGED", error: "duplicated raw error", hint: "diverged", data: {} }),
|
|
843
|
+
gitFailureDisplayText: () => "deduplicated pull error",
|
|
844
|
+
addEvent: (message, level) => pullFailureEvents.push({ message, level }),
|
|
845
|
+
requestGitFooterWebuiPayload() {},
|
|
846
|
+
openGitPullErrorDialog: (message, options) => pullFailureDialogs.push({ message, options }),
|
|
847
|
+
};
|
|
848
|
+
vm.runInNewContext(`${pullGitFooterSyncSource}\nthis.runPullGitFooterSync = pullGitFooterSync;`, pullFailureContext);
|
|
849
|
+
assert.equal(await pullFailureContext.runPullGitFooterSync("tab-pull", { syncValue: "⇡1 · ⇣2" }), false, "failed footer pull should report failure to ordered Sync");
|
|
850
|
+
assert.deepEqual(pullFailureEvents, [{ message: "deduplicated pull error", level: "error" }], "failed footer pull should keep only deduplicated output in the event log");
|
|
851
|
+
assert.deepEqual(JSON.parse(JSON.stringify(pullFailureDialogs)), [{ message: "deduplicated pull error", options: { code: "DIVERGED", tabId: "tab-pull", syncValue: "⇡1 · ⇣2" } }], "failed footer pull should preserve structured recovery context");
|
|
852
|
+
assert.match(app, /async function pushGitFooterSync\(tabId = activeTabId, syncValue = ""\)[\s\S]*api\("\/api\/git-workflow\/push", \{ method: "POST", body: \{\}, tabId \}\)[\s\S]*response\.code === "NON_FAST_FORWARD"[\s\S]*recoverWithPullFirst = true[\s\S]*gitFooterSyncInFlightByTab\.delete\(tabId\)[\s\S]*pullThenPushGitFooterSync\(tabId, syncValue\)/, "non-fast-forward footer pushes should release their mutation lock before entering pull-first recovery");
|
|
853
|
+
const pushGitFooterSyncStart = app.indexOf("async function pushGitFooterSync(");
|
|
854
|
+
const pushGitFooterSyncEnd = app.indexOf("\nfunction renderGitFooterPayloadMeta(", pushGitFooterSyncStart);
|
|
855
|
+
assert.ok(pushGitFooterSyncStart >= 0 && pushGitFooterSyncEnd > pushGitFooterSyncStart, "footer push should remain a standalone async frontend helper");
|
|
856
|
+
const pushRecoveryRequests = [];
|
|
857
|
+
const pushRecoveryEvents = [];
|
|
858
|
+
const pushRecoveryCalls = [];
|
|
859
|
+
const pushRecoveryInFlight = new Set();
|
|
860
|
+
const pushRecoveryContext = {
|
|
861
|
+
activeTabId: "tab-push",
|
|
862
|
+
gitFooterSyncInFlightByTab: pushRecoveryInFlight,
|
|
863
|
+
gitFooterSyncCounts: () => ({ ahead: 2, behind: 0 }),
|
|
864
|
+
activeTabContext: (tabId) => ({ tabId }),
|
|
865
|
+
tabs: [{ id: "tab-push", title: "feature/push-recovery" }],
|
|
866
|
+
hideFooterTooltip() {},
|
|
867
|
+
gitFooterCurrentBranch: () => "feature/push-recovery",
|
|
868
|
+
appConfirmText: async () => true,
|
|
869
|
+
isCurrentTabContext: () => false,
|
|
870
|
+
renderFooter() {},
|
|
871
|
+
api: async (path, options) => {
|
|
872
|
+
pushRecoveryRequests.push({ path, options });
|
|
873
|
+
return { ok: false, code: "NON_FAST_FORWARD", error: "remote contains new commits" };
|
|
874
|
+
},
|
|
875
|
+
addEvent: (message, level) => pushRecoveryEvents.push({ message, level }),
|
|
876
|
+
requestGitFooterWebuiPayload() {},
|
|
877
|
+
formatGitCommandResult: () => "",
|
|
878
|
+
pullThenPushGitFooterSync: async (tabId, value) => pushRecoveryCalls.push({ tabId, value, locked: pushRecoveryInFlight.has(tabId) }),
|
|
879
|
+
};
|
|
880
|
+
vm.runInNewContext(`${app.slice(pushGitFooterSyncStart, pushGitFooterSyncEnd)}\nthis.runPushGitFooterSync = pushGitFooterSync;`, pushRecoveryContext);
|
|
881
|
+
await pushRecoveryContext.runPushGitFooterSync("tab-push", "⇡2");
|
|
882
|
+
assert.deepEqual(JSON.parse(JSON.stringify(pushRecoveryRequests)), [{ path: "/api/git-workflow/push", options: { method: "POST", body: {}, tabId: "tab-push" } }], "footer Push should not offer or attempt force-with-lease after a non-fast-forward rejection");
|
|
883
|
+
assert.deepEqual(JSON.parse(JSON.stringify(pushRecoveryCalls)), [{ tabId: "tab-push", value: "⇡2", locked: false }], "footer Push should hand non-fast-forward recovery to the existing pull-then-push workflow after unlocking the tab");
|
|
884
|
+
assert.deepEqual(pushRecoveryEvents, [{ message: "Push found incoming commits. Starting pull-first recovery.", level: "info" }], "footer Push should explain the switch to pull-first recovery");
|
|
885
|
+
assert.match(app, /chip\.key === "sync" && visible\("webui-sync-push"\)[\s\S]*syncAction === "pull"[\s\S]*pullGitFooterSync\(tabId\)[\s\S]*syncAction === "pull-push"[\s\S]*pullThenPushGitFooterSync\(tabId, chip\.value\)[\s\S]*syncAction === "push"[\s\S]*pushGitFooterSync\(tabId, chip\.value\)/, "footer Sync should route incoming, diverged, and outgoing states to their respective actions");
|
|
708
886
|
const gitFooterSyncRoutingSource = appFunctionSource("gitFooterSyncCounts", "gitFooterCurrentBranch");
|
|
709
887
|
const gitFooterSyncRouting = JSON.parse(vm.runInNewContext(`${gitFooterSyncRoutingSource}\nJSON.stringify({
|
|
710
888
|
incoming: gitFooterSyncAction({ key: "sync", value: "⇣2" }),
|
|
@@ -713,7 +891,23 @@ const gitFooterSyncRouting = JSON.parse(vm.runInNewContext(`${gitFooterSyncRouti
|
|
|
713
891
|
unavailable: gitFooterSyncAction({ key: "sync", value: "no upstream" }),
|
|
714
892
|
other: gitFooterSyncAction({ key: "changes", value: "⇣2" }),
|
|
715
893
|
})`));
|
|
716
|
-
assert.deepEqual(gitFooterSyncRouting, { incoming: "pull", outgoing: "push", diverged: "push", unavailable: "", other: "" }, "Sync routing should pull
|
|
894
|
+
assert.deepEqual(gitFooterSyncRouting, { incoming: "pull", outgoing: "push", diverged: "pull-push", unavailable: "", other: "" }, "Sync routing should pull before pushing whenever incoming and outgoing commits both exist");
|
|
895
|
+
const pullThenPushGitFooterSyncStart = app.indexOf("async function pullThenPushGitFooterSync(");
|
|
896
|
+
const pullThenPushGitFooterSyncEnd = app.indexOf("\nasync function pushGitFooterSync(", pullThenPushGitFooterSyncStart);
|
|
897
|
+
assert.ok(pullThenPushGitFooterSyncStart >= 0 && pullThenPushGitFooterSyncEnd > pullThenPushGitFooterSyncStart, "pull-then-push Sync should remain a standalone async frontend helper");
|
|
898
|
+
const pullThenPushGitFooterSyncSource = app.slice(pullThenPushGitFooterSyncStart, pullThenPushGitFooterSyncEnd);
|
|
899
|
+
const orderedSyncCalls = [];
|
|
900
|
+
const orderedSyncContext = {
|
|
901
|
+
pullGitFooterSync: async (tabId) => { orderedSyncCalls.push(`pull:${tabId}`); return true; },
|
|
902
|
+
pushGitFooterSync: async (tabId, value) => { orderedSyncCalls.push(`push:${tabId}:${value}`); },
|
|
903
|
+
};
|
|
904
|
+
vm.runInNewContext(`${pullThenPushGitFooterSyncSource}\nthis.runPullThenPushGitFooterSync = pullThenPushGitFooterSync;`, orderedSyncContext);
|
|
905
|
+
await orderedSyncContext.runPullThenPushGitFooterSync("tab-sync", "⇡1 · ⇣2");
|
|
906
|
+
assert.deepEqual(orderedSyncCalls, ["pull:tab-sync", "push:tab-sync:⇡1 · ⇣2"], "combined Sync should await pull before push");
|
|
907
|
+
orderedSyncCalls.length = 0;
|
|
908
|
+
orderedSyncContext.pullGitFooterSync = async (tabId) => { orderedSyncCalls.push(`pull:${tabId}`); return false; };
|
|
909
|
+
await orderedSyncContext.runPullThenPushGitFooterSync("tab-sync", "⇡1 · ⇣2");
|
|
910
|
+
assert.deepEqual(orderedSyncCalls, ["pull:tab-sync"], "combined Sync should skip push when pull fails or cannot start");
|
|
717
911
|
assert.match(app, /function gitDiffDisplayLine\(row, side\)[\s\S]*`-\$\{text\}`[\s\S]*`\+\$\{text\}`/, "git changes modal should render changed lines with +/- prefixes");
|
|
718
912
|
assert.match(app, /function gitUntrackedEntryToDiffFile\(entry\)[\s\S]*?renderRowLimit:\s*Number\.POSITIVE_INFINITY[\s\S]*?type: "added"/, "untracked files should render as complete added-file diffs without the row preview cap");
|
|
719
913
|
assert.match(app, /async function loadMissingGitUntrackedContent\(entry[\s\S]*?\/api\/git-changes\/untracked-file\?path=/, "untracked path-only payloads should fetch complete file contents instead of rendering as empty files");
|
|
@@ -838,7 +1032,7 @@ assert.match(app, /const PI_WEBUI_NPM_URL = "https:\/\/www\.npmjs\.com\/package\
|
|
|
838
1032
|
assert.match(app, /async function confirmOpenWebuiNpmPage\(\)[\s\S]*appConfirm\([\s\S]*confirmLabel: "Open npm"[\s\S]*openWebuiNpmPageInNewTab\(\)/, "Web UI version button should ask before opening npm in a new tab");
|
|
839
1033
|
assert.match(app, /function refreshWebuiVersion\(\)[\s\S]*api\("\/api\/health", \{ scoped: false \}\)[\s\S]*setWebuiVersion\(health\.webuiVersion\)[\s\S]*setPiVersion\(health\.piVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(health\)\)/, "frontend should load Pi version, Web UI version, and dev mode from health metadata");
|
|
840
1034
|
assert.match(app, /case "webui_connected":[\s\S]*setWebuiVersion\(event\.version\)[\s\S]*setPiVersion\(event\.piVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(event\)\)/, "frontend should refresh Pi version, Web UI version, and dev mode from reconnect events");
|
|
841
|
-
assert.match(server, /url\.pathname === "\/api\/pi-release-notes"[\s\S]*
|
|
1035
|
+
assert.match(server, /url\.pathname === "\/api\/pi-release-notes"[\s\S]*piReleaseNotes\(\)/, "server should expose release notes for the available Pi update or the installed fallback");
|
|
842
1036
|
assert.match(server, /PI_RELEASES_PAGE_BASE_URL = "https:\/\/github\.com\/earendil-works\/pi\/releases\/tag"/, "release-note links should target the official Pi GitHub release page");
|
|
843
1037
|
assert.match(server, /const webuiDevServer = isTruthyEnv\(process\.env\.PI_WEBUI_DEV\) \|\| isSourceCheckout\(packageRoot\)/, "server should derive dev mode from PI_WEBUI_DEV or a source checkout");
|
|
844
1038
|
assert.match(server, /webuiDev: webuiDevServer,[\s\S]*webuiMode: webuiDevServer \? "dev" : "production"/, "server status should expose Web UI dev mode");
|
|
@@ -849,8 +1043,8 @@ assert.match(server, /options\.cwd = await validateStartupCwd\(options\.cwd\)/,
|
|
|
849
1043
|
assert.match(server, /cwdExplicit: false/, "server should track whether startup cwd was explicitly requested");
|
|
850
1044
|
assert.match(server, /return options\.cwdExplicit \? \[await createTab\(\)\] : \[\]/, "server should wait for UI cwd selection when no --cwd is supplied");
|
|
851
1045
|
assert.match(server, /async function resolvedPiCliScript\(\)[\s\S]*require\.resolve\.paths\(PI_CODING_AGENT_PACKAGE\)[\s\S]*nodeModulesRoot[\s\S]*dist[\s\S]*cli\.js/, "server should resolve the bundled Pi CLI through Node resolution roots so hoisted global installs can spawn RPC tabs");
|
|
852
|
-
assert.match(server, /
|
|
853
|
-
assert.match(server, /
|
|
1046
|
+
assert.match(server, /canonicalPiRuntimeIdentity[\s\S]*bundledCli: await resolvedPiCliScript\(\)/, "standalone server should use the canonical resolver with the bundled Pi CLI before PATH pi");
|
|
1047
|
+
assert.match(server, /resolveCanonicalPiRuntime\([\s\S]*explicitCommand: options\.piBinExplicit \? options\.piBin : ""[\s\S]*bundledCli/, "updates should resolve the same canonical explicit or bundled Pi identity used by tabs");
|
|
854
1048
|
assert.match(app, /serverActionSelect\.addEventListener\("change", updateServerActionButton\)/, "Server action dropdown should control the guarded run button");
|
|
855
1049
|
assert.match(app, /runServerActionButton\.addEventListener\("click"[\s\S]*runSelectedServerAction/, "Server action run button should execute the selected action");
|
|
856
1050
|
assert.match(app, /api\("\/api\/restart", \{ method: "POST", scoped: false \}\)/, "Restart Server action should call the unscoped restart endpoint");
|
|
@@ -858,18 +1052,16 @@ assert.match(app, /setServerActionStatus\(message, "warn"\);\n\s+setServerRestar
|
|
|
858
1052
|
assert.match(app, /const showOfflinePanel = backendOffline && !serverRestartInProgress/, "intentional restart should suppress the generic offline shell while reconnecting");
|
|
859
1053
|
assert.match(app, /api\("\/api\/shutdown", \{ method: "POST", scoped: false \}\)/, "Stop Server action should call the unscoped shutdown endpoint");
|
|
860
1054
|
assert.match(server, /url\.pathname === "\/api\/restart" && req\.method === "POST"/, "server should expose restart endpoint");
|
|
861
|
-
assert.match(server, /
|
|
1055
|
+
assert.match(server, /PI_WEBUI_RESTORE_FILE: restore\.file/, "server restart should pass tab metadata through a private read-once restore file");
|
|
862
1056
|
assert.match(server, /if \(webuiDevServer\) env\.PI_WEBUI_DEV = "1";/, "server restart should explicitly preserve dev mode");
|
|
863
|
-
assert.match(server, /
|
|
864
|
-
assert.match(server, /
|
|
865
|
-
assert.match(server, /
|
|
866
|
-
assert.
|
|
867
|
-
assert.match(
|
|
868
|
-
assert.match(app, /
|
|
869
|
-
assert.match(
|
|
870
|
-
assert.match(
|
|
871
|
-
assert.match(html, /<option value="update-all">Update Pi \+ Packages & Restart<\/option>/, "side panel should expose package-inclusive updates as a separate server action");
|
|
872
|
-
assert.match(readme, /first checks the selected Pi executable's `pi update --help`[\s\S]*uses `pi update --all` when advertised[\s\S]*otherwise falls back/, "README should document the checked preferred and fallback update modes");
|
|
1057
|
+
assert.match(server, /url\.pathname === "\/api\/update\/plan"[\s\S]*createServerOwnedUpdatePlan/, "server should expose exact server-owned update planning");
|
|
1058
|
+
assert.match(server, /url\.pathname === "\/api\/update\/apply"[\s\S]*validateUpdateApplyRequest[\s\S]*applyServerOwnedUpdate/, "server should apply only a transaction id and plan digest");
|
|
1059
|
+
assert.match(server, /Legacy update mutation is disabled/, "divergent legacy update mutation routes should fail closed");
|
|
1060
|
+
assert.doesNotMatch(server, /function resolveUpdateTasks|function projectPackageRootUpdateTasks|function npmGlobalPackageRootUpdateTask|function bunGlobalPackageRootUpdateTask/, "broad heuristic package-root mutation should be removed");
|
|
1061
|
+
assert.match(app, /Exact immutable plan digest:[\s\S]*persisted exact-target plan[\s\S]*will not re-resolve latest or scan package roots/, "frontend confirmation should bind users to the exact plan digest and fail-closed scope");
|
|
1062
|
+
assert.match(app, /api\("\/api\/update\/apply", \{ method: "POST", body: \{ transactionId: plan\.transactionId, planDigest: plan\.digest \}/, "frontend should apply only the confirmed transaction and digest");
|
|
1063
|
+
assert.match(html, /<option value="update-all">/, "side panel should retain a combined update action while routing through exact plans");
|
|
1064
|
+
assert.match(readme, /exact-target plan|plan digest/i, "README should document exact update plans");
|
|
873
1065
|
assert.match(server, /async function closeNetworkAccess\(\)/, "server should expose a local-only rebind helper for closing network access");
|
|
874
1066
|
assert.match(server, /url\.pathname === "\/api\/network\/close" && req\.method === "POST"/, "server should route network close requests");
|
|
875
1067
|
assert.match(server, /server\.closeAllConnections\?\.\(\)/, "network rebind should force-close long-lived clients so close-to-localhost can complete");
|
|
@@ -884,7 +1076,7 @@ assert.match(app, /function setOptionsMenuOpen\(open\)[\s\S]*scheduleMobileDropd
|
|
|
884
1076
|
assert.match(app, /function focusPromptInput\(\{ defer = false \} = \{\}\)/, "frontend should focus the prompt composer programmatically after tab/app startup");
|
|
885
1077
|
assert.match(app, /async function switchTab\(tabId\)[\s\S]*?restoreActiveDraft\(\);\n\s+focusPromptInput\(\{ defer: true \}\);/, "switching to a newly opened tab should focus the prompt input immediately");
|
|
886
1078
|
assert.match(app, /async function initializeTabs\(\)[\s\S]*?restoreActiveDraft\(\);[\s\S]*if \(!loadedTabs\.length\)[\s\S]*focusPromptInput\(\{ defer: true \}\);/, "starting the Web UI should prompt for cwd when needed and focus active tabs");
|
|
887
|
-
assert.match(app, /resizePromptInput\(\);\nrestoreDurableUiLayoutPendingJournal\(\);\nrestoreSidePanelWidthPreference\(\);\nrestoreFileViewerWidthPreference\(\);\nfocusPromptInput\(\{ defer: true \}\);\nrestoreStoredSkillUsage\(\);\nrestoreBusyPromptBehaviorSetting\(\);\nupdateComposerModeButtons\(\);/, "startup should restore resizable panel preferences, request prompt focus, and restore skill tags before waiting for tab state refreshes");
|
|
1079
|
+
assert.match(app, /resizePromptInput\(\);\nclearRemovedSidePanelSectionHeightState\(\);\nrestoreDurableUiLayoutPendingJournal\(\);\nrestoreSidePanelWidthPreference\(\);\nrestoreFileViewerWidthPreference\(\);\nfocusPromptInput\(\{ defer: true \}\);\nrestoreStoredSkillUsage\(\);\nrestoreBusyPromptBehaviorSetting\(\);\nupdateComposerModeButtons\(\);/, "startup should clear retired section-height state, restore resizable panel preferences, request prompt focus, and restore skill tags before waiting for tab state refreshes");
|
|
888
1080
|
assert.match(app, /elements\.promptInput\.addEventListener\("focus", \(\) => \{\n\s+syncMobileChatToBottomForInput\(\);/, "focusing mobile input should scroll output to bottom");
|
|
889
1081
|
assert.match(app, /navigator\.serviceWorker\.register\("\/service-worker\.js"\)/, "PWA service worker should be registered by the app");
|
|
890
1082
|
assert.match(app, /function serverStartCommandText\(\)[\s\S]*return `pi-webui\$\{currentPortArg\(\)\}`/, "PWA/offline shell should build a pathless pi-webui recovery command");
|
|
@@ -1363,7 +1555,7 @@ assert.match(app, /if \(response\.data\?\.level\) requestGitFooterWebuiPayload\(
|
|
|
1363
1555
|
assert.match(app, /Loading git footer status…/, "missing git footer payload should show a loading state before declaring the extension unavailable");
|
|
1364
1556
|
assert.match(app, /GIT_FOOTER_WEBUI_PAYLOAD_CACHE_KEY/, "git footer payloads should be cached across Web UI reloads");
|
|
1365
1557
|
assert.match(app, /function setOptionalFeatureDisabled\(featureId, disabled\)[\s\S]*clearGitFooterWebuiPayloadCache\(\)/, "changing the git footer feature toggle should invalidate the cached footer payload");
|
|
1366
|
-
const workspaceInfoSource = server.match(/async function getWorkspaceInfo[\s\S]*?\n}\n\nlet activeGitWorkflowProcess/)?.[0] || "";
|
|
1558
|
+
const workspaceInfoSource = server.match(/async function getWorkspaceInfo[\s\S]*?\r?\n}\r?\n\r?\nlet activeGitWorkflowProcess/)?.[0] || "";
|
|
1367
1559
|
assert.ok(workspaceInfoSource, "server workspace info source should be inspectable");
|
|
1368
1560
|
assert.doesNotMatch(workspaceInfoSource, /runCommand\("git"|branchStatus|isRepo/, "Web UI workspace endpoint should not duplicate git footer status collection");
|
|
1369
1561
|
assert.match(app, /function renderOptionalFeatureDependentDisplays\(\)[\s\S]*renderOptionalFeatureControls\(\);[\s\S]*renderThemeSelect\(\);[\s\S]*renderWidgets\(\);[\s\S]*renderStatus\(\);[\s\S]*renderCommands\(\);[\s\S]*renderAllMessages\(\{ preserveScroll: true, forceRebuild: true \}\);[\s\S]*if \(streamRawText\) renderStreamingAssistantText\(\);/, "optional feature toggles should immediately refresh visible controls, commands, transcript, and live stream displays");
|
|
@@ -2081,8 +2273,8 @@ assert.match(server, /type: "webui_extension_ui_resolved"[\s\S]*?pendingExtensio
|
|
|
2081
2273
|
assert.match(server, /command\.type === "abort"[\s\S]*?cancelPendingExtensionUiRequests\(tab\)/, "abort should cancel hidden pending extension UI requests");
|
|
2082
2274
|
assert.match(server, /type: "webui_extension_ui_cancelled"/, "server should notify browsers when pending extension UI requests are cancelled");
|
|
2083
2275
|
assert.match(server, /async function handleNativeSlashCommand\(tab, body, req\)/, "server should intercept supported native slash commands with request context for security guards");
|
|
2084
|
-
assert.match(server, /const restoreTabs = readRestoreTabsFromEnv\(\)/, "server should accept restart tab restore descriptors from the launcher environment");
|
|
2085
|
-
assert.match(server, /delete process\.env\.PI_WEBUI_RESTORE_TABS/, "server should avoid leaking restore descriptors into spawned Pi RPC processes");
|
|
2276
|
+
assert.match(server, /const restoreTabs = await readRestoreTabsFromEnv\(\)/, "server should accept private restart tab restore descriptors from the launcher environment");
|
|
2277
|
+
assert.match(server, /delete process\.env\.PI_WEBUI_RESTORE_FILE[\s\S]*delete process\.env\.PI_WEBUI_RESTORE_TABS/, "server should avoid leaking private or obsolete restore descriptors into spawned Pi RPC processes");
|
|
2086
2278
|
assert.match(server, /if \(sessionFile && !options\.noSession\) piArgs\.push\("--session", sessionFile\)/, "restored tabs should resume previous session files");
|
|
2087
2279
|
assert.doesNotMatch(server, /args\.push\("--name"/, "Web UI tab titles should not be forwarded as Pi CLI --name flags because older bundled Pi CLIs reject them");
|
|
2088
2280
|
assert.match(server, /const closedRestorableTabs = \[\]/, "server should track recently closed tabs separately from restart restore descriptors");
|
|
@@ -2104,7 +2296,7 @@ assert.match(extension, /const openTabSources: unknown\[\] = \[\]/, "launcher sh
|
|
|
2104
2296
|
assert.match(extension, /const detailedTabs = statusData\?\.tabs;\n\s+if \(Array\.isArray\(detailedTabs\)\) openTabSources\.push\(detailedTabs\)/, "launcher should prefer detailed open tabs over restorableTabs that may include closed tabs");
|
|
2105
2297
|
assert.match(extension, /if \(openTabSources\.length > 0\) return mergeRestorableTabsFromStatusSources\(openTabSources, options\)/, "launcher should restore only open tabs when open tab lists are available");
|
|
2106
2298
|
assert.match(extension, /return mergeRestorableTabsFromStatusSources\(\[statusData\?\.restorableTabs, existing\.restorableTabs\], options\)/, "launcher should use restorableTabs only as a legacy fallback");
|
|
2107
|
-
assert.match(extension, /env\.
|
|
2299
|
+
assert.match(extension, /env\.PI_WEBUI_RESTORE_FILE = \(await createRestoreFile\(agentDir, restoreTabs\)\)\.file/, "launcher should pass restorable tabs through a private read-once file");
|
|
2108
2300
|
assert.match(extension, /pi\.registerCommand\("webui-start"/, "extension should expose the canonical /webui-start command");
|
|
2109
2301
|
assert.match(extension, /pi\.registerCommand\("webui-tree-navigate"/, "extension should expose the internal Web UI tree navigation command");
|
|
2110
2302
|
assert.match(extension, /ctx\.navigateTree\(payload\.entryId/, "internal Web UI tree command should call the native session tree navigation API");
|
|
@@ -2193,6 +2385,7 @@ assert.match(server, /function optionalFeaturePackageStatus\(featureId, cwd = op
|
|
|
2193
2385
|
assert.match(server, /if \(beforeStatus\.locallyConfigured\)[\s\S]*load it twice[\s\S]*local-resource-conflict/, "server should block npm registration when a top-level resource already owns the optional feature");
|
|
2194
2386
|
assert.match(server, /function installOptionalFeaturePackage\(featureId, cwd = options\.cwd\)[\s\S]*const source = `npm:\$\{packageName\}`[\s\S]*resolvePiCommand\(\["install", source\]\)/, "server should install and update optional features through the selected Pi CLI");
|
|
2195
2387
|
assert.match(server, /function configuredAgentNpmRoot\(\)/, "status discovery should consider Pi's agent npm root for legacy or hoisted packages");
|
|
2388
|
+
assert.match(server, /function packageNodeModulesPath\(nodeModulesRoot, packageName\)[\s\S]*path\.join\(nodeModulesRoot,[\s\S]*split\("\/"\)/, "status discovery should map scoped npm package names into node_modules paths");
|
|
2196
2389
|
assert.match(server, /resolveInstalledPackageSubpath\(nodeModulesRef\.packageName, nodeModulesRef\.subpath\)/, "started Web UI resource resolution should support configured package resources");
|
|
2197
2390
|
assert.match(server, /url\.pathname === "\/api\/optional-features" && req\.method === "GET"/, "server should expose optional feature package status endpoint");
|
|
2198
2391
|
assert.match(server, /url\.pathname === "\/api\/optional-feature-install" && req\.method === "POST"/, "server should preserve the optional feature single-install endpoint");
|
|
@@ -68,7 +68,7 @@ assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server
|
|
|
68
68
|
assert.match(serviceWorker, /"\/issue-wizard-state\.mjs"/, "the PWA shell must keep caching the pure wizard module");
|
|
69
69
|
assert.match(serviceWorker, /"\/issue-bot-client\.mjs"/, "the PWA shell must cache the browser client module");
|
|
70
70
|
// Intent preserved: changing the public startup graph advances the PWA cache identity.
|
|
71
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
71
|
+
assert.match(serviceWorker, /pi-webui-pwa-v81/, "the PWA cache name must change with browser wiring updates");
|
|
72
72
|
assert.match(packageJson, /node --check public\/issue-wizard-state\.mjs/, "the package check must keep syntax-checking the pure wizard module");
|
|
73
73
|
assert.match(packageJson, /node --check public\/issue-bot-client\.mjs/, "the package check must syntax-check the browser client module");
|
|
74
74
|
|
|
@@ -31,8 +31,12 @@ assert.match(surfaceSource, /Checking optional features…[\s\S]*elapsed[\s\S]*C
|
|
|
31
31
|
assert.match(surfaceSource, /Previous optional features need migration[\s\S]*Migrate…[\s\S]*Later/, "action-required migration should expose Migrate and persisted Later actions");
|
|
32
32
|
assert.match(surfaceSource, /safely excluded[\s\S]*Copy recommended fix[\s\S]*Recheck/, "conflicts should explain safe exclusion using a recommended path-free fix and recheck");
|
|
33
33
|
assert.match(surfaceSource, /started safely without optional companions[\s\S]*Recheck/, "degraded startup should remain core-safe and recheckable");
|
|
34
|
+
assert.match(surfaceSource, /noticeDismissKey[\s\S]*optionalFeatureMigrationDismissedNoticeKey === noticeDismissKey[\s\S]*surface\.hidden = true/, "a dismissed degraded snapshot should stay hidden for the current page lifetime");
|
|
35
|
+
assert.match(surfaceSource, /optional-feature-migration-dismiss[\s\S]*aria-label", "Close optional feature startup notice"/, "degraded startup should expose an accessible dismiss button");
|
|
36
|
+
assert.match(app, /function dismissOptionalFeatureMigrationNotice\(\)[\s\S]*optionalFeatureMigrationDismissedNoticeKey = key[\s\S]*renderOptionalFeatureMigrationSurface\(\)/, "the degraded dismiss action should hide the current snapshot through the existing renderer");
|
|
34
37
|
assert.match(surfaceSource, /Migrating optional features[\s\S]*Retry failed[\s\S]*Copy commands[\s\S]*Restart tab/, "progress and recovery should expose the required sequential/retry/copy/deferred-restart actions");
|
|
35
38
|
assert.match(surfaceSource, /if \(optionalFeatureRestartNotice\.restartDeferred\)[\s\S]*Restart tab[\s\S]*else[\s\S]*Dismiss/, "a deferred restart action must remain persistent until restart succeeds");
|
|
39
|
+
assert.match(surfaceSource, /optionalFeatureMigrationCompletionIsDismissed\(snapshot\)[\s\S]*surface\.hidden = true[\s\S]*phase === "complete"[\s\S]*dismissOptionalFeatureMigrationCompletion/, "dismissing a completed migration should hide the complete surface, not only its restart notice");
|
|
36
40
|
assert.match(surfaceSource, /setAttribute\("role", "alert"\)/, "only conflict/partial terminal feedback should add alert semantics");
|
|
37
41
|
assert.match(surfaceSource, /optional-feature-migration-completion-summary[\s\S]*card\.focus/, "completion summary should receive focus once");
|
|
38
42
|
assert.doesNotMatch(surfaceSource, /percent|% complete/i, "package-manager progress must not fabricate percentages");
|
|
@@ -56,17 +60,21 @@ assert.match(eventSource, /webui_optional_feature_migration[\s\S]*applyOptionalF
|
|
|
56
60
|
assert.match(eventSource, /webui_optional_feature_restart_completed[\s\S]*webui_optional_feature_restart_deferred/, "SSE restart events should be consumed");
|
|
57
61
|
const progressRecoverySource = sourceBetween("function applyOptionalFeatureProgressStates", "function refreshOptionalFeatureMigrationElapsedText");
|
|
58
62
|
assert.match(progressRecoverySource, /progress\.restartDeferred === true[\s\S]*optionalFeatureRestartNotice/, "cached progress must rehydrate the deferred Restart action after a full browser reload");
|
|
59
|
-
assert.match(progressRecoverySource, /progress\.autoRestarted === true[\s\S]*optionalFeatureRestartNotice/, "cached progress should rehydrate
|
|
63
|
+
assert.match(progressRecoverySource, /progress\.autoRestarted === true && !optionalFeatureMigrationCompletionIsDismissed\(snapshot\)[\s\S]*optionalFeatureRestartNotice/, "cached progress should rehydrate an undismissed completed restart notice");
|
|
64
|
+
assert.match(progressRecoverySource, /optionalFeatureMigrationCompletionIsDismissed\(snapshot\)[\s\S]*optionalFeatureRestartNotice = null/, "cached progress must not resurrect a dismissed completion notice");
|
|
65
|
+
assert.match(app, /OPTIONAL_FEATURE_MIGRATION_DISMISS_STORAGE_KEY[\s\S]*storedDismissedOptionalFeatureMigrationKey[\s\S]*localStorage\.setItem\(OPTIONAL_FEATURE_MIGRATION_DISMISS_STORAGE_KEY, key\)/, "completion dismissal should survive reloads in browser storage");
|
|
60
66
|
assert.match(app, /source\.onopen[\s\S]*refreshOptionalFeaturePackageStatuses\(\)/, "event-stream reconnect should recover the current cached server snapshot");
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
assert.
|
|
67
|
+
const elapsedTimerSource = sourceBetween("function refreshOptionalFeatureMigrationElapsedText", "function clearOptionalFeatureReadyDismissTimer");
|
|
68
|
+
const dismissalTimerSource = sourceBetween("function clearOptionalFeatureReadyDismissTimer", "function optionalFeatureMigrationAction");
|
|
69
|
+
assert.doesNotMatch(elapsedTimerSource, /renderOptionalFeatureMigrationSurface\(\)/, "elapsed ticks must not replace and re-announce the entire live region");
|
|
70
|
+
assert.match(elapsedTimerSource, /querySelector\("\.optional-feature-migration-detail"\)/, "elapsed ticks should update only the detail node");
|
|
64
71
|
assert.match(app, /const OPTIONAL_FEATURE_READY_AUTO_DISMISS_MS = 5_000;/, "a successful startup audit should remain readable briefly before dismissal");
|
|
65
|
-
assert.match(
|
|
72
|
+
assert.match(dismissalTimerSource, /scheduleOptionalFeatureReadyDismiss[\s\S]*setTimeout[\s\S]*optionalFeatureReadyDismissKey\(\) !== key \|\| optionalFeatureRestartNotice[\s\S]*surface\.hidden = true/, "ready feedback should auto-dismiss only while the same ready snapshot remains non-actionable");
|
|
66
73
|
assert.match(surfaceSource, /readyCanAutoDismiss[\s\S]*scheduleOptionalFeatureReadyDismiss\(readyCanAutoDismiss \? readyDismissKey : ""\)/, "rendering should schedule dismissal only for non-actionable ready feedback");
|
|
67
74
|
|
|
68
75
|
assert.match(css, /\.optional-feature-migration-surface[\s\S]*\.optional-feature-migration-dialog[\s\S]*@media \(max-width: 34rem\)/, "migration surfaces should have desktop and responsive styling");
|
|
69
76
|
assert.match(css, /\.optional-feature-migration-card:focus-visible/, "focused completion summary should have a visible focus treatment");
|
|
77
|
+
assert.match(css, /\.optional-feature-migration-card\.phase-degraded[\s\S]*padding-right:[^;]+;[\s\S]*\.optional-feature-migration-dismiss \{[\s\S]*position: absolute;[\s\S]*top:[^;]+;[\s\S]*right:[^;]+;/, "the degraded popup should reserve space for a top-right dismiss button");
|
|
70
78
|
|
|
71
79
|
assert.match(readme, /read-only startup audit/i, "README should document startup auditing");
|
|
72
80
|
assert.match(readme, /--migrate-optional-features[\s\S]*--migration-dry-run/, "README should document explicit unattended migration and dry-run flags");
|
|
@@ -22,6 +22,11 @@ assert.match(
|
|
|
22
22
|
/const UI_LAYOUT_FIELDS = \["sidePanel", "composerActions", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"\];/,
|
|
23
23
|
"every approved arrangement surface should be a durable layout field",
|
|
24
24
|
);
|
|
25
|
+
assert.match(
|
|
26
|
+
app,
|
|
27
|
+
/const UI_LAYOUT_SIDE_PANEL_FIELDS = \["sectionOrder", "collapsedSectionIds", "hiddenSectionIds", "collapsed"\];/,
|
|
28
|
+
"Control Deck durable layout should contain only order, visibility, and collapse state",
|
|
29
|
+
);
|
|
25
30
|
for (const [constant, value] of [
|
|
26
31
|
["UI_LAYOUT_ID_MAX_LENGTH", "256"],
|
|
27
32
|
["UI_LAYOUT_TITLE_MAX_LENGTH", "160"],
|
|
@@ -193,6 +198,11 @@ assert.match(
|
|
|
193
198
|
/function restoreSidePanelState\(\)[\s\S]*setSidePanelCollapsed\(stored \?\? false, \{ persist: false \}\)/,
|
|
194
199
|
"passive Control Deck restoration must not echo stale cache back to the server",
|
|
195
200
|
);
|
|
201
|
+
assert.doesNotMatch(
|
|
202
|
+
app,
|
|
203
|
+
/initializeSidePanelSectionResizing|persistSidePanelSectionHeight|beginSidePanelSectionResize|sidePanelSectionResizeState|data-side-panel-section-resize/,
|
|
204
|
+
"Control Deck section-height adjustment and persistence should be absent",
|
|
205
|
+
);
|
|
196
206
|
|
|
197
207
|
// --- Composer order and grid stay one atomic logical update ----------------
|
|
198
208
|
|
|
@@ -261,7 +271,8 @@ assert.match(
|
|
|
261
271
|
|
|
262
272
|
// --- Coherent browser asset revisions --------------------------------------
|
|
263
273
|
|
|
264
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
265
|
-
assert.match(html, /
|
|
274
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "changed browser assets should advance the PWA cache identity");
|
|
275
|
+
assert.match(html, /styles\.css\?v=104/, "the page should request the updated layout stylesheet revision");
|
|
276
|
+
assert.match(html, /data-app-src="\/app\.js\?v=120"/, "the boot loader should request the updated app module revision");
|
|
266
277
|
|
|
267
278
|
console.log("persistent-ui-layout-static.test.mjs passed");
|
|
@@ -98,11 +98,19 @@ const routingAdd = sendSource.indexOf("promptRoutingTabs.add(targetTabId);");
|
|
|
98
98
|
const workingMark = sendSource.indexOf("markTabWorkingLocally(targetTabId);");
|
|
99
99
|
const responseApply = sendSource.indexOf("applyResponseTab(response);");
|
|
100
100
|
const successDelete = sendSource.indexOf("promptRoutingTabs.delete(targetTabId);", responseApply);
|
|
101
|
+
const nativeResponseBranch = sendSource.indexOf('if (response?.command === "native_slash_command"', responseApply);
|
|
101
102
|
const catchStart = sendSource.indexOf("} catch (error)", successDelete);
|
|
102
103
|
const failureDelete = sendSource.indexOf("promptRoutingTabs.delete(targetTabId);", catchStart);
|
|
103
104
|
const idleMark = sendSource.indexOf("markTabIdleLocally(targetTabId);", catchStart);
|
|
104
105
|
assert.ok(routingAdd >= 0 && routingAdd < workingMark, "fresh prompts should enter routing protection before rendering working state");
|
|
105
106
|
assert.ok(responseApply >= 0 && successDelete > responseApply && successDelete < catchStart, "successful routing protection should end only after applying the server handoff response");
|
|
107
|
+
assert.ok(successDelete < nativeResponseBranch, "all accepted prompts, including extension commands, should release routing ownership before native-command special cases");
|
|
106
108
|
assert.ok(failureDelete > catchStart && failureDelete < idleMark, "failed routing should clear protection before restoring idle state");
|
|
107
109
|
|
|
110
|
+
const abortSource = functionSource("abortActiveRun");
|
|
111
|
+
const abortRequest = abortSource.indexOf('await api("/api/abort"');
|
|
112
|
+
const abortRoutingDelete = abortSource.indexOf("promptRoutingTabs.delete(tabContext.tabId);", abortRequest);
|
|
113
|
+
const abortStateChecks = abortSource.indexOf("scheduleAbortStateChecks(tabContext);", abortRoutingDelete);
|
|
114
|
+
assert.ok(abortRequest >= 0 && abortRoutingDelete > abortRequest && abortRoutingDelete < abortStateChecks, "a successful abort should release local routing ownership before canonical state checks");
|
|
115
|
+
|
|
108
116
|
console.log("prompt routing tab-status checks passed");
|
|
@@ -504,8 +504,8 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
|
|
|
504
504
|
assert.match(css, /\.questionnaire-options button\s*\{\s*min-height:\s*3\.35rem/, "mobile questionnaire targets must exceed the 44px floor");
|
|
505
505
|
assert.match(css, /@media \(prefers-reduced-motion: reduce\)\s*\{[\s\S]*?\*, \*::before, \*::after[\s\S]*?transition-duration:\s*1ms !important/, "global reduced-motion rules must cover questionnaire transitions");
|
|
506
506
|
|
|
507
|
-
assert.match(html, /styles\.css\?v=
|
|
508
|
-
assert.match(html, /app\.js\?v=
|
|
509
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
507
|
+
assert.match(html, /styles\.css\?v=104/, "questionnaire CSS needs the current stylesheet revision");
|
|
508
|
+
assert.match(html, /app\.js\?v=120/, "questionnaire behavior needs the current app revision");
|
|
509
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "questionnaire public assets need a coherent PWA cache revision");
|
|
510
510
|
|
|
511
511
|
console.log("questionnaire-dialog.test.mjs passed");
|
|
@@ -68,7 +68,13 @@ try {
|
|
|
68
68
|
assert.equal(initialSafetyGuardSetup.status, 200);
|
|
69
69
|
assert.equal(initialSafetyGuardSetup.body?.data?.config?.enabled, true, "safety guard should default to enabled");
|
|
70
70
|
assert.deepEqual(initialSafetyGuardSetup.body?.data?.config?.contextLines, { before: 3, after: 3 });
|
|
71
|
+
assert.deepEqual(initialSafetyGuardSetup.body?.data?.config?.autoReview, {
|
|
72
|
+
enabled: false,
|
|
73
|
+
model: { provider: "", modelId: "", thinkingLevel: "off" },
|
|
74
|
+
}, "auto-review should default off with no implicit model selection");
|
|
71
75
|
assert.ok(initialSafetyGuardSetup.body?.data?.categories?.includes("database"));
|
|
76
|
+
assert.equal(initialSafetyGuardSetup.body?.data?.models?.[0]?.id, "fake-model", "GET should return authenticated models from the active Pi tab");
|
|
77
|
+
assert.deepEqual(initialSafetyGuardSetup.body?.data?.modelThinkingLevels?.["fake/fake-model"], ["off"], "GET should return supported thinking levels per model");
|
|
72
78
|
|
|
73
79
|
const invalidSafetyGuardSetup = await request("/api/safety-guard/config", {
|
|
74
80
|
method: "POST",
|
|
@@ -76,6 +82,28 @@ try {
|
|
|
76
82
|
});
|
|
77
83
|
assert.equal(invalidSafetyGuardSetup.status, 400, "setup should reject context limits outside the canonical range");
|
|
78
84
|
|
|
85
|
+
const unavailableAutoReviewModel = await request("/api/safety-guard/config", {
|
|
86
|
+
method: "POST",
|
|
87
|
+
body: { config: { autoReview: { enabled: true, model: { provider: "fake", modelId: "missing-model", thinkingLevel: "off" } } } },
|
|
88
|
+
});
|
|
89
|
+
assert.equal(unavailableAutoReviewModel.status, 400, "enabled auto-review should reject unavailable models");
|
|
90
|
+
|
|
91
|
+
const unsupportedAutoReviewThinking = await request("/api/safety-guard/config", {
|
|
92
|
+
method: "POST",
|
|
93
|
+
body: { config: { autoReview: { enabled: true, model: { provider: "fake", modelId: "fake-model", thinkingLevel: "low" } } } },
|
|
94
|
+
});
|
|
95
|
+
assert.equal(unsupportedAutoReviewThinking.status, 400, "enabled auto-review should reject unsupported thinking levels");
|
|
96
|
+
|
|
97
|
+
const enabledAutoReviewSetup = await request("/api/safety-guard/config", {
|
|
98
|
+
method: "POST",
|
|
99
|
+
body: { config: { autoReview: { enabled: true, model: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" } } } },
|
|
100
|
+
});
|
|
101
|
+
assert.equal(enabledAutoReviewSetup.status, 200);
|
|
102
|
+
assert.deepEqual(enabledAutoReviewSetup.body?.data?.config?.autoReview, {
|
|
103
|
+
enabled: true,
|
|
104
|
+
model: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" },
|
|
105
|
+
});
|
|
106
|
+
|
|
79
107
|
const savedSafetyGuardSetup = await request("/api/safety-guard/config", {
|
|
80
108
|
method: "POST",
|
|
81
109
|
body: {
|
|
@@ -84,6 +112,7 @@ try {
|
|
|
84
112
|
categories: { docker: false },
|
|
85
113
|
protectedPaths: { edit: false },
|
|
86
114
|
contextLines: { before: 2, after: 4 },
|
|
115
|
+
autoReview: { enabled: false },
|
|
87
116
|
},
|
|
88
117
|
},
|
|
89
118
|
});
|
|
@@ -91,8 +120,13 @@ try {
|
|
|
91
120
|
assert.equal(savedSafetyGuardSetup.body?.data?.config?.enabled, false);
|
|
92
121
|
assert.equal(savedSafetyGuardSetup.body?.data?.config?.categories?.docker, false);
|
|
93
122
|
assert.deepEqual(savedSafetyGuardSetup.body?.data?.config?.contextLines, { before: 2, after: 4 });
|
|
123
|
+
assert.deepEqual(savedSafetyGuardSetup.body?.data?.config?.autoReview, {
|
|
124
|
+
enabled: false,
|
|
125
|
+
model: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" },
|
|
126
|
+
}, "disabling auto-review should retain the explicitly selected model");
|
|
94
127
|
const persistedSafetyGuardSetup = JSON.parse(await readFile(safetyGuardSettingsFile, "utf8"));
|
|
95
128
|
assert.equal(persistedSafetyGuardSetup.protectedPaths?.edit, false);
|
|
129
|
+
assert.equal(persistedSafetyGuardSetup.autoReview?.enabled, false);
|
|
96
130
|
|
|
97
131
|
const initialGitSetup = await request("/api/git-workflow/preferences");
|
|
98
132
|
assert.equal(initialGitSetup.status, 200);
|
|
@@ -61,6 +61,15 @@ const rawPiScript = String.raw`
|
|
|
61
61
|
});
|
|
62
62
|
`;
|
|
63
63
|
|
|
64
|
+
let testSocketSerial = 0;
|
|
65
|
+
|
|
66
|
+
function testSocketPath(label) {
|
|
67
|
+
testSocketSerial += 1;
|
|
68
|
+
return process.platform === "win32"
|
|
69
|
+
? `\\\\.\\pipe\\pi-webui-rpc-host-${process.pid}-${testSocketSerial}-${label}`
|
|
70
|
+
: path.join(work, `${label}.sock`);
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
async function listen(server, socketPath) {
|
|
65
74
|
const connections = new Set();
|
|
66
75
|
server.__testConnections = connections;
|
|
@@ -374,7 +383,7 @@ try {
|
|
|
374
383
|
await removeSupervisorState(resetPaths, { removeSocket: true, instanceId: "reset-instance" });
|
|
375
384
|
|
|
376
385
|
// Untagged pre-attach errors and silent peers must fail a client deterministically.
|
|
377
|
-
const attachErrorPath =
|
|
386
|
+
const attachErrorPath = testSocketPath("attach-error");
|
|
378
387
|
const attachErrorServer = createServer((socket) => socket.once("data", () => socket.write(`${JSON.stringify({ type: "result", ok: false, code: "RPC_SUPERVISOR_AUTH", error: "denied" })}\n`)));
|
|
379
388
|
await listen(attachErrorServer, attachErrorPath);
|
|
380
389
|
const attachErrorClient = new RpcSupervisorClient({
|
|
@@ -387,7 +396,7 @@ try {
|
|
|
387
396
|
await delay(20);
|
|
388
397
|
await closeServer(attachErrorServer);
|
|
389
398
|
|
|
390
|
-
const attachTimeoutPath =
|
|
399
|
+
const attachTimeoutPath = testSocketPath("attach-timeout");
|
|
391
400
|
const attachTimeoutServer = createServer(() => {});
|
|
392
401
|
await listen(attachTimeoutServer, attachTimeoutPath);
|
|
393
402
|
const attachTimeoutClient = new RpcSupervisorClient({
|