Some checks failed
Main Confidence / confidence (push) Failing after 45s
## Summary - introduce surface-aware compressed governance outcomes and reuse the shared truth/explanation seams for operator-first summaries - apply the compressed outcome hierarchy across baseline, evidence, review, review-pack, canonical review/evidence, and artifact-oriented operation-run surfaces - expand spec 214 fixtures and Pest coverage, and fix tenant-panel route assertions by generating explicit tenant-panel URLs in the affected Filament tests ## Validation - `cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent` - focused governance compression suite from `specs/214-governance-outcome-compression/quickstart.md` passed (`68` tests, `445` assertions) - `cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Feature/Filament/InventoryItemResourceTest.php tests/Feature/Filament/BackupSetUiEnforcementTest.php tests/Feature/Filament/RestoreRunUiEnforcementTest.php` passed (`18` tests, `81` assertions) Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #253
177 lines
6.6 KiB
Plaintext
177 lines
6.6 KiB
Plaintext
"use strict";
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
var registry_exports = {};
|
|
__export(registry_exports, {
|
|
Registry: () => Registry,
|
|
baseDaemonDir: () => baseDaemonDir,
|
|
createClientInfo: () => createClientInfo,
|
|
explicitSessionName: () => explicitSessionName,
|
|
resolveSessionName: () => resolveSessionName
|
|
});
|
|
module.exports = __toCommonJS(registry_exports);
|
|
var import_crypto = __toESM(require("crypto"));
|
|
var import_fs = __toESM(require("fs"));
|
|
var import_os = __toESM(require("os"));
|
|
var import_path = __toESM(require("path"));
|
|
class Registry {
|
|
constructor(files) {
|
|
this._files = files;
|
|
}
|
|
entry(clientInfo, sessionName) {
|
|
const key = clientInfo.workspaceDir || clientInfo.workspaceDirHash;
|
|
const entries = this._files.get(key) || [];
|
|
return entries.find((entry) => entry.config.name === sessionName);
|
|
}
|
|
entries(clientInfo) {
|
|
const key = clientInfo.workspaceDir || clientInfo.workspaceDirHash;
|
|
return this._files.get(key) || [];
|
|
}
|
|
entryMap() {
|
|
return this._files;
|
|
}
|
|
async loadEntry(clientInfo, sessionName) {
|
|
const entry = await Registry._loadSessionEntry(clientInfo.daemonProfilesDir, sessionName + ".session");
|
|
if (!entry)
|
|
throw new Error(`Could not start the session "${sessionName}"`);
|
|
const key = clientInfo.workspaceDir || clientInfo.workspaceDirHash;
|
|
let list = this._files.get(key);
|
|
if (!list) {
|
|
list = [];
|
|
this._files.set(key, list);
|
|
}
|
|
const oldIndex = list.findIndex((e) => e.config.name === sessionName);
|
|
if (oldIndex !== -1)
|
|
list.splice(oldIndex, 1);
|
|
list.push(entry);
|
|
return entry;
|
|
}
|
|
static async _loadSessionEntry(daemonDir, file) {
|
|
try {
|
|
const fileName = import_path.default.join(daemonDir, file);
|
|
const data = await import_fs.default.promises.readFile(fileName, "utf-8");
|
|
const config = JSON.parse(data);
|
|
if (!config.name)
|
|
config.name = import_path.default.basename(file, ".session");
|
|
if (!config.timestamp)
|
|
config.timestamp = 0;
|
|
return { file: fileName, config, daemonDir };
|
|
} catch {
|
|
return void 0;
|
|
}
|
|
}
|
|
static async load() {
|
|
const sessions = /* @__PURE__ */ new Map();
|
|
const hashDirs = await import_fs.default.promises.readdir(baseDaemonDir).catch(() => []);
|
|
for (const workspaceDirHash of hashDirs) {
|
|
const daemonDir = import_path.default.join(baseDaemonDir, workspaceDirHash);
|
|
const stat = await import_fs.default.promises.stat(daemonDir);
|
|
if (!stat.isDirectory())
|
|
continue;
|
|
const files = await import_fs.default.promises.readdir(daemonDir).catch(() => []);
|
|
for (const file of files) {
|
|
if (!file.endsWith(".session"))
|
|
continue;
|
|
const entry = await Registry._loadSessionEntry(daemonDir, file);
|
|
if (!entry)
|
|
continue;
|
|
const key = entry.config.workspaceDir || workspaceDirHash;
|
|
let list = sessions.get(key);
|
|
if (!list) {
|
|
list = [];
|
|
sessions.set(key, list);
|
|
}
|
|
list.push(entry);
|
|
}
|
|
}
|
|
return new Registry(sessions);
|
|
}
|
|
}
|
|
const baseDaemonDir = (() => {
|
|
if (process.env.PLAYWRIGHT_DAEMON_SESSION_DIR)
|
|
return process.env.PLAYWRIGHT_DAEMON_SESSION_DIR;
|
|
let localCacheDir;
|
|
if (process.platform === "linux")
|
|
localCacheDir = process.env.XDG_CACHE_HOME || import_path.default.join(import_os.default.homedir(), ".cache");
|
|
if (process.platform === "darwin")
|
|
localCacheDir = import_path.default.join(import_os.default.homedir(), "Library", "Caches");
|
|
if (process.platform === "win32")
|
|
localCacheDir = process.env.LOCALAPPDATA || import_path.default.join(import_os.default.homedir(), "AppData", "Local");
|
|
if (!localCacheDir)
|
|
throw new Error("Unsupported platform: " + process.platform);
|
|
return import_path.default.join(localCacheDir, "ms-playwright", "daemon");
|
|
})();
|
|
function createClientInfo() {
|
|
const packageLocation = require.resolve("../../../package.json");
|
|
const packageJSON = require(packageLocation);
|
|
const workspaceDir = findWorkspaceDir(process.cwd());
|
|
const version = process.env.PLAYWRIGHT_CLI_VERSION_FOR_TEST || packageJSON.version;
|
|
const hash = import_crypto.default.createHash("sha1");
|
|
hash.update(workspaceDir || packageLocation);
|
|
const workspaceDirHash = hash.digest("hex").substring(0, 16);
|
|
return {
|
|
version,
|
|
workspaceDir,
|
|
workspaceDirHash,
|
|
daemonProfilesDir: daemonProfilesDir(workspaceDirHash)
|
|
};
|
|
}
|
|
function findWorkspaceDir(startDir) {
|
|
let dir = startDir;
|
|
for (let i = 0; i < 10; i++) {
|
|
if (import_fs.default.existsSync(import_path.default.join(dir, ".playwright")))
|
|
return dir;
|
|
const parentDir = import_path.default.dirname(dir);
|
|
if (parentDir === dir)
|
|
break;
|
|
dir = parentDir;
|
|
}
|
|
return void 0;
|
|
}
|
|
const daemonProfilesDir = (workspaceDirHash) => {
|
|
return import_path.default.join(baseDaemonDir, workspaceDirHash);
|
|
};
|
|
function explicitSessionName(sessionName) {
|
|
return sessionName || process.env.PLAYWRIGHT_CLI_SESSION;
|
|
}
|
|
function resolveSessionName(sessionName) {
|
|
if (sessionName)
|
|
return sessionName;
|
|
if (process.env.PLAYWRIGHT_CLI_SESSION)
|
|
return process.env.PLAYWRIGHT_CLI_SESSION;
|
|
return "default";
|
|
}
|
|
// Annotate the CommonJS export names for ESM import in node:
|
|
0 && (module.exports = {
|
|
Registry,
|
|
baseDaemonDir,
|
|
createClientInfo,
|
|
explicitSessionName,
|
|
resolveSessionName
|
|
});
|