Complex event subscription code changes#496
Conversation
There was a problem hiding this comment.
Caution
Changes requested ❌
Reviewed everything up to ae1ea03 in 3 minutes and 46 seconds. Click for details.
- Reviewed
1354lines of code in14files - Skipped
2files when reviewing. - Skipped posting
8draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. sc-kpm/sc-ui/src/ui.h:10
- Draft comment:
Verify removal of the extern "C" block around the include. Ensure this change does not break C linkage for C++ builds. - Reason this comment was not posted:
Comment looked like it was already resolved.
2. sc-memory/sc-core/include/sc-container/sc_hash_table.h:1
- Draft comment:
Avoid embedding a hardcoded relative path. Use proper include directories instead of '../../../src/sc-store/sc-container/sc_hash_table.h'. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a symlink file, not a regular include statement. The comment seems to misunderstand that this is a filesystem symlink, not a C++ include directive. Build systems and include directories are for compile-time includes, while symlinks are filesystem-level constructs. The relative path here is appropriate for a symlink. Maybe there's a good reason to avoid symlinks altogether in the codebase? Maybe there's a better way to structure the includes? While there might be alternative approaches to code organization, symlinks are a valid and common solution, and using relative paths in symlinks is standard practice. The comment's suggestion to use include directories doesn't apply to symlinks. The comment should be deleted because it incorrectly treats a symlink as a C++ include directive and suggests an inapplicable solution.
3. sc-memory/sc-core/include/sc-core/sc_event_subscription.h:72
- Draft comment:
Add documentation for the new complex event subscription functions and their extra parameters to clarify their purpose and usage. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%This comment is purely informative, asking for documentation to be added. It doesn't suggest a specific change or improvement to the code itself, nor does it address any of the specific rules or guidelines provided.
4. sc-memory/sc-core/src/sc-store/sc_event_subscription.c:172
- Draft comment:
Revisit the logic for initializing complex event subscriptions. Setting events_list to null for complex subscriptions may be counterintuitive; please clarify or document the design rationale. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =50%<= threshold50%The comment is asking for clarification or documentation on the design rationale, which is not allowed by the rules. However, it does point out a potential issue with settingevents_listto null, which could be a valid concern. The comment could be rephrased to focus on confirming the intention behind settingevents_listto null, which is allowed.
5. sc-memory/sc-core/src/sc-store/sc_event_subscription.c:367
- Draft comment:
Ensure safe handling of the events_list during destruction; check for null before calling sc_list_destroy to prevent potential crashes. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The code already has proper guards in place - events_list is only set to non-null when is_complex_event_subscription is false, and the destroy call is only made when is_complex_event_subscription is true. This means events_list will always be null when the destroy is attempted, making the suggested check redundant. The comment appears to misunderstand the existing control flow. Could there be edge cases I'm missing where events_list could be non-null when is_complex_event_subscription is true? Should I double check the initialization logic? Looking at the initialization in sc_complex_event_subscription_new(), when is_complex_event_subscription is true, events_list is explicitly set to null_ptr. The logic is consistent. The comment should be deleted as it suggests adding redundant null checks when the code already has proper guards through its control flow.
6. sc-memory/sc-core/src/sc-store/sc_event_subscription.c:660
- Draft comment:
Remove extraneous inline comments (e.g., '// добавил параметр') before committing to production. - Reason this comment was not posted:
Marked as duplicate.
7. sc-memory/sc-core/src/sc-store/sc-event/sc_event_private.h:14
- Draft comment:
There's an extra trailing whitespace at the end of the include directive on line 14. Please remove the unnecessary spaces. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While the comment is technically correct about the whitespace, this is an extremely minor formatting issue. It doesn't affect functionality, readability, or maintainability in any meaningful way. Most IDEs can automatically handle trailing whitespace. This kind of nitpick violates the rule about not making obvious or unimportant comments. The whitespace could theoretically cause issues with some tools or scripts that are sensitive to trailing whitespace. Some coding standards are strict about whitespace. Even if there are tools sensitive to whitespace, this is the kind of issue that should be handled by automated formatting tools or pre-commit hooks, not manual code review comments. This comment should be deleted as it violates the rule about not making obvious or unimportant comments. Whitespace issues should be handled by automated tools.
8. sc-memory/sc-core/src/sc-store/sc-event/sc_event_queue.c:246
- Draft comment:
Typographical error: The comment contains 'зависисмость'. It should be corrected to 'зависимость'. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 30% vs. threshold = 50% While the comment is technically correct about the typo, it's a very minor issue in a non-English comment. The typo doesn't affect code functionality. The comment is about a changed line, but fixing typos in comments is not a critical code quality issue. However, clear communication is important, and fixing obvious typos helps with code maintenance. The typo is in a comment that appears to be temporary/internal discussion (starts with "Наверное плохо" meaning "Probably bad"), so it may not be worth fixing. The comment itself might be removed later. Even if the comment is temporary, maintaining clear communication standards is valuable, and fixing obvious typos takes minimal effort. Keep the comment but with low confidence, as it's a valid but very minor issue.
Workflow ID: wflow_F59hBEzLsS9y6Krf
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
| #define _sc_hash_table_h_ | ||
|
|
||
| #include <glib.h> | ||
| #include "/usr/include/glib-2.0/glib.h" |
There was a problem hiding this comment.
Avoid hardcoding the absolute GLib include path. Replace "/usr/include/glib-2.0/glib.h" with <glib.h> and configure include paths in the build system.
| #include "/usr/include/glib-2.0/glib.h" | |
| #include <glib.h> |
This comment was generated because it violated a code review rule: irule_Ah6kBzD0nPDBJTxk.
| sc_storage_end_new_process(); | ||
|
|
||
|
|
||
| sc_monitor_acquire_write(&event_subscription->monitor); |
There was a problem hiding this comment.
Review the locking protocol: the code acquires a write lock then later releases it and also calls release_read on the same monitor. Confirm that the read/write lock upgrade/downgrade is correctly handled.
| g_thread_pool_push(manager->thread_pool, event, null_ptr); | ||
| sc_monitor_release_write(&manager->pool_monitor); | ||
| if (event_subscription->is_complex_event_subscription){ | ||
| start_check_condition_to_activate_complex_event(event_subscription, |
There was a problem hiding this comment.
The coupling introduced by calling start_check_condition_to_activate_complex_event from within the event manager seems tight. Consider refactoring to separate concerns or clarify dependency.
| if (event_subscription == null_ptr) | ||
| return SC_RESULT_NO; | ||
|
|
||
| if (event_subscription->events_list != null_ptr) //????? type_error with != |
There was a problem hiding this comment.
Remove ambiguous inline comments (e.g., '????? type_error with !=') and ensure the comparison logic for events_list is clearly documented.
| if (event_subscription->events_list != null_ptr) //????? type_error with != | |
| if (event_subscription->events_list != null_ptr) |
| return null_ptr; | ||
| } | ||
|
|
||
| gpointer decrease_thread(sc_event_subscription* complex_event_subscription) { |
There was a problem hiding this comment.
Review the logic in decrease_thread: the condition and subsequent decrement appear inconsistent. Verify that the intended behavior for decrementing counter_of_activated_events is correctly implemented.
| } | ||
|
|
||
|
|
||
| sc_result start_check_condition_to_activate_complex_event(sc_event_subscription* complex_event_subscription, |
There was a problem hiding this comment.
Spawning and immediately joining threads in start_check_condition_to_activate_complex_event blocks the caller. Consider redesigning this logic for better asynchronous behavior.
Important
Add complex event subscription functionality and modify event emission to support complex events in
sc-machine.sc_complex_event_subscription_new()andsc_complex_event_subscription_with_user_new()insc_event_subscription.handsc_event_subscription.cto create complex event subscriptions.sc_event_subscription_is_complex()to check if an event subscription is complex.sc_event_subscription_add_complex_events_list()andsc_event_subscription_add_one_complex_event()to manage complex event lists._sc_event_emission_manager_add()insc_event_queue.cto handle complex events by callingstart_check_condition_to_activate_complex_event().sc_event_emit_impl()insc_event_subscription.cto support complex event handling.sc_hash_table.h,sc_monitor_private.h, andsc_mutex_private.hinsc-core/includeto their respective locations insc-store.extern "C"block inui.h.This description was created by
for ae1ea03. You can customize this summary. It will automatically update as commits are pushed.