mirror of
https://github.com/zsviczian/obsidian-excalidraw-plugin.git
synced 2026-12-03 06:43:35 +00:00
Implement the scoped fixes for PR #3046: - Ignore unsupported aliases while retaining whole string/list aliases and paths. - Use Obsidian source-heading identities for section targets, preserving legacy image-transclusion matching. - Block Ctrl/Cmd+Shift+S only in the focused drawing editor, retaining normal save and explicit legacy export. - Honor internal-link removal in manual vault and clipboard SVG exports through the existing scene filter without mutating source elements or changing hooks. Add source and native regressions, including standalone H2 wikilinks, aliased and unresolved wikilinks, save/reopen, image decoding and ordinary section-link navigation in Reading and Live Preview. Preserve the original NBSP attachment with provenance. Add the requested CLI troubleshooting guidance and remove the temporary plan-only handoff. Validation: 993 portable cases passed; 776 fast/source tests passed; all ten PR-specific native cases passed in main and popout, including the expanded wikilink matrix. Production build and all five bundle tests passed. No new lint diagnostics; the repository retains 116 existing errors. The exact tested build was deployed to Zsolt's Brain with backed-up artifacts and unchanged settings. The complete native profile remains failed: table controls also fail on the unchanged baseline; the offscreen phone toolbar remains unclassified against baseline. Initial zoom-settling and popout code-image reopen failures passed focused reruns. macOS, physical mobile and minimum-version Obsidian remain untested. Original SVG escaping (#2570) and NBSP (#2389) reports did not reproduce on this Windows host; they gain coverage without speculative serializer/cache changes. Optional simple-columns compatibility (#2858) is deferred.
557 lines
23 KiB
JavaScript
557 lines
23 KiB
JavaScript
/** Prepare the repository-local vault from current workspace builds, then run guarded native profiles. */
|
|
import {createAcknowledgedCLI} from "./acknowledgedCLI.mjs";
|
|
import { randomUUID } from "node:crypto";
|
|
import { existsSync, mkdirSync } from "node:fs";
|
|
import { homedir } from "node:os";
|
|
import { dirname, join, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { runObsidianSmoke } from "./runner.mjs";
|
|
import { obsidianCliExecutable, spawnNativeSync } from "./processTools.mjs";
|
|
import { runTextUndoScenario } from "./textUndo.mjs";
|
|
import { runNativeCLIScenario } from "./nativeCLI.mjs";
|
|
import { runEmbedRecoveryScenario } from "./embedRecovery.mjs";
|
|
import { runEmbedControlsScenario } from "./embedControls.mjs";
|
|
import { runEmbedRegressionsScenario } from "./embedRegressions.mjs";
|
|
import { runEmbedReliabilityScenario } from "./embedReliability.mjs";
|
|
import { runFrameSemanticsScenario } from "./frameSemantics.mjs";
|
|
import { runGroupedLinkClickScenario } from "./groupedLinkClick.mjs";
|
|
import { runLatexInputScenario } from "./latexInput.mjs";
|
|
import { runImageGeometryScenario } from "./imageGeometry.mjs";
|
|
import { runWheelZoomScenario } from "./wheelZoom.mjs";
|
|
import { runWebDropScenario } from "./webDrop.mjs";
|
|
import { runInternalDropScenario } from "./internalDrop.mjs";
|
|
import { runYouTubeDropScenario } from "./youtubeDrop.mjs";
|
|
import { runSvgImportScenario } from "./svgImport.mjs";
|
|
import { runSvgPaintScenario } from "./svgPaint.mjs";
|
|
import { runSvgTextScenario } from "./svgText.mjs";
|
|
import { runSVGEntryPointsScenario } from "./svgEntryPoints.mjs";
|
|
import { runLucideScenario } from "./lucideIcons.mjs";
|
|
import { runWorkflowFixesScenario } from "./workflowFixes.mjs";
|
|
import { runWorkflowBundleScenario } from "./workflowBundle.mjs";
|
|
import { runTextSaveShortcutScenario } from "./textSaveShortcut.mjs";
|
|
import { runCodeCardScenario } from "./codeCards.mjs";
|
|
import { runKplexOntologyScenario } from "./kplexOntology.mjs";
|
|
import { nativeRepositoryRoot } from "../nativeRepositoryRoot.mjs";
|
|
import { acquireHostLock } from "./hostLock.mjs";
|
|
import { runDataIntegrityScenario } from "./dataIntegrity.mjs";
|
|
import { runLifecycleScenario } from "./lifecycle.mjs";
|
|
import { runMarkdownMigrationControl } from "./markdownMigrationControl.mjs";
|
|
import { runExtrasServicesScenario } from "./extrasServices.mjs";
|
|
import { runStabilityScenario } from "./stability.mjs";
|
|
import { runAutomateScenario } from "./automate.mjs";
|
|
import { runCoreInteractionScenario } from "./coreInteraction.mjs";
|
|
import { runPDFImportScenario } from "./pdfImport.mjs";
|
|
import { runDeviceMatrix } from "./devices.mjs";
|
|
import { deviceProfiles, breakpointProfiles } from "./deviceProfiles.mjs";
|
|
import { produceCombination, stageExtras } from "./combination.mjs";
|
|
import {
|
|
aggregateReports,
|
|
adaptSmokeReport,
|
|
sourceIdentity,
|
|
} from "../contracts.mjs";
|
|
import { writeReportFiles } from "../reportFiles.mjs";
|
|
import { writeFileSync } from "node:fs";
|
|
import {
|
|
configureLocalVaultEnvironment,
|
|
prepareLocalVault,
|
|
restoreLocalVaultBaseline,
|
|
} from "../localVault.mjs";
|
|
import { runBehaviorMatrix } from "./behaviorMatrix.mjs";
|
|
import { runErrorOracle } from "./errorOracle.mjs";
|
|
import {requiredNativeCases,requiredDeviceCases} from '../regression.mjs';
|
|
import { assertCompanionVersions } from "./companionVersions.mjs";
|
|
|
|
const pluginRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../..");
|
|
const target = configureLocalVaultEnvironment(pluginRoot);
|
|
const prepareOnly = process.argv.includes("--prepare-only");
|
|
const diagnostics = process.argv.includes("--diagnostics") || process.argv.some(arg=>['--profile=full','--profile=regression'].includes(arg));
|
|
const profileArg = process.argv
|
|
.slice(2)
|
|
.find((arg) => arg.startsWith("--profile="));
|
|
const profile = profileArg?.slice("--profile=".length);
|
|
if (
|
|
profileArg !== undefined &&
|
|
!["smoke", "regression", "full", "devices", "soak"].includes(profile)
|
|
)
|
|
throw Error("Use --profile=smoke|regression|full|devices|soak");
|
|
const fullProfile = profile === "full" || profile === "regression";
|
|
const coreOnly=process.argv.includes("--core"),coreScenarios=fullProfile||coreOnly;
|
|
const lifecycle = coreScenarios || process.argv.includes("--lifecycle");
|
|
const migrationComparison = process.argv.includes("--migration-comparison");
|
|
const markdownMigrationControl = process.argv.includes("--markdown-migration-control");
|
|
if (fullProfile && migrationComparison)
|
|
throw Error("Migration comparison is a focused diagnostic, not a full-profile replacement");
|
|
if (fullProfile && markdownMigrationControl)
|
|
throw Error("Host-only Markdown migration is a focused diagnostic, not full coverage");
|
|
const extrasServices =
|
|
coreScenarios || process.argv.includes("--extras-services");
|
|
const devices =
|
|
fullProfile || profile === "devices" || process.argv.includes("--devices");
|
|
const textUndo = coreScenarios || process.argv.includes("--text-undo");
|
|
const stability = coreScenarios || profile === "soak" || process.argv.includes("--stability");
|
|
const nativeCLI = coreScenarios || process.argv.includes("--native-cli");
|
|
const embedRecovery = coreScenarios || process.argv.includes("--embed-recovery");
|
|
const embedControls = coreScenarios || process.argv.includes("--embed-controls");
|
|
const embedRegressions = coreScenarios || process.argv.includes("--embed-regressions");
|
|
const embedReliability = coreScenarios || process.argv.includes("--embed-reliability");
|
|
const frameSemantics = coreScenarios || process.argv.includes("--frame-semantics");
|
|
const groupedLinkClick =
|
|
coreScenarios || process.argv.includes("--grouped-link-click");
|
|
const latexInput = coreScenarios || process.argv.includes("--latex-input");
|
|
const latexPreview = process.argv.includes("--latex-preview");
|
|
const imageGeometryReal =
|
|
coreScenarios || process.argv.includes("--image-geometry-real");
|
|
const imageGeometry =
|
|
process.argv.includes("--image-geometry") || imageGeometryReal;
|
|
const wheelZoom = coreScenarios || process.argv.includes("--wheel-zoom");
|
|
const webDrop = coreScenarios || process.argv.includes("--web-drop");
|
|
const internalDrop = coreScenarios || process.argv.includes("--internal-drop");
|
|
const youtubeDrop = process.argv.includes("--youtube-drop");
|
|
const svgImport = process.argv.includes("--svg-import");
|
|
const svgPaint = process.argv.includes("--svg-paint");
|
|
const svgText = process.argv.includes("--svg-text");
|
|
const svgEntryPoints = process.argv.includes("--svg-entry-points");
|
|
const lucide = coreScenarios || process.argv.includes("--lucide");
|
|
const workflowFixes = coreScenarios || process.argv.includes("--workflow-fixes");
|
|
const workflowBundle = coreScenarios || process.argv.includes("--workflow-bundle");
|
|
const textSaveShortcut = workflowBundle || process.argv.includes("--text-save-shortcut");
|
|
const codeCards = workflowBundle || process.argv.includes("--code-cards");
|
|
const kplexOntology = coreScenarios || profile === "devices" || process.argv.includes("--kplex-ontology");
|
|
const behaviorMatrix =
|
|
fullProfile || process.argv.includes("--behavior-matrix");
|
|
const dataIntegrity = coreScenarios || process.argv.includes("--data-integrity");
|
|
const focusContextArg = process.argv
|
|
.slice(2)
|
|
.find((arg) => arg.startsWith("--behavior-context="));
|
|
const focusCasesArg = process.argv
|
|
.slice(2)
|
|
.find((arg) => arg.startsWith("--behavior-cases="));
|
|
if (fullProfile && (focusContextArg || focusCasesArg))
|
|
throw Error(
|
|
"Full/regression profiles cannot omit behavioral cases or contexts",
|
|
);
|
|
const focusedContexts = focusContextArg
|
|
?.slice("--behavior-context=".length)
|
|
.split(",");
|
|
const focusedCases = focusCasesArg
|
|
?.slice("--behavior-cases=".length)
|
|
.split(",");
|
|
const deviceProfilesArg=process.argv.slice(2).find(arg=>arg.startsWith('--device-profiles='));
|
|
const allDeviceProfiles=[...deviceProfiles(),...breakpointProfiles()];
|
|
const selectedDeviceIds=deviceProfilesArg?.slice('--device-profiles='.length).split(',');
|
|
if(fullProfile&&deviceProfilesArg)throw Error('Full/regression profiles cannot omit device profiles');
|
|
if(selectedDeviceIds?.some(id=>!allDeviceProfiles.some(profile=>profile.id===id)))throw Error('Unknown focused device profile');
|
|
if (
|
|
focusedContexts?.some(
|
|
(id) => !["main", "split", "nested-split", "popout"].includes(id),
|
|
)
|
|
)
|
|
throw Error("Focused desktop contexts: main,split,nested-split,popout");
|
|
const flags = [
|
|
"--diagnostics",
|
|
"--core",
|
|
"--prepare-only",
|
|
"--behavior-matrix",
|
|
"--lifecycle",
|
|
"--migration-comparison",
|
|
"--markdown-migration-control",
|
|
"--extras-services",
|
|
"--devices",
|
|
"--data-integrity",
|
|
"--workflow-fixes",
|
|
"--workflow-bundle",
|
|
"--text-save-shortcut",
|
|
"--code-cards",
|
|
"--kplex-ontology",
|
|
"--lucide",
|
|
"--text-undo",
|
|
"--stability",
|
|
"--native-cli",
|
|
"--embed-recovery",
|
|
"--embed-controls",
|
|
"--embed-regressions",
|
|
"--embed-reliability",
|
|
"--frame-semantics",
|
|
"--grouped-link-click",
|
|
"--latex-input",
|
|
"--latex-preview",
|
|
"--image-geometry",
|
|
"--image-geometry-real",
|
|
"--wheel-zoom",
|
|
"--web-drop",
|
|
"--internal-drop",
|
|
"--youtube-drop",
|
|
"--svg-import",
|
|
"--svg-paint",
|
|
"--svg-text",
|
|
"--svg-entry-points",
|
|
];
|
|
const unknown = process.argv
|
|
.slice(2)
|
|
.filter(
|
|
(arg) =>
|
|
![profileArg, focusContextArg, focusCasesArg, deviceProfilesArg, ...flags].includes(arg),
|
|
);
|
|
if (unknown.length)
|
|
throw Error(
|
|
"Unsupported options: " +
|
|
unknown.join(", ") +
|
|
". Native runs always build current workspace producers. Available: " +
|
|
flags.join(", "),
|
|
);
|
|
|
|
const extrasRoot = resolve(
|
|
process.env.EXCALIDRAW_EXTRAS_ROOT ||
|
|
join(pluginRoot, "../obsidian-excalidraw-extras"),
|
|
);
|
|
const forkRoot = resolve(
|
|
process.env.EXCALIDRAW_FORK_ROOT || join(pluginRoot, "../excalidraw"),
|
|
);
|
|
const kplexRoot = kplexOntology ? resolve(process.env.EXCALIDRAW_KPLEX_ROOT || join(nativeRepositoryRoot(pluginRoot), "../kplex")) : undefined;
|
|
if (kplexOntology) {
|
|
for (const [key,value] of Object.entries({KPLEX_TEST_VAULT_NAME:target.vaultName,KPLEX_TEST_VAULT_PATH:target.vaultPath,KPLEX_TEST_CONFIG_DIR:target.configDir})) {
|
|
const supplied=process.env[key];
|
|
if(supplied && (key.endsWith("NAME")?supplied!==value:resolve(supplied)!==resolve(value)))throw Error("Combined K-Plex target differs from the owned vault: "+key);
|
|
process.env[key]=value;
|
|
}
|
|
}
|
|
const reportDir =
|
|
process.env.EXCALIDRAW_TEST_REPORT_DIR ||
|
|
join(pluginRoot, ".test-work/reports/native-" + randomUUID());
|
|
|
|
if(existsSync(join(reportDir,'report.json'))||existsSync(join(reportDir,'preparation.json')))throw Error('Choose a new native report directory; previous evidence must not be overwritten');
|
|
|
|
function command(file, args, cwd, timeout = 60_000, inherit = false) {
|
|
const result = spawnNativeSync(file, args, {
|
|
cwd,
|
|
encoding: "utf8",
|
|
timeout,
|
|
killSignal: "SIGKILL",
|
|
maxBuffer: 4 * 1024 * 1024,
|
|
stdio: inherit ? "inherit" : "pipe",
|
|
});
|
|
if (result.error) throw new Error(`${file} ${args[1]||""} ${args.find(arg=>arg.startsWith("method="))||""}: ${result.error.message}`);
|
|
if (result.status !== 0)
|
|
throw new Error(
|
|
`${file} ${args.join(" ")} failed (${result.status}): ${(result.stderr || result.stdout || "").trim().slice(0, 1000)}`,
|
|
);
|
|
return result.stdout || "";
|
|
}
|
|
|
|
const git = (root, args) => command("git", args, root, 10_000).trim();
|
|
const source = {
|
|
pluginRevision: git(pluginRoot, ["rev-parse", "HEAD"]),
|
|
pluginDirty: Boolean(git(pluginRoot, ["status", "--porcelain"])),
|
|
forkRevision: git(forkRoot, ["rev-parse", "HEAD"]),
|
|
forkDirty: Boolean(git(forkRoot, ["status", "--porcelain"])),
|
|
buildMode: "workspace-frozen",
|
|
requestedProfile: coreOnly ? "core" : profile || "focused",
|
|
node: process.version,
|
|
platform: process.platform,
|
|
};
|
|
|
|
// One lock spans every CLI call, staging and scenario across all three repositories.
|
|
const userDataPath =
|
|
process.env.EXCALIDRAW_TEST_USER_DATA_PATH ||
|
|
(process.platform === "win32"
|
|
? join(process.env.APPDATA || "", "obsidian")
|
|
: process.platform === "darwin"
|
|
? join(homedir(), "Library/Application Support/obsidian")
|
|
: join(
|
|
process.env.XDG_CONFIG_HOME || join(homedir(), ".config"),
|
|
"obsidian",
|
|
));
|
|
const hostLock = acquireHostLock({ userDataPath });
|
|
let report, combination, deviceReport, acknowledgedCLI;
|
|
try {
|
|
combination = produceCombination({
|
|
pluginRoot,
|
|
forkRoot,
|
|
extrasRoot,
|
|
kplexRoot,
|
|
output: join(pluginRoot, ".test-work/frozen/combination-" + randomUUID()),
|
|
});
|
|
const invokeCLI=(name,args,timeout)=>command(obsidianCliExecutable(),[`vault=${target.vaultName}`,name,...args],pluginRoot,timeout);
|
|
acknowledgedCLI=createAcknowledgedCLI((name,...args)=>invokeCLI(name,args),{invoke:invokeCLI,screenshotRoot:reportDir});
|
|
const localCLI=acknowledgedCLI.cli;
|
|
const preparation = await prepareLocalVault({
|
|
projectRoot: pluginRoot,
|
|
combination,
|
|
userDataPath,
|
|
cli: localCLI,
|
|
});
|
|
mkdirSync(reportDir, { recursive: true });
|
|
try {
|
|
if (preparation.ready && combination.manifests.extras) preparation.companionVersions = assertCompanionVersions(localCLI);
|
|
} catch (error) {
|
|
writeFileSync(join(reportDir,"preparation.json"),JSON.stringify({...preparation,companionVersionError:error.message},null,2)+"\n");
|
|
throw error;
|
|
}
|
|
writeFileSync(
|
|
join(reportDir, "preparation.json"),
|
|
JSON.stringify(preparation, null, 2) + "\n",
|
|
);
|
|
if (!combination.manifests.extras && !prepareOnly)
|
|
throw Error(
|
|
"Workspace Extras is missing. The local plugin installation is prepared, but Extras-dependent coverage remains unfinished.",
|
|
);
|
|
if (prepareOnly || !preparation.ready) {
|
|
process.stdout.write(
|
|
JSON.stringify({ status: "prepared", ...preparation }, null, 2) + "\n",
|
|
);
|
|
if (!preparation.ready && !prepareOnly) process.exitCode = 2;
|
|
} else {
|
|
report = await runObsidianSmoke({
|
|
projectRoot: pluginRoot,
|
|
vaultName: process.env.EXCALIDRAW_TEST_VAULT_NAME,
|
|
vaultPath: process.env.EXCALIDRAW_TEST_VAULT_PATH,
|
|
configDir: process.env.EXCALIDRAW_TEST_CONFIG_DIR,
|
|
automationRoot: process.env.EXCALIDRAW_TEST_AUTOMATION_ROOT,
|
|
expectedUserDataPath: userDataPath,
|
|
reportDir,
|
|
source,
|
|
ownedDebugger: true,
|
|
deployCompanions: (context) => stageExtras({ combination, ...context }),
|
|
scenarios: [
|
|
...(behaviorMatrix
|
|
? [
|
|
(context) =>
|
|
runBehaviorMatrix({
|
|
...context,
|
|
...(focusedContexts ? { contexts: focusedContexts } : {}),
|
|
...(focusedCases ? { caseIds: focusedCases } : {}),
|
|
}),
|
|
]
|
|
: []),
|
|
...(lifecycle ? [runLifecycleScenario] : []),
|
|
...(migrationComparison ? [
|
|
context => runLifecycleScenario(context),
|
|
context => runLifecycleScenario(context, { migrationRoute: "host-drag" }),
|
|
] : []),
|
|
...(markdownMigrationControl ? [runMarkdownMigrationControl] : []),
|
|
...(extrasServices ? [runExtrasServicesScenario] : []),
|
|
...(dataIntegrity ? [runDataIntegrityScenario] : []),
|
|
...(workflowFixes ? [runWorkflowFixesScenario] : []),
|
|
...(svgImport ? [runSvgImportScenario] : []),
|
|
...(svgPaint ? [runSvgPaintScenario] : []),
|
|
...(svgText ? [runSvgTextScenario] : []),
|
|
...(svgEntryPoints ? [runSVGEntryPointsScenario] : []),
|
|
...(wheelZoom ? [runWheelZoomScenario] : []),
|
|
...(imageGeometry
|
|
? [
|
|
(context) =>
|
|
runImageGeometryScenario({
|
|
...context,
|
|
realRenderer: imageGeometryReal,
|
|
}),
|
|
]
|
|
: []),
|
|
...(webDrop
|
|
? [
|
|
(context) =>
|
|
runWebDropScenario({ ...context, includePopout: true }),
|
|
]
|
|
: []),
|
|
...(internalDrop
|
|
? [
|
|
(context) =>
|
|
runInternalDropScenario({ ...context, includePopout: true }),
|
|
]
|
|
: []),
|
|
...(youtubeDrop ? [runYouTubeDropScenario] : []),
|
|
...(textUndo ? [runTextUndoScenario] : []),
|
|
...(nativeCLI ? [runNativeCLIScenario] : []),
|
|
...(embedRecovery ? [runEmbedRecoveryScenario] : []),
|
|
...(embedControls ? [runEmbedControlsScenario] : []),
|
|
...(embedRegressions ? [runEmbedRegressionsScenario] : []),
|
|
...(embedReliability ? [runEmbedReliabilityScenario] : []),
|
|
...(frameSemantics ? [runFrameSemanticsScenario] : []),
|
|
...(groupedLinkClick ? [runGroupedLinkClickScenario] : []),
|
|
...(latexInput ? [runLatexInputScenario] : []),
|
|
...(latexPreview
|
|
? [
|
|
(context) =>
|
|
runLatexInputScenario({ ...context, realRenderer: true }),
|
|
]
|
|
: []),
|
|
...(coreScenarios ? [runAutomateScenario] : []),
|
|
...(coreScenarios ? [runCoreInteractionScenario] : []),
|
|
...(coreScenarios ? [runPDFImportScenario] : []),
|
|
...(stability
|
|
? [
|
|
(context) =>
|
|
runStabilityScenario({
|
|
...context,
|
|
cycles: profile === "soak" ? 25 : 6,
|
|
}),
|
|
]
|
|
: []),
|
|
...(workflowBundle ? [runWorkflowBundleScenario] : []),
|
|
...(textSaveShortcut ? [runTextSaveShortcutScenario] : []),
|
|
...(codeCards ? [runCodeCardScenario] : []),
|
|
...(kplexOntology ? [runKplexOntologyScenario] : []),
|
|
// The catalogue/picker workflow runs after independent core scenarios.
|
|
...(lucide ? [runLucideScenario] : []),
|
|
],
|
|
runCli: (vault, commandName, ...args) => {
|
|
if(vault!==target.vaultName)throw Error("CLI receipt target changed");
|
|
return localCLI(commandName,...args);
|
|
},
|
|
runBuild: () => ({
|
|
pluginArtifactRoot: join(combination.output, "plugin"),
|
|
forkArtifacts: Object.fromEntries(
|
|
combination.manifests.fork.artifacts
|
|
.filter((entry) =>
|
|
[
|
|
"production-js",
|
|
"production-css",
|
|
"development-js",
|
|
"development-css",
|
|
].includes(entry.role),
|
|
)
|
|
.map((entry) => [entry.role, entry.sha256]),
|
|
),
|
|
combination,
|
|
}),
|
|
});
|
|
// A completed functional run can retain an error-gate failure while device
|
|
// cases execute independently. Unsettled cleanup must never enter this lane.
|
|
if (devices && report.cleanup === "passed") {
|
|
const cli=localCLI;
|
|
deviceReport = await runDeviceMatrix({
|
|
cli,
|
|
reportDir: join(reportDir, "devices"),
|
|
vaultName: process.env.EXCALIDRAW_TEST_VAULT_NAME,
|
|
vaultPath: process.env.EXCALIDRAW_TEST_VAULT_PATH,
|
|
configDir: process.env.EXCALIDRAW_TEST_CONFIG_DIR,
|
|
automationRoot: process.env.EXCALIDRAW_TEST_AUTOMATION_ROOT,
|
|
profiles: selectedDeviceIds ? allDeviceProfiles.filter(profile=>selectedDeviceIds.includes(profile.id)) : allDeviceProfiles,
|
|
featureWorkflows: fullProfile || profile === "devices",
|
|
featureCases:focusedCases,
|
|
kplexOntology,
|
|
embedControls,
|
|
frameSemantics,
|
|
});
|
|
deviceReport.source = combination?.manifests.plugin || source;
|
|
deviceReport.artifacts = report.artifacts.installedHashes;
|
|
writeFileSync(
|
|
join(reportDir, "devices/report.json"),
|
|
JSON.stringify(deviceReport, null, 2) + "\n",
|
|
);
|
|
} else if (devices) {
|
|
const reason =
|
|
"Parent native cleanup did not complete; device work is blocked to preserve owned resources";
|
|
deviceReport = {
|
|
schemaVersion: 2,
|
|
suiteId: "native-devices",
|
|
status: "blocked",
|
|
cleanup: "not-started",
|
|
source: combination?.manifests.plugin || source,
|
|
tests: [...deviceProfiles(), ...breakpointProfiles()].map(
|
|
(profile) => ({
|
|
testId: "native:device:" + profile.id,
|
|
featureIds: ["P07", "P08"],
|
|
status: "blocked",
|
|
reason,
|
|
}),
|
|
),
|
|
};
|
|
mkdirSync(join(reportDir, "devices"), { recursive: true });
|
|
writeFileSync(
|
|
join(reportDir, "devices/report.json"),
|
|
JSON.stringify(deviceReport, null, 2) + "\n",
|
|
);
|
|
writeReportFiles(deviceReport, join(reportDir, "devices"));
|
|
}
|
|
if (combination) {
|
|
try {
|
|
for (const [kind, manifest] of Object.entries(combination.manifests)) {
|
|
const after = sourceIdentity(combination.roots[kind]);
|
|
if (
|
|
["commit", "dirty", "diffHash", "lockfileHash"].some(
|
|
(key) => after[key] !== manifest[key],
|
|
)
|
|
)
|
|
throw Error(kind + " source changed during native verification");
|
|
}
|
|
report.scenarios.push({ id: "source-stability", status: "passed" });
|
|
} catch (error) {
|
|
report.status = "failed";
|
|
report.error ||= error.message;
|
|
report.scenarios.push({
|
|
id: "source-stability",
|
|
status: "failed",
|
|
reason: error.message,
|
|
});
|
|
}
|
|
}
|
|
if (
|
|
report.cleanup === "passed" &&
|
|
(!deviceReport || deviceReport.cleanup === "passed")
|
|
) {
|
|
if (diagnostics) {
|
|
const oracle = await runErrorOracle({
|
|
cli: localCLI,
|
|
reportDir: join(reportDir, "error-oracle"),
|
|
source: combination.manifests.plugin,
|
|
});
|
|
if (oracle.status !== "passed") {
|
|
report.status = "failed";
|
|
report.error = "Actual unhandled-error negative control failed";
|
|
}
|
|
}
|
|
try {
|
|
report.baselineRestoration = await restoreLocalVaultBaseline({
|
|
projectRoot: pluginRoot,
|
|
cli: localCLI,
|
|
});
|
|
} catch (error) {
|
|
report.status = "failed";
|
|
report.cleanup = "failed";
|
|
report.cleanupError = String(error.stack || error);
|
|
}
|
|
}
|
|
if(coreOnly){const audit=aggregateReports([adaptSmokeReport(report)],requiredNativeCases.filter(id=>!id.startsWith('native:behavior:')));report.coreAudit={status:audit.status,missing:audit.missing};if(audit.status!=='passed')report.status='failed';}
|
|
acknowledgedCLI.dispose();
|
|
report.transportDiagnostics=acknowledgedCLI.diagnostics;
|
|
writeFileSync(
|
|
join(reportDir, "report.json"),
|
|
JSON.stringify(report, null, 2) + "\n",
|
|
);
|
|
const normalized = adaptSmokeReport(report);
|
|
writeFileSync(
|
|
join(reportDir, "report-v2.json"),
|
|
JSON.stringify(normalized, null, 2) + "\n",
|
|
);
|
|
writeReportFiles(normalized, reportDir);
|
|
if (deviceReport) {
|
|
const aggregate = aggregateReports(
|
|
[adaptSmokeReport(report), deviceReport],
|
|
fullProfile ? [...requiredNativeCases,...requiredDeviceCases] : [],
|
|
);
|
|
aggregate.source = source;
|
|
aggregate.combination = combination;
|
|
writeFileSync(
|
|
join(reportDir, "aggregate.json"),
|
|
JSON.stringify(aggregate, null, 2) + "\n",
|
|
);
|
|
writeReportFiles(aggregate, reportDir);
|
|
if (aggregate.status !== "passed") report.status = "failed";
|
|
writeFileSync(join(reportDir,'report.json'),JSON.stringify(report,null,2)+'\n');
|
|
}
|
|
}
|
|
} finally {
|
|
try {acknowledgedCLI?.dispose();}
|
|
finally {hostLock.release();}
|
|
}
|
|
|
|
const log = (message) => process.stdout.write(`${message}\n`);
|
|
if (report) {
|
|
log(
|
|
`Obsidian smoke ${report.status}; report: ${join(reportDir, "report.json")}`,
|
|
);
|
|
if (report.error) console.error(report.error);
|
|
if (report.cleanupError) console.error(`Cleanup: ${report.cleanupError}`);
|
|
if (report.status !== "passed") process.exitCode = 1;
|
|
}
|