Skip to content

fix(api): exclude removed issues from module progress#362

Open
cavidelizade wants to merge 1 commit into
Devlaner:mainfrom
cavidelizade:fix/module-progress-softdeleted
Open

fix(api): exclude removed issues from module progress#362
cavidelizade wants to merge 1 commit into
Devlaner:mainfrom
cavidelizade:fix/module-progress-softdeleted

Conversation

@cavidelizade

@cavidelizade cavidelizade commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Module progress counted issues that had been removed from the module.

Linked issues

Closes #343

Type of change

  • Bug fix (fix:)

Surface

  • API (apps/api/)

What changed

ModuleStore.StateDistributionByProject is a raw SQL query, so GORM doesn't add the soft-delete scope automatically, and it was missing AND mi.deleted_at IS NULL. RemoveModuleIssue soft-deletes the link, so removed issues stayed in the progress totals. Added the filter, matching the cycle version which already has it.

Test plan

  • go build, go vet, go test ./... green
  • One-line WHERE change mirroring CycleStore.StateDistributionByProject

AI assistance

  • AI tools were used, tool(s): Claude Code (Opus 4.8), commits carry a Co-Authored-By: trailer

Summary by CodeRabbit

  • Bug Fixes
    • Excluded soft-deleted module issues from per-module issue counts.
    • Updated project state distributions to reflect only active module issues.

StateDistributionByProject is a raw query, so GORM doesn't inject the
soft-delete scope, and it was missing AND mi.deleted_at IS NULL. Issues removed
from a module (a soft delete on module_issues) still counted toward its progress
totals. The cycle equivalent already filters this; match it.

Closes Devlaner#343

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cavidelizade
cavidelizade requested a review from a team as a code owner July 16, 2026 21:00
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fd798871-1e9f-4e36-a4b6-a3e8ad8c411a

📥 Commits

Reviewing files that changed from the base of the PR and between 61bc903 and 9c488cd.

📒 Files selected for processing (1)
  • apps/api/internal/store/module.go

📝 Walkthrough

Walkthrough

The module state distribution query now excludes soft-deleted module_issues rows from aggregated counts.

Changes

Module issue count filtering

Layer / File(s) Summary
State distribution query filter
apps/api/internal/store/module.go
StateDistributionByProject now requires mi.deleted_at IS NULL, excluding removed module issue links from state-group counts.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

  • Devlaner/devlane#273: Updates related raw SQL counting logic for excluding soft-deleted module issues.

Suggested labels: API, improvement

Suggested reviewers: martian56

Poem

I’m a bunny with a query so bright,
Deleted links now hop out of sight.
Counts stay neat, progress stays true,
One tiny filter makes all this new.
Thump, thump! 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix to module progress counts.
Description check ✅ Passed The description covers the summary, linked issue, change details, surface, test plan, and AI disclosure.
Linked Issues check ✅ Passed The change matches #343 by adding the missing soft-delete filter to the raw module progress query.
Out of Scope Changes check ✅ Passed The PR appears narrowly scoped to the reported soft-delete bug and adds no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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.

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.

Module progress counts removed (soft-deleted) issue links

1 participant