Skip to content

Commit 0735f93

Browse files
anandgupta42claude
andcommitted
feat: v0.2.0 — redesigned PR comments, inline reviews, interactive commands, 19 rules
PR Comment Redesign: - Compact summary table (SQL, dbt, Cost, PII in one view) - Collapsible severity-grouped issues (Critical > Error > Warning > Info) - ASCII DAG visualization for impact analysis - Cost before/after/delta per model - ~8 visible lines for clean PRs, ~12 for complex ones Inline Review Comments: - Critical issues always posted on diff lines - Warnings posted if <= 5 total - Capped at 10 per PR, batched as single review Interactive Commands: - `/altimate review` — full review or specific file - `/altimate impact` — DAG impact analysis - `/altimate cost` — cost estimation - `/altimate help` — command reference Rule Engine v2 (19 rules): - 5 new rules: function_on_indexed_column, not_in_with_nulls, distinct_masking_bad_join, count_for_existence, no_limit_on_delete - All rules now have fix suggestions - Rules categorized: correctness, performance, style, security 329 tests, 0 failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ceae42f commit 0735f93

22 files changed

+2507
-666
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.0] - 2026-03-24
9+
10+
### Added
11+
- **Redesigned PR comment format** — compact summary table, collapsible severity-grouped issues, ASCII DAG visualization
12+
- **Inline review comments** — critical issues posted directly on diff lines (configurable via `comment_mode: both`)
13+
- **Interactive commands**`@altimate review`, `@altimate impact`, `@altimate cost`, `@altimate help`
14+
- **5 new SQL rules**`function_on_indexed_column`, `not_in_with_nulls`, `distinct_masking_bad_join`, `count_for_existence`, `no_limit_on_delete`
15+
- **Rule categories** — rules grouped into correctness, performance, style, security
16+
- **Fix suggestions** — every rule now provides a concrete fix recommendation
17+
- **ASCII DAG diagrams** — impact analysis shows pipeline dependency tree
18+
- **Cost before/after** — cost section shows per-model before/after/delta
19+
20+
### Changed
21+
- PR comment is now ~8 lines for clean PRs (was ~15)
22+
- Issues grouped by severity with collapsible sections (was flat table)
23+
- Footer uses HTML links instead of markdown (more compact)
24+
25+
### Fixed
26+
- All issues from v0.1.0 UX audit addressed
27+
828
## [0.1.0] - 2026-03-24
929

1030
### Added

README.md

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ Altimate Code Actions brings production-grade SQL analysis, dbt impact assessmen
2727
| :deciduous_tree: | **dbt Impact Analysis** | Maps changed models to downstream dependencies, exposures, and tests in your dbt DAG |
2828
| :moneybag: | **Cost Estimation** | Estimates query cost deltas so you catch expensive changes before they hit production |
2929
| :shield: | **PII Detection** | Identifies personally identifiable information across 15 categories to prevent data leaks |
30+
| :speech_balloon: | **Inline Comments** | Critical issues posted directly on diff lines for faster triage |
31+
| :video_game: | **Interactive Commands** | `@altimate review`, `@altimate impact`, `@altimate cost`, `@altimate help` in PR comments |
3032

3133
## Quick Start
3234

@@ -82,40 +84,61 @@ That is it. Open a PR that touches `.sql` files and Altimate will post a review
8284

8385
## Example PR Comment
8486

85-
When Altimate reviews your pull request, it posts a structured comment like this:
87+
When Altimate reviews your pull request, it posts a compact, structured comment like this:
8688

8789
```
8890
## Altimate Code Review
8991
90-
### Summary
91-
Analyzed 3 SQL files | Found 5 issues | Impact score: 42/100
92+
| Files | Issues | Impact | Cost Delta |
93+
|-------|--------|--------|------------|
94+
| 3 | 5 | 42/100 | +$6.30/mo |
9295
93-
### Issues
96+
<details><summary>:red_circle: Errors (1)</summary>
9497
95-
| Severity | File | Line | Rule | Message |
96-
|----------|------|------|------|---------|
97-
| ERROR | models/staging/stg_orders.sql | 14 | no-select-star | Avoid SELECT * — enumerate columns explicitly |
98-
| WARNING | models/marts/fct_revenue.sql | 27 | missing-where | DELETE without WHERE clause affects all rows |
99-
| WARNING | models/marts/fct_revenue.sql | 53 | implicit-join | Use explicit JOIN syntax instead of comma joins |
100-
| INFO | models/staging/stg_users.sql | 8 | pii-detected | Column `email` may contain PII (email address) |
101-
| INFO | models/staging/stg_users.sql | 9 | pii-detected | Column `phone` may contain PII (phone number) |
98+
| File | Line | Rule | Message | Fix |
99+
|------|------|------|---------|-----|
100+
| stg_orders.sql | 14 | no-select-star | Avoid SELECT * | Enumerate columns explicitly |
102101
103-
### dbt Impact Analysis
104-
- **Modified models:** stg_orders, fct_revenue
105-
- **Downstream models:** dim_customers, rpt_daily_revenue (+3 more)
106-
- **Affected exposures:** Revenue Dashboard, Executive KPI Report
107-
- **Affected tests:** 7 tests cover modified or downstream models
108-
- **Impact score:** 42/100 (medium risk)
102+
</details>
103+
104+
<details><summary>:warning: Warnings (2)</summary>
105+
106+
| File | Line | Rule | Message | Fix |
107+
|------|------|------|---------|-----|
108+
| fct_revenue.sql | 27 | missing-where | DELETE without WHERE | Add a WHERE clause |
109+
| fct_revenue.sql | 53 | implicit-join | Comma join detected | Use explicit JOIN syntax |
110+
111+
</details>
112+
113+
<details><summary>:blue_circle: Info (2)</summary>
114+
115+
| File | Line | Rule | Message | Fix |
116+
|------|------|------|---------|-----|
117+
| stg_users.sql | 8 | pii-detected | Column `email` may contain PII | Mask or exclude from SELECT |
118+
| stg_users.sql | 9 | pii-detected | Column `phone` may contain PII | Mask or exclude from SELECT |
119+
120+
</details>
121+
122+
### Impact Analysis
123+
124+
stg_orders ─┬─ dim_customers
125+
└─ rpt_daily_revenue ─── Revenue Dashboard
126+
fct_revenue ─┬─ rpt_daily_revenue
127+
└─ Executive KPI Report
128+
129+
7 tests cover modified or downstream models
109130

110131
### Cost Estimation
132+
111133
| Model | Before | After | Delta |
112134
|-------|--------|-------|-------|
113135
| fct_revenue | $12.40/mo | $18.70/mo | +$6.30/mo |
114136

115-
---
116-
*Powered by [Altimate Code](https://github.com/AltimateAI/altimate-code-actions)*
137+
<sub><a href="https://github.com/AltimateAI/altimate-code-actions">Altimate Code</a> · <a href="https://github.com/AltimateAI/altimate-code-actions/blob/main/docs/configuration.md">Docs</a></sub>
117138
```
118139

140+
When `comment_mode: both` is configured, critical issues are also posted as inline review comments directly on the affected diff lines.
141+
119142
## Features
120143

121144
### Always-On (Static Analysis)
@@ -158,12 +181,25 @@ Enable with `pii_check: true`:
158181

159182
- Detects 15 PII categories: email, phone, SSN, credit card, IP address, date of birth, name, address, passport, driver license, national ID, bank account, health records, biometric data, geolocation
160183

184+
### Interactive Commands
185+
186+
When interactive mode is enabled, developers can trigger specific analyses by commenting on a PR:
187+
188+
| Command | Description |
189+
|---------|-------------|
190+
| `@altimate review` | Run full SQL quality review on the PR |
191+
| `@altimate impact` | Run dbt DAG impact analysis only |
192+
| `@altimate cost` | Run cost estimation only |
193+
| `@altimate help` | Show available commands and configuration |
194+
195+
Configure trigger phrases with the `mentions` input (default: `@altimate,/altimate,/oc`).
196+
161197
## What Altimate Adds Beyond dbt Cloud
162198

163199
| Feature | dbt Cloud CI | Altimate Code |
164200
|---------|-------------|---------------|
165201
| Slim CI (build changed models) | Yes | No (use dbt Cloud for this) |
166-
| SQL anti-pattern detection | No | Yes (14 rules) |
202+
| SQL anti-pattern detection | No | Yes (19 rules) |
167203
| Impact blast radius in PR | Limited | Yes (full DAG visualization) |
168204
| Query cost estimation | No | Yes (Snowflake, BigQuery) |
169205
| PII detection | No | Yes (15 categories) |

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ inputs:
3131
default: "full"
3232

3333
interactive:
34-
description: "Enable @altimate mentions for interactive review"
34+
description: "Enable @altimate mentions for interactive review. Supported commands: review, impact, cost, help"
3535
default: "true"
3636

3737
mentions:

docs/configuration.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Warehouse credentials are passed via environment variables, not action inputs. S
4040
|-------|------|---------|-------------|
4141
| `severity_threshold` | string | `warning` | Minimum severity to include in the review. Issues below this threshold are silently dropped. Values: `info`, `warning`, `error`, `critical`. |
4242
| `fail_on` | string | `none` | Fail the GitHub Actions step when issues at this severity or above are found. `none` means the step always succeeds. `error` fails on errors and criticals. `critical` fails only on criticals. |
43-
| `comment_mode` | string | `single` | How to post review feedback. `single` posts one summary comment on the PR. `inline` posts individual comments on changed lines. `both` does both. |
43+
| `comment_mode` | string | `single` | How to post review feedback. `single` posts one summary comment on the PR. `inline` posts individual comments on changed lines. `both` does both — a summary comment plus inline review comments on lines with critical issues. |
4444
| `max_files` | number | `50` | Maximum number of SQL files to analyze per PR. When the PR exceeds this limit, the most-changed files (by additions) are prioritized. |
4545

4646
### Interactive Mode
@@ -281,3 +281,110 @@ If you prefer not to receive a comment when there are no findings, set `suppress
281281
REDSHIFT_PASSWORD: ${{ secrets.REDSHIFT_PASSWORD }}
282282
REDSHIFT_DATABASE: analytics
283283
```
284+
285+
## Inline Review Comments
286+
287+
When `comment_mode` is set to `both`, the action posts:
288+
289+
1. **A summary comment** on the PR with the compact review table and collapsible issue groups.
290+
2. **Inline review comments** on the specific diff lines where critical issues were detected.
291+
292+
Inline comments appear directly in the "Files changed" tab, making it easier to address issues without jumping between the conversation and the diff.
293+
294+
```yaml
295+
- uses: AltimateAI/altimate-code-actions@v0
296+
with:
297+
comment_mode: both
298+
env:
299+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
300+
```
301+
302+
Only issues at `error` or `critical` severity are posted as inline comments. Lower-severity issues appear only in the summary comment.
303+
304+
## Interactive Commands
305+
306+
When `interactive: true` (the default), developers can trigger specific analyses by commenting on the PR. The action listens for trigger phrases configured via the `mentions` input.
307+
308+
### Available Commands
309+
310+
| Command | Description |
311+
|---------|-------------|
312+
| `@altimate review` | Run full SQL quality review on the current PR |
313+
| `@altimate impact` | Run dbt DAG impact analysis only |
314+
| `@altimate cost` | Run cost estimation only |
315+
| `@altimate help` | Reply with available commands and current configuration |
316+
317+
Commands are case-insensitive. The trigger phrase must appear at the start of the comment or on its own line.
318+
319+
### Workflow Setup
320+
321+
Interactive mode requires the `issue_comment` event trigger:
322+
323+
```yaml
324+
name: Altimate Interactive
325+
on:
326+
issue_comment:
327+
types: [created]
328+
329+
permissions:
330+
pull-requests: write
331+
contents: read
332+
333+
jobs:
334+
review:
335+
if: contains(github.event.comment.body, '@altimate')
336+
runs-on: ubuntu-latest
337+
steps:
338+
- uses: actions/checkout@v4
339+
- uses: AltimateAI/altimate-code-actions@v0
340+
with:
341+
interactive: true
342+
mentions: "@altimate,/altimate,/oc"
343+
mode: full
344+
model: anthropic/claude-haiku-4-5-20251001
345+
env:
346+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
347+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
348+
```
349+
350+
## SQL Rules Reference
351+
352+
Altimate Code Actions includes 19 built-in SQL rules organized by category:
353+
354+
### Correctness
355+
356+
| Rule | Description |
357+
|------|-------------|
358+
| `missing-where` | DELETE or UPDATE without a WHERE clause |
359+
| `not-in-with-nulls` | NOT IN with a subquery that may return NULLs (always evaluates to empty) |
360+
| `distinct-masking-bad-join` | DISTINCT used to mask a bad JOIN that produces duplicates |
361+
| `no-limit-on-delete` | DELETE without LIMIT on databases that support it |
362+
363+
### Performance
364+
365+
| Rule | Description |
366+
|------|-------------|
367+
| `no-select-star` | SELECT * instead of enumerating columns |
368+
| `function-on-indexed-column` | Function applied to an indexed column, preventing index use |
369+
| `count-for-existence` | COUNT(*) used where EXISTS would be more efficient |
370+
| `order-by-in-subquery` | ORDER BY inside a subquery with no LIMIT |
371+
| `cartesian-join` | JOIN without a join condition |
372+
373+
### Style
374+
375+
| Rule | Description |
376+
|------|-------------|
377+
| `implicit-join` | Comma-separated tables instead of explicit JOIN syntax |
378+
| `unused-cte` | CTE defined but never referenced |
379+
| `ambiguous-column` | Column reference that could resolve to multiple tables |
380+
| `duplicate-column-alias` | Conflicting column names in a SELECT list |
381+
| `union-vs-union-all` | UNION where UNION ALL would suffice |
382+
| `schema-qualification` | Unqualified table references |
383+
384+
### Security
385+
386+
| Rule | Description |
387+
|------|-------------|
388+
| `pii-detected` | Column name or literal matches a PII pattern |
389+
390+
Every rule provides a concrete **fix suggestion** in the review comment, so developers know exactly how to resolve each issue.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "altimate-code-actions",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

0 commit comments

Comments
 (0)