[PR #914] [MERGED] fix(cli): emit empty structured filter projections #2342

Closed
opened 2026-10-16 21:17:33 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/914
Author: @kaoru0822-kitauji
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @morluto

Base: main ← Head: fix/cli-empty-filter-output


📝 Commits (1)

  • b6ca0d8 fix(cli): emit empty structured filter projections

📊 Changes

4 files changed (+126 additions, -7 deletions)

View changed files

📝 scripts/rea.mjs (+9 -1)
📝 src/cliOutput.ts (+39 -5)
📝 tests/boundary/cli/cliOutput.test.ts (+77 -0)
📝 tests/boundary/cli/dispatcher.test.ts (+1 -1)

📄 Description

Summary

Fixes #912.

Incur returns undefined when a top-level --filter-output selector is absent. Its formatter then writes nothing, so a structured request can exit successfully with a zero-byte document.

This change keeps the executable output boundary responsible for document completeness: when a structured format (json, jsonl, or yaml) is combined with --filter-output and the command writes no output, REA emits the explicit empty projection {}\n. Unfiltered commands, text/TOON output, valid selections, and nested partial selections are unchanged.

Evidence

On current main:

node scripts/rea.mjs analyze-javascript-application tests/conformance/readiness/javascript-cli --format json --filter-output summary

exits 0 with zero stdout bytes. With this branch it exits 0 and emits {}\n, which parses as JSON.

Validation

  • Stable TypeScript 5.9.3 production build
  • Focused boundary suite: 2 files, 10 tests passed
  • Regression covers the reported missing top-level selector, nested missing selection, and a valid selection
  • Repository lint and module-boundary checks
  • Knip
  • Metadata and test-discovery checks
  • Generated package metadata, MCP/skill/product catalogs, completion ledger, documentation facts, and error schema
  • Targeted Oxfmt/Oxlint and git diff --check

The default TypeScript 7 build/package verification could not run in this execution environment because it requires /proc/self/exe, which is unavailable here. The equivalent production build completed with TypeScript 5.9.3; hosted CI remains the full package-level validation.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/914 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/cli-empty-filter-output` --- ### 📝 Commits (1) - [`b6ca0d8`](https://github.com/morluto/rea/commit/b6ca0d858182be4c3ce4d921291f4e896e23cf5e) fix(cli): emit empty structured filter projections ### 📊 Changes **4 files changed** (+126 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `scripts/rea.mjs` (+9 -1) 📝 `src/cliOutput.ts` (+39 -5) 📝 `tests/boundary/cli/cliOutput.test.ts` (+77 -0) 📝 `tests/boundary/cli/dispatcher.test.ts` (+1 -1) </details> ### 📄 Description ## Summary Fixes #912. Incur returns `undefined` when a top-level `--filter-output` selector is absent. Its formatter then writes nothing, so a structured request can exit successfully with a zero-byte document. This change keeps the executable output boundary responsible for document completeness: when a structured format (`json`, `jsonl`, or `yaml`) is combined with `--filter-output` and the command writes no output, REA emits the explicit empty projection `{}\n`. Unfiltered commands, text/TOON output, valid selections, and nested partial selections are unchanged. ## Evidence On current `main`: ```sh node scripts/rea.mjs analyze-javascript-application tests/conformance/readiness/javascript-cli --format json --filter-output summary ``` exits 0 with zero stdout bytes. With this branch it exits 0 and emits `{}\n`, which parses as JSON. ## Validation - Stable TypeScript 5.9.3 production build - Focused boundary suite: 2 files, 10 tests passed - Regression covers the reported missing top-level selector, nested missing selection, and a valid selection - Repository lint and module-boundary checks - Knip - Metadata and test-discovery checks - Generated package metadata, MCP/skill/product catalogs, completion ledger, documentation facts, and error schema - Targeted Oxfmt/Oxlint and `git diff --check` The default TypeScript 7 build/package verification could not run in this execution environment because it requires `/proc/self/exe`, which is unavailable here. The equivalent production build completed with TypeScript 5.9.3; hosted CI remains the full package-level validation. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-16 21:17:33 +00:00
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#2342
No description provided.