pingdotgg / pingdotgg/t3code

[Bug]: Git file paths lose leading and trailing spaces during decoding

Open Beginner friendly
#12,464 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

accepted bug via-triage
Dominant language
TypeScript
Stars
23k
Forks
5.9k
Avg merge
11h 14m
Merged PRs (30d)
357

Description

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

packages/contracts or packages/shared

Steps to reproduce

Git action inputs and working-tree status results trim whitespace from file paths. A path such as " leading.txt" becomes "leading.txt", which names a different file.

Both GitRunStackedActionInput.filePaths and VcsStatusLocalResult.workingTree.files[].path use a string schema that trims its input.

Related: issue #5501 reports a Files panel failure involving ProjectEntry.path; this report concerns the separate Git action and working-tree status schemas.

This is a schema-level reproduction; no filesystem setup is required.

  1. Decode this input with Schema.decodeUnknownSync(GitRunStackedActionInput):

    {
      "actionId": "action-1",
      "cwd": "/repo",
      "action": "commit",
      "filePaths": [" leading.txt", "trailing.txt "]
    }
    
  2. Inspect the decoded filePaths.

  3. The same transformation occurs when those paths are decoded in a valid VcsStatusLocalResult working-tree file list.

Expected behavior

File paths retain their exact characters. Empty paths remain invalid.

Actual behavior
Input:   [" leading.txt", "trailing.txt "]
Decoded: ["leading.txt", "trailing.txt"]

The decoded value identifies a different path when a filename has leading or trailing spaces. Such filenames are legal on macOS and Linux, so their working-tree status results can carry paths affected by this trimming. A complete staging or commit failure was not tested.

Impact

Minor bug or occasional failure

Version or commit

Upstream commit 9ea9c3d5d2c444133e3ddff40eecf38737951589.

Environment

Focused automated tests on Windows with Node 24.13.1 and Vitest 4.1.11. These tests decode strings; they do not create Windows files with trailing spaces.

Logs or stack traces

Both preservation assertions report:

AssertionError: expected [ 'leading.txt', 'trailing.txt' ] to deeply equal [ ' leading.txt', 'trailing.txt ' ]

Two preservation assertions fail against upstream: one for action inputs and one for status results. Two empty-path rejection assertions pass.

A local fix uses non-empty strings without trimming for these path fields. All four assertions pass with that fix.

Screenshots, recordings, or supporting files

None attached.

Workaround

No workaround was verified.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/contracts or packages/shared by locating GitRunStackedActionInput.filePaths and VcsStatusLocalResult. Check the focused automated tests that decode these schemas; done means leading and trailing spaces are preserved while empty paths remain invalid, with all four preservation and rejection assertions passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.