Skip to content

BUILD-1129: scrub dashboard checkout paths containing spaces - #4010

Open
Hanioe2 wants to merge 4 commits into
ItsNotRexed:mainfrom
Hanioe2:fix/dashboard-checkout-spaces
Open

Hanioe2 wants to merge 4 commits into
ItsNotRexed:mainfrom
Hanioe2:fix/dashboard-checkout-spaces

Conversation

@Hanioe2

@Hanioe2 Hanioe2 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

BUILD-1129 was claimed in #3918. Thanks to @Chezzizoo for the report.

Change

The progress dashboard now matches the known checkout prefix before scanning for generic absolute paths. A path inside a checkout whose directory contains spaces keeps its repository-relative form. The existing containment check still decides whether a match can be shown.

Validation

  • On Windows with CPython 3.14.7, the new regression failed on aa2988cc and passed with the fix. It covers quoted and unquoted paths, mixed Windows case and slash styles, and the checkout directory itself.
  • python -I tests/test_progress_dashboard.py passed all 27 tests both in a regular worktree and in a worktree whose real path contains spaces.
  • py_compile and git diff --check passed. The tests use synthetic inputs.

AI-assisted.

Coordination

The updated #4522 combines these checkout cases with broader path handling. Its current head passed all six checkout-prefix comparisons against this PR on Windows. The review records one remaining quoted-path case and proposes a single merge through #4522 once addressed. Combined review

@evilclanker9000

Copy link
Copy Markdown
Contributor

Second check on Windows with Python 3.12 at 5754abc. All 27 dashboard tests passed. In a separate synthetic checkout, the parent missed all four expected rewrites when the root contained spaces. This head passed the unquoted, quoted, mixed-case/slash, and checkout-root-only cases. Both revisions produced the same expected results for the plain checkout, the relative path, and the outside path.

AI-assisted.

@shdann

shdann commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Tested 5754abc on Windows, CPython 3.14.7, CPU only (no GPU, no game files).

python -m pytest -q tests/test_progress_dashboard.py::Scrub gives 4 tests passed. I used a virtual environment with tests/requirements.txt. With the tool from the merge base (aa2988c), one test fails.

One case stays. A checkout path with a space is still partly visible when plain text follows it.

Run this script from the repository root:

import sys, tempfile
from pathlib import Path
from unittest.mock import patch
sys.path.insert(0, "tools")
import progress_dashboard as pd
with tempfile.TemporaryDirectory() as d:
    root = Path(d) / "Test Checkout"
    root.mkdir()
    with patch.object(pd, "ROOT", str(root)):
        print(pd.scrub(f"Checkout {root} is ready"))

Actual result: Checkout <path> Checkout is ready. The word Checkout from the folder name stays in the text.
Expected result: Checkout . is ready.

The merge base gives the same result. A path in quotation marks gives the correct result at this head.
The new pattern accepts a quotation mark or the end of the line after the checkout root. Possible correction: also accept a word separator after the full root.

AI-assisted.

@Hanioe2

Hanioe2 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up at 9b04ba4c covers the sibling-directory case suggested by @ray3242 in #4003. The matcher consumes the full path and runs the containment check before deciding how to display it. The regression requires complete redaction of the external path, including the filename.

The new assertion failed on 5754abc1 and passed on 9b04ba4c. All 27 dashboard tests passed on Windows in both worktrees, including the one with spaces in its actual path. py_compile and git diff --check passed.

AI-assisted.

@ray3242

ray3242 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Re-checked 9b04ba4c on Linux with CPython 3.12.16, after the sibling-folder case went in: pass. python -I tests/test_progress_dashboard.py passes 27/27. With main's tools/progress_dashboard.py swapped in, test_checkout_path_with_spaces_becomes_relative fails, so the test pins the fix. Thanks for taking the case over from #4003.

AI-assisted.

@Hanioe2

Hanioe2 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @shdann. I reproduced the unquoted checkout directory followed by prose on 9b04ba4c and fixed it in de164539. The new assertion expects Checkout . is ready, and the sibling-directory redaction assertion still passes.

All 27 dashboard tests passed on Windows in both the normal worktree and a worktree whose actual path contains spaces. py_compile and git diff --check passed. Thanks @Vonsek and @ray3242 for the independent Windows and Linux checks.

AI-assisted.

@kapitche

Copy link
Copy Markdown
Contributor

Tested de16453 merged with main d974c88 on Linux (WSL2) Python 3.12.16 and native Windows Python 3.13.1: pass

tests/test_progress_dashboard.py: 27 tests OK on both OSes.
Negative control: with tools/progress_dashboard.py from main, test_checkout_path_with_spaces_becomes_relative fails on both (Linux: 'Error: with spaces [1] line 3'; Windows: 'Error: with spaces [1]\tools\text_tables.py line 3').
No issues found in the diff.

@Hanioe2

Hanioe2 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

66bbad15 covers the same-prefix sibling from the #4522 comparison. For a checkout named Checkout with spaces, an error path under Checkout with spaces backup now becomes <path> including its filename. A file inside the checkout still becomes repo-relative, and a bare checkout followed by ordinary prose remains . plus the prose.

Scope: the extension applies to paths starting with the known checkout prefix. An immediately adjacent, unquoted relative path token can look like the end of a sibling name, so that ambiguous form is redacted together. A connector such as at keeps a following repo-relative path visible.

Windows 11 / Python 3.14.7: 27/27 dashboard tests passed. The new case leaks the synthetic basename on de164539. I also passed a synthetic JUnit failure through the CLI and checked that both the generated HTML and snapshot JSON redact it. Five POSIX path cases passed with posixpath on this machine. The branch merges cleanly with main 3faac557.

AI-assisted.

@S1m0ne1997

Copy link
Copy Markdown
Contributor

Reviewed and tested 66bbad15 on Windows 11 (CPython 3.12): pass.

  • python -I tests/test_progress_dashboard.py: 27 OK, on the PR head and on the head merged with current main 3faac557 (it merges cleanly; the base is ~930 commits behind).

  • The new test runs its os.name == "nt" branch here (mixed case and / separators).

  • A few extra lines with ROOT = C:\Users\Some One\My Repo, i.e. spaces in two folder names:

    • Error: <root>\tools\a.py line 3 → Error: tools/a.py line 3;
    • see <root>x\a.py (a sibling folder) → see <path>;
    • <root> and C:\other\b.py → . and <path>;
    • in '<root>\x y\z.py' → in 'x y\z.py'.

    So a space inside the repo-relative part is kept too, and nothing outside the checkout leaks.

  • Code read: the checkout prefix is tried first in one combined re.sub, so the drive/POSIX patterns can't cut it at the first space. shown() still does the containment check, and the sibling rule (checkout + suffix + \s+ + a word that has a separator) is what keeps <root> backup\... out.

AI-assisted (Claude Code).

@tedin7

tedin7 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed 66bbad1 (CPU, Linux, Python 3.13): 1 issue

  • Base: PR head merged onto origin/main 3faac55 (all merged cleanly), RunPod, CPU only, Linux, Python 3.13.18, python -I per test file. Negative control: the PR test files run against main's code.
  • python -I tests/test_progress_dashboard.py: 27 tests OK on the PR. With main's code and the PR test file: 27 run, 1 failure (the new checkout-with-spaces test). The test guards the fix.
  • Issue, tools/progress_dashboard.py:129: sibling_suffix follows the checkout path by only one word before a separator. A sibling folder whose name adds two words still leaks its file name. Probe with ROOT = <tmp>/Check out (and also <tmp>/Repo): Error: <ROOT> backup old/SENT.fssm line 3 gives Error: . backup old/SENT.fssm line 3. The one-word case (<ROOT> copy/SENT.fssm) is hidden correctly. The tests cover only the one-word case. A name like Leonida - Copy is the same shape (- and Copy are two words).
  • Note, not a defect: with no space in the checkout name, cwd <ROOT> docs/b.md now gives cwd <path>, where main gives cwd . docs/b.md. The author documents this as the ambiguous adjacent-path case. It hides more, never less.
  • Already known (comments on this head): none of the above was reported yet. The 4522 PR covers external paths with spaces, which this PR does not.

No game files.
AI-assisted (Claude Code).

@leozinhoszg

Copy link
Copy Markdown
Contributor

Tested on Windows with a checkout path that has spaces in it. This PR fixes the paths inside the checkout. Four leaks from main remain for paths outside it, and #4522 fixes those too (details below).

Windows 11 Pro (26200), CPython 3.14.7, python -I. Each tree was checked out at ...\My Work\Leonida <name>, so the repository root and its parent folder both have a space in the name. Besides tests/test_progress_dashboard.py, I ran 14 extra scrub() inputs. A case counts as wrong when a file or folder name from outside the repository survives, or when an expected exact output differs.

Tree test_progress_dashboard.py Extra scrub() cases wrong
main 3faac557b1 FAILED (1): test_paths_inside_the_repository_become_relative 11 of 14
#4010 head 66bbad1598, and merged onto main OK (27) 4 of 14
#4522 head 9fcbbe29c0, and merged onto main OK (29) 0 of 14

Inputs (the same on every tree) and what each tree printed:

Input main #4010 #4522
<root>\tools\a.py:3 <path> Work\Leonida main\tools\a.py:3 tools/a.py:3 tools/a.py:3
<root> (forward slashes) /docs/x.md leaks docs/x.md docs/x.md
cwd <root> leaks cwd . cwd .
"<root>\tools\c.py" leaks "tools/c.py" "tools/c.py"
<root>\tools\a.py failed in tests leaks tools/a.py failed in tests same
<root>\..\secret\f1.fssm leaks <path> <path>
<parent>\other dir\f2.fssm <path> Work\other dir\f2.fssm <path> Work\other dir\f2.fssm <path>
<root>X\f3.fssm leaks <path> <path>
FAIL: D:\My Work\shaders\f4.fssm line 3 FAIL: <path> Work\shaders\f4.fssm line 3 same as main FAIL: <path> line 3
open /home/a b/work/f5.fssm: no such file open <path> b/work/f5.fssm: ... same as main open <path> no such file
x D:\w\f6.fssm: see docs/design.md x <path> see docs/design.md same same
C:\work\f7.fssm, C:\f8.fssm <path> <path> same same
D:\Users\O'Connor\My Work\f9.fssm <path>'Connor\My Work\f9.fssm same as main <path>
see https://github.com/ItsNotRexed/Leonida/issues/1 unchanged unchanged unchanged

The four cases #4010 still gets wrong are the same on main: a path outside the checkout whose folder has a space (or an apostrophe) keeps everything after the space, file name included. A work folder like D:\My Work\... is the case where that file name can be a carved shader's.

#4010, #4522 and #4295 (UNC paths) conflict with each other, two at a time, in tools/progress_dashboard.py (and, for #4010+#4522 and #4522+#4295, also in tests/test_progress_dashboard.py), so only one of #4010 / #4522 can land and #4295 needs a rebase after it.

AI-assisted (Claude Code). I read the diffs and ran the tests myself on the machine above.

ItsNotRexed added a commit that referenced this pull request Nov 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants