mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #3326] [Other] strata_bench redactor: the user-name substitution runs before the folder substitutions, so reports keep /home/<user>/Strata instead of <strata> #1349
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1349
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Dmitry-B on GitHub (Oct 20, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/3326
Problem:
tools/strata_bench.pysorts its redactions by the length of the pattern, so a short user namewins over the longer path that contains it. On a machine whose user name is short, the repository folder
is never replaced with
<strata>: instead of<strata>/strata-x.jsonthe report gets/home/<user>/Strata/strata-x.json. The tool's own test for this fails on such machines.Environment: Strata
e88ee39d(0.2.0-beta), Ubuntu 26.04.1, Python 3.14.4. User namedgbox(5 chars),home
/home/dgbox, repository/home/dgbox/Strata, host namedgbox-ubuntu-server. No GPU involved.Reproduce:
Expected:
Actual:
The same call directly:
Why: in
redactor()(tools/strata_bench.py, ~line 90) the substitutions are collected and thensubs.sort(key=lambda p: -len(p[0].pattern))- ordered by the compiled pattern length, and the patternsof user and host names are wrapped in
(?<!\[\w-]) … (?![\w-])(+20 characters). The name pattern istherefore always longer than the folder pattern that contains that name (
len(name)+20againstlen(name)+13for/home/<name>/Strata), so<user>is substituted first and the<strata>and<home>patterns have nothing left to match. The genericpath_userregex then rewrites the path to/home/<user>/….Isolation of the condition: the same test passes when the repository is not under the home folder - in a
worktree at
/tmp/gold-check(git worktree add /tmp/gold-check e88ee39d, same commit, same venv):So the order is what matters, not the length of the user name: for any normal install (the repository
under the user's home) the folder substitutions are dead.
Reproduction status: reproduced locally in the working tree and in a clean worktree of
e88ee39d; theworktree at
/tmp/gold-checkis the control that isolates the condition. Consequence for publishedreports: reports written by the tool on such an install keep
/home/<user>/Strata/…where the formatexpects
<strata>/….@Niko1221 commented on GitHub (Oct 26, 2026):
Thanks, this is fixed by #3619, ported to 0.2.7. Closing with it.