Conversation
📝 WalkthroughWalkthroughAdded a SQL predicate to exclude devices with Changes
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/scan/session_events.py (1)
182-182: Consider centralizing the forced-online predicate.The same
LOWER(COALESCE(devForceStatus, '')) != 'online'fragment now lives in three separate INSERTs. Pulling it into one shared SQL snippet/constant would make future event-path edits less likely to miss one branch.Also applies to: 198-198, 234-234
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d5e187b7-ddb2-4ca5-9d04-00bdbd4ae227
📒 Files selected for processing (3)
server/scan/session_events.pytest/db_test_helpers.pytest/scan/test_down_sleep_events.py
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@front/plugins/fritzbox/fritzbox.py`:
- Around line 177-178: The current fallback uses raw truthiness of fritzbox_mac
which allows values like whitespace or an invalid MAC to slip through; update
the guest_mac creation by first calling normalize_mac(fritzbox_mac) (or '' if
fritzbox_mac is None), then check the normalized result (e.g., truthy after
strip) and only use it if valid, otherwise use the sentinel 'FRITZBOX_GUEST' as
the seed passed into string_to_fake_mac; modify the code around fritzbox_mac and
guest_mac so string_to_fake_mac receives either the normalized MAC or the
sentinel, not the original raw value.
🪄 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: a78d2bbc-192a-4d8e-9ac5-b5a74fab0eb8
📒 Files selected for processing (2)
front/plugins/fritzbox/fritzbox.pytest/plugins/test_fritzbox.py
| fritzbox_mac = fc.call_action('DeviceInfo:1', 'GetInfo').get('NewMACAddress', '') | ||
| guest_mac = string_to_fake_mac(normalize_mac(fritzbox_mac) if fritzbox_mac else host) | ||
| guest_mac = string_to_fake_mac(normalize_mac(fritzbox_mac) if fritzbox_mac else 'FRITZBOX_GUEST') |
There was a problem hiding this comment.
Harden fallback when MAC is present-but-invalid/blank.
At Line 178, fallback only checks raw truthiness. Values like whitespace can normalize to an empty string and produce a hash seed of "" instead of the sentinel fallback.
Proposed fix
- fritzbox_mac = fc.call_action('DeviceInfo:1', 'GetInfo').get('NewMACAddress', '')
- guest_mac = string_to_fake_mac(normalize_mac(fritzbox_mac) if fritzbox_mac else 'FRITZBOX_GUEST')
+ fritzbox_mac = fc.call_action('DeviceInfo:1', 'GetInfo').get('NewMACAddress', '')
+ normalized_mac = normalize_mac(fritzbox_mac) if fritzbox_mac else ''
+ guest_mac = string_to_fake_mac(normalized_mac if normalized_mac else 'FRITZBOX_GUEST')🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@front/plugins/fritzbox/fritzbox.py` around lines 177 - 178, The current
fallback uses raw truthiness of fritzbox_mac which allows values like whitespace
or an invalid MAC to slip through; update the guest_mac creation by first
calling normalize_mac(fritzbox_mac) (or '' if fritzbox_mac is None), then check
the normalized result (e.g., truthy after strip) and only use it if valid,
otherwise use the sentinel 'FRITZBOX_GUEST' as the seed passed into
string_to_fake_mac; modify the code around fritzbox_mac and guest_mac so
string_to_fake_mac receives either the normalized MAC or the sentinel, not the
original raw value.
Summary by CodeRabbit
Bug Fixes
Refactor
Tests