TenantAtlas/apps/platform/.pnpm-store/v10/files/0f/9aabebf152fa8f9c541a5e97676e45a476f7db6a48513cc25aa4e3f2487f141fb56b15eedd67288dbcf3ef2d9586a23e029518434c41f2fba0e33d713d683b
ahmido 1fec9c6f9d
Some checks failed
Main Confidence / confidence (push) Failing after 45s
feat: compress governance operator outcomes (#253)
## 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
2026-04-19 12:30:36 +00:00

186 lines
7.4 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 localUtilsDispatcher_exports = {};
__export(localUtilsDispatcher_exports, {
LocalUtilsDispatcher: () => LocalUtilsDispatcher
});
module.exports = __toCommonJS(localUtilsDispatcher_exports);
var import_net = __toESM(require("net"));
var import_dispatcher = require("./dispatcher");
var import_instrumentation = require("../../server/instrumentation");
var localUtils = __toESM(require("../localUtils"));
var import_userAgent = require("../utils/userAgent");
var import_deviceDescriptors = require("../deviceDescriptors");
var import_jsonPipeDispatcher = require("../dispatchers/jsonPipeDispatcher");
var import_pipeTransport = require("../pipeTransport");
var import_socksInterceptor = require("../socksInterceptor");
var import_transport = require("../transport");
var import_network = require("../utils/network");
var import_urlMatch = require("../../utils/isomorphic/urlMatch");
class LocalUtilsDispatcher extends import_dispatcher.Dispatcher {
constructor(scope, playwright) {
const localUtils2 = new import_instrumentation.SdkObject(playwright, "localUtils", "localUtils");
localUtils2.logName = "browser";
const deviceDescriptors = Object.entries(import_deviceDescriptors.deviceDescriptors).map(([name, descriptor]) => ({ name, descriptor }));
super(scope, localUtils2, "LocalUtils", {
deviceDescriptors
});
this._harBackends = /* @__PURE__ */ new Map();
this._stackSessions = /* @__PURE__ */ new Map();
this._type_LocalUtils = true;
}
async zip(params, progress) {
return await localUtils.zip(progress, this._stackSessions, params);
}
async harOpen(params, progress) {
return await localUtils.harOpen(progress, this._harBackends, params);
}
async harLookup(params, progress) {
return await localUtils.harLookup(progress, this._harBackends, params);
}
async harClose(params, progress) {
localUtils.harClose(this._harBackends, params);
}
async harUnzip(params, progress) {
return await localUtils.harUnzip(progress, params);
}
async tracingStarted(params, progress) {
return await localUtils.tracingStarted(progress, this._stackSessions, params);
}
async traceDiscarded(params, progress) {
return await localUtils.traceDiscarded(progress, this._stackSessions, params);
}
async addStackToTracingNoReply(params, progress) {
localUtils.addStackToTracingNoReply(this._stackSessions, params);
}
async connect(params, progress) {
if (URL.canParse(params.endpoint))
return await this._connectOverWebSocket(params, progress);
return await this._connectOverPipe(params, progress);
}
async _connectOverWebSocket(params, progress) {
const wsHeaders = {
"User-Agent": (0, import_userAgent.getUserAgent)(),
"x-playwright-proxy": params.exposeNetwork ?? "",
...params.headers
};
const wsEndpoint = await urlToWSEndpoint(progress, params.endpoint);
const transport = await import_transport.WebSocketTransport.connect(progress, wsEndpoint, { headers: wsHeaders, followRedirects: true, debugLogHeader: "x-playwright-debug-log" });
const socksInterceptor = new import_socksInterceptor.SocksInterceptor(transport, params.exposeNetwork, params.socksProxyRedirectPortForTest);
const pipe = new import_jsonPipeDispatcher.JsonPipeDispatcher(this);
transport.onmessage = (json) => {
if (socksInterceptor.interceptMessage(json))
return;
const cb = () => {
try {
pipe.dispatch(json);
} catch (e) {
transport.close();
}
};
if (params.slowMo)
setTimeout(cb, params.slowMo);
else
cb();
};
pipe.on("message", (message) => {
transport.send(message);
});
transport.onclose = (reason) => {
socksInterceptor?.cleanup();
pipe.wasClosed(reason);
};
pipe.on("close", () => transport.close());
return { pipe, headers: transport.headers };
}
async _connectOverPipe(params, progress) {
const socket = await new Promise((resolve, reject) => {
const conn = import_net.default.connect(params.endpoint, () => resolve(conn));
conn.on("error", reject);
});
const transport = new import_pipeTransport.PipeTransport(socket, socket);
const pipe = new import_jsonPipeDispatcher.JsonPipeDispatcher(this);
transport.onmessage = (json) => {
const cb = () => {
try {
pipe.dispatch(json);
} catch (e) {
transport.close();
}
};
if (params.slowMo)
setTimeout(cb, params.slowMo);
else
cb();
};
pipe.on("message", (message) => {
transport.send(message);
});
transport.onclose = (reason) => {
pipe.wasClosed(reason);
};
pipe.on("close", () => socket.end());
return { pipe, headers: [] };
}
async globToRegex(params, progress) {
const regex = (0, import_urlMatch.resolveGlobToRegexPattern)(params.baseURL, params.glob, params.webSocketUrl);
return { regex };
}
}
async function urlToWSEndpoint(progress, endpointURL) {
if (endpointURL.startsWith("ws"))
return endpointURL;
progress.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);
const fetchUrl = new URL(endpointURL);
if (!fetchUrl.pathname.endsWith("/"))
fetchUrl.pathname += "/";
fetchUrl.pathname += "json";
const json = await (0, import_network.fetchData)(progress, {
url: fetchUrl.toString(),
method: "GET",
headers: { "User-Agent": (0, import_userAgent.getUserAgent)() }
}, async (params, response) => {
return new Error(`Unexpected status ${response.statusCode} when connecting to ${fetchUrl.toString()}.
This does not look like a Playwright server, try connecting via ws://.`);
});
const wsUrl = new URL(endpointURL);
let wsEndpointPath = JSON.parse(json).wsEndpointPath;
if (wsEndpointPath.startsWith("/"))
wsEndpointPath = wsEndpointPath.substring(1);
if (!wsUrl.pathname.endsWith("/"))
wsUrl.pathname += "/";
wsUrl.pathname += wsEndpointPath;
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
return wsUrl.toString();
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
LocalUtilsDispatcher
});