[GH-ISSUE #6756] [Bug] CLI output filters drop selected own __proto__ JSON members #4116

Closed
opened 2026-10-31 00:46:55 +00:00 by bsakaguchi · 1 comment
Owner

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

Before submitting

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

Area

CLI

Observed behavior

inspect-evidence-bundle returns a valid stored own JSON member named __proto__ without a filter, but --filter-output 'records[0,1].normalized_result.__proto__.answer' silently omits its selected value. Selecting an ordinary sibling or their common parent succeeds. The affected command still exits 0 with empty stderr.

Reproduction

With an unpacked published package and its runtime dependencies available, save this as reproduce.mjs. Run mkdir -p /tmp/rea-probe, then node reproduce.mjs /path/to/rea-package /tmp/rea-probe/bundle.json. The program creates one synthetic Evidence bundle and runs the public executable with no filter, the failing selection, an ordinary-key control, and a whole-parent workaround:

import { dirname, resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
import { writeFile } from 'node:fs/promises';
import { spawnSync } from 'node:child_process';
const root = resolve(process.argv[2]);
const path = resolve(process.argv[3]);
const load = p => import(pathToFileURL(resolve(root, p)));
const { createEvidence } = await load('dist/domain/evidence.js');
const { createEvidenceBundle } = await load('dist/domain/evidenceBundle.js');
const result = JSON.parse('{"__proto__":{"answer":7},"normal":{"answer":7}}');
const record = createEvidence(undefined,
  { id:'fixture', name:'Fixture', version:'1' },
  { operation:'ordinary-json', parameters:{}, result });
await writeFile(path, JSON.stringify(createEvidenceBundle([record])));
for (const suffix of [undefined, '__proto__.answer', 'normal.answer', '']) {
  const filter = suffix === undefined ? undefined :
    'records[0,1].normalized_result' + (suffix ? '.' + suffix : '');
  const args = [resolve(root, 'scripts/rea.mjs'), 'inspect-evidence-bundle',
    JSON.stringify({path, detail:'complete'}), '--json',
    ...(filter === undefined ? [] : ['--filter-output', filter])];
  const r = spawnSync(process.execPath, args, {encoding:'utf8',
    env:{PATH:process.env.PATH, HOME:dirname(path), REA_LOG_LEVEL:'silent'},
    timeout:20000});
  console.log(JSON.stringify({filter,status:r.status,stdout:r.stdout,stderr:r.stderr}));
}

Executed twice against the published package with the same four outcomes. An equivalent selection with an extra payload wrapper also failed through the actual source createCli({}) registration and output owner; ordinary-key and parent-selection controls passed there.

Expected behavior

The selected member should remain own JSON data, yielding:

{"records":[{"normalized_result":{"__proto__":{"answer":7}}}]}

The CLI guide promises selected fields from successful command data. The shared JSON schema explicitly retains all own data members. The unfiltered public command confirms this fixture passes bundle loading and preserves the member before selection.

Impact and scope

P2: an explicitly selected existing fact disappears from successful CLI output. The stored bundle remains usable. Removing the filter or selecting records[0,1].normalized_result preserved the required value in the executed controls. This establishes JSON output loss for the supplied ordinary own-key fixture; real-world prevalence and other public-command formats were not measured.

REA version

Published rea-agents 6.7.0; current source revision 7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4, metadata 6.7.0. Both use pinned Incur 0.6.1.

Runtime and platform

Node.js v24.22.1; Linux x86_64. No native analysis provider was required.

Target and artifact context

One self-authored JSON Evidence bundle containing one record with own __proto__ and normal members, each holding {"answer":7}.

Interface

CLI

Earliest failure stage

Transport or result projection

Relevant output or evidence

Every invocation exited 0 with empty stderr. Reduced observed outputs:

{"filter":"records[0,1].normalized_result.__proto__.answer","output":{"records":[{"normalized_result":{}}]}}
{"filter":"records[0,1].normalized_result.normal.answer","output":{"records":[{"normalized_result":{"normal":{"answer":7}}}]}}
{"filter":"records[0,1].normalized_result","output":{"records":[{"normalized_result":{"__proto__":{"answer":7},"normal":{"answer":7}}}]}}
  • Expected source: CLI selection documentation and own-member-preserving JSON schema linked above.
  • Failure source: executed published CLI with the fixture above; equivalent current-source registered CLI selection with the extra wrapper described under Reproduction.
  • Evidence provenance: observed; diagnosis below is source-derived.
  • Local verification: reproduced.
  • Reproduction completeness: complete.

Reachability: the command loads the bundle and returns its selected detail, then the production CLI installs result formatting.

Typed outcome or recovery expected

A successful projection containing the selected value, preserving the existing operation status.

Analysis or suspected cause

Source-derived: current object projection builds {} and assigns result[key]; assigning this key does not create the enumerable own member the JSON writer reads. The published package instead delegates filtering to Incur's Filter.apply, with the same observed omission. The shared JSON serializer is downstream of the missing member.

Additional context

Closest report #1036 concerns the former z.json() schema losing producer members. That boundary now preserves this fixture, as the unfiltered and parent-selection controls show; the remaining failure is CLI path projection. #6542 concerns sibling slice selections overwriting one another; this failure requires only one selected path.

Open/closed searches included "__proto__", "__proto__" "filter", "__proto__" "CLI", and "filter-output" "prototype". No matching CLI selection report was found. NOT_ENOUGH_INFO: no last-known-good release was established.

Proposed restoration check, unexecuted: rerun the supplied selections and require the own-key selection to contain answer:7, while the ordinary-key and parent selections keep their existing results. Keep successful bundle loading and the source bundle's contents unchanged.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: A public successful CLI projection silently omits an explicitly selected existing JSON value on both tested baselines.
  • Workaround status: available
  • Workaround basis: Selecting the common parent or removing the filter preserved the same value in executed public-command controls.
Originally created by @coygeek on GitHub (Oct 23, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/6756 ### 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 CLI ### Observed behavior `inspect-evidence-bundle` returns a valid stored own JSON member named `__proto__` without a filter, but `--filter-output 'records[0,1].normalized_result.__proto__.answer'` silently omits its selected value. Selecting an ordinary sibling or their common parent succeeds. The affected command still exits 0 with empty stderr. ### Reproduction With an unpacked published package and its runtime dependencies available, save this as `reproduce.mjs`. Run `mkdir -p /tmp/rea-probe`, then `node reproduce.mjs /path/to/rea-package /tmp/rea-probe/bundle.json`. The program creates one synthetic Evidence bundle and runs the public executable with no filter, the failing selection, an ordinary-key control, and a whole-parent workaround: ```js import { dirname, resolve } from 'node:path'; import { pathToFileURL } from 'node:url'; import { writeFile } from 'node:fs/promises'; import { spawnSync } from 'node:child_process'; const root = resolve(process.argv[2]); const path = resolve(process.argv[3]); const load = p => import(pathToFileURL(resolve(root, p))); const { createEvidence } = await load('dist/domain/evidence.js'); const { createEvidenceBundle } = await load('dist/domain/evidenceBundle.js'); const result = JSON.parse('{"__proto__":{"answer":7},"normal":{"answer":7}}'); const record = createEvidence(undefined, { id:'fixture', name:'Fixture', version:'1' }, { operation:'ordinary-json', parameters:{}, result }); await writeFile(path, JSON.stringify(createEvidenceBundle([record]))); for (const suffix of [undefined, '__proto__.answer', 'normal.answer', '']) { const filter = suffix === undefined ? undefined : 'records[0,1].normalized_result' + (suffix ? '.' + suffix : ''); const args = [resolve(root, 'scripts/rea.mjs'), 'inspect-evidence-bundle', JSON.stringify({path, detail:'complete'}), '--json', ...(filter === undefined ? [] : ['--filter-output', filter])]; const r = spawnSync(process.execPath, args, {encoding:'utf8', env:{PATH:process.env.PATH, HOME:dirname(path), REA_LOG_LEVEL:'silent'}, timeout:20000}); console.log(JSON.stringify({filter,status:r.status,stdout:r.stdout,stderr:r.stderr})); } ``` Executed twice against the published package with the same four outcomes. An equivalent selection with an extra `payload` wrapper also failed through the actual source `createCli({})` registration and output owner; ordinary-key and parent-selection controls passed there. ### Expected behavior The selected member should remain own JSON data, yielding: ```json {"records":[{"normalized_result":{"__proto__":{"answer":7}}}]} ``` The [CLI guide](https://github.com/morluto/rea/blob/7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4/docs/cli.md#L570-L580) promises selected fields from successful command data. The [shared JSON schema](https://github.com/morluto/rea/blob/7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4/src/domain/jsonValue.ts#L157-L187) explicitly retains all own data members. The unfiltered public command confirms this fixture passes bundle loading and preserves the member before selection. ### Impact and scope P2: an explicitly selected existing fact disappears from successful CLI output. The stored bundle remains usable. Removing the filter or selecting `records[0,1].normalized_result` preserved the required value in the executed controls. This establishes JSON output loss for the supplied ordinary own-key fixture; real-world prevalence and other public-command formats were not measured. ### REA version Published `rea-agents` 6.7.0; current source revision `7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4`, metadata 6.7.0. Both use pinned Incur 0.6.1. ### Runtime and platform Node.js v24.22.1; Linux x86_64. No native analysis provider was required. ### Target and artifact context One self-authored JSON Evidence bundle containing one record with own `__proto__` and `normal` members, each holding `{"answer":7}`. ### Interface CLI ### Earliest failure stage Transport or result projection ### Relevant output or evidence Every invocation exited 0 with empty stderr. Reduced observed outputs: ```jsonl {"filter":"records[0,1].normalized_result.__proto__.answer","output":{"records":[{"normalized_result":{}}]}} {"filter":"records[0,1].normalized_result.normal.answer","output":{"records":[{"normalized_result":{"normal":{"answer":7}}}]}} {"filter":"records[0,1].normalized_result","output":{"records":[{"normalized_result":{"__proto__":{"answer":7},"normal":{"answer":7}}}]}} ``` - Expected source: CLI selection documentation and own-member-preserving JSON schema linked above. - Failure source: executed published CLI with the fixture above; equivalent current-source registered CLI selection with the extra wrapper described under Reproduction. - Evidence provenance: observed; diagnosis below is source-derived. - Local verification: reproduced. - Reproduction completeness: complete. Reachability: [the command loads the bundle and returns its selected detail](https://github.com/morluto/rea/blob/7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4/src/cli/analysisViewCommands.ts#L28-L74), then [the production CLI installs result formatting](https://github.com/morluto/rea/blob/7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4/src/cli.ts#L178-L183). ### Typed outcome or recovery expected A successful projection containing the selected value, preserving the existing operation status. ### Analysis or suspected cause Source-derived: current [object projection](https://github.com/morluto/rea/blob/7fd6e486ae6fa0bdf2c13485ca516c40c3a0bab4/src/cli/cliResultOutput.ts#L473-L495) builds `{}` and assigns `result[key]`; assigning this key does not create the enumerable own member the JSON writer reads. The published package instead delegates filtering to Incur's `Filter.apply`, with the same observed omission. The shared JSON serializer is downstream of the missing member. ### Additional context Closest report [#1036](https://github.com/morluto/rea/issues/1036) concerns the former `z.json()` schema losing producer members. That boundary now preserves this fixture, as the unfiltered and parent-selection controls show; the remaining failure is CLI path projection. [#6542](https://github.com/morluto/rea/issues/6542) concerns sibling slice selections overwriting one another; this failure requires only one selected path. Open/closed searches included `"__proto__"`, `"__proto__" "filter"`, `"__proto__" "CLI"`, and `"filter-output" "prototype"`. No matching CLI selection report was found. NOT_ENOUGH_INFO: no last-known-good release was established. Proposed restoration check, unexecuted: rerun the supplied selections and require the own-key selection to contain `answer:7`, while the ordinary-key and parent selections keep their existing results. Keep successful bundle loading and the source bundle's contents unchanged. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: A public successful CLI projection silently omits an explicitly selected existing JSON value on both tested baselines. - Workaround status: available - Workaround basis: Selecting the common parent or removing the filter preserved the same value in executed public-command controls.
Author
Owner

@amyanger commented on GitHub (Oct 23, 2026):

I'm working on this and will open a draft PR shortly.

<!-- gh-comment-id:6368727882 --> @amyanger commented on GitHub (Oct 23, 2026): I'm working on this and will open a draft PR shortly.
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#4116
No description provided.