TenantAtlas/apps/platform/.pnpm-store/v10/files/4b/3d01e195c0424c0451025ec266a1102ebf17c88bc02f0ec86b6bf5d4672791cb6ea2cba835a6158e1a0e3016c2dbfc49b875ce9f5146ef6455f6f1d8bac9bf
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

259 lines
5.9 KiB
Plaintext

/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("./Resolver").FileSystem} FileSystem */
/** @typedef {import("./Resolver").StringCallback} StringCallback */
/** @typedef {import("./Resolver").SyncFileSystem} SyncFileSystem */
// eslint-disable-next-line jsdoc/reject-function-type
/** @typedef {Function} SyncOrAsyncFunction */
// eslint-disable-next-line jsdoc/reject-any-type
/** @typedef {any} ResultOfSyncOrAsyncFunction */
/**
* @param {SyncFileSystem} fs file system implementation
* @constructor
*/
function SyncAsyncFileSystemDecorator(fs) {
this.fs = fs;
this.lstat = undefined;
this.lstatSync = undefined;
const { lstatSync } = fs;
if (lstatSync) {
this.lstat =
/** @type {FileSystem["lstat"]} */
(
(arg, options, callback) => {
let result;
try {
result = /** @type {SyncOrAsyncFunction | undefined} */ (callback)
? lstatSync.call(fs, arg, options)
: lstatSync.call(fs, arg);
} catch (err) {
return (callback || options)(
/** @type {NodeJS.ErrnoException | null} */
(err),
);
}
(callback || options)(
null,
/** @type {ResultOfSyncOrAsyncFunction} */
(result),
);
}
);
this.lstatSync =
/** @type {SyncFileSystem["lstatSync"]} */
((arg, options) => lstatSync.call(fs, arg, options));
}
this.stat =
/** @type {FileSystem["stat"]} */
(
(arg, options, callback) => {
let result;
try {
result = /** @type {SyncOrAsyncFunction | undefined} */ (callback)
? fs.statSync(arg, options)
: fs.statSync(arg);
} catch (err) {
return (callback || options)(
/** @type {NodeJS.ErrnoException | null} */
(err),
);
}
(callback || options)(
null,
/** @type {ResultOfSyncOrAsyncFunction} */
(result),
);
}
);
this.statSync =
/** @type {SyncFileSystem["statSync"]} */
((arg, options) => fs.statSync(arg, options));
this.readdir =
/** @type {FileSystem["readdir"]} */
(
(arg, options, callback) => {
let result;
try {
result = /** @type {SyncOrAsyncFunction | undefined} */ (callback)
? fs.readdirSync(
arg,
/** @type {Exclude<Parameters<FileSystem["readdir"]>[1], (err: NodeJS.ErrnoException | null, files: string[]) => void>} */
(options),
)
: fs.readdirSync(arg);
} catch (err) {
return (callback || options)(
/** @type {NodeJS.ErrnoException | null} */
(err),
[],
);
}
(callback || options)(
null,
/** @type {ResultOfSyncOrAsyncFunction} */
(result),
);
}
);
this.readdirSync =
/** @type {SyncFileSystem["readdirSync"]} */
(
(arg, options) =>
fs.readdirSync(
arg,
/** @type {Parameters<SyncFileSystem["readdirSync"]>[1]} */ (options),
)
);
this.readFile =
/** @type {FileSystem["readFile"]} */
(
(arg, options, callback) => {
let result;
try {
result = /** @type {SyncOrAsyncFunction | undefined} */ (callback)
? fs.readFileSync(arg, options)
: fs.readFileSync(arg);
} catch (err) {
return (callback || options)(
/** @type {NodeJS.ErrnoException | null} */
(err),
);
}
(callback || options)(
null,
/** @type {ResultOfSyncOrAsyncFunction} */
(result),
);
}
);
this.readFileSync =
/** @type {SyncFileSystem["readFileSync"]} */
((arg, options) => fs.readFileSync(arg, options));
this.readlink =
/** @type {FileSystem["readlink"]} */
(
(arg, options, callback) => {
let result;
try {
result = /** @type {SyncOrAsyncFunction | undefined} */ (callback)
? fs.readlinkSync(
arg,
/** @type {Exclude<Parameters<FileSystem["readlink"]>[1], StringCallback>} */
(options),
)
: fs.readlinkSync(arg);
} catch (err) {
return (callback || options)(
/** @type {NodeJS.ErrnoException | null} */
(err),
);
}
(callback || options)(
null,
/** @type {ResultOfSyncOrAsyncFunction} */
(result),
);
}
);
this.readlinkSync =
/** @type {SyncFileSystem["readlinkSync"]} */
(
(arg, options) =>
fs.readlinkSync(
arg,
/** @type {Parameters<SyncFileSystem["readlinkSync"]>[1]} */ (
options
),
)
);
this.readJson = undefined;
this.readJsonSync = undefined;
const { readJsonSync } = fs;
if (readJsonSync) {
this.readJson =
/** @type {FileSystem["readJson"]} */
(
(arg, callback) => {
let result;
try {
result = readJsonSync.call(fs, arg);
} catch (err) {
return callback(
/** @type {NodeJS.ErrnoException | Error | null} */ (err),
);
}
callback(null, result);
}
);
this.readJsonSync =
/** @type {SyncFileSystem["readJsonSync"]} */
((arg) => readJsonSync.call(fs, arg));
}
this.realpath = undefined;
this.realpathSync = undefined;
const { realpathSync } = fs;
if (realpathSync) {
this.realpath =
/** @type {FileSystem["realpath"]} */
(
(arg, options, callback) => {
let result;
try {
result = /** @type {SyncOrAsyncFunction | undefined} */ (callback)
? realpathSync.call(
fs,
arg,
/** @type {Exclude<Parameters<NonNullable<FileSystem["realpath"]>>[1], StringCallback>} */
(options),
)
: realpathSync.call(fs, arg);
} catch (err) {
return (callback || options)(
/** @type {NodeJS.ErrnoException | null} */
(err),
);
}
(callback || options)(
null,
/** @type {ResultOfSyncOrAsyncFunction} */
(result),
);
}
);
this.realpathSync =
/** @type {SyncFileSystem["realpathSync"]} */
(
(arg, options) =>
realpathSync.call(
fs,
arg,
/** @type {Parameters<NonNullable<SyncFileSystem["realpathSync"]>>[1]} */
(options),
)
);
}
}
module.exports = SyncAsyncFileSystemDecorator;