[PR #1291] [MERGED] fix(process): normalize ports that end a sentence #2771

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

📋 Pull Request Information

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

Base: main ← Head: fix/process-port-normalization-sentence-period


📝 Commits (3)

  • db98a51 fix(process): normalize ports that end a sentence
  • 184ed97 fix(process): keep ports before a chunk-final period
  • ad813e4 fix(process): treat non-ASCII letters as port continuations

📊 Changes

5 files changed (+42 additions, -6 deletions)

View changed files

📝 docs/process-capture.md (+5 -2)
📝 src/domain/process/processScenario.ts (+1 -1)
📝 src/process/capture/ProcessNormalization.test.ts (+28 -0)
📝 src/process/capture/ProcessNormalization.ts (+7 -2)
📝 tests/boundary/process/processCaptureNormalization.test.ts (+1 -1)

📄 Description

Summary

Process-capture port normalization (ports: true, the default) refused any port followed by a period. The explicit-field pattern ended in (?![\w.]) and the endpoint pattern in (?![\w.@:]). Common log lines kept their run-specific port in the normalized terminal text, so two equivalent runs that bind different ephemeral ports compared as changed:

"Listening on port: 8080."          -> unchanged on main
"Server at http://localhost:8080."  -> unchanged on main
"listen:8080."                      -> unchanged on main

The Codex review on #1263 flagged this (src/process/capture/ProcessNormalization.ts:57, "Normalize ports before sentence-ending periods"), and it was still present on main.

Change

  • Both lookaheads now accept a period that ends the token and still refuse a period followed by a word character: (?!\w|\.\w) and (?![\w@:]|\.\w). port: 80.5, localhost:8080.5 and localhost:8080.example.test stay unchanged.
  • The committed port_normalization_version goes from contextual-endpoints-v1 to contextual-endpoints-v2, because the same output now normalizes differently and older captures must not silently compare as the same contract.
  • docs/process-capture.md describes the sentence-ending period rule.

Not addressed here: the second Codex finding on #1263 (a label and its :port split across PTY chunks). That needs carry-over context and is a separate design change.

Verification

  • src/process/capture/ProcessNormalization.test.ts: a new case covers sentence-ending ports for explicit fields, URLs, IPv6 endpoints and a trailing newline, plus decimal and host continuations that must stay unchanged. It fails on main and passes here. The existing ambiguous-spelling and contextual cases are unchanged and pass.
  • npm run check:changed (517 passed, 3 platform-skipped), npm run docs:check
  • npm run test:focused -- tests/boundary/process/processCaptureNormalization.test.ts src/domain/process/processCapture.comparison.test.ts. The real-capture boundary case is Linux-only and skipped on this macOS host; CI runs it with the bumped version.

🤖 Generated with Claude Code


🔄 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/1291 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/process-port-normalization-sentence-period` --- ### 📝 Commits (3) - [`db98a51`](https://github.com/morluto/rea/commit/db98a51dd1750b09b3905e18efac526f7ebf90f7) fix(process): normalize ports that end a sentence - [`184ed97`](https://github.com/morluto/rea/commit/184ed970b9021552a5454ced20d202d10cabcbb8) fix(process): keep ports before a chunk-final period - [`ad813e4`](https://github.com/morluto/rea/commit/ad813e473b094ab0d3ab30798b7d252e2f4beb94) fix(process): treat non-ASCII letters as port continuations ### 📊 Changes **5 files changed** (+42 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/process-capture.md` (+5 -2) 📝 `src/domain/process/processScenario.ts` (+1 -1) 📝 `src/process/capture/ProcessNormalization.test.ts` (+28 -0) 📝 `src/process/capture/ProcessNormalization.ts` (+7 -2) 📝 `tests/boundary/process/processCaptureNormalization.test.ts` (+1 -1) </details> ### 📄 Description ## Summary Process-capture port normalization (`ports: true`, the default) refused any port followed by a period. The explicit-field pattern ended in `(?![\w.])` and the endpoint pattern in `(?![\w.@:])`. Common log lines kept their run-specific port in the normalized terminal text, so two equivalent runs that bind different ephemeral ports compared as changed: ``` "Listening on port: 8080." -> unchanged on main "Server at http://localhost:8080." -> unchanged on main "listen:8080." -> unchanged on main ``` The Codex review on #1263 flagged this (`src/process/capture/ProcessNormalization.ts:57`, "Normalize ports before sentence-ending periods"), and it was still present on `main`. ## Change - Both lookaheads now accept a period that ends the token and still refuse a period followed by a word character: `(?!\w|\.\w)` and `(?![\w@:]|\.\w)`. `port: 80.5`, `localhost:8080.5` and `localhost:8080.example.test` stay unchanged. - The committed `port_normalization_version` goes from `contextual-endpoints-v1` to `contextual-endpoints-v2`, because the same output now normalizes differently and older captures must not silently compare as the same contract. - `docs/process-capture.md` describes the sentence-ending period rule. Not addressed here: the second Codex finding on #1263 (a label and its `:port` split across PTY chunks). That needs carry-over context and is a separate design change. ## Verification - `src/process/capture/ProcessNormalization.test.ts`: a new case covers sentence-ending ports for explicit fields, URLs, IPv6 endpoints and a trailing newline, plus decimal and host continuations that must stay unchanged. It fails on `main` and passes here. The existing ambiguous-spelling and contextual cases are unchanged and pass. - `npm run check:changed` (517 passed, 3 platform-skipped), `npm run docs:check` - `npm run test:focused -- tests/boundary/process/processCaptureNormalization.test.ts src/domain/process/processCapture.comparison.test.ts`. The real-capture boundary case is Linux-only and skipped on this macOS host; CI runs it with the bumped version. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:03 +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#2771
No description provided.