mirror of
https://github.com/morluto/rea.git
synced 2026-11-30 18:39:24 +00:00
* chore(deps): bump the npm-minor-and-patch group across 2 directories with 38 updates Bumps the npm-minor-and-patch group with 37 updates in the / directory: | Package | From | To | | --- | --- | --- | | [@babel/parser](https://github.com/babel/babel/tree/HEAD/packages/babel-parser) | `8.0.4` | `8.1.2` | | [@babel/types](https://github.com/babel/babel/tree/HEAD/packages/babel-types) | `8.0.4` | `8.1.2` | | [@bufbuild/protobuf](https://github.com/bufbuild/protobuf-es/tree/HEAD/packages/protobuf) | `2.16.0` | `2.17.0` | | [@clack/prompts](https://github.com/bombshell-dev/clack/tree/HEAD/packages/prompts) | `1.7.0` | `1.9.0` | | [@zip.js/zip.js](https://github.com/gildas-lormeau/zip.js) | `2.15.0` | `2.25.0` | | [evmole](https://github.com/cdump/evmole/tree/HEAD/javascript) | `0.9.3` | `0.9.4` | | [ignore](https://github.com/kaelzhang/node-ignore) | `7.0.6` | `7.0.14` | | [isomorphic-git](https://github.com/isomorphic-git/isomorphic-git) | `1.38.7` | `1.44.15` | | [lossless-json](https://github.com/josdejong/lossless-json) | `4.3.1` | `4.3.3` | | [parse5](https://github.com/inikulin/parse5) | `8.0.1` | `8.1.1` | | [playwright-core](https://github.com/microsoft/playwright) | `1.64.1` | `1.65.1` | | [plist](https://github.com/TooTallNate/plist.js) | `5.0.0` | `5.1.1` | | [semver](https://github.com/npm/node-semver) | `7.8.5` | `7.8.6` | | [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.7.1` | `7.8.0` | | [smol-toml](https://github.com/squirrelchat/smol-toml) | `1.9.0` | `1.9.1` | | [stream-chain](https://github.com/uhop/stream-chain) | `4.2.6` | `4.4.2` | | [stream-json](https://github.com/uhop/stream-json) | `3.7.0` | `3.9.0` | | [ws](https://github.com/websockets/ws) | `8.21.0` | `8.23.0` | | [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) | `8.18.1` | `8.18.2` | | [yaml](https://github.com/eemeli/yaml) | `2.9.0` | `2.9.1` | | [zod](https://github.com/colinhacks/zod) | `4.6.6` | `4.6.7` | | [@electron/asar](https://github.com/electron/asar) | `4.2.0` | `4.3.2` | | [@stryker-mutator/core](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/core) | `10.0.0` | `10.1.1` | | [@stryker-mutator/typescript-checker](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/typescript-checker) | `10.0.0` | `10.1.1` | | [@stryker-mutator/vitest-runner](https://github.com/stryker-mutator/stryker-js/tree/HEAD/packages/vitest-runner) | `10.0.0` | `10.1.1` | | [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `26.6.4` | `26.6.6` | | [@types/semver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/semver) | `7.7.1` | `7.8.0` | | [@types/ws](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/ws) | `8.18.1` | `8.18.2` | | [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) | `5.0.3` | `5.1.0` | | [jscpd](https://github.com/kucherenko/jscpd/tree/HEAD/rust/jscpd) | `5.0.12` | `5.4.3` | | [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip) | `6.39.0` | `6.45.1` | | [oxfmt](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt) | `0.72.0` | `0.79.0` | | [oxlint](https://github.com/oxc-project/oxc/tree/HEAD/npm/oxlint) | `1.87.0` | `1.94.0` | | [oxlint-tsgolint](https://github.com/oxc-project/tsgolint) | `7.0.2005` | `7.0.2007` | | [release-please](https://github.com/googleapis/release-please) | `17.3.0` | `17.11.2` | | [rolldown](https://github.com/rolldown/rolldown/tree/HEAD/packages/rolldown) | `1.2.12` | `1.3.2` | | [turbo](https://github.com/vercel/turborepo) | `2.11.7` | `2.11.11` | | [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) | `5.0.3` | `5.1.0` | | [frida](https://github.com/frida/frida-node) | `17.23.2` | `17.26.4` | Bumps the npm-minor-and-patch group with 1 update in the /scripts/verify-tools/skills directory: [skills](https://github.com/vercel-labs/skills). Updates `@babel/parser` from 8.0.4 to 8.1.2 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v8.1.2/packages/babel-parser) Updates `@babel/types` from 8.0.4 to 8.1.2 - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v8.1.2/packages/babel-types) Updates `@bufbuild/protobuf` from 2.16.0 to 2.17.0 - [Release notes](https://github.com/bufbuild/protobuf-es/releases) - [Commits](https://github.com/bufbuild/protobuf-es/commits/v2.17.0/packages/protobuf) Updates `@clack/prompts` from 1.7.0 to 1.9.0 - [Release notes](https://github.com/bombshell-dev/clack/releases) - [Changelog](https://github.com/bombshell-dev/clack/blob/main/packages/prompts/CHANGELOG.md) - [Commits](https://github.com/bombshell-dev/clack/commits/@clack/prompts@1.9.0/packages/prompts) Updates `@zip.js/zip.js` from 2.15.0 to 2.25.0 - [Release notes](https://github.com/gildas-lormeau/zip.js/releases) - [Commits](https://github.com/gildas-lormeau/zip.js/compare/v2.15.0...v2.25.0) Updates `evmole` from 0.9.3 to 0.9.4 - [Release notes](https://github.com/cdump/evmole/releases) - [Commits](https://github.com/cdump/evmole/commits/0.9.4/javascript) Updates `ignore` from 7.0.6 to 7.0.14 - [Release notes](https://github.com/kaelzhang/node-ignore/releases) - [Commits](https://github.com/kaelzhang/node-ignore/compare/7.0.6...7.0.14) Updates `isomorphic-git` from 1.38.7 to 1.44.15 - [Release notes](https://github.com/isomorphic-git/isomorphic-git/releases) - [Commits](https://github.com/isomorphic-git/isomorphic-git/compare/v1.38.7...v1.44.15) Updates `lossless-json` from 4.3.1 to 4.3.3 - [Changelog](https://github.com/josdejong/lossless-json/blob/main/CHANGELOG.md) - [Commits](https://github.com/josdejong/lossless-json/compare/v4.3.1...v4.3.3) Updates `parse5` from 8.0.1 to 8.1.1 - [Release notes](https://github.com/inikulin/parse5/releases) - [Commits](https://github.com/inikulin/parse5/compare/v8.0.1...v8.1.1) Updates `playwright-core` from 1.64.1 to 1.65.1 - [Release notes](https://github.com/microsoft/playwright/releases) - [Commits](https://github.com/microsoft/playwright/compare/v1.64.1...v1.65.1) Updates `plist` from 5.0.0 to 5.1.1 - [Release notes](https://github.com/TooTallNate/plist.js/releases) - [Changelog](https://github.com/TooTallNate/plist.js/blob/master/CHANGELOG.md) - [Commits](https://github.com/TooTallNate/plist.js/compare/plist@5.0.0...plist@5.1.1) Updates `semver` from 7.8.5 to 7.8.6 - [Release notes](https://github.com/npm/node-semver/releases) - [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md) - [Commits](https://github.com/npm/node-semver/compare/v7.8.5...v7.8.6) Updates `@types/semver` from 7.7.1 to 7.8.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) Updates `smol-toml` from 1.9.0 to 1.9.1 - [Release notes](https://github.com/squirrelchat/smol-toml/releases) - [Commits](https://github.com/squirrelchat/smol-toml/compare/v1.9.0...v1.9.1) Updates `stream-chain` from 4.2.6 to 4.4.2 - [Commits](https://github.com/uhop/stream-chain/compare/4.2.6...4.4.2) Updates `stream-json` from 3.7.0 to 3.9.0 - [Commits](https://github.com/uhop/stream-json/compare/3.7.0...3.9.0) Updates `ws` from 8.21.0 to 8.23.0 - [Release notes](https://github.com/websockets/ws/releases) - [Commits](https://github.com/websockets/ws/compare/8.21.0...8.23.0) Updates `@types/ws` from 8.18.1 to 8.18.2 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws) Updates `yaml` from 2.9.0 to 2.9.1 - [Release notes](https://github.com/eemeli/yaml/releases) - [Commits](https://github.com/eemeli/yaml/compare/v2.9.0...v2.9.1) Updates `zod` from 4.6.6 to 4.6.7 - [Release notes](https://github.com/colinhacks/zod/releases) - [Commits](https://github.com/colinhacks/zod/compare/v4.6.6...v4.6.7) Updates `@electron/asar` from 4.2.0 to 4.3.2 - [Release notes](https://github.com/electron/asar/releases) - [Changelog](https://github.com/electron/asar/blob/main/CHANGELOG.md) - [Commits](https://github.com/electron/asar/compare/v4.2.0...v4.3.2) Updates `@stryker-mutator/core` from 10.0.0 to 10.1.1 - [Release notes](https://github.com/stryker-mutator/stryker-js/releases) - [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/core/CHANGELOG.md) - [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/core) Updates `@stryker-mutator/typescript-checker` from 10.0.0 to 10.1.1 - [Release notes](https://github.com/stryker-mutator/stryker-js/releases) - [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/typescript-checker/CHANGELOG.md) - [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/typescript-checker) Updates `@stryker-mutator/vitest-runner` from 10.0.0 to 10.1.1 - [Release notes](https://github.com/stryker-mutator/stryker-js/releases) - [Changelog](https://github.com/stryker-mutator/stryker-js/blob/master/packages/vitest-runner/CHANGELOG.md) - [Commits](https://github.com/stryker-mutator/stryker-js/commits/v10.1.1/packages/vitest-runner) Updates `@types/node` from 26.6.4 to 26.6.6 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Updates `@types/semver` from 7.7.1 to 7.8.0 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/semver) Updates `@types/ws` from 8.18.1 to 8.18.2 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/ws) Updates `@vitest/coverage-v8` from 5.0.3 to 5.1.0 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.0/packages/coverage-v8) Updates `jscpd` from 5.0.12 to 5.4.3 - [Release notes](https://github.com/kucherenko/jscpd/releases) - [Commits](https://github.com/kucherenko/jscpd/commits/v5.4.3/rust/jscpd) Updates `knip` from 6.39.0 to 6.45.1 - [Release notes](https://github.com/webpro-nl/knip/releases) - [Commits](https://github.com/webpro-nl/knip/commits/knip@6.45.1/packages/knip) Updates `oxfmt` from 0.72.0 to 0.79.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxfmt/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxfmt_v0.79.0/npm/oxfmt) Updates `oxlint` from 1.87.0 to 1.94.0 - [Release notes](https://github.com/oxc-project/oxc/releases) - [Changelog](https://github.com/oxc-project/oxc/blob/main/npm/oxlint/CHANGELOG.md) - [Commits](https://github.com/oxc-project/oxc/commits/oxlint_v1.94.0/npm/oxlint) Updates `oxlint-tsgolint` from 7.0.2005 to 7.0.2007 - [Release notes](https://github.com/oxc-project/tsgolint/releases) - [Commits](https://github.com/oxc-project/tsgolint/compare/v7.0.2005...v7.0.2007) Updates `release-please` from 17.3.0 to 17.11.2 - [Release notes](https://github.com/googleapis/release-please/releases) - [Changelog](https://github.com/googleapis/release-please/blob/main/CHANGELOG.md) - [Commits](https://github.com/googleapis/release-please/compare/v17.3.0...v17.11.2) Updates `rolldown` from 1.2.12 to 1.3.2 - [Release notes](https://github.com/rolldown/rolldown/releases) - [Changelog](https://github.com/rolldown/rolldown/blob/main/CHANGELOG.md) - [Commits](https://github.com/rolldown/rolldown/commits/v1.3.2/packages/rolldown) Updates `turbo` from 2.11.7 to 2.11.11 - [Release notes](https://github.com/vercel/turborepo/releases) - [Changelog](https://github.com/vercel/turborepo/blob/main/RELEASE.md) - [Commits](https://github.com/vercel/turborepo/compare/v2.11.7...v2.11.11) Updates `vitest` from 5.0.3 to 5.1.0 - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md) - [Commits](https://github.com/vitest-dev/vitest/commits/v5.1.0/packages/vitest) Updates `frida` from 17.23.2 to 17.26.4 - [Commits](https://github.com/frida/frida-node/compare/17.23.2...17.26.4) Updates `skills` from 1.7.2 to 1.9.0 - [Release notes](https://github.com/vercel-labs/skills/releases) - [Commits](https://github.com/vercel-labs/skills/compare/v1.7.2...v1.9.0) --- updated-dependencies: - dependency-name: "@babel/parser" dependency-version: 8.1.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@babel/types" dependency-version: 8.1.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@bufbuild/protobuf" dependency-version: 2.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@clack/prompts" dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@electron/asar" dependency-version: 4.3.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@stryker-mutator/core" dependency-version: 10.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@stryker-mutator/typescript-checker" dependency-version: 10.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@stryker-mutator/vitest-runner" dependency-version: 10.1.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@types/node" dependency-version: 26.6.6 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: "@types/semver" dependency-version: 7.8.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@types/semver" dependency-version: 7.8.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@types/ws" dependency-version: 8.18.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: "@types/ws" dependency-version: 8.18.2 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: "@vitest/coverage-v8" dependency-version: 5.1.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: "@zip.js/zip.js" dependency-version: 2.25.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: evmole dependency-version: 0.9.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: frida dependency-version: 17.26.4 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: ignore dependency-version: 7.0.14 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: isomorphic-git dependency-version: 1.44.15 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: jscpd dependency-version: 5.4.3 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: knip dependency-version: 6.45.1 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: lossless-json dependency-version: 4.3.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: oxfmt dependency-version: 0.79.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: oxlint dependency-version: 1.94.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: oxlint-tsgolint dependency-version: 7.0.2007 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: parse5 dependency-version: 8.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: playwright-core dependency-version: 1.65.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: plist dependency-version: 5.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: release-please dependency-version: 17.11.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: rolldown dependency-version: 1.3.2 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: semver dependency-version: 7.8.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: skills dependency-version: 1.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: smol-toml dependency-version: 1.9.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: stream-chain dependency-version: 4.4.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: stream-json dependency-version: 3.9.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: turbo dependency-version: 2.11.11 dependency-type: direct:development update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: vitest dependency-version: 5.1.0 dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: ws dependency-version: 8.23.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: npm-minor-and-patch - dependency-name: yaml dependency-version: 2.9.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch - dependency-name: zod dependency-version: 4.6.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: npm-minor-and-patch ... Signed-off-by: dependabot[bot] <support@github.com> * fix(deps): adapt release tooling and capture metadata to the new npm pins * fix(deps): preserve numeric, plist and archive evidence semantics * test(zip): verify malformed compression with CRC checks enabled * fix(capture): preserve exact decimal projections and redaction * test(apple): verify keyed archive controls before altering the trailer * test(lint): cover safe and suggested regex escape fixes * fix(reference): preserve directory exclusion provenance with ignore 7 * docs(examples): refresh HAR evidence identities for the current decoder * fix(reference): preserve metadata failures with strict Git ref reads * chore(config): remove the unused MCP profile type alias --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
771 lines
25 KiB
TypeScript
771 lines
25 KiB
TypeScript
import {
|
|
mkdir,
|
|
lstat as fsLstat,
|
|
open as fsOpen,
|
|
opendir as fsOpendir,
|
|
realpath as fsRealpath,
|
|
stat as fsStat,
|
|
writeFile,
|
|
type FileHandle,
|
|
} from "node:fs/promises";
|
|
import { join, resolve } from "node:path";
|
|
import { constants } from "node:fs";
|
|
|
|
import { afterEach, beforeEach, expect, it, onTestFinished, vi } from "vitest";
|
|
|
|
import { ArtifactResourceScope } from "../../../src/resources/ArtifactResourceScope.js";
|
|
import { importReferenceSource } from "../../../src/application/ReferenceSourceImport.js";
|
|
import { readReferenceSourceVcs } from "../../../src/application/ReferenceSourceVcsAdapter.js";
|
|
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
|
|
|
|
vi.mock("node:fs/promises", async (importOriginal) => {
|
|
const actual = await importOriginal<typeof import("node:fs/promises")>();
|
|
return {
|
|
...actual,
|
|
lstat: vi.fn(actual.lstat),
|
|
open: vi.fn(actual.open),
|
|
stat: vi.fn(actual.stat),
|
|
realpath: vi.fn(actual.realpath),
|
|
opendir: vi.fn(actual.opendir),
|
|
};
|
|
});
|
|
|
|
const lstatMock = vi.mocked(fsLstat);
|
|
const openMock = vi.mocked(fsOpen);
|
|
const opendirMock = vi.mocked(fsOpendir);
|
|
const statMock = vi.mocked(fsStat);
|
|
const realpathMock = vi.mocked(fsRealpath);
|
|
let actual: typeof import("node:fs/promises");
|
|
|
|
beforeEach(async () => {
|
|
actual =
|
|
await vi.importActual<typeof import("node:fs/promises")>(
|
|
"node:fs/promises",
|
|
);
|
|
lstatMock.mockImplementation((...args) => actual.lstat(...args));
|
|
openMock.mockImplementation((...args) => actual.open(...args));
|
|
opendirMock.mockImplementation((...args) => actual.opendir(...args));
|
|
statMock.mockImplementation((...args) => actual.stat(...args));
|
|
realpathMock.mockImplementation((...args) => actual.realpath(...args));
|
|
});
|
|
|
|
afterEach(() => {
|
|
lstatMock.mockReset();
|
|
openMock.mockReset();
|
|
opendirMock.mockReset();
|
|
statMock.mockReset();
|
|
realpathMock.mockReset();
|
|
});
|
|
|
|
const failCloseUntilAllowed = (
|
|
target: string,
|
|
): { readonly allow: () => void; readonly calls: () => number } => {
|
|
const closeFailure = new Error("injected metadata close failure");
|
|
let allowClose = false;
|
|
let closeCalls = 0;
|
|
openMock.mockImplementation(async (...args) => {
|
|
const handle = await actual.open(...args);
|
|
if (resolve(String(args[0])) !== resolve(target)) return handle;
|
|
const close = handle.close.bind(handle);
|
|
vi.spyOn(handle, "close").mockImplementation(async () => {
|
|
closeCalls += 1;
|
|
if (!allowClose) throw closeFailure;
|
|
await close();
|
|
});
|
|
return handle;
|
|
});
|
|
return {
|
|
allow: () => {
|
|
allowClose = true;
|
|
},
|
|
calls: () => closeCalls,
|
|
};
|
|
};
|
|
|
|
it.each([".", "nested"])(
|
|
"retains failed %s/.gitignore cleanup under the caller's scope",
|
|
async (directory) => {
|
|
const root = await createTestTempDirectory("rea-reference-ignore-owner-");
|
|
await mkdir(join(root, directory), { recursive: true });
|
|
const path = join(root, directory, ".gitignore");
|
|
await writeFile(path, "generated/\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const close = failCloseUntilAllowed(path);
|
|
onTestFinished(async () => {
|
|
close.allow();
|
|
await resources.close().catch(() => undefined);
|
|
});
|
|
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "reference-source-metadata-cleanup-test",
|
|
policy: { secretPatterns: [] },
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
code: "io",
|
|
cleanup: {
|
|
resources: [path],
|
|
reason: expect.stringContaining("injected metadata close failure"),
|
|
},
|
|
},
|
|
});
|
|
expect(close.calls()).toBe(2);
|
|
|
|
close.allow();
|
|
await resources.close();
|
|
expect(close.calls()).toBe(3);
|
|
},
|
|
);
|
|
|
|
it("retains local Git configuration cleanup before trusting ignore policy", async () => {
|
|
const root = await createTestTempDirectory("rea-reference-config-owner-");
|
|
await mkdir(join(root, ".git"));
|
|
const path = join(root, ".git", "config");
|
|
await writeFile(path, "[core]\nignorecase = true\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const close = failCloseUntilAllowed(path);
|
|
onTestFinished(async () => {
|
|
close.allow();
|
|
await resources.close().catch(() => undefined);
|
|
});
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "reference-source-config-cleanup-test",
|
|
policy: { secretPatterns: [] },
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: { code: "io", cleanup: { resources: [path] } },
|
|
});
|
|
expect(close.calls()).toBe(2);
|
|
close.allow();
|
|
await resources.close();
|
|
expect(close.calls()).toBe(3);
|
|
});
|
|
|
|
it("preserves Git metadata cleanup failure and the completed source read", async () => {
|
|
const root = await createTestTempDirectory("rea-reference-head-owner-");
|
|
const repository = join(root, "repository");
|
|
const sourceRoot = join(root, "source");
|
|
await Promise.all([
|
|
mkdir(join(repository, ".git"), { recursive: true }),
|
|
mkdir(sourceRoot),
|
|
]);
|
|
const source = join(sourceRoot, "main.ts");
|
|
const bytes = "export const value = 1;\n";
|
|
await writeFile(source, bytes);
|
|
await writeFile(join(sourceRoot, ".git"), "gitdir: ../repository/.git\n");
|
|
const head = join(repository, ".git", "HEAD");
|
|
await writeFile(head, "ref: refs/heads/main\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const close = failCloseUntilAllowed(head);
|
|
onTestFinished(async () => {
|
|
close.allow();
|
|
await resources.close().catch(() => undefined);
|
|
});
|
|
|
|
const result = await importReferenceSource(
|
|
{
|
|
root: sourceRoot,
|
|
excludePaths: [".git"],
|
|
caller: "reference-source-metadata-cleanup-test",
|
|
policy: { secretPatterns: [] },
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
code: "io",
|
|
cleanup: {
|
|
resources: [head],
|
|
reason: expect.stringContaining("injected metadata close failure"),
|
|
},
|
|
partial: {
|
|
entries: [
|
|
{
|
|
kind: "file",
|
|
path: "main.ts",
|
|
bytes: Buffer.from(bytes),
|
|
},
|
|
],
|
|
},
|
|
},
|
|
});
|
|
expect(close.calls()).toBe(2);
|
|
|
|
close.allow();
|
|
await resources.close();
|
|
expect(close.calls()).toBe(3);
|
|
});
|
|
|
|
it.each([
|
|
{ read: "loose", close: "loose", code: "EIO" },
|
|
{ read: "packed", close: "packed", code: "EIO" },
|
|
// A directory-shaped candidate is skipped, so the next probe can also fail.
|
|
{ read: "packed", close: "loose", code: "EISDIR" },
|
|
] as const)(
|
|
"keeps the $read ref $code primary and retains $close ref cleanup",
|
|
async ({ read, close, code }) => {
|
|
const root = await createTestTempDirectory("rea-reference-packed-owner-");
|
|
const gitdir = join(root, ".git");
|
|
const loose = join(gitdir, "refs", "heads", "main");
|
|
const packed = join(gitdir, "packed-refs");
|
|
const head = "0123456789abcdef0123456789abcdef01234567";
|
|
await mkdir(join(gitdir, "refs", "heads"), { recursive: true });
|
|
await Promise.all([
|
|
writeFile(join(gitdir, "HEAD"), "ref: refs/heads/main\n"),
|
|
writeFile(loose, `${head}\n`),
|
|
writeFile(packed, `${head} refs/heads/main\n`),
|
|
]);
|
|
|
|
const paths = { loose, packed };
|
|
const readFailure = Object.assign(
|
|
new Error(`injected ${read} ref ${code}`),
|
|
{
|
|
code,
|
|
},
|
|
);
|
|
const closeFailure = new Error(`injected ${close} ref close failure`);
|
|
const closeCalls = new Map<FileHandle, number>();
|
|
let readAttempted = false;
|
|
let allowClose = false;
|
|
const resources = new ArtifactResourceScope();
|
|
openMock.mockImplementation(async (...args) => {
|
|
const handle = await actual.open(...args);
|
|
const path = resolve(String(args[0]));
|
|
if (path === paths[read])
|
|
vi.spyOn(handle, "read").mockImplementation(async () => {
|
|
readAttempted = true;
|
|
throw readFailure;
|
|
});
|
|
if (path === paths[close]) {
|
|
const closeHandle = handle.close.bind(handle);
|
|
vi.spyOn(handle, "close").mockImplementation(async () => {
|
|
closeCalls.set(handle, (closeCalls.get(handle) ?? 0) + 1);
|
|
if (!allowClose) throw closeFailure;
|
|
await closeHandle();
|
|
});
|
|
}
|
|
return handle;
|
|
});
|
|
try {
|
|
const result = await readReferenceSourceVcs(root, resources);
|
|
if (result.ok) throw new Error("Expected Git metadata read failure");
|
|
expect(result.error).toMatchObject({
|
|
code: "io",
|
|
cleanup: {
|
|
resources: [paths[close]],
|
|
reason: expect.stringContaining(closeFailure.message),
|
|
},
|
|
});
|
|
expect(readAttempted).toBe(true);
|
|
const failure = result.error.cause;
|
|
if (
|
|
!(failure instanceof Error && failure.cause instanceof AggregateError)
|
|
)
|
|
throw new Error("Expected the Git metadata failure aggregate");
|
|
expect(failure.cause.cause).toBe(readFailure);
|
|
expect(result.error.message).toContain(readFailure.message);
|
|
expect(closeCalls.size).toBe(1);
|
|
expect(new Set(closeCalls.values())).toEqual(new Set([2]));
|
|
expect(resources.cleanupResources).toEqual([paths[close]]);
|
|
} finally {
|
|
allowClose = true;
|
|
await resources.close();
|
|
}
|
|
expect(new Set(closeCalls.values())).toEqual(new Set([3]));
|
|
expect(resources.hasPending).toBe(false);
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
["stat", false],
|
|
["stat", true],
|
|
["realpath", false],
|
|
["realpath", true],
|
|
] as const)(
|
|
"preserves a physical root %s failure when cancellation arrives (same reason: %s)",
|
|
async (stage, sameReason) => {
|
|
const root = await createTestTempDirectory("rea-reference-root-eio-");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const physical = Object.assign(new Error(`root ${stage} failed`), {
|
|
code: "EIO",
|
|
});
|
|
const reason = sameReason ? physical : { source: "caller" };
|
|
const reject = (): never => {
|
|
controller.abort(reason);
|
|
throw physical;
|
|
};
|
|
if (stage === "stat") {
|
|
statMock.mockImplementation(async (...args) => {
|
|
if (String(args[0]) === root) return reject();
|
|
return actual.stat(...args);
|
|
});
|
|
} else {
|
|
realpathMock.mockImplementation(async (...args) => {
|
|
if (String(args[0]) === root) return reject();
|
|
return actual.realpath(...args);
|
|
});
|
|
}
|
|
try {
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
if (result.ok)
|
|
throw new Error("Expected physical root admission failure");
|
|
expect(result.error.code).toBe("io");
|
|
expect(result.error.cause).toBe(physical);
|
|
expect(result.error.secondaryCancellation?.cause).toBe(reason);
|
|
} finally {
|
|
await resources.close();
|
|
}
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
{ closeFails: false, sameReason: false },
|
|
{ closeFails: false, sameReason: true },
|
|
{ closeFails: true, sameReason: false },
|
|
{ closeFails: true, sameReason: true },
|
|
])(
|
|
"retains physical Git read failure through late cancellation (close fails: $closeFails, same reason: $sameReason)",
|
|
async ({ closeFails, sameReason }) => {
|
|
const root = await createTestTempDirectory("rea-reference-vcs-eio-");
|
|
const gitdir = join(root, ".git");
|
|
await mkdir(gitdir);
|
|
const head = join(gitdir, "HEAD");
|
|
await writeFile(head, "ref: refs/heads/main\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const reason = { source: "caller" };
|
|
let physical: unknown;
|
|
const handles: FileHandle[] = [];
|
|
let allowClose = false;
|
|
openMock.mockImplementation(async (...args) => {
|
|
if (resolve(String(args[0])) !== resolve(head))
|
|
return actual.open(...args);
|
|
const flags = args[1];
|
|
if (typeof flags !== "number")
|
|
throw new Error("Expected numeric regular-file admission flags");
|
|
// Preserve admission flags; neither O_TRUNC nor a write is used.
|
|
const handle = await actual.open(
|
|
args[0],
|
|
flags | constants.O_WRONLY,
|
|
args[2],
|
|
);
|
|
handles.push(handle);
|
|
const read = handle.read.bind(handle);
|
|
vi.spyOn(handle, "read").mockImplementation(async (...readArgs) => {
|
|
try {
|
|
return await read(...readArgs);
|
|
} catch (cause: unknown) {
|
|
physical = cause;
|
|
throw cause;
|
|
}
|
|
});
|
|
const close = handle.close.bind(handle);
|
|
vi.spyOn(handle, "close").mockImplementation(async () => {
|
|
controller.abort(sameReason ? physical : reason);
|
|
if (closeFails && !allowClose) throw new Error("close failed");
|
|
await close();
|
|
});
|
|
return handle;
|
|
});
|
|
try {
|
|
const result = await readReferenceSourceVcs(
|
|
root,
|
|
resources,
|
|
controller.signal,
|
|
);
|
|
expect(physical).toMatchObject({ code: "EBADF" });
|
|
const cancellation = sameReason ? physical : reason;
|
|
expect(controller.signal.reason).toBe(cancellation);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
code: "io",
|
|
secondaryCancellation: { cause: cancellation },
|
|
...(closeFails ? { cleanup: { resources: [head] } } : {}),
|
|
},
|
|
});
|
|
if (result.ok) throw new Error("Physical metadata failure was ignored");
|
|
expect(result.error.secondaryCancellation?.cause).toBe(cancellation);
|
|
expect(resources.cleanupResources).toEqual(closeFails ? [head] : []);
|
|
let retained: unknown = result.error.cause;
|
|
while (
|
|
retained !== physical &&
|
|
retained instanceof Error &&
|
|
retained.cause !== undefined
|
|
)
|
|
retained = retained.cause;
|
|
expect(retained).toBe(physical);
|
|
expect(
|
|
handles.every((handle) =>
|
|
closeFails ? handle.fd >= 0 : handle.fd === -1,
|
|
),
|
|
).toBe(true);
|
|
allowClose = true;
|
|
await resources.close();
|
|
expect(handles.every((handle) => handle.fd === -1)).toBe(true);
|
|
expect(resources.hasPending).toBe(false);
|
|
} finally {
|
|
allowClose = true;
|
|
await resources.close();
|
|
}
|
|
},
|
|
);
|
|
|
|
it("preserves cancellation during final policy close and retains the descriptor for retry", async () => {
|
|
const root = await createTestTempDirectory("rea-reference-policy-cancel-");
|
|
const policyPath = join(root, ".gitignore");
|
|
await writeFile(policyPath, "ignored\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const reason = { source: "caller" };
|
|
const closeFailure = new Error("policy close failed");
|
|
let policyHandle: FileHandle | undefined;
|
|
let closeAttempts = 0;
|
|
let allowClose = false;
|
|
openMock.mockImplementation(async (...args) => {
|
|
const handle = await actual.open(...args);
|
|
if (resolve(String(args[0])) !== resolve(policyPath)) return handle;
|
|
policyHandle = handle;
|
|
const close = handle.close.bind(handle);
|
|
vi.spyOn(handle, "close").mockImplementation(async () => {
|
|
closeAttempts += 1;
|
|
controller.abort(reason);
|
|
if (!allowClose) throw closeFailure;
|
|
await close();
|
|
});
|
|
return handle;
|
|
});
|
|
try {
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: { code: "cancelled", cleanup: { resources: [policyPath] } },
|
|
});
|
|
if (result.ok) throw new Error("Expected policy cancellation");
|
|
expect(result.error.cause).toBe(reason);
|
|
expect(result.error.secondaryCancellation).toBeUndefined();
|
|
expect(result.error.cleanup?.reason).toContain(closeFailure.message);
|
|
expect(closeAttempts).toBe(2);
|
|
expect(policyHandle?.fd).toBeGreaterThanOrEqual(0);
|
|
expect(resources.cleanupResources).toEqual([policyPath]);
|
|
} finally {
|
|
allowClose = true;
|
|
await resources.close();
|
|
}
|
|
expect(policyHandle?.fd).toBe(-1);
|
|
expect(resources.hasPending).toBe(false);
|
|
});
|
|
|
|
it.each([false, true])(
|
|
"preserves a policy read failure and later cancellation (close fails: %s)",
|
|
async (closeFails) => {
|
|
const root = await createTestTempDirectory("rea-reference-policy-eio-");
|
|
const policyPath = join(root, ".gitignore");
|
|
await writeFile(policyPath, "ignored\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const reason = { source: "caller" };
|
|
const physical = Object.assign(new Error("policy read failed"), {
|
|
code: "EIO",
|
|
});
|
|
let allowClose = false;
|
|
openMock.mockImplementation(async (...args) => {
|
|
const handle = await actual.open(...args);
|
|
if (resolve(String(args[0])) !== resolve(policyPath)) return handle;
|
|
vi.spyOn(handle, "read").mockImplementation(async () => {
|
|
throw physical;
|
|
});
|
|
const close = handle.close.bind(handle);
|
|
vi.spyOn(handle, "close").mockImplementation(async () => {
|
|
controller.abort(reason);
|
|
if (closeFails && !allowClose) throw new Error("close failed");
|
|
await close();
|
|
});
|
|
return handle;
|
|
});
|
|
try {
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: { code: "io", secondaryCancellation: { cause: reason } },
|
|
});
|
|
if (result.ok) throw new Error("Policy failure was ignored");
|
|
expect(result.error.message).toContain("policy read failed");
|
|
expect(resources.cleanupResources).toEqual(
|
|
closeFails ? [policyPath] : [],
|
|
);
|
|
} finally {
|
|
allowClose = true;
|
|
await resources.close();
|
|
}
|
|
},
|
|
);
|
|
|
|
it("preserves physical Git failure and exact cancellation across parallel traversal", async () => {
|
|
const root = await createTestTempDirectory("rea-reference-parallel-abort-");
|
|
const gitdir = join(root, ".git");
|
|
await mkdir(gitdir);
|
|
const head = join(gitdir, "HEAD");
|
|
await writeFile(head, "ref: refs/heads/main\n");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const reason = { caller: "cancel while Git metadata fails" };
|
|
const physical = Object.assign(new Error("HEAD read EIO"), { code: "EIO" });
|
|
let entered!: () => void;
|
|
let release!: () => void;
|
|
const opendirEntered = new Promise<void>((resolve) => {
|
|
entered = resolve;
|
|
});
|
|
const gate = new Promise<void>((resolve) => {
|
|
release = resolve;
|
|
});
|
|
opendirMock.mockImplementation(async (...args) => {
|
|
entered();
|
|
await gate;
|
|
return actual.opendir(...args);
|
|
});
|
|
openMock.mockImplementation(async (...args) => {
|
|
const handle = await actual.open(...args);
|
|
if (resolve(String(args[0])) === resolve(head))
|
|
vi.spyOn(handle, "read").mockImplementation(async () => {
|
|
await opendirEntered;
|
|
controller.abort(reason);
|
|
release();
|
|
throw physical;
|
|
});
|
|
return handle;
|
|
});
|
|
try {
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
if (result.ok) throw new Error("Expected failure");
|
|
expect(result.error.code).toBe("io");
|
|
expect(result.error.secondaryCancellation?.cause).toBe(reason);
|
|
expect(((result.error.cause as Error).cause as Error).cause).toBe(physical);
|
|
} finally {
|
|
release();
|
|
await resources.close();
|
|
}
|
|
});
|
|
|
|
it.each(["metadata", "import"] as const)(
|
|
"preserves optional commondir absence when its probe coincides with cancellation (%s)",
|
|
async (surface) => {
|
|
const root = await createTestTempDirectory("rea-reference-optional-git-");
|
|
const gitdir = join(root, ".git");
|
|
await mkdir(gitdir);
|
|
await writeFile(
|
|
join(gitdir, "HEAD"),
|
|
"0123456789abcdef0123456789abcdef01234567\n",
|
|
);
|
|
const commondir = join(gitdir, "commondir");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const reason = { caller: "stop after optional metadata absence" };
|
|
let probed = false;
|
|
openMock.mockImplementation(async (...args) => {
|
|
try {
|
|
return await actual.open(...args);
|
|
} catch (cause: unknown) {
|
|
if (resolve(String(args[0])) === resolve(commondir)) {
|
|
probed = true;
|
|
controller.abort(reason);
|
|
}
|
|
throw cause;
|
|
}
|
|
});
|
|
try {
|
|
const result =
|
|
surface === "metadata"
|
|
? await readReferenceSourceVcs(root, resources, controller.signal)
|
|
: await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
expect(probed).toBe(true);
|
|
expect(controller.signal.reason).toBe(reason);
|
|
if (surface === "metadata")
|
|
expect(result).toEqual({
|
|
ok: true,
|
|
value: { kind: "unknown", head: null, dirty: null },
|
|
});
|
|
else {
|
|
if (result.ok) throw new Error("Expected cancelled import");
|
|
expect(result.error.code).toBe("cancelled");
|
|
expect(result.error.cause).toBe(reason);
|
|
}
|
|
} finally {
|
|
await resources.close();
|
|
}
|
|
},
|
|
);
|
|
|
|
it.each([
|
|
["lstat", false],
|
|
["lstat", true],
|
|
["stat", false],
|
|
["stat", true],
|
|
["realpath", false],
|
|
["realpath", true],
|
|
] as const)(
|
|
"retains physical git directory %s with late abort (same reason: %s)",
|
|
async (stage, sameReason) => {
|
|
const root = await createTestTempDirectory("rea-git-physical-");
|
|
await mkdir(join(root, ".git"));
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const physical = Object.assign(new Error("git lookup failed"), {
|
|
code: "EIO",
|
|
});
|
|
const reason = sameReason ? physical : { caller: "stopped" };
|
|
const reject = (): never => {
|
|
controller.abort(reason);
|
|
throw physical;
|
|
};
|
|
if (stage === "lstat")
|
|
lstatMock.mockImplementation(async (...args) => {
|
|
if (resolve(String(args[0])) === resolve(root, ".git")) return reject();
|
|
return actual.lstat(...args);
|
|
});
|
|
else if (stage === "stat")
|
|
statMock.mockImplementation(async (...args) => {
|
|
if (resolve(String(args[0])) === resolve(root, ".git")) return reject();
|
|
return actual.stat(...args);
|
|
});
|
|
else
|
|
realpathMock.mockImplementation(async (...args) => {
|
|
if (resolve(String(args[0])) === resolve(root, ".git")) return reject();
|
|
return actual.realpath(...args);
|
|
});
|
|
try {
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
code: "io",
|
|
cause: physical,
|
|
secondaryCancellation: { cause: reason },
|
|
},
|
|
});
|
|
} finally {
|
|
await resources.close();
|
|
}
|
|
},
|
|
);
|
|
|
|
it("preserves real cancellation between Git directory lookup checkpoints", async () => {
|
|
const root = await createTestTempDirectory("rea-git-checkpoint-");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const reason = { caller: "stopped" };
|
|
lstatMock.mockImplementation(async (...args) => {
|
|
if (resolve(String(args[0])) === resolve(root, ".git")) {
|
|
controller.abort(reason);
|
|
throw Object.assign(new Error("absent"), { code: "ENOENT" });
|
|
}
|
|
return actual.lstat(...args);
|
|
});
|
|
try {
|
|
const result = await importReferenceSource(
|
|
{
|
|
root,
|
|
caller: "test",
|
|
policy: { secretPatterns: [] },
|
|
signal: controller.signal,
|
|
},
|
|
resources,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: { code: "cancelled", cause: reason },
|
|
});
|
|
} finally {
|
|
await resources.close();
|
|
}
|
|
});
|
|
|
|
it("retains physical Git discovery lstat failure with late abort through VCS", async () => {
|
|
const root = await createTestTempDirectory("rea-git-vcs-physical-");
|
|
const resources = new ArtifactResourceScope();
|
|
const controller = new AbortController();
|
|
const physical = Object.assign(new Error("git discovery failed"), {
|
|
code: "EIO",
|
|
});
|
|
lstatMock.mockImplementation(async (...args) => {
|
|
if (resolve(String(args[0])) === resolve(root, ".git")) {
|
|
controller.abort(physical);
|
|
throw physical;
|
|
}
|
|
return actual.lstat(...args);
|
|
});
|
|
try {
|
|
const result = await readReferenceSourceVcs(
|
|
root,
|
|
resources,
|
|
controller.signal,
|
|
);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: { code: "io", secondaryCancellation: { cause: physical } },
|
|
});
|
|
} finally {
|
|
await resources.close();
|
|
}
|
|
});
|