Conversation
…pecified When using 'edr report --select invocation_id:XXXX', the report showed 0 tests for non-latest invocations because the invocations_rank_index == 1 filter ran unconditionally after the invocation_id filter, removing all results where the selected invocation wasn't the most recent one. This mirrors the existing correct pattern in get_test_results_summary(). Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
👋 @devin-ai-integration[bot] |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughget_test_results now applies the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan for PR comments
Comment |
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 `@elementary/monitor/api/tests/tests.py`:
- Around line 431-438: The two timestamp assignments are reversed: ensure
latest_run_time is the local-time ISO string and latest_run_time_utc is the UTC
ISO string to match _get_test_metadata_from_test_result_db_row(); swap the
values so latest_run_time uses latest_run_datetime.isoformat() or
latest_run_datetime.astimezone(tz.tzlocal()).isoformat() for local time and
latest_run_time_utc uses latest_run_datetime.astimezone(tz.tzutc()).isoformat()
(or datetime.timezone.utc) for UTC, updating the assignments for latest_run_time
and latest_run_time_utc accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f0a7320f-343f-44b7-9bf8-a571291ddfab
📒 Files selected for processing (1)
elementary/monitor/api/tests/tests.py
Co-Authored-By: Itamar Hartstein <haritamar@gmail.com>
Summary
Fixes a bug where
edr report --select invocation_id:XXXXonly worked for the most recent test invocation. For any older invocation, the report would show 0 tests.Root cause: In
TestsAPI.get_test_results(), theinvocations_rank_index == 1filter ran unconditionally after theinvocation_idfilter. When a non-latest invocation was selected, results were correctly filtered to that invocation, then immediately discarded becauseinvocations_rank_index != 1.Fix: Move the
invocations_rank_index == 1filter into anelseblock so it only applies when no specificinvocation_idis provided. This matches the already-correct pattern inget_test_results_summary()in the same class.The remaining diff lines are cosmetic
blackreformatting (no logic changes).Review & Testing Checklist for Human
invocation_idis provided, skipping theinvocations_rank_index == 1filter won't cause duplicate/unexpected rows for the same test within a single invocationedr report --select invocation_id:<non_latest_id>against a warehouse with historical test data and confirm tests now appearedr report(without--select invocation_id) still behaves correctly (only shows latest invocation results)Notes
Summary by CodeRabbit
Bug Fixes
Refactor