refactor(store): wave B.15 — action_set repo (#273)#274
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughAdds a read-side ActionSetRepo: domain projections and interface, Postgres implementation, repo wiring in NewRepos, and migrates action-set read call sites across handlers and the search index from query-layer sqlc calls to the new repository methods. ChangesActionSetRepo Read-Side Repository
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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/api/assignment_handler.go`:
- Around line 340-343: The code in assignment_handler.go silently ignores errors
from h.store.Repos().ActionSet.Get (and the similar call around lines 356-359)
by using continue; change these branches to log the error before continuing:
capture the returned err from h.store.Repos().ActionSet.Get(ctx, id) and call
the appropriate logger (e.g., h.logger or h.store logger) with a clear message
including the action set id and err, then continue; do the same for the second
occurrence so partial failures are visible in logs while preserving the existing
control flow.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 15f5d63c-8faa-4764-83a0-0c63feb30536
📒 Files selected for processing (10)
internal/api/action_dispatch.gointernal/api/action_set_handler.gointernal/api/assignment_handler.gointernal/api/definition_handler.gointernal/api/user_selection_handler.gointernal/search/index.gointernal/store/action_set.gointernal/store/postgres/action_set.gointernal/store/postgres/wire.gointernal/store/repos.go
| set, err := h.store.Repos().ActionSet.Get(ctx, id) | ||
| if err != nil { | ||
| continue | ||
| } |
There was a problem hiding this comment.
Log enrichment failures before continuing.
Line 341 and Line 357 swallow repo errors with continue, which hides partial response failures.
🔧 Suggested fix
set, err := h.store.Repos().ActionSet.Get(ctx, id)
if err != nil {
+ logEnrichmentErr("ActionSet.Get", "action_set_id", id, err)
continue
}
@@
members, err := h.store.Repos().ActionSet.ListMembers(ctx, id)
if err != nil {
+ logEnrichmentErr("ActionSet.ListMembers", "action_set_id", id, err)
continue
}As per coding guidelines, "Never silently ignore errors."
Also applies to: 356-359
🤖 Prompt for 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.
In `@internal/api/assignment_handler.go` around lines 340 - 343, The code in
assignment_handler.go silently ignores errors from h.store.Repos().ActionSet.Get
(and the similar call around lines 356-359) by using continue; change these
branches to log the error before continuing: capture the returned err from
h.store.Repos().ActionSet.Get(ctx, id) and call the appropriate logger (e.g.,
h.logger or h.store logger) with a clear message including the action set id and
err, then continue; do the same for the second occurrence so partial failures
are visible in logs while preserving the existing control flow.
ActionSetRepo continues the action-chain migration started in #271: Get / List(filter) / Count(unassignedOnly) / ListMembers / ListInDefinition ActionSetMember rows are hydrated with action_name + action_type for display. Schedule stays as json.RawMessage at the boundary per the JSONB normalize plan. Call sites migrated (~20): - action_set_handler.go (full CRUD + actionSetToProto signature) - assignment_handler.go (source validation for ActionSet) - user_selection_handler.go (ActionSet source enrichment) - search/index.go (set reindex sweep + member-list enrichment + definition-set membership) Non-goals: - Definition / Execution / Assignment — subsequent sub-waves. - Write-side projector queries — stay on Queries() per pattern. Closes #273.
0af1f39 to
6dbf590
Compare
Summary
`ActionSetRepo` — read side of `action_sets_projection` + `action_set_members_projection`. Branches off main directly.
Methods
`Schedule` stays as `json.RawMessage` at the boundary.
Call sites migrated (~20)
Non-goals
Acceptance
Part of #242. Closes #273.
Summary by CodeRabbit