Repository navigation
List tables P001 couldn't prove in lintel check's human output - #7
Conversation
`lintel check` recorded empty exposed tables in the JSON report (probes.unverified) but never printed them. The human report now lists each one as `P001 [unverified_no_rows]` with a one-line reason, and the summary counts them. Wording shared with the playground (object labels, level counts, the unverified explanation) moves to src/core/report-text.ts, and splinter row normalization moves from sources/advisors.ts (which runs the Supabase CLI) to a pure sources/lints.ts, so a browser engine can use it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Reviewer's GuideThe PR adds human-readable reporting for P001 probe results that remain unverified on empty tables, including explanatory lines and summary counts, while preserving machine-readable and diff/comment outputs. It also extracts shared report text and pure advisor-lint normalization into core modules so the CLI and browser playground can reuse the same behavior. Flow diagram for unverified P001 human reportingflowchart TD
A[Report with probes.unverified] --> B{Unverified entries?}
B -- No --> C[Render findings and level counts]
B -- Yes --> D[unverifiedLine]
D --> E[unverifiedExplanation]
E --> F[Render unverified table lines]
F --> G[levelCounts]
G --> H[Append unverified summary count]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/cli/format/human.ts" line_range="18" />
<code_context>
- return `${by("error")} error, ${by("warn")} warn, ${by("info")} info`;
+/** An exposed relation P001 couldn't prove either way, e.g. an empty table. */
+function unverifiedLine(u: { schema: string; name: string; reason: string }): string {
+ return ` ${pc.dim("-".padEnd(5))} ${pc.bold(`${u.schema}.${u.name}`)} ${pc.dim("P001")}${pc.dim(" [unverified_no_rows]")}\n ${unverifiedExplanation(u.reason)}`;
}
</code_context>
<issue_to_address>
**Identifiers manipulate terminal output**
When a database-controlled schema or relation name contains terminal control characters and an operator runs the check in a terminal, `unverifiedLine` passes the names directly to `pc.bold`, which does not escape them, so the terminal interprets control sequences and the operator sees a spoofed or disrupted report.
Escape or sanitize schema and relation names before formatting them for terminal output.
Also at `src/cli/format/human.ts:19`.
</issue_to_address>
### Comment 2
<location path="test/unit/human.test.ts" line_range="14" />
<code_context>
+ r.probes.unverified = [{ schema: "public", name: "notes", reason: "no rows to probe" }];
+ const out = plain(renderReportHuman(r));
+ expect(out).toContain(
+ " - public.notes P001 [unverified_no_rows]\n anon can query it",
+ );
+ expect(out.trimEnd().split("\n").at(-1)).toBe(
</code_context>
<issue_to_address>
**Truncated explanation still passes**
When the rendered explanation is truncated after `anon can query it`, the `lists tables P001 couldn't prove for lack of rows` test's `toContain` assertion checks only the explanation prefix, so the output can omit why P001 could not prove the table is safe and what to do next while the test still passes.
Assert the complete expected unverified line, including the no-rows reason and seed instruction.
</issue_to_address>| return `${by("error")} error, ${by("warn")} warn, ${by("info")} info`; | ||
| /** An exposed relation P001 couldn't prove either way, e.g. an empty table. */ | ||
| function unverifiedLine(u: { schema: string; name: string; reason: string }): string { | ||
| return ` ${pc.dim("-".padEnd(5))} ${pc.bold(`${u.schema}.${u.name}`)} ${pc.dim("P001")}${pc.dim(" [unverified_no_rows]")}\n ${unverifiedExplanation(u.reason)}`; |
There was a problem hiding this comment.
🟡 Medium · Identifiers manipulate terminal output
When a database-controlled schema or relation name contains terminal control characters and an operator runs the check in a terminal, unverifiedLine passes the names directly to pc.bold, which does not escape them, so the terminal interprets control sequences and the operator sees a spoofed or disrupted report.
Escape or sanitize schema and relation names before formatting them for terminal output.
Also at src/cli/format/human.ts:19.
Prompt for AI agents
In `src/cli/format/human.ts` at line 18:
**Identifiers manipulate terminal output**
When a database-controlled schema or relation name contains terminal control characters and an operator runs the check in a terminal, `unverifiedLine` passes the names directly to `pc.bold`, which does not escape them, so the terminal interprets control sequences and the operator sees a spoofed or disrupted report.
Escape or sanitize schema and relation names before formatting them for terminal output.
Also at `src/cli/format/human.ts:19`.| r.probes.unverified = [{ schema: "public", name: "notes", reason: "no rows to probe" }]; | ||
| const out = plain(renderReportHuman(r)); | ||
| expect(out).toContain( | ||
| " - public.notes P001 [unverified_no_rows]\n anon can query it", |
There was a problem hiding this comment.
🟡 Medium · Truncated explanation still passes
When the rendered explanation is truncated after anon can query it, the lists tables P001 couldn't prove for lack of rows test's toContain assertion checks only the explanation prefix, so the output can omit why P001 could not prove the table is safe and what to do next while the test still passes.
Assert the complete expected unverified line, including the no-rows reason and seed instruction.
Prompt for AI agents
In `test/unit/human.test.ts` at line 14:
**Truncated explanation still passes**
When the rendered explanation is truncated after `anon can query it`, the `lists tables P001 couldn't prove for lack of rows` test's `toContain` assertion checks only the explanation prefix, so the output can omit why P001 could not prove the table is safe and what to do next while the test still passes.
Assert the complete expected unverified line, including the no-rows reason and seed instruction.
lintel checkalready recorded exposed tables it couldn't prove either way in the JSON report (probes.unverified, "no rows to probe"), but the human output never showed them. An empty, readable table looked the same as a safe one.Now each one gets a line, and the summary counts them:
src/core/report-text.ts.sources/advisors.ts, which shells out to the Supabase CLI, into a puresources/lints.ts.test/unit/human.test.ts.pnpm check:allpasses.🤖 Generated with Claude Code
Summary by Sourcery
Expose unverified empty tables in human-readable lint output while keeping machine-readable and diff outputs unchanged.
New Features:
Enhancements:
Documentation:
Tests: