Repository navigation
fix(admin): bound overview history and paginate alerts - #440
deepjerry-ai wants to merge 6 commits into
Conversation
Replace retained-history materialization with bounded previews, paged alerts, and incremental lifetime projections. Preserve scoped visibility, correction handling, cancellation, and online backfill progress.
Co-Authored-By: OpenAI Codex <noreply@openai.com>
astaxie
left a comment
There was a problem hiding this comment.
Reviewed the complete diff at 05c9f2ddbfbcc637047741d2e69d467c8cf665f0 against the PR base, issue #433 and the overview guide.
Standards
No actionable finding. The shared behavior has English, Simplified Chinese and Japanese guidance, and the changed UI has named acceptance scenarios. The documented compatible bridge release remains a deployment prerequisite; this review does not establish that those release artifacts have shipped.
Spec
No confirmed new actionable finding. Reviewed projection accounting, permission scopes, backfill/concurrency handling, cache expiry/cancellation, alert pagination, model search and frontend loading/status behavior. Focused overview, projection, alert-page, quota-event and model-search Go tests pass.
GitHub CI passes on this exact head. Full local backend/frontend/browser suites and PostgreSQL integration were not rerun for this review.
Findings: Standards 0; Spec 0.
Summary
Bound the history-dependent overview payload and preserve lifetime statistics as retained data grows. Historical alerts now have server-side pagination, and slow analytics load independently from the usable console.
Related Issue
Related to #433.
Changes
Return the latest 20 alerts in overview. Page alert history with a default size of 50 and enforced maximum of 100, filtering by UTC time, severity and project. Preserve project quota-event counts and latest occurrence through separate permission-scoped aggregates.
Return model counts in overview and load definitions on their consuming pages. Add bounded, authorization-scoped model search with capability/modality matching and literal wildcard handling.
Maintain lifetime totals and breakdown dimensions transactionally through database triggers, including corrections, deletions and writes from other application instances. PostgreSQL writers reserve separate transaction shards to avoid row-lock serialization, and reads aggregate signed contributions before filtering. Preserve overlapping OR permission scopes without duplicate counting.
Backfill existing rows in bounded, resumable batches with cluster leases and a durable completion marker. Keep the page usable during preparation and hide global progress counts from scoped users.
Cache successful summaries for 15 seconds, coalesce concurrent refreshes, propagate cancellation and enforce query deadlines. Mark successful results up to 60 seconds old as stale on failure, then hide expired values and their derived trends.
Use PostgreSQL NUMERIC and compensated SQLite monetary accumulation. Protect source persistence and corrected totals at extreme numeric ranges, with an explicitly documented SQLite raw-aggregation safety fallback.
Add per-dialect schema expansions, independently retryable concurrent PostgreSQL indexes with exact-definition postconditions, and English/Chinese/Japanese operational documentation. Reuse the held PostgreSQL migration session after committing its dirty marker to support a one-connection runtime pool.
Address follow-up review findings. SQLite keeps ordinary mixed amounts on compensated projection reads and detects actual range failures. Preparation polls wait for the previous refresh to finish. Failed breakdowns discard old classifications. Model search queries the server even after visiting the directory. Alert history reloads a valid page when retention shrinks the result set.
Type of Change
Verification
05c9f2ddbfbcc637047741d2e69d467c8cf665f0, including the PostgreSQL and pinned N-1 contracts.05c9f2dd: SQLite mixed-amount and overflow regressions, 14 isolated browser scenarios, 16 real-backend browser smoke tests, 824 frontend tests, Go vet, pinned lint and migration-manifest checks passed.go vet ./...and pinned golangci-lint v2.12.2 passed. Targeted shared-cache, cancellation, shutdown and multi-instance backfill tests passed with-race.Standards review
Reviewed migration safety, retry/postconditions, lifecycle deadlines and shared state. Findings were fixed and rechecked. The release prerequisite below remains explicit.
Spec review
Reviewed bounded responses, full statistics, permission isolation, stale-result expiry, model navigation/search, monetary corrections and concurrent/resumable backfill. Reported implementation defects were fixed with regression coverage.
Compatibility, Security, and Operations
The admin overview emits model counts and
summary_status; model consumers fetch definitions explicitly. Alert-history consumers iterate the paged response. Deploy the matching admin frontend and backend together.Schema migrations 12–18 add the projection structures, concurrent indexes and completion state. PostgreSQL index migrations have independent budgets and recovery checks. The online worker starts with the existing background scheduler and releases owned leases on graceful shutdown.
Release prerequisite: the shipped v0.11.0 runner rejects the newer migration ledger entries. Publish and deploy a compatible bridge release before rolling out this change. A local bridge candidate retains target 11 and verifies the exact additive migration checksums through 18. SQLite and PostgreSQL tests started the candidate before and after upgrade, exercised project, key, provider, model, gateway and audit writes after rollback, then verified the feature release read and counted those writes. The official bridge artifacts and managed upgrade flow remain a release step.
SQLite's exceptional numeric-safety fallback scans retained history while retaining permission scoping, caching and deadlines. Normal-range lifetime reads use the projection. Fixtures and benchmark data are synthetic.
Documentation
unknown_applied_version (version 12), confirming the prerequisite.Checklist
.envfiles, databases, backups, or runtime logs are included.start.sh, and deployment documentation where applicable. The scale switch is test-only.data/model-catalog.yamlremains tracked and catalog changes were reviewed where applicable.git diff --checkpasses.