Conversation
| import goqulib "github.com/doug-martin/goqu/v9" | ||
|
|
||
| func GoquViolations() { | ||
| _ = goqulib.L("SELECT id, email FROM users WHERE active = true") |
There was a problem hiding this comment.
VG004: SELECT without LIMIT may return unbounded rows; add LIMIT or FETCH FIRST | Query: SELECT id, email FROM users WHERE active = true
|
|
||
| func GoquViolations() { | ||
| _ = goqulib.L("SELECT id, email FROM users WHERE active = true") | ||
| _ = goqulib.L("SELECT id FROM users WHERE email LIKE '%@example.com' LIMIT 1") |
There was a problem hiding this comment.
VG005: LIKE/ILIKE with leading wildcard may prevent index usage; use a suffix pattern or full-text search | Query: SELECT id FROM users WHERE email LIKE '%@example.com' LIMIT 1
| func GoquViolations() { | ||
| _ = goqulib.L("SELECT id, email FROM users WHERE active = true") | ||
| _ = goqulib.L("SELECT id FROM users WHERE email LIKE '%@example.com' LIMIT 1") | ||
| _ = goqulib.L("SELECT id FROM users FOR UPDATE") |
There was a problem hiding this comment.
VG004: SELECT without LIMIT may return unbounded rows; add LIMIT or FETCH FIRST | Query: SELECT id FROM users FOR UPDATE
| func GoquViolations() { | ||
| _ = goqulib.L("SELECT id, email FROM users WHERE active = true") | ||
| _ = goqulib.L("SELECT id FROM users WHERE email LIKE '%@example.com' LIMIT 1") | ||
| _ = goqulib.L("SELECT id FROM users FOR UPDATE") |
There was a problem hiding this comment.
🚫 [valk-guard] reported by reviewdog 🐶
VG006: SELECT FOR UPDATE without WHERE may lock too many rows; add a WHERE clause | Query: SELECT id FROM users FOR UPDATE
|
|
||
| func StdViolations(db *sql.DB) { | ||
| ctx := context.Background() | ||
| _, _ = db.QueryContext(ctx, "SELECT id, email FROM users WHERE active = true") |
There was a problem hiding this comment.
VG004: SELECT without LIMIT may return unbounded rows; add LIMIT or FETCH FIRST | Query: SELECT id, email FROM users WHERE active = true
|
|
||
|
|
||
| def raw_select_for_update_no_where(session: Session): | ||
| return session.execute(text("SELECT id FROM users FOR UPDATE")).all() |
There was a problem hiding this comment.
🚫 [valk-guard] reported by reviewdog 🐶
VG006: SELECT FOR UPDATE without WHERE may lock too many rows; add a WHERE clause | Query: SELECT id FROM users FOR UPDATE
| @@ -0,0 +1 @@ | |||
| SELECT id, email FROM users WHERE active = true; | |||
There was a problem hiding this comment.
VG004: SELECT without LIMIT may return unbounded rows; add LIMIT or FETCH FIRST | Query: SELECT id, email FROM users WHERE active = true
| @@ -0,0 +1 @@ | |||
| SELECT id FROM users WHERE email LIKE '%@example.com' LIMIT 1; | |||
There was a problem hiding this comment.
VG005: LIKE/ILIKE with leading wildcard may prevent index usage; use a suffix pattern or full-text search | Query: SELECT id FROM users WHERE email LIKE '%@example.com' LIMIT 1
| @@ -0,0 +1 @@ | |||
| SELECT id FROM users FOR UPDATE; | |||
There was a problem hiding this comment.
VG004: SELECT without LIMIT may return unbounded rows; add LIMIT or FETCH FIRST | Query: SELECT id FROM users FOR UPDATE
| @@ -0,0 +1 @@ | |||
| SELECT id FROM users FOR UPDATE; | |||
There was a problem hiding this comment.
🚫 [valk-guard] reported by reviewdog 🐶
VG006: SELECT FOR UPDATE without WHERE may lock too many rows; add a WHERE clause | Query: SELECT id FROM users FOR UPDATE
a668be7 to
d75b348
Compare
Purpose
This PR demonstrates selectivity/locking rules across SQL, Go
database/sql, Goqu, Python ORM, and Python non-ORM paths.Expected Findings In This PR
VG004(unbounded-select): expected because demo includes boundedness violations (selects without limit).VG005(like-leading-wildcard): expected because demo includesLIKE '%...'patterns.VG006(select-for-update-no-where): expected because demo includesFOR UPDATEwithoutWHERE.These findings are intentionally introduced to document behavior and reviewer UX.
Why We Previously Failed In CI
The failure was workflow-level (
Convert to reviewdog format) due to JSON-shape assumptions in jq, not rule misfires.This branch includes the jq shape-normalization fix and pins
VALK_GUARD_INSTALL_REFto the known-good build used in successful conversion.How ORM AST Crawl Works In This PR
Valk Guard parses Python AST query forms and emits SQL/synthetic SQL that then flows through the same parser + rule pipeline as SQL files and Go queries.
That unified pipeline is why VG004-VG006 show consistently across ORM and non-ORM examples.
What We Gain