Skip to content

feat: Blog Groups - #27

Open
phedayat wants to merge 12 commits into
JulienTant:mainfrom
phedayat:feat-blog-groups
Open

phedayat wants to merge 12 commits into
JulienTant:mainfrom
phedayat:feat-blog-groups

Conversation

@phedayat

@phedayat phedayat commented Jul 26, 2026 •

Copy link
Copy Markdown

Summary

Adds support for blog groups, allowing users to quickly pull articles from many specific blogs at once. Good for organization as well.

Test plan

  • golangci-lint run passes
  • gotestsum -- ./... passes
  • Manually verified (if applicable)

Summary by CodeRabbit

  • New Features
    • Added optional groups when adding and tracking blogs.
    • Added group filtering to blog listings, scans, and article views.
    • Group matching is case-insensitive and requires an exact match.
    • Blog listings now display group information when available.
  • Bug Fixes
    • Group-filtered results include all matching blogs and articles, and no-match cases are clearly reported.

@coderabbitai

coderabbitai Bot commented Jul 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: d6e6727c-a741-489f-9b08-c83e54f3846b

📥 Commits

Reviewing files that changed from the base of the PR and between 5845685 and 0397288.

📒 Files selected for processing (1)
  • internal/storage/database.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Adds blog groups with database persistence, case-insensitive exact filtering, CLI flags, group-scoped scanning and article listing, migration support, unit tests, and end-to-end coverage.

Changes

Blog group support

Layer / File(s) Summary
Persist and query blog groups
internal/model/model.go, internal/storage/..., internal/storage/migrations/...
Adds Blog.Group, stores it in group_name, loads it from queries, and filters blogs and articles by exact case-insensitive group matches.
Propagate group filters through services
internal/controller/..., internal/scanner/...
Extends blog creation, article retrieval, and all-blog scanning with group arguments and adds corresponding tests.
Expose group-aware CLI commands
internal/cli/...
Adds group flags to blog creation, listing, scanning, and article commands, including group-aware empty-state messages and optional filter handling.
Verify grouped command behavior
e2e/e2e_test.go, e2e/expected/*
Covers grouped blog display, filtering, scanning, article listing, multiple matches, and prefix non-matches through end-to-end expected outputs.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant Controller
  participant Scanner
  participant Database
  CLI->>Controller: Add blog with group
  Controller->>Database: Persist group_name
  CLI->>Database: List blogs by group
  CLI->>Scanner: Scan all blogs by group
  Scanner->>Database: Load matching blogs
  Database-->>Scanner: Group-filtered blogs
  CLI->>Controller: List articles by group
  Controller->>Database: Query group-filtered articles
  Database-->>Controller: Matching articles
Loading

Merge Risk: ⚪ Minimal · up to 03972

No merge-blocking issue is established. Group workflows have storage, service, CLI, and end-to-end coverage, and rollback restores the prior schema constraints.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 03972

Group filtering does not appear to create a new access boundary or broaden which blogs can be read or scanned. The main design risk is that downgrading the database discards saved group assignments, even though blogs and articles remain.

Retained concerns

  • Low · reliability · inferred: Downgrading migration 000004 after groups have been assigned removes their persisted memberships. Reapplying the migration cannot reconstruct them, so group-scoped operations require reassignment after such a rollback.
Security review details

Security Blast Radius

  • inferred — The new selector controls which saved blogs and articles a local command processes. Group-scoped scanning can trigger network requests for selected blogs, but an unfiltered scan could already reach all saved blogs.

Security Findings and Attack Paths

  • inferred — No new boundary bypass was established in the inspected CLI-to-storage path: caller-supplied group values become bound equality parameters and do not replace existing article filters. This does not establish safety for unexamined runtime or external callers.

Trust Boundaries and Controls

  • observed — Storage parameterizes group values before querying SQLite. The inspected group checks provide selection, not an identity or permission check.

Resilience and Maintainability Implications

  • inferred — Group membership is mutable stored state, but scanner jobs hold a snapshot of each selected blog. The conditional stale-update behavior matters if another writer changes membership during a scan; its reachability through current CLI operations was not established.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely identifies the main change: adding blog group support.
Description check ✅ Passed The description includes the required Summary and Test plan sections. It explains the feature and reports that linting, tests, and manual verification passed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@phedayat phedayat changed the title Blog Groups feat: Blog Groups Jul 26, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/storage/database.go`:
- Around line 163-165: Update both group-name filters in
internal/storage/database.go at lines 163-165 and 395-397 to wrap the
LOWER(group_name) SQL predicates with Squirrel’s expression API, such as
sq.Expr, before passing them to query.Where; preserve the existing conditions
and bound group-name arguments.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d6b04e9f-72f3-49ee-a750-49ac0160a3f8

📥 Commits

Reviewing files that changed from the base of the PR and between 8d18c6e and 5845685.

📒 Files selected for processing (21)
  • e2e/e2e_test.go
  • e2e/expected/24_add_with_group.txt
  • e2e/expected/25_blogs_shows_group.txt
  • e2e/expected/26_blogs_filter_group.txt
  • e2e/expected/27_blogs_filter_group_no_match.txt
  • e2e/expected/28_scan_filter_group.txt
  • e2e/expected/29_scan_filter_group_no_match.txt
  • e2e/expected/30_articles_filter_group.txt
  • e2e/expected/31_blogs_filter_group_multi.txt
  • e2e/expected/32_blogs_filter_group_prefix_no_match.txt
  • internal/cli/commands.go
  • internal/cli/commands_test.go
  • internal/controller/controller.go
  • internal/controller/controller_test.go
  • internal/model/model.go
  • internal/scanner/scanner.go
  • internal/scanner/scanner_test.go
  • internal/storage/database.go
  • internal/storage/database_test.go
  • internal/storage/migrations/000004_add_blog_group.down.sql
  • internal/storage/migrations/000004_add_blog_group.up.sql

Comment thread internal/storage/database.go Resolved
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