fix(audit): expose verified visit exports and export-only recovery

This commit is contained in:
2026-10-20 21:20:06 +01:00
parent f87e1ed488
commit ca78b24f47
14 changed files with 359 additions and 59 deletions
+17 -4
View File
@@ -59,6 +59,9 @@ export function createDialogsView(rt) {
let changeViewerOverlay = null;
let changeViewerIndex = null;
let refreshAudit = null;
function refreshStageAudit() { refreshAudit?.(); }
/** Close the diff viewer; the controller returns focus to the viewed row. */
function closeChangeViewer() {
@@ -840,10 +843,10 @@ function openStageDefinition(detail, stageKey, subtitle = "") {
* on the right. It is the only place the system files are shown, so the artifact
* surfaces stay focused on what the stage actually produced.
*/
function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = null } = {}) {
function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = null, revision = null } = {}) {
const available = (tabs ?? []).filter((tab) => typeof tab?.body === "function");
if (!available.length) return;
const close = () => modal.close("stage-audit");
const close = () => { refreshAudit = null; modal.close("stage-audit"); };
const overlay = h("div", {
class: "audit-viewer",
role: "dialog",
@@ -890,6 +893,12 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
overlay.append(panel);
let active = available[0].key;
let renderedRevision = null;
const renderBody = () => {
const current = available.find((tab) => tab.key === active) ?? available[0];
body.replaceChildren(current.body());
renderedRevision = typeof revision === "function" ? revision(active) : null;
};
const renderTabs = () => {
nav.replaceChildren(
...available.map((tab) => {
@@ -923,8 +932,7 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
});
}),
);
const current = available.find((tab) => tab.key === active) ?? available[0];
body.replaceChildren(current.body());
renderBody();
};
renderTabs();
modal.open("stage-audit", overlay, {
@@ -932,9 +940,14 @@ function openStageAudit({ title = "Audit", subtitle = "", tabs = [], trigger = n
trigger,
fallbackSelectors: ["#detailTitle", "#pane-main"],
});
refreshAudit = () => {
if (!overlay.isConnected || typeof revision !== "function") return;
if (revision(active) !== renderedRevision) renderBody();
};
}
return {
refreshStageAudit,
openStageDefinition,
closeChangeViewer,
openChangeViewer,