Skip to content

Conversation

@nikhilsinhaparseable
Copy link
Contributor

@nikhilsinhaparseable nikhilsinhaparseable commented Jan 23, 2026

Summary by CodeRabbit

  • New Features
    • Added a setup checklist displaying completed configuration steps (data ingestion, metrics, keystone, alerts, user management).
    • Added alert trigger history with severity-based tracking and time-window distribution for better monitoring visibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

Walkthrough

The pull request refactors the home response structure by replacing stats_details and top_five_ingestion fields with new checklist and alert_trigger_history fields. It introduces new public structs (Checklist, SeverityCount, TimeBin, AlertTriggerHistory) and simplifies the generate_home_response function by removing concurrent stream operations and top-5 ingestion calculations.

Changes

Cohort / File(s) Change Summary
Home Response Struct Refactoring
src/prism/home/mod.rs
Removed stats_details and top_five_ingestion fields from HomeResponse. Added checklist and alert_trigger_history fields. New public structs: Checklist, SeverityCount, TimeBin, and AlertTriggerHistory with appropriate derive attributes (Serialize, Deserialize, Default, Clone).
Function Logic Refactoring
src/prism/home/mod.rs
Refactored generate_home_response to replace concurrent stream title calls with PARSEABLE.metastore.list_streams() and authorization filtering. Removed functions: get_top_5_streams_by_ingestion, stats_for_date, get_stream_stats_for_date. Added new checklist computation logic and placeholder alert trigger history initialization.
Import Adjustments
src/prism/home/mod.rs
Added rbac::map::users import. Updated chrono imports to use DateTime and Utc. Expanded serde imports to include Deserialize.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • parseablehq/parseable#1275: Directly modifies src/prism/home/mod.rs and refactors the same helper functions and generate_home_response logic for stream title and stats handling.
  • parseablehq/parseable#1371: Both PRs modify the home response structure and alerts-related types by updating HomeResponse fields and changing how alerts are represented.
  • parseablehq/parseable#1307: Both PRs refactor src/prism/home/mod.rs and transform the HomeResponse shape through changes to generate_home_response logic.

Suggested labels

for next release

Poem

🐰 A checklist hops in, alert history blooms,
Old stats fade away in the home response rooms,
With severity counts and time bins so neat,
The refactoring's done, the response complete! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning No pull request description was provided by the author; the PR lacks required sections including the issue reference, description of goals, solutions, key changes, and testing/documentation checklists. Add a comprehensive description including the issue fixed, explanation of goals and rationale, key changes made, and completion of the provided checklist items regarding testing and documentation.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'home checklist api' directly describes the main change: introducing a new checklist API for the home response, which aligns with the refactored HomeResponse struct.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 23, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/prism/home/mod.rs`:
- Around line 193-205: The data_ingested flag is incorrectly computed from
all_streams (which can include unauthorized/internal streams); update the
computation to use the already-filtered datasets instead so it reflects only
authorized, non-internal data the user can see. Replace the data_ingested
assignment (used to build Checklist) to check the filtered datasets collection
(e.g., use datasets.is_empty() or datasets.iter().any(|d| !d.internal) depending
on existing dataset filtering) so Checklist.data_ingested correctly reports
visible data; keep the rest of the Checklist construction unchanged and
reference variables Checklist, data_ingested, all_streams, and datasets to
locate the change.

Comment on lines +193 to +205
// Generate checklist
let data_ingested = !all_streams.is_empty();
let alert_created = alerts_summary.total > 0;
let user_count = users().len();
let user_added = user_count > 1; // more than just the default admin user

let checklist = Checklist {
data_ingested,
metrics_dataset: has_metrics_dataset,
keystone_created: false, // Enterprise will override
alert_created,
user_added,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Align data_ingested with authorized/non-internal datasets to avoid false positives and info leakage.
all_streams includes unauthorized/internal streams, so data_ingested can be true even when the user sees none. Consider basing it on datasets (already filtered).

✅ Proposed fix
-    let data_ingested = !all_streams.is_empty();
+    let data_ingested = !datasets.is_empty();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Generate checklist
let data_ingested = !all_streams.is_empty();
let alert_created = alerts_summary.total > 0;
let user_count = users().len();
let user_added = user_count > 1; // more than just the default admin user
let checklist = Checklist {
data_ingested,
metrics_dataset: has_metrics_dataset,
keystone_created: false, // Enterprise will override
alert_created,
user_added,
};
// Generate checklist
let data_ingested = !datasets.is_empty();
let alert_created = alerts_summary.total > 0;
let user_count = users().len();
let user_added = user_count > 1; // more than just the default admin user
let checklist = Checklist {
data_ingested,
metrics_dataset: has_metrics_dataset,
keystone_created: false, // Enterprise will override
alert_created,
user_added,
};
🤖 Prompt for AI Agents
In `@src/prism/home/mod.rs` around lines 193 - 205, The data_ingested flag is
incorrectly computed from all_streams (which can include unauthorized/internal
streams); update the computation to use the already-filtered datasets instead so
it reflects only authorized, non-internal data the user can see. Replace the
data_ingested assignment (used to build Checklist) to check the filtered
datasets collection (e.g., use datasets.is_empty() or datasets.iter().any(|d|
!d.internal) depending on existing dataset filtering) so Checklist.data_ingested
correctly reports visible data; keep the rest of the Checklist construction
unchanged and reference variables Checklist, data_ingested, all_streams, and
datasets to locate the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant