Skip to content

fix(process): normalize descendants of slash-spelled directory roots - #7803

Merged
morluto merged 2 commits into
morluto:mainfrom
HawkForge:fix/observation-root-trailing-slash
Oct 29, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
HawkForge:fix/observation-root-trailing-slash

Conversation

@HawkForge

@HawkForge HawkForge commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #7584.

With normalization.paths: true, a selected observation directory spelled /dir/ or /dir/. left its descendants literal. /dir/item.txt stayed /dir/item.txt instead of becoming <filesystem-root-0>/item.txt, while the same directory selected as /dir normalized fine. A working directory spelled with a trailing slash had the same problem.

Problem and expected behavior

Smallest trigger: filesystem_observation_paths: ["/x/selected/"] and output P=/x/selected/item.txt.

createPathRule matches each selected path literally and then requires $, /, whitespace or a quote right after it. For /x/selected/ the match ends after the slash, the next character is i, so the lookahead fails and the descendant is left alone. /x/selected/. never occurs inside /x/selected/item.txt at all.

Expected: the spelling of a selected directory doesn't change which output text gets its alias.

Change and scope

  • ProcessNormalization.ts: a small directoryIdentity helper strips trailing / and /. from the working directory and each observation path before they become aliases. A bare / and relative . stay as they are. The executable path and temporary root aren't touched.
  • The comparison contract goes from path-component-boundaries-v2 to -v3 because normalized text changes for these spellings, same as c74bc21 did for v2. docs/process-capture.md mentions the new case.

Not included: resolving .., symlinks or relative paths against the working directory. Those aren't part of this report.

The follow-up also normalizes descendants of a selected filesystem root /, while leaving URL separators and HTML closing tags intact.

Contract and boundary impact

  • Semantic owner and earliest changed stage: createPathRule in src/process/capture/ProcessNormalization.ts, consumed by normalized frames, rendered frames and samples.
  • Contribution scope fit and linked maintainer decision: not applicable, ordinary fix within the existing boundary.
  • CLI and MCP/tool-catalog contract: no schema change. path_normalization_version in the comparison contract is now path-component-boundaries-v3.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: normalized text changes only for slash/dot-spelled directory roots. The version bump keeps old captures from being compared as if they used the same rules. Raw data is unchanged.
  • Target selection, authority, upstream behavior, and cleanup details: not applicable.
  • Generated metadata, package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process. (existing capture-process behavior; this only changes how its output is normalized)
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/process/capture/ProcessNormalization.test.ts: /selected/ and /other/. roots plus a /work/ working directory, with descendants and the bare slash spelling.
    • tests/boundary/process/processCaptureNormalization.test.ts: actual PTY capture with an observation root ending in /, and the existing contract assertion updated to v3.
  • Base reproduction or other evidence: executed. With the source change reverted, the new unit test fails (1 failed | 23 passed). With it, all pass.
  • User-visible CLI/MCP output: for the issue's slash case, frame data becomes P=<filesystem-root-0>/item.txt, same as the plain case.
  • Remaining proof gaps: the two Linux-only PID tests in the boundary file were skipped on macOS. They don't touch path rules.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • vitest run tests/boundary/process/processCaptureNormalization.test.ts src/process/capture/ProcessNormalization.test.ts src/domain/process — 140 passed, 2 skipped (Linux-only PID tests), macOS arm64

  • same unit test file with the source fix reverted — the new test fails

  • oxfmt --check src tests/boundary/process docs/process-capture.md — clean

  • oxlint on the 4 changed TS files — exit 0, only the existing no-control-regex warning at processScenario.ts:60

  • Follow-up: focused normalization and PTY boundary tests — 35 passed, 2 Linux-only tests skipped; npm run check:fast and git diff --check passed (macOS).

Compatibility, safety, and release

  • Breaking changes or migration steps: none for callers. Captures made with v2 can't be compared against v3 captures, so recapture both sides.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS PTY capture only.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none. Only alias matching changes.

Author readiness

Human owner: @HawkForge

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code

A working directory or observation path ending in / or /. kept its
trailing separator as the alias, so descendant paths never met the
delimiter lookahead and stayed literal. Strip those spellings before
building aliases and version the path normalization contract as v3.

Fixes #7584

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@greptile-apps

greptile-apps Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge; no blocking defect was established.

Summary

The PR normalizes descendants of directory roots spelled with a trailing / or /. and updates the comparison contract to path-component-boundaries-v3.

  • Selected directories match descendants even when their paths end in slashes or dots.
  • A selected filesystem root aliases paths without rewriting URLs or closing tags.

Reviews (2) · Last reviewed commit: "fix(process): normalize filesystem root ..." · Reviewed by Greptile

@HawkForge
HawkForge marked this pull request as ready for review October 28, 2026 14:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-28T14:01:33.440498Z
We couldn’t complete this review. Comment @codex review to try again.
62622ed Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto
morluto merged commit 64d282b into morluto:main Oct 29, 2026
43 checks passed
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Path normalization skips descendants when an observation root ends in a slash

2 participants