Skip to content

List tables P001 couldn't prove in lintel check's human output - #7

Merged
Amsozzer1 merged 2 commits into
mainfrom
cli/unverified-tables
Oct 13, 2026
Merged

Amsozzer1 merged 2 commits into
mainfrom
cli/unverified-tables

Conversation

@Amsozzer1

@Amsozzer1 Amsozzer1 commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

lintel check already 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:

  -     public.notes P001 [unverified_no_rows]
        anon can query it, but it has no rows, so P001 can't prove whether RLS hides them. Add rows to seed.sql.

1 findings (1 error, 0 warn, 0 info) · 1 unverified
  • JSON output, diffs and the PR comment are unchanged.
  • The README limitations section shows the line.
  • Refactor so the browser playground can share the code (no behaviour change):
    • Wording used by more than one surface (object labels, level counts, the unverified explanation) moves to src/core/report-text.ts.
    • Splinter row normalization moves from sources/advisors.ts, which shells out to the Supabase CLI, into a pure sources/lints.ts.
  • New unit test in test/unit/human.test.ts. pnpm check:all passes.

🤖 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:

  • Show tables that P001 cannot verify because they have no rows in human-readable lint reports and include their count in the summary.

Enhancements:

  • Centralize shared report wording and move advisor lint normalization into reusable, I/O-free core code.

Documentation:

  • Document the human-readable output for tables that remain unverified because they have no rows.

Tests:

  • Add coverage for displaying unverified tables and their summary count.

Amsozzer1 and others added 2 commits October 13, 2026 17:47
`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>
@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The 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 reporting

flowchart 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]
Loading

File-Level Changes

Change Details Files
Expose P001 tables that cannot be verified because they have no rows in human-readable reports and include them in the summary.
  • Render each unverified relation with a stable P001 status and explanatory message.
  • Add the unverified count to the findings summary while preserving JSON, diff, and PR-comment behavior.
  • Document the human-output limitation and add coverage for the rendered line and count.
src/cli/format/human.ts
README.md
test/unit/human.test.ts
Centralize report wording so the CLI and browser playground can share consistent formatting text.
  • Move object labels and level-count formatting into the core report-text module.
  • Centralize the explanation for unverified probe reasons.
  • Re-export the object-label helper from the Markdown formatter for existing consumers.
src/core/report-text.ts
src/cli/format/human.ts
src/cli/format/markdown.ts
Move advisor lint row normalization into a pure, reusable source module.
  • Extract advisor lint types, replay denylist, row conversion, and finding normalization from the CLI-backed advisor source.
  • Keep Supabase CLI parsing focused on I/O and delegate row conversion to the shared normalizer.
src/core/sources/lints.ts
src/core/sources/advisors.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/cli/format/human.ts
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)}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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`.

Comment thread test/unit/human.test.ts
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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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.

@Amsozzer1
Amsozzer1 merged commit c89ceb4 into main Oct 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant