* fix(reference): report entries beyond the path limit as I/O failures Reference-source traversal joins each child onto the root path. A valid tree whose nested entries exceed the platform's absolute path limit (PATH_MAX 1024 on macOS) makes lstat fail with ENAMETOOLONG. The reader's filesystem error allow-list lacked that code, so filesystemFailureDetail returned undefined and the native rejection escaped both readReferenceSource and importReferenceSource instead of becoming the existing failed `io` entry. Add ENAMETOOLONG to the allow-list, matching the JavaScript application reader's list. Readable siblings stay in the graph and the unreachable entry is recorded with its OS message. Fixes #2652 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(reference): assert the imported graph keeps readable and failed entries Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(process): report no remaining time after a provider deadline fires Node timers can fire while performance.now() is still a fraction of a millisecond short of the monotonic deadline. ProviderStartupDeadline then reported interruption "timeout" and an aborted signal while remainingMs() returned ceil(0.x) = 1, so polling loops guarded by remainingMs() > 0 (Hopper and Ghidra startup) could run past an elapsed deadline, and the real-timer test "aborts a bounded wait when its real monotonic deadline expires" failed intermittently in CI (expected 1 to be 0). Once the deadline's own timer has classified a timeout, report zero remaining time. A deterministic regression test fires the timer with the monotonic clock 0.4 ms short of the deadline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(reference): preserve path limit entry uncertainty * fix(reference): preserve unknown entry failures and identity * fix(reference): type unknown-kind exclusions and keep them out of symlink counts The metadata-failure path offers "unknown" to exclusion predicates, but the predicate type only admitted concrete kinds, which broke the build. Directory-only secret and ignore rules now also match an unknown-kind entry (it may be a directory), and the summary counts unknown entries separately instead of as symlinks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Codex <codex@users.noreply.github.com>
111 lines
3.2 KiB
TypeScript
111 lines
3.2 KiB
TypeScript
import type { BigIntStats } from "node:fs";
|
|
|
|
import type { Result } from "../domain/result.js";
|
|
import type { AnalysisCleanupObservation } from "../domain/analysisErrorBase.js";
|
|
import type { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
|
|
|
export type ReferenceSourceEntryKind =
|
|
| "file"
|
|
| "directory"
|
|
| "symlink"
|
|
| "other";
|
|
|
|
/**
|
|
* Kind offered to exclusion predicates. `unknown` marks an entry whose
|
|
* metadata could not be read, so its concrete kind cannot be claimed.
|
|
*/
|
|
export type ReferenceSourceExclusionKind = ReferenceSourceEntryKind | "unknown";
|
|
|
|
export interface ReferenceSourceReaderOptions {
|
|
readonly signal?: AbortSignal;
|
|
readonly shouldExclude?: (
|
|
path: string,
|
|
kind: ReferenceSourceExclusionKind,
|
|
) => boolean;
|
|
}
|
|
|
|
export type ReferenceSourceFailureCode =
|
|
| "cancelled"
|
|
| "changed"
|
|
| "io"
|
|
| "symlink"
|
|
| "unsupported";
|
|
|
|
export type ReferenceSourceEntry =
|
|
| {
|
|
readonly status: "read";
|
|
readonly kind: "file";
|
|
readonly path: string;
|
|
readonly bytes: Uint8Array;
|
|
readonly size: number;
|
|
}
|
|
| {
|
|
readonly status: "read";
|
|
readonly kind: "directory";
|
|
readonly path: string;
|
|
}
|
|
| {
|
|
readonly status: "read";
|
|
readonly kind: "symlink";
|
|
readonly path: string;
|
|
/** Internal and relative missing targets are resolved from the inventory root. */
|
|
readonly target: string;
|
|
readonly targetState: "internal" | "external" | "missing";
|
|
}
|
|
| {
|
|
readonly status: "failed";
|
|
readonly kind: "file" | "directory" | "symlink" | "other" | "unknown";
|
|
readonly path: string;
|
|
readonly code: ReferenceSourceFailureCode;
|
|
readonly message: string;
|
|
readonly size?: number;
|
|
};
|
|
|
|
export interface ReferenceSourceRead {
|
|
readonly root: string;
|
|
readonly entries: readonly ReferenceSourceEntry[];
|
|
readonly bytesRead: number;
|
|
/** Node exposes no portable openat traversal; pathname identity is checked around each operation. */
|
|
readonly limitations: readonly string[];
|
|
}
|
|
|
|
export interface ReferenceSourceReaderError {
|
|
readonly tag: "reference-source-reader";
|
|
readonly code: "cancelled" | "invalid-root" | "io" | "unsupported";
|
|
readonly message: string;
|
|
readonly cleanup?: AnalysisCleanupObservation;
|
|
/** Captured entries before failure; this does not establish complete tree coverage. */
|
|
readonly partial?: ReferenceSourceRead;
|
|
readonly cause?: unknown;
|
|
}
|
|
|
|
export type PendingDirectory = {
|
|
readonly path: string;
|
|
};
|
|
|
|
export type TraversalState = {
|
|
readonly resources: ArtifactResourceScope;
|
|
readonly root: string;
|
|
readonly rootIdentity: BigIntStats;
|
|
readonly signal?: AbortSignal;
|
|
readonly shouldExclude?: (
|
|
path: string,
|
|
kind: ReferenceSourceExclusionKind,
|
|
) => boolean;
|
|
readonly entries: ReferenceSourceEntry[];
|
|
readonly pending: PendingDirectory[];
|
|
bytesRead: number;
|
|
};
|
|
|
|
export type StableFileRequest = {
|
|
readonly resources: ArtifactResourceScope;
|
|
readonly root: string;
|
|
readonly rootIdentity: BigIntStats;
|
|
readonly absolute: string;
|
|
readonly path: string;
|
|
readonly expected: BigIntStats;
|
|
readonly signal?: AbortSignal;
|
|
};
|
|
|
|
export type ReferenceSourceResult<T> = Result<T, ReferenceSourceReaderError>;
|