mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
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#4716
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?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/3619
Author: @ctr-137
Created: 10/21/2026
Status: ❌ Closed
Base:
main← Head:bench-redactor-order-3326📝 Commits (1)
26e0731Fix #3326: the report redaction replaces a folder before the short user name inside it (redactor sorts by the length of the text it replaces instead of the compiled pattern; the word wrappers add 19 characters, so a 5-character name outranked /home/dgbox/Strata and the report kept the folder layout instead of and , which also made the tool's own redaction test fail on such machines)📊 Changes
2 files changed (+29 additions, -5 deletions)
View changed files
📝
tools/strata_bench.py(+4 -4)📝
tools/test_strata_bench.py(+25 -1)📄 Description
Problem and result
tools/strata_bench.pywrites a report you can share, andredactor()is what makes it shareable: home folders, the Strata folder, user and host names, IP addresses and the API key become placeholders. The substitutions were applied in the order of the compiled pattern length. A user or host name is wrapped in word bounds ((?<![\w-])…(?![\w-]), 19 characters more), so a short name always looked longer than the folder that holds it: the name went first, and the<strata>and<home>patterns then had nothing left to match.Same input, before and after, measured with user
dgboxand repository/home/dgbox/Strata(forward slashes; the backslash forms were checked the same way):The name itself was still replaced in the old order, so nothing leaks the account name. What the report lost was the placeholders: on such a machine
<strata>and<home>never appeared, the install layout stayed in the text (/home/…/Strata/engine/…), and the tool's own redaction test failed. On Windows the same ordering costs the<home>placeholder (C:\Users\<user>\datainstead of<home>\data).Related discussion
Issue #3326 — it names the cause, the environment and the failing test. No scope agreement needed: one tool, no default changed, no other code reads this list.
Approach
subs.sort(key=lambda s: -s[2])— by the length of the text that is replaced, not of the pattern that matches it. A folder is always longer than the name inside it, so the container is now always replaced before its own name. Entries of the same length keep the order they were added in (folders come before names). Which values are collected, thelen >= 4floor,path_user, the IP ranges, the bearer and the key rules are untouched.Validation
Environment: Windows 11 Pro 10.0.26200, Python 3.14.7, no GPU. Branch from
mainat011c9e60; every check re-run at26e07312.Passed:
python -X utf8 tools/test_strata_bench.py->Ran 18 tests in 12.949s/OK— the 17 tests that were there plus the new one.python -X utf8 -m unittest tools.test_strata_bench.RedactionTests->Ran 4 tests/OK.test_a_folder_under_a_short_home_keeps_its_own_placeholder: it pins the reporter's machine inside the test by patching the valuesredactor()reads (ROOT/home/dgbox/Strata, home/home/dgbox, userdgbox, hostdgbox-ubuntu-server, tmp/tmp), so it measures the same thing on any PC, and it covers a Windows layout in the same test.python -X utf8 -m unittest tools.test_strata_bench.RedactionTests.test_paths_names_ips_and_keys->Ran 1 test/OK, both before and after the change. This is the reporter's own command, and it is green here in either case: the account name on this PC is one character andadd()skips anything shorter than four, so this machine never had the condition. The failing case is carried by the pinned layout above.python -X utf8 tools/test_bench_host.py5 testsOK,python -X utf8 tools/test_strata_mcp.py41 testsOK,python -X utf8 tests/terminal/test_issues_022.py31 testsOK./home/dgbox/Strata6/10 unchanged,/home/matthias/Strata6/10 unchanged,C:\Users\matthias\Strata8/10 unchanged. Every changed sample is a<home>or<strata>placeholder appearing where the text used to keep/home/<user>/Strata/…orC:\Users\<user>\…. Nothing else moved.Failed:
One failure, produced on purpose, as the regression proof: the new test run against the base file (
git show HEAD:tools/strata_bench.pyovertools/strata_bench.py,redactor()unchanged) ->Ran 1 test/FAILED (failures=1)withAssertionError: 'loading /home/<user>/Strata/strata-x.json' != 'loading <strata>/strata-x.json'— the message from #3326. Restoring the fixed file gives
OKagain, for that test and for the whole file. No other check failed, before or after.Not run:
ROOT,Path.home,getpass.getuser,socket.gethostname,platform.nodeandtempfile.gettempdir— they are not executed on Linux, and the reporter's Ubuntu 26.04.1 / Python 3.14.4 machine is not available here.tools/test_strata_bench.pyanswers from a fake HTTP server, and no GPU, model or download is involved..github/workflowsruns the node scripts, the title-area check and intake only — nothing there runs these Python tools tests.Limits
<strata>and<home>where it used to read/home/<user>/Strata/…. That is the point of the change, but it does change how new reports look on such machines; the measured counts are in Validation.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.