TenantAtlas/apps/platform/.pnpm-store/v10/files/35/ddcc4337ff8c0cb12c3ad8f7d8853d5a9a1fcebfb28f20af6252801e83cd22417b65bdd2d8ece035018cfba9ac0dd4a1c2b8c94c3f516408ac37fc6d45ff51
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

150 lines
6.1 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 clock_exports = {};
__export(clock_exports, {
Clock: () => Clock
});
module.exports = __toCommonJS(clock_exports);
var rawClockSource = __toESM(require("../generated/clockSource"));
class Clock {
constructor(browserContext) {
this._initScripts = [];
this._browserContext = browserContext;
}
async uninstall(progress) {
await progress.race(Promise.all(this._initScripts.map((script) => script.dispose())));
this._initScripts = [];
}
async fastForward(ticks) {
await this._installIfNeeded();
const ticksMillis = parseTicks(ticks);
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('fastForward', ${Date.now()}, ${ticksMillis})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.fastForward(${ticksMillis})`);
}
async install(time) {
await this._installIfNeeded();
const timeMillis = time !== void 0 ? parseTime(time) : Date.now();
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('install', ${Date.now()}, ${timeMillis})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.install(${timeMillis})`);
}
async pauseAt(ticks) {
await this._installIfNeeded();
const timeMillis = parseTime(ticks);
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('pauseAt', ${Date.now()}, ${timeMillis})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.pauseAt(${timeMillis})`);
}
resumeNoReply() {
if (!this._initScripts.length)
return;
const doResume = async () => {
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('resume', ${Date.now()})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.resume()`);
};
doResume().catch(() => {
});
}
async resume(progress) {
await this._installIfNeeded();
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('resume', ${Date.now()})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.resume()`);
}
async setFixedTime(time) {
await this._installIfNeeded();
const timeMillis = parseTime(time);
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('setFixedTime', ${Date.now()}, ${timeMillis})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.setFixedTime(${timeMillis})`);
}
async setSystemTime(time) {
await this._installIfNeeded();
const timeMillis = parseTime(time);
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('setSystemTime', ${Date.now()}, ${timeMillis})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.setSystemTime(${timeMillis})`);
}
async runFor(ticks) {
await this._installIfNeeded();
const ticksMillis = parseTicks(ticks);
this._initScripts.push(await this._browserContext.addInitScript(`globalThis.__pwClock.controller.log('runFor', ${Date.now()}, ${ticksMillis})`));
await this._evaluateInFrames(`globalThis.__pwClock.controller.runFor(${ticksMillis})`);
}
async _installIfNeeded() {
if (this._initScripts.length)
return;
const script = `(() => {
const module = {};
${rawClockSource.source}
if (!globalThis.__pwClock)
globalThis.__pwClock = (module.exports.inject())(globalThis, ${JSON.stringify(this._browserContext._browser.options.name)});
})();`;
const initScript = await this._browserContext.addInitScript(script);
await this._evaluateInFrames(script);
this._initScripts.push(initScript);
}
async _evaluateInFrames(script) {
await this._browserContext.safeNonStallingEvaluateInAllFrames(script, "main", { throwOnJSErrors: true });
}
}
function parseTicks(value) {
if (typeof value === "number")
return value;
if (!value)
return 0;
const str = value;
const strings = str.split(":");
const l = strings.length;
let i = l;
let ms = 0;
let parsed;
if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) {
throw new Error(
`Clock only understands numbers, 'mm:ss' and 'hh:mm:ss'`
);
}
while (i--) {
parsed = parseInt(strings[i], 10);
if (parsed >= 60)
throw new Error(`Invalid time ${str}`);
ms += parsed * Math.pow(60, l - i - 1);
}
return ms * 1e3;
}
function parseTime(epoch) {
if (!epoch)
return 0;
if (typeof epoch === "number")
return epoch;
const parsed = new Date(epoch);
if (!isFinite(parsed.getTime()))
throw new Error(`Invalid date: ${epoch}`);
return parsed.getTime();
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Clock
});