Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/persistence_postgres/src/entity_sql.rs

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Redundant byte gate in label validation

The is_ascii_alphanumeric() || byte == b'_' byte check in validate_entity_label/validate_project_label (entity_sql.rs) is fully subsumed by the stricter final clause requiring lowercase/digit/underscore. It cannot independently reject any input, which is why the new AUTHOR/ACTIVE cases are needed to exercise the last operand.

(Refers to this code)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Contradictory duplicated docstring on validate

The # Errors docstring pairs two overlapping sentences (entity_sql.rs and the analogous project_sql.rs): one claims an ASCII-letters allowlist, the next claims lowercase-only. The new tests confirm lowercase-only, so the first sentence is misleading. Pre-existing context, not changed here.

(Refers to this code)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ mod tests {
"author;role".into(),
"author\\".into(),
"author\nrole".into(),
// Uppercase bytes pass the alphanumeric gate yet fail the lowercase
// gate, so this exercises the final clause of the validation chain.
"AUTHOR".into(),
"a".repeat(129),
] {
assert_eq!(
Expand Down
3 changes: 3 additions & 0 deletions crates/persistence_postgres/src/project_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ mod tests {
"active;closed".into(),
"active\\".into(),
"active\nclosed".into(),
// Uppercase bytes pass the alphanumeric gate yet fail the lowercase
// gate, so this exercises the final clause of the validation chain.
"ACTIVE".into(),
"s".repeat(129),
] {
assert_eq!(
Expand Down
43 changes: 22 additions & 21 deletions tests/quality/test_check_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,32 +640,33 @@ def test_structural_comma_continuation_edge_cases(self) -> None:

with tempfile.TemporaryDirectory() as temporary:
source = Path(temporary) / "commas.rs"
# Lines 211->215 and 212->211: loop skips blank lines and non-matching
source.write_text(
"fn example() {\n"
" let value = foo(\n"
"\n"
" 1,\n"
" );\n"
"}\n",
encoding="utf-8",
)
# A comma-terminated line whose preceding lines are entirely blank
# exhausts the previous-line scan (arcs 211->215 and 212->211).
source.write_text("\n\nfoo,\n", encoding="utf-8")
self.assertTrue(
coverage_contract.is_executable_source_line(str(source), 2)
coverage_contract.is_executable_source_line(str(source), 3)
)

# Line 318->311: while loop with backslash at end of line inside string
source.write_text(
'fn path() {\n'
' let s = "a\\\n'
'b";\n'
"}\n",
encoding="utf-8",
)
self.assertTrue(
coverage_contract.is_executable_source_line(str(source), 2)
# A blank candidate between the comma line and its previous
# non-empty line is skipped by the same scan.
source.write_text("bar(\n\n baz,\n", encoding="utf-8")
self.assertFalse(
coverage_contract.is_executable_source_line(str(source), 3)
)

def test_multiline_string_scanner_covers_escaped_char_literals(self) -> None:
"""An escaped character inside a char literal keeps the scanner in loop.

The backslash inside a character literal must clear through the
escape-tracking branch so a following quote cannot close the literal
early; this exercises the scanner's escaped-character arc (318->311).
"""

lines = ["fn f() {", r" let newline = '\n';", "}"]
self.assertFalse(
coverage_contract._line_in_multiline_string(lines, 3)
)


if __name__ == "__main__": # pragma: no cover
unittest.main()
Loading