fix: replace create_item_in_table placeholder with direct endpoint call (#30) #69
No reviewers
Labels
No Label
ai-changes-requested
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
in-next-release
status/in-progress
status/pr-open
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-v2#69
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/major-domo-v2#30"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
create_item_in_tableplaceholder method fromBaseService— it existed solely to POST to an arbitrarytable_namestring with a comment acknowledging it wasn't a real implementationCustomCommandsService.get_or_create_creatorwith a directclient.post("custom_commands/creators", creator_data)call, consistent with how_update_creator_statsand_update_creator_infoalready interact with the creators sub-endpointFiles Changed
services/base_service.py— removed 22-line placeholder method; note: project linter auto-reformatted the file (quote style, line length) as a side effect of the editservices/custom_commands_service.py— replaced 3-linecreate_item_in_tablecall with 2-line direct client POSTTest Results
926 passed, 1 skipped (6 pre-existing failures in
test_commands_profile_images.pyunrelated to this change)Other observations
get_items_from_table_with_paramsinbase_service.pyis a similar generic-table helper used exclusively bycustom_commands_service.pyfor creator reads. It could be refactored into a dedicated_get_creatorsmethod inCustomCommandsServicein a follow-up, but is out of scope for this issue.Remove the generic placeholder method from BaseService and replace the single call site in CustomCommandsService.get_or_create_creator with a direct client.post("custom_commands/creators", ...) call, consistent with how _update_creator_stats and _update_creator_info already work. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>AI Code Review
Files Reviewed
services/base_service.py(modified — removedcreate_item_in_table, linter reformatting)services/custom_commands_service.py(modified — replaced call site inget_or_create_creator)Findings
Correctness
create_item_in_tablemethod did exactly what the replacement does:client.post(table_name, item_data). The call site change is semantically equivalent.try/exceptwrapper thatcreate_item_in_tablehad (which caughtExceptionand returnedNone). Now exceptions fromclient.post()propagate directly. The caller already handlesNoneby raisingBotException, so any exception path still terminates with an exception — this is actually better because the original error details are preserved rather than being swallowed into aNonereturn."custom_commands/creators"endpoint string is consistent with the strings used in_update_creator_stats(line 747),_update_creator_info(line 761), andget_creator_by_discord_id(line 572).Security
creator_datais constructed from validated method parameters.Style & Conventions
self.get_client()+client.post()pattern withinCustomCommandsServiceis established throughout the class (seeget_command_by_name,execute_command,get_commands_by_creator,_update_creator_stats,_update_creator_info). The replacement is consistent with these peers.services/CLAUDE.mdanti-pattern ("reject any PR that callsawait service.get_client()outside of service layer") targets commands/tasks/views bypassing the service layer — not service internals callingself.get_client(). No violation here.Suggestions
get_items_from_table_with_paramsbeing a similar candidate for refactoring is accurate and appropriate to defer. No action needed now.Verdict: COMMENT
Clean removal of a placeholder. The implementation is correct, follows established patterns within
CustomCommandsService, and improves error transparency by letting API exceptions propagate with full context rather than silencing them into aNonereturn. No issues blocking merge.Automated review by Claude PR Reviewer