Skip to content

Chore/refactor audit dashboard#422

Open
Ktl-XV wants to merge 3 commits intoethereum:masterfrom
Ktl-XV:chore/refactor-audit-dashboard
Open

Chore/refactor audit dashboard#422
Ktl-XV wants to merge 3 commits intoethereum:masterfrom
Ktl-XV:chore/refactor-audit-dashboard

Conversation

@Ktl-XV
Copy link
Contributor

@Ktl-XV Ktl-XV commented May 19, 2025

closes #393

Changes:

  • Remove Filter types, reuse SubProtocol, ContentType, SelectionStrategy and AuditResult instead
  • Leverage strum to convert Enums to and from strings instead of implementing manually
  • Use a API to fetch audit dashboard data
  • Break up detail and stats into two requests
  • Remove Latest State Audit strategy, closes Latest Audit Strategy for State might not be working #421

@Ktl-XV Ktl-XV marked this pull request as draft May 19, 2025 17:55
@Ktl-XV Ktl-XV force-pushed the chore/refactor-audit-dashboard branch 3 times, most recently from 4629fa1 to 7b6097d Compare May 20, 2025 11:58
@Ktl-XV Ktl-XV marked this pull request as ready for review May 20, 2025 11:58
@Ktl-XV Ktl-XV force-pushed the chore/refactor-audit-dashboard branch from 7b6097d to ed68352 Compare May 21, 2025 20:16
@carver carver requested a review from Copilot May 23, 2025 21:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR primarily refactors the audit dashboard by removing redundant Filter types, standardizing enum usage via strum, and splitting the API calls for audit details and statistics. Key changes include:

  • Removal of legacy Filter types and deprecation of the "Latest State Audit" strategy.
  • Migration to strum-based enum conversions with updated naming (e.g. renaming "SelectOldestUnaudited" to "OldestUnaudited").
  • Updates to the audit dashboard’s frontend and backend integration with new API endpoints.

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
migration/src/m20250521_164847_remove_state_latest_stats.rs Removes the obsolete column/logic for Latest State Audit stats.
glados-web/templates/*.html Updates template syntax to invoke enum message getters and reflect new enum naming.
glados-web/src/templates.rs & routes.rs Adjustments to pass new enum types and API integration changes.
glados-core/src/stats.rs, glados-audit/, entity/ Refactoring of audit filtering, enum conversion, and removal of legacy fields.
glados-web/assets/js/*.js Modifications in JS components to align with the updated API endpoints and filters.
Comments suppressed due to low confidence (1)

entity/src/audit_stats.rs:36

  • The 'success_rate_state_latest' field has been removed. Confirm that all downstream components and consumers of AuditStats have been updated accordingly to avoid runtime or integration issues.
pub success_rate_state_latest: f32,

Comment on lines +37 to +41
No explanation available for {{ strategy.get_message().expect("Strategy missing message") }}
{% endmatch %}

</div>
<h2>{{ strategy }} stats</h2>
<h2>{{ strategy.get_message().expect("Strategy missing message") }} stats</h2>
Copy link

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

Directly calling expect on get_message may lead to runtime panics if a strategy is missing its message. Consider providing a safe fallback or logging a clear error rather than panicking.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the bot. We don't want to panic the server. Maybe .or_else("Strategy missing message") and/or an error log?

@carver
Copy link
Contributor

carver commented May 23, 2025

I think we should have a very good reason to review PR's this big:
image

I'm not sure I see it here, except that reviews are a little slow (which is something I hope we can improve!).

As a preview: I don't think we need to remove the latest state stats column from the DB. Migrations are always a risk point, and we will eventually want a latest state audit. Maybe within a few months even.

Anyway, it looks like you've already got it cleanly separated into 3 commits, so that seems like the right separation to start with for PRs

Copy link
Contributor

@mrferris mrferris left a comment

Choose a reason for hiding this comment

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

Just needs a rebase

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.

Latest Audit Strategy for State might not be working Update Audit Dashboard

3 participants