Clearly separate literals and patterns in the test DSL - #822
Conversation
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
🤖 Augment PR SummarySummary: This PR refines the internal CLI-test DSL by separating literal filters from regular-expression filters. Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
| # one out of a variable is what keeps the two forms from ever meeting, | ||
| # and so is what removes the escaping rule that would otherwise be | ||
| # needed to stop an expanded path from being read as more pattern | ||
| if VARIABLE.search(token): |
There was a problem hiding this comment.
compile_pattern is documented as receiving patterns verbatim, but VARIABLE.search also matches an escaped regex dollar. For example, REPLACE MATCHING '^\s*"\$schema":' ... is rejected as a variable reference, so regex filters cannot match common JSON Schema $-prefixed keywords (nor use $$).
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
1 issue found across 76 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="scripts/clitest.py">
<violation number="1" location="scripts/clitest.py:289">
P2: The existing help tests still pass `\\.exe` expecting regex removal. This literal branch leaves `jsonschema.exe` unchanged on Windows, so those tests fail; migrate those callers or preserve compatibility.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| self.expand(replacement, line_number).replace("\\", "\\\\"), content) | ||
| expanded = self.expand(replacement, line_number) | ||
| if expression is None: | ||
| content = content.replace( |
There was a problem hiding this comment.
P2: The existing help tests still pass \\.exe expecting regex removal. This literal branch leaves jsonschema.exe unchanged on Windows, so those tests fail; migrate those callers or preserve compatibility.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At scripts/clitest.py, line 289:
<comment>The existing help tests still pass `\\.exe` expecting regex removal. This literal branch leaves `jsonschema.exe` unchanged on Windows, so those tests fail; migrate those callers or preserve compatibility.</comment>
<file context>
@@ -256,33 +267,50 @@ def command_compare(self, operands, line_number):
- self.expand(replacement, line_number).replace("\\", "\\\\"), content)
+ expanded = self.expand(replacement, line_number)
+ if expression is None:
+ content = content.replace(
+ self.expand(operands[0], line_number), expanded)
else:
</file context>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Signed-off-by: Juan Cruz Viotti jv@jviotti.com