[GH-ISSUE #3218] [Bug] Source imports report FIFOs as files and inflate file counts #1155

Closed
opened 2026-10-15 18:31:34 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/3218

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Evidence, artifacts, or reconstruction

Observed behavior

Importing a local source tree containing one regular file and one FIFO succeeds with exit status 0, but the full historical-source graph reports the FIFO as kind: "file" with content_state: "unreadable". Its limitation correctly says that the entry is not a regular file. The summary and its outline also report the FIFO as a file, producing files=2, unreadable=1 and unknown=0 for a tree with only one regular file.

An independently executed regular-file-only control returned files=1, unreadable=0 and known_bytes="2". The FIFO reproduction also returned known_bytes="2"; no inflated byte total was observed. Both trees reported a partial inventory because the general pathname-race limitation also applies to the regular-file control.

Reproduction

  1. From a clean checkout at the source revision below, install the locked dependencies and build the runtime.

    npm ci
    npm run build:cached
    
  2. On macOS or Linux with mkfifo available, create isolated CLI state, the affected source tree and a regular-file-only control.

    mkdir -p verification-home/config verification-home/cache verification-home/data
    mkdir -p sample-tree/src control-tree/src
    printf 'x\n' > sample-tree/src/a.ts
    printf 'x\n' > control-tree/src/a.ts
    mkfifo sample-tree/src/pipe
    
  3. Import the affected tree with full and summary output.

    env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" node scripts/rea.mjs import-reference-source "$PWD/sample-tree" --json
    env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" node scripts/rea.mjs import-reference-source "$PWD/sample-tree" --detail summary --outline-depth 2 --json
    
  4. Observe src/pipe as kind: "file" in the graph and outline, and observe two files with one unreadable file in the summary. Run the control and observe one file with no unreadable files.

    env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" node scripts/rea.mjs import-reference-source "$PWD/control-tree" --detail summary --outline-depth 2 --json
    
  5. To reproduce the verified exclusion workaround, run the affected import with a configured-secret pattern matching only the FIFO.

    env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" REA_REFERENCE_SECRET_PATTERNS_JSON='["src/pipe"]' node scripts/rea.mjs import-reference-source "$PWD/sample-tree" --detail summary --json
    

    This control returned files=1, unreadable=0 and an exclusion with entry_kind: "other", reason: "configured-secret" and pattern: "src/pipe".

The independent verifier executed the fixtures and import commands against a prepared baseline checkout with dependencies installed and the runtime built. The clean-checkout installation and build commands are prerequisites and were not rerun during that verification. The reproduction was executed on macOS; Linux execution was not tested.

Expected behavior

Preserve the reader's positively observed non-regular entry kind through the committed graph and summary. The FIFO must retain a non-file representation and its unsupported-entry limitation, rather than become an unreadable regular file. The summary must count one regular file, no unreadable files and the regular file's two known bytes. Preserve all three inventoried entries and partial coverage.

AGENTS.md, Architecture and Cleanup, requires consumers to use the owner's parsed facts and to preserve identity, omission, uncertainty and source evidence across boundaries. src/domain/referenceSourceGraph.ts:109 distinguishes file, directory, symlink and unknown representations, although the schema does not prescribe a particular FIFO encoding. docs/cli.md:223 documents full and summary views of the same committed inventory, and docs/cli.md:248 defines exact known inventoried file sizes. The full graph and summary outline must agree on the corrected kind.

Impact and scope

P2. The supported CLI returns incorrect machine-readable entry kinds and file counts for the reproduced FIFO input. The import succeeds and retains a limitation; the verifier observed no data loss or security boundary crossing. The reproduced zero-size FIFO does not inflate the known-byte total. Other non-regular entry types were not independently tested.

A verified workaround excludes only src/pipe with REA_REFERENCE_SECRET_PATTERNS_JSON='["src/pipe"]'. It preserves the regular-file inventory, records the FIFO as an exclusion with its observed other kind and avoids the incorrect file and unreadable counts. This intentionally omits the FIFO from retained entries.

REA version

6.4.0 (main at 5830088520)

Runtime and platform

Node.js v26.10.0; macOS arm64; Darwin release 27.0.0.

Target and artifact context

A caller-selected local source directory containing src/a.ts with x plus a newline and src/pipe created with mkfifo. Historical-source import uses isolated HOME and XDG state. No external analysis engine is required.

Interface

CLI

Earliest failure stage

Artifact or evidence registration

Relevant output or evidence

Full graph entry:
{"path":"src/pipe","classifications":["unknown"],"limitations":["Entry is not a regular file Exclude this entry or replace it with a regular file."],"kind":"file","language":null,"sha256":null,"size":0,"content_state":"unreadable"}

Summary excerpt:
{"counts":{"entries":3,"files":2,"directories":1,"symlinks":0,"unknown":0,"relationships":0,"parse_failures":0,"exclusions":0},"file_content_states":{"hashed":1,"redacted-secret":0,"excluded":0,"unreadable":1,"unknown":0},"file_sizes":{"known_bytes":"2","unknown_file_count":0},"inventory_state":"partial"}

Typed outcome or recovery expected

Retain the FIFO as a non-file entry in both the full graph and summary outline, with its non-regular limitation available. With the existing unknown representation, the affected tree would have entries=3, files=1, unknown=1 and unreadable=0. Keep known_bytes="2" and partial inventory coverage. Do not silently drop the FIFO or claim complete coverage.

The regular-file-only control must still return files=1, unreadable=0 and known_bytes="2". The configured-exclusion control must still record the FIFO with entry_kind: "other" and contribute no file count.

Analysis or suspected cause

Source-derived reasoning at the reported baseline: src/reference/ReferenceSourceReaderEntries.ts:214 identifies the FIFO as other, and src/reference/ReferenceSourceReaderEntries.ts:245 records its unsupported non-regular failure without opening the pipe. src/application/ReferenceSourceImportEntries.ts:56 handles failed directories, symlinks and unknown entries separately, but lets other fall through to kind: "file". src/application/ReferenceSourceImportEntries.ts:210 inserts that projected entry into the graph. src/domain/referenceSourceSummary.ts:54 then counts it as a file and an unreadable file.

The observed CLI output agrees with this source path. The classifications: ["unknown"] value alone does not demonstrate a contradiction, because classifications describe source roles rather than filesystem entry kinds.

Additional context

Related to closed PR #770, which addressed preserving the FIFO failure reason in limitation text; this report requires preserving the non-file kind and correcting inventory counts even when that reason is already retained.

Originally created by @coygeek on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/3218 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Evidence, artifacts, or reconstruction ### Observed behavior Importing a local source tree containing one regular file and one FIFO succeeds with exit status 0, but the full historical-source graph reports the FIFO as `kind: "file"` with `content_state: "unreadable"`. Its limitation correctly says that the entry is not a regular file. The summary and its outline also report the FIFO as a file, producing `files=2`, `unreadable=1` and `unknown=0` for a tree with only one regular file. An independently executed regular-file-only control returned `files=1`, `unreadable=0` and `known_bytes="2"`. The FIFO reproduction also returned `known_bytes="2"`; no inflated byte total was observed. Both trees reported a partial inventory because the general pathname-race limitation also applies to the regular-file control. ### Reproduction 1. From a clean checkout at the source revision below, install the locked dependencies and build the runtime. ```sh npm ci npm run build:cached ``` 2. On macOS or Linux with `mkfifo` available, create isolated CLI state, the affected source tree and a regular-file-only control. ```sh mkdir -p verification-home/config verification-home/cache verification-home/data mkdir -p sample-tree/src control-tree/src printf 'x\n' > sample-tree/src/a.ts printf 'x\n' > control-tree/src/a.ts mkfifo sample-tree/src/pipe ``` 3. Import the affected tree with full and summary output. ```sh env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" node scripts/rea.mjs import-reference-source "$PWD/sample-tree" --json env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" node scripts/rea.mjs import-reference-source "$PWD/sample-tree" --detail summary --outline-depth 2 --json ``` 4. Observe `src/pipe` as `kind: "file"` in the graph and outline, and observe two files with one unreadable file in the summary. Run the control and observe one file with no unreadable files. ```sh env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" node scripts/rea.mjs import-reference-source "$PWD/control-tree" --detail summary --outline-depth 2 --json ``` 5. To reproduce the verified exclusion workaround, run the affected import with a configured-secret pattern matching only the FIFO. ```sh env HOME="$PWD/verification-home" XDG_CONFIG_HOME="$PWD/verification-home/config" XDG_CACHE_HOME="$PWD/verification-home/cache" XDG_DATA_HOME="$PWD/verification-home/data" REA_REFERENCE_SECRET_PATTERNS_JSON='["src/pipe"]' node scripts/rea.mjs import-reference-source "$PWD/sample-tree" --detail summary --json ``` This control returned `files=1`, `unreadable=0` and an exclusion with `entry_kind: "other"`, `reason: "configured-secret"` and `pattern: "src/pipe"`. The independent verifier executed the fixtures and import commands against a prepared baseline checkout with dependencies installed and the runtime built. The clean-checkout installation and build commands are prerequisites and were not rerun during that verification. The reproduction was executed on macOS; Linux execution was not tested. ### Expected behavior Preserve the reader's positively observed non-regular entry kind through the committed graph and summary. The FIFO must retain a non-file representation and its unsupported-entry limitation, rather than become an unreadable regular file. The summary must count one regular file, no unreadable files and the regular file's two known bytes. Preserve all three inventoried entries and partial coverage. `AGENTS.md`, Architecture and Cleanup, requires consumers to use the owner's parsed facts and to preserve identity, omission, uncertainty and source evidence across boundaries. `src/domain/referenceSourceGraph.ts:109` distinguishes file, directory, symlink and unknown representations, although the schema does not prescribe a particular FIFO encoding. `docs/cli.md:223` documents full and summary views of the same committed inventory, and `docs/cli.md:248` defines exact known inventoried file sizes. The full graph and summary outline must agree on the corrected kind. ### Impact and scope P2. The supported CLI returns incorrect machine-readable entry kinds and file counts for the reproduced FIFO input. The import succeeds and retains a limitation; the verifier observed no data loss or security boundary crossing. The reproduced zero-size FIFO does not inflate the known-byte total. Other non-regular entry types were not independently tested. A verified workaround excludes only `src/pipe` with `REA_REFERENCE_SECRET_PATTERNS_JSON='["src/pipe"]'`. It preserves the regular-file inventory, records the FIFO as an exclusion with its observed `other` kind and avoids the incorrect file and unreadable counts. This intentionally omits the FIFO from retained entries. ### REA version 6.4.0 (main at 58300885207133422af235e0f2b10658cf958b03) ### Runtime and platform Node.js v26.10.0; macOS arm64; Darwin release 27.0.0. ### Target and artifact context A caller-selected local source directory containing `src/a.ts` with `x` plus a newline and `src/pipe` created with `mkfifo`. Historical-source import uses isolated HOME and XDG state. No external analysis engine is required. ### Interface CLI ### Earliest failure stage Artifact or evidence registration ### Relevant output or evidence ```text Full graph entry: {"path":"src/pipe","classifications":["unknown"],"limitations":["Entry is not a regular file Exclude this entry or replace it with a regular file."],"kind":"file","language":null,"sha256":null,"size":0,"content_state":"unreadable"} Summary excerpt: {"counts":{"entries":3,"files":2,"directories":1,"symlinks":0,"unknown":0,"relationships":0,"parse_failures":0,"exclusions":0},"file_content_states":{"hashed":1,"redacted-secret":0,"excluded":0,"unreadable":1,"unknown":0},"file_sizes":{"known_bytes":"2","unknown_file_count":0},"inventory_state":"partial"} ``` ### Typed outcome or recovery expected Retain the FIFO as a non-file entry in both the full graph and summary outline, with its non-regular limitation available. With the existing unknown representation, the affected tree would have `entries=3`, `files=1`, `unknown=1` and `unreadable=0`. Keep `known_bytes="2"` and partial inventory coverage. Do not silently drop the FIFO or claim complete coverage. The regular-file-only control must still return `files=1`, `unreadable=0` and `known_bytes="2"`. The configured-exclusion control must still record the FIFO with `entry_kind: "other"` and contribute no file count. ### Analysis or suspected cause Source-derived reasoning at the reported baseline: `src/reference/ReferenceSourceReaderEntries.ts:214` identifies the FIFO as `other`, and `src/reference/ReferenceSourceReaderEntries.ts:245` records its unsupported non-regular failure without opening the pipe. `src/application/ReferenceSourceImportEntries.ts:56` handles failed directories, symlinks and unknown entries separately, but lets `other` fall through to `kind: "file"`. `src/application/ReferenceSourceImportEntries.ts:210` inserts that projected entry into the graph. `src/domain/referenceSourceSummary.ts:54` then counts it as a file and an unreadable file. The observed CLI output agrees with this source path. The `classifications: ["unknown"]` value alone does not demonstrate a contradiction, because classifications describe source roles rather than filesystem entry kinds. ### Additional context Related to closed [PR #770](https://github.com/morluto/rea/pull/770), which addressed preserving the FIFO failure reason in limitation text; this report requires preserving the non-file kind and correcting inventory counts even when that reason is already retained.
bsakaguchi 2026-10-15 18:31:34 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1155
No description provided.