[PR #1311] [CLOSED] fix(reference): report malformed UTF-8 before import parsing #2791

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1311
Author: @rudycelekli
Created: 10/9/2026
Status: ❌ Closed

Base: main ← Head: fix/reference-source-utf8-20261009


📝 Commits (1)

  • 5a08238 fix(reference): report malformed UTF-8 before import parsing

📊 Changes

3 files changed (+100 additions, -1 deletions)

View changed files

📝 docs/cli.md (+4 -0)
📝 src/domain/referenceSourceImportParsing.ts (+19 -1)
➕ tests/boundary/cli/referenceSourceUtf8.test.ts (+77 -0)

📄 Description

Problem

Reference-source import decoded malformed UTF-8 by replacing bytes with U+FFFD before parsing. That could invent an internal module relationship to an actual replacement-character filename and report the source as fully parsed.

Change

Use strict UTF-8 decoding for source import parsing. Retain the original file bytes' hash/size and a per-file UTF-8 diagnostic; malformed source contributes no invented dependency edges. Other valid files still import normally. A genuine U+FFFD character remains valid.

Verification

  • Frozen compiled public CLI regression failed before the fix for an invalid byte in a module name and an overlong UTF-8 sequence in a comment.
  • The isolated final checkout passed 33 tests across seven owner suites, including actual filesystem/compiled CLI, import recovery, dynamic/computed imports, TypeScript extensions and Dockerfile language selection.
  • Original byte hashes and sizes are preserved; valid replacement-character source/filename remains linked.
  • npm run check passed. No contracts or generated identities changed.
  • macOS filesystem/public CLI tested; Linux/Windows await hosted CI. The source importer never executes imported code. Hopper/Ghidra workflows were unaffected and not run.

AI assistance was used for investigation, implementation and verification.


🔄 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/1311 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/9/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/reference-source-utf8-20261009` --- ### 📝 Commits (1) - [`5a08238`](https://github.com/morluto/rea/commit/5a082386d0b6cb613ac1181d2f80e153bc28b850) fix(reference): report malformed UTF-8 before import parsing ### 📊 Changes **3 files changed** (+100 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `docs/cli.md` (+4 -0) 📝 `src/domain/referenceSourceImportParsing.ts` (+19 -1) ➕ `tests/boundary/cli/referenceSourceUtf8.test.ts` (+77 -0) </details> ### 📄 Description ## Problem Reference-source import decoded malformed UTF-8 by replacing bytes with U+FFFD before parsing. That could invent an internal module relationship to an actual replacement-character filename and report the source as fully parsed. ## Change Use strict UTF-8 decoding for source import parsing. Retain the original file bytes' hash/size and a per-file UTF-8 diagnostic; malformed source contributes no invented dependency edges. Other valid files still import normally. A genuine U+FFFD character remains valid. ## Verification - Frozen compiled public CLI regression failed before the fix for an invalid byte in a module name and an overlong UTF-8 sequence in a comment. - The isolated final checkout passed 33 tests across seven owner suites, including actual filesystem/compiled CLI, import recovery, dynamic/computed imports, TypeScript extensions and Dockerfile language selection. - Original byte hashes and sizes are preserved; valid replacement-character source/filename remains linked. - `npm run check` passed. No contracts or generated identities changed. - macOS filesystem/public CLI tested; Linux/Windows await hosted CI. The source importer never executes imported code. Hopper/Ghidra workflows were unaffected and not run. AI assistance was used for investigation, implementation and verification. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:18 +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#2791
No description provided.