Commit graph

69 commits

Author SHA1 Message Date
Yussif Mohammed
880bf2daa2 fix tests 2025-12-24 21:43:13 +00:00
Yussif Mohammed
cc51fda8a6
Alerts view & Error details page (#225)
* towards supporting teams in projects.

* Auto-format code with fourmolu

* improve team list

team view side page, alerts and dashbaord next

yeah well

validation checks and fixes

tiny details improvments

prepare endpoints for testing

Auto-format code with fourmolu

towards tests

Auto-format code with fourmolu

rm monoscope-test

more tests cases

Auto-format code with fourmolu

alerts page improvements bug fixes and teams link

Auto-format code with fourmolu

feat: alerts section, teams.

send notifications

Auto-format code with fourmolu

fix errs and slack install

Auto-format code with fourmolu

towards table component

Auto-format code with fourmolu

dashbaord bulk actions delete

dashboards with teams

team dashboard

Auto-format code with fourmolu

feat: teams bulk actions delete

Auto-format code with fourmolu

feat: add title field & teams to dashboard modal

Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

Auto-format code with fourmolu

fix and passing tests

Auto-format code with fourmolu

add dashboards spec

Auto-format code with fourmolu

notifications templates

query viz and alert notifications

Auto-format code with fourmolu

alert config stuff

fixes and towards issue detail page

Auto-format code with fourmolu

Reorganize project structure

Move config files to config/ directory (tailwind.config.js, workbox-config.js, weeder.toml). Move documentation to docs/ (DEVELOPMENT.md, DOCKER_COMPOSE_README.md). Update all references in Dockerfile, Makefile, tailwind.css, and documentation.

Fix CI disk space exhaustion by cleaning up unnecessary files and build artifacts

Optimize CI caching strategy to reduce disk usage

Use separate caches per test suite and cache only essential build
artifacts instead of entire dist-newstyle directory. This reduces
disk usage while maintaining fast compilation through effective caching.

Fix CSS build in deployment by using correct Tailwind v4 CLI

The project uses Tailwind CSS v4 syntax (@import, @source, @plugin
directives) but the build commands were using the old v3 CLI which
doesn't process v4 syntax correctly, causing CSS changes to not appear
in deployed builds.

Updated Dockerfile and CI workflows to use @tailwindcss/cli instead of
the legacy tailwindcss command, and removed the obsolete -c config flag
since v4 uses @config directive in the CSS file.

Use npx tailwindcss instead of @tailwindcss/cli for v4 compatibility

The tailwindcss package (v4.1.13) in devDependencies is the correct CLI
for Tailwind v4. Using @tailwindcss/cli was unnecessarily specific and
may have caused issues in the Docker build environment.

This ensures the CSS with all custom utilities (surface-raised, etc.)
builds correctly in production.

Cherry pick files (#232)

* cherry pick files

* Auto-format code with fourmolu

* add more files

* Auto-format code with fourmolu

* finx undefined var

* review changes

* Auto-format code with fourmolu

* discord channel' type rename

* Auto-format code with fourmolu

* claude rec fixes

* Auto-format code with fourmolu

* fix notification typo

* Auto-format code with fourmolu

* discord get channel log error

* fix typo

* rm reswap related code from System.Types.hs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>

Teams rebased (#233)

* towards supporting teams in projects.

* Auto-format code with fourmolu

* fix htmx json encoder extension

* improve team list

* team view side page, alerts and dashbaord next

* yeah well

* validation checks and fixes

* tiny details improvments

* prepare endpoints for testing

* Auto-format code with fourmolu

* towards tests

* Auto-format code with fourmolu

* rm monoscope-test

* fix alert creation

* more tests cases

* Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

* Auto-format code with fourmolu

* feat: alerts section, teams.

* send notifications

* Auto-format code with fourmolu

* fix errs and slack install

* Auto-format code with fourmolu

* add teams column to dashboards table

* towards table component

* Auto-format code with fourmolu

* dashbaord bulk actions delete

* dashboards with teams

* team dashboard

* Auto-format code with fourmolu

* fix table

* feat: teams bulk actions delete

* Auto-format code with fourmolu

* feat: add title field & teams to dashboard modal

* Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

* Auto-format code with fourmolu

* fix and passing tests

* Auto-format code with fourmolu

* add more tests

* add dashboards spec

* Auto-format code with fourmolu

* fix pull request workflow

* fix: review change requests

* Auto-format code with fourmolu

* feat: tagify consolidation

* Auto-format code with fourmolu

* updates

* simplifications and other changes

* background changes and fixes

* Auto-format code with fourmolu

* package yaml

* Auto-format code with fourmolu

* fix typo

* towards supporting teams in projects.

* Auto-format code with fourmolu

* improve team list

* team view side page, alerts and dashbaord next

* yeah well

* validation checks and fixes

* tiny details improvments

* prepare endpoints for testing

* Auto-format code with fourmolu

* towards tests

* Auto-format code with fourmolu

* rm monoscope-test

* more tests cases

* Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

* Auto-format code with fourmolu

* feat: alerts section, teams.

* send notifications

* Auto-format code with fourmolu

* fix errs and slack install

* Auto-format code with fourmolu

* add teams column to dashboards table

* towards table component

* Auto-format code with fourmolu

* dashbaord bulk actions delete

* dashboards with teams

* team dashboard

* Auto-format code with fourmolu

* feat: teams bulk actions delete

* Auto-format code with fourmolu

* feat: add title field & teams to dashboard modal

* Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

* Auto-format code with fourmolu

* fix and passing tests

* Auto-format code with fourmolu

* add more tests

* add dashboards spec

* Auto-format code with fourmolu

* fix: review change requests

* Auto-format code with fourmolu

* feat: tagify consolidation

* Auto-format code with fourmolu

* updates

* simplifications and other changes

* background changes and fixes

* Auto-format code with fourmolu

* package yaml

* Auto-format code with fourmolu

* Migrate to master's Table API

  - Update dashboards and teams tables to use new column-based API
  - Replace ItemsList.ItemsRows with Table.TableRows
  - Add missing validateTeamDetails function
  - Fix import conflicts

* Migrate to master's Table API and fix migration idempotency

- Update dashboards and teams tables to use new column-based API
- Replace ItemsList.ItemsRows with Table.TableRows
- Add missing validateTeamDetails function
- Fix import conflicts (Wreq.header ambiguity)
- Add IF NOT EXISTS to index creation in teams migration

* Add frosted glass backdrop to modals

- Add backdrop-filter blur effect to .modal-backdrop class
- Applies 8px blur for frosted glass effect
- Includes webkit prefix for browser compatibility

* Remove padding from table container

- Remove px-6, pt-4, and pb-16 from containerClasses
- Table now renders edge-to-edge without padding

* Add padding to non-settings page content

- Remove padding from Table component's default containerClasses
- Add px-6 pt-4 pb-16 wrapper for non-settings pages in BodyWrapper
- Settings pages (Teams, etc.) remain without extra padding

* Remove duplicate padding from dashboards list page

- Remove pb-2 px-6 pt-8 from itemsListPage div
- Padding now comes from BodyWrapper parent wrapper
- Avoids double padding on dashboards list

* Align dashboard button and table checkbox with page header

* Fix double padding issue with standardized table padding system

- Remove global padding wrapper from BodyWrapper to fix double padding
- Add addPadding config option to Table component
- Update table pages to use addPadding: Dashboards, API Catalog, Issues, Monitors
- Standardize all table padding to px-6 pt-4 pb-2
- Update Monitors page section padding to match standard

* fix tables and compilation

* Auto-format code with fourmolu

* fix dulicate line

* Auto-format code with fourmolu

* fix build

* Refactor FromJSON instances to use deriving strategies

- Use deriving via with DAE.Rename for field name transformations

- Use deriving via with DAE.StripSuffix for simple underscore removal

- Extract SlackEventPayload constructors into separate record types

- Simplify TeamForm to use deriving anyclass for internal API

- Remove unused imports

Code reduction: ~80 lines of manual JSON parsing boilerplate eliminated

* Auto-format code with fourmolu

* Add team validation and permission checks

- Add admin-only restriction for team create/update
- Validate team members are project members
- Add email format validation for notification emails
- Add length limits to team name and handle
- Verify teams exist before adding to dashboards
- Extract dispatchTeamNotifications helper in BackgroundJobs
- Use TeamDetails record to simplify createTeam/updateTeam APIs
- Handle duplicate team handles with ON CONFLICT DO NOTHING

* Auto-format code with fourmolu

* Refactor teams feature with comprehensive improvements

Code Quality & Type Safety:

- Refactor createTeam/updateTeam to use TeamDetails record type

- Add compile-time safety with NonEmpty for softDeleteProjectMembers

- Standardize SQL array syntax (lowercase uuid[], consistent spacing)

- Add phone_numbers support to all team types and queries

Performance Optimizations:

- Optimize getTeamsVM/getTeamByHandle with LEFT JOIN + array_agg

- Use for_ instead of explicit null checks

Error Handling & Observability:

- Add logging for missing/deleted teams in monitor notifications

- Improve error handling for addTeamsToDashboards

- Add graceful fallback when configured teams are deleted

Code Cleanup:

- Extract dispatchTeamNotifications helper function

- Remove redundant project query

- Use idiomatic Haskell patterns

* Auto-format code with fourmolu

* Fix variable shadowing in email validation

* Refactor for code succinctness

- Simplify NonEmpty to Vector conversion (remove redundant toList)

- Extract handleQueryMonitorThreshold into focused helper functions

- Add logMissingTeams for team logging

- Add createAndInsertIssue for issue creation

- Add calculateThreshold for threshold calculation

- Add buildMonitorAlert for alert construction

- Add sendNotifications for notification dispatch

- Add sendFallbackNotifications for fallback handling

* Auto-format code with fourmolu

---------

Co-authored-by: Yussif Mohammed <yousiph77@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

towards supporting teams in projects.

Auto-format code with fourmolu

improve team list

validation checks and fixes

tiny details improvments

Auto-format code with fourmolu

towards tests

Auto-format code with fourmolu

more tests cases

Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

Auto-format code with fourmolu

feat: alerts section, teams.

send notifications

Auto-format code with fourmolu

fix errs and slack install

Auto-format code with fourmolu

towards table component

Auto-format code with fourmolu

dashbaord bulk actions delete

dashboards with teams

Auto-format code with fourmolu

feat: teams bulk actions delete

Auto-format code with fourmolu

feat: add title field & teams to dashboard modal

Auto-format code with fourmolu

remove stack files and configure hie.yaml for better IDE support

Auto-format code with fourmolu

fix and passing tests

Auto-format code with fourmolu

add dashboards spec

Auto-format code with fourmolu

alert config stuff

fixes and towards issue detail page

rmv duplicate declarations

Auto-format code with fourmolu

fix resizer

Auto-format code with fourmolu

make project compile/fix errors

* Auto-format code with fourmolu

feat: use log-list virtual table for monitor history tab

Auto-format code with fourmolu

fix issue detail tabs

Auto-format code with fourmolu

clean up unused imports

Auto-format code with fourmolu

parameterized trace/span sql queries

fix unkwon stack typo

more unused imports cleanup

Auto-format code with fourmolu

remove commented logs

Rebase onto master, resolve conflicts with master changes

fix tests after recent changes to alerts view

fix tests after changing ManageMembers handlers to return ProjectId

remove monoscope-test

towards fixing tests

Auto-format code with fourmolu

fix: sort starred dashboards first and add chart padding

- Dashboard list now always shows starred/favorited items at the top regardless of the selected sort option (newest, oldest, A-Z, etc.)

- Added p-2 padding to widget chart container to prevent bleeding edges

fix: exclude p-2 padding for timeseries_stat widgets

fix: dashboard variable tagify inputs not initializing correctly

- Update createTagify to accept both selector strings and DOM elements

- Wrap dashboard variable tagify init in DOMContentLoaded event

- Remove overflow-hidden from variable fieldset to allow dropdown display

fix: remove unnecessary border wrapper from table component

Auto-format code with fourmolu

towards fixing integration tests

Auto-format code with fourmolu

* fix more errors

* Auto-format code with fourmolu

* claude req fixes

* Auto-format code with fourmolu

* fix table

* Auto-format code with fourmolu

* bring back removed page due to rebase

* Auto-format code with fourmolu

* rm unused imports

* fix failing delim queries in BackgroundJobs.hs

* Auto-format code with fourmolu

* fix build after rebase

* Auto-format code with fourmolu

* test final fix

* rm log attention

* add index for first_trace_id and recent_trace_id in errors table

* fix index creation in 0019_add_trace_id.sql

* remove concurrently index

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-23 17:54:20 +01:00
Anthony Alaribe
64b3a8bc88
refactor: migrate from pg-transact to effectful-postgresql to support postgres open telemetry instrumentation (#236)
* refactor: migrate from pg-transact to effectful-postgresql

Replace pg-transact and pg-transact-effectful with effectful-postgresql for database operations. Key changes: replace DB effect with WithConnection, remove dbtToEff wrappers, use direct PG.query/PG.execute calls, update runDB to runWithConnectionPool, keep pg-entity for query building, add IOE constraint alongside WithConnection where needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* Auto-format code with fourmolu

* chore: use effectful-postgresql fork with OpenTelemetry support

Switch to tonyalaribe/effectful-postgresql fork (instrument-pg branch) and
enable the +enable-otel flag for OpenTelemetry instrumentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: improve connection usage and error handling in BackgroundJobs

- Use PG.execute directly instead of multiple withConnection calls for
  CleanupDemoProject (more efficient connection usage)
- Handle missing project gracefully in ATRuntimeException processing
  instead of crashing with error
- Clean up unused imports (PGS, withConnection)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: correct effectful-postgresql subdir path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* fix: add proper error handling and logging for critical operations

- Log advisory lock release failures instead of silently ignoring
- Log when error update doesn't match any span (potential data issue)
- Log when span hash update count mismatches expected (data integrity)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

* Auto-format code with fourmolu

* refactor: simplify single-row query handling in BackgroundJobs

* refactor: return lists from model query functions instead of Vectors

PostgreSQL-simple returns lists naturally, so wrapping results with V.fromList was wasteful. Model query functions now return lists directly, with Vector conversion happening at call sites that actually need Vectors.

* Auto-format code with fourmolu

* perf: fix N+1 query pattern and improve advisory lock handling

- Replace individual UPDATE queries in forM_ loop with batched UPDATE
  using SQL unnest to reduce O(n) DB round-trips to O(1)
- Add 5-minute statement timeout to advisory lock to prevent hangs
- Add timeout reset in finally block for cleanup
- Improve comments explaining session-level lock auto-release behavior

* refactor: replace verbose Only unwrapping with coerce

- Use coerce @[Only T] @[T] instead of map (\(Only x) -> x)
- Use coerce @(Maybe (Only T)) @(Maybe T) instead of fmap (\(Only x) -> x)
- Update GenerateOtelFacetsBatch to use Projects.ProjectId instead of Text

* Auto-format code with fourmolu

* fix: advisory lock release and remove unnecessary vector conversion

- Use query instead of execute for pg_advisory_unlock (SELECT returns result)
- Add validation for unexpected unlock results
- Remove unnecessary V.fromList/V.toList round-trip in runHourlyJob

* refactor: simplify COUNT(*) query result handling

Use inline maybe/listToMaybe instead of case expression for cleaner code.

* Auto-format code with fourmolu

* refactor: use catch instead of try/case for advisory lock cleanup

Cleaner error handling with catch pattern instead of explicit try + case Left/Right.

* Auto-format code with fourmolu

* perf: use V.mapMaybe and V.unzip3 to avoid list conversions

Direct Vector operations for batch error updates instead of
list mapMaybe + V.fromList.

* refactor: introduce DB type alias and switch to pg-transact

* Auto-format code with fourmolu

* fix errors in specs

* fix: remove duplicate import in Dashboards.hs

* fix: resolve integration test failures

- BusinessFlowsSpec: fix column names for apis.subscriptions table

- TestUtils: add test user as admin to nil UUID project

- System/Types: increase static UUID pool to prevent collisions

- AnomaliesSpec: fix test assertions for correct filter views

* fix aroundAll

* fix: resolve integration test failures

- Fix insertProjectMembers to handle empty list (prevents 'no rows supplied' error)

- Fix DashboardsSpec UUID collisions by grouping creations and adding cleanup

- Fix ManageMembersSpec: correct userID to UUID 1, update expected member count and email

- Fix ProjectsSpec: update expected project count to include demo project

* remove PG_EFFECT_MIGRATION.md

* fix: use unique team handles in bulk add teams test to avoid conflicts

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-22 22:32:43 +01:00
Anthony Alaribe
5cd948697f
Teams improvement v2 (#234)
* Improve dashboards and teams UI with star functionality

- Add star/unstar functionality for dashboards with persistent state
- Update dashboard sorting to prioritize starred items
- Improve table component styling and layout
- Add icons for dashboards and teams in list views
- Streamline table columns and remove unnecessary checkboxes
- Update bulk actions to use new table component features

* Auto-format code with fourmolu

* Fix teams bulk actions to use itemId field

Update TBulkActionForm to use itemId instead of teamId to match
the Table component's standardized field name for bulk actions.

* Improve settings navigation layout and styling

- Reduce navigation width for better space utilization
- Update font sizes and spacing for cleaner appearance
- Improve icon styling with background colors
- Enhance navigation item padding and layout

* Refactor API keys page to use Table component and add client-side tab support

- Enhanced TabFilter component to support both client-side and server-side tabs
- Added clientSide boolean field to TabFilter for tab switching mode
- Added targetId field to TabFilterOpt for custom element targeting
- Refactored API keys page to use reusable Table component
- Updated all existing TabFilter usage to include new fields
- Improved consistency across table implementations

* Auto-format code with fourmolu

* nitpicks on

* add test for starring and unstarring, and dashboard default sorting

* Fix tagify scope issue in dashboard creation modal

The tagify variable was scoped inside DOMContentLoaded event listener,
causing a reference error when getSelectedTeams() tried to access it
during form submission. Moved declaration to outer scope.

* Fix gridStackInstance null error when adding dashboard widgets

* Fix teams badge WCAG contrast by using badge-neutral

* Fix compilation errors

- Fix do-notation errors by adding proper do blocks instead of using >> after $
- Rename local section_ helper to teamSection_ to avoid shadowing
- Remove unused ProjectId parameter from renderMonitorContent

* Use brackets instead of do-blocks for single-line expressions

- Keep code on one line by using parentheses and >> operator
- Applied to card_, notifRow_, lazySection_, teamSection_, field_, fieldIcon_ helpers

* Apply code formatting updates

- Replace font-mono with monospace class
- Minor whitespace adjustments

* Fix duplicate html assignment bug and simplify code

* Auto-format code with fourmolu

* Refactor tables to use standardized Table component with sorting

- Add containerId to Table Config for HTMX targeting
- Add renderAsTable mode for proper table rendering
- Add rowId and rowAttrs to TableRows for load-more consistency
- Fix th elements to include column attrs for alignment
- Fix class concatenation spacing in table headers
- Fix scrolling in BodyWrapper (overflow-y-hidden to overflow-y-auto)
- Add sort parameter to Issues.selectIssues
- Refactor Anomalies and ApiCatalog to use TableHeaderActions
- Remove flex classes from table cells

* Auto-format code with fourmolu

* Fix table load more by moving pagination inside tbody

- Move pagination link inside tbody for table mode (as a <tr>)
- Add renderTablePaginationLink with hx-target='closest tr'
- Add id to tbody for targeting
- Pagination row gets replaced with new rows + new pagination row

* Refactor Anomalies table to use built-in checkbox

- Remove custom checkbox column (use table's rowId feature instead)
- Add status indicator dot to Issue column title row
- Update TableRows to use proper rowId for load more

* Auto-format code with fourmolu

* Fix Anomalies issue column layout structure

- Fix indentation so metadata, stats, actions are separate blocks
- Status indicator dot in title row
- Condense code using single-line patterns where appropriate

* Auto-format code with fourmolu

* Merge renderPaginationLink and renderTablePaginationLink into single function

* Auto-format code with fourmolu

* Align row checkboxes to top and add vertical padding to issue column

* Improve settings sidebar: larger text, neutral icons, stronger selection highlight

* Widen settings sidebar

* Fix hlint warnings

* Fix all hlint warnings across codebase

* Auto-format code with fourmolu

* Fix GHC warnings: dodgy import, name shadowing, unused do-bind

* Use foldMap and zipWithM_ for cleaner iteration patterns

* Extract columnCount helper and add error handling for processVariable

* Auto-format code with fourmolu

* Optimize URL construction and use single-pass fold for change counting

* Extract issueTypeBadge helper to reduce code duplication

* Fix SQL injection vulnerabilities and semantic error in change counting

* Auto-format code with fourmolu

* Simplify SQL validation and remove redundant variable

* Auto-format code with fourmolu

* Rename selectDashboardsSorted to selectDashboardsSortedBy for clarity

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-19 23:44:55 +01:00
Anthony Alaribe
9521695299
Teams rebased (#233)
* towards supporting teams in projects.

* Auto-format code with fourmolu

* fix htmx json encoder extension

* improve team list

* team view side page, alerts and dashbaord next

* yeah well

* validation checks and fixes

* tiny details improvments

* prepare endpoints for testing

* Auto-format code with fourmolu

* towards tests

* Auto-format code with fourmolu

* rm monoscope-test

* fix alert creation

* more tests cases

* Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

* Auto-format code with fourmolu

* feat: alerts section, teams.

* send notifications

* Auto-format code with fourmolu

* fix errs and slack install

* Auto-format code with fourmolu

* add teams column to dashboards table

* towards table component

* Auto-format code with fourmolu

* dashbaord bulk actions delete

* dashboards with teams

* team dashboard

* Auto-format code with fourmolu

* fix table

* feat: teams bulk actions delete

* Auto-format code with fourmolu

* feat: add title field & teams to dashboard modal

* Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

* Auto-format code with fourmolu

* fix and passing tests

* Auto-format code with fourmolu

* add more tests

* add dashboards spec

* Auto-format code with fourmolu

* fix pull request workflow

* fix: review change requests

* Auto-format code with fourmolu

* feat: tagify consolidation

* Auto-format code with fourmolu

* updates

* simplifications and other changes

* background changes and fixes

* Auto-format code with fourmolu

* package yaml

* Auto-format code with fourmolu

* fix typo

* towards supporting teams in projects.

* Auto-format code with fourmolu

* improve team list

* team view side page, alerts and dashbaord next

* yeah well

* validation checks and fixes

* tiny details improvments

* prepare endpoints for testing

* Auto-format code with fourmolu

* towards tests

* Auto-format code with fourmolu

* rm monoscope-test

* more tests cases

* Auto-format code with fourmolu

* alerts page improvements bug fixes and teams link

* Auto-format code with fourmolu

* feat: alerts section, teams.

* send notifications

* Auto-format code with fourmolu

* fix errs and slack install

* Auto-format code with fourmolu

* add teams column to dashboards table

* towards table component

* Auto-format code with fourmolu

* dashbaord bulk actions delete

* dashboards with teams

* team dashboard

* Auto-format code with fourmolu

* feat: teams bulk actions delete

* Auto-format code with fourmolu

* feat: add title field & teams to dashboard modal

* Auto-format code with fourmolu

* remove stack files and configure hie.yaml for better IDE support

* Auto-format code with fourmolu

* fix and passing tests

* Auto-format code with fourmolu

* add more tests

* add dashboards spec

* Auto-format code with fourmolu

* fix: review change requests

* Auto-format code with fourmolu

* feat: tagify consolidation

* Auto-format code with fourmolu

* updates

* simplifications and other changes

* background changes and fixes

* Auto-format code with fourmolu

* package yaml

* Auto-format code with fourmolu

* Migrate to master's Table API

  - Update dashboards and teams tables to use new column-based API
  - Replace ItemsList.ItemsRows with Table.TableRows
  - Add missing validateTeamDetails function
  - Fix import conflicts

* Migrate to master's Table API and fix migration idempotency

- Update dashboards and teams tables to use new column-based API
- Replace ItemsList.ItemsRows with Table.TableRows
- Add missing validateTeamDetails function
- Fix import conflicts (Wreq.header ambiguity)
- Add IF NOT EXISTS to index creation in teams migration

* Add frosted glass backdrop to modals

- Add backdrop-filter blur effect to .modal-backdrop class
- Applies 8px blur for frosted glass effect
- Includes webkit prefix for browser compatibility

* Remove padding from table container

- Remove px-6, pt-4, and pb-16 from containerClasses
- Table now renders edge-to-edge without padding

* Add padding to non-settings page content

- Remove padding from Table component's default containerClasses
- Add px-6 pt-4 pb-16 wrapper for non-settings pages in BodyWrapper
- Settings pages (Teams, etc.) remain without extra padding

* Remove duplicate padding from dashboards list page

- Remove pb-2 px-6 pt-8 from itemsListPage div
- Padding now comes from BodyWrapper parent wrapper
- Avoids double padding on dashboards list

* Align dashboard button and table checkbox with page header

* Fix double padding issue with standardized table padding system

- Remove global padding wrapper from BodyWrapper to fix double padding
- Add addPadding config option to Table component
- Update table pages to use addPadding: Dashboards, API Catalog, Issues, Monitors
- Standardize all table padding to px-6 pt-4 pb-2
- Update Monitors page section padding to match standard

* fix tables and compilation

* Auto-format code with fourmolu

* fix dulicate line

* Auto-format code with fourmolu

* fix build

* Refactor FromJSON instances to use deriving strategies

- Use deriving via with DAE.Rename for field name transformations

- Use deriving via with DAE.StripSuffix for simple underscore removal

- Extract SlackEventPayload constructors into separate record types

- Simplify TeamForm to use deriving anyclass for internal API

- Remove unused imports

Code reduction: ~80 lines of manual JSON parsing boilerplate eliminated

* Auto-format code with fourmolu

* Add team validation and permission checks

- Add admin-only restriction for team create/update
- Validate team members are project members
- Add email format validation for notification emails
- Add length limits to team name and handle
- Verify teams exist before adding to dashboards
- Extract dispatchTeamNotifications helper in BackgroundJobs
- Use TeamDetails record to simplify createTeam/updateTeam APIs
- Handle duplicate team handles with ON CONFLICT DO NOTHING

* Auto-format code with fourmolu

* Refactor teams feature with comprehensive improvements

Code Quality & Type Safety:

- Refactor createTeam/updateTeam to use TeamDetails record type

- Add compile-time safety with NonEmpty for softDeleteProjectMembers

- Standardize SQL array syntax (lowercase uuid[], consistent spacing)

- Add phone_numbers support to all team types and queries

Performance Optimizations:

- Optimize getTeamsVM/getTeamByHandle with LEFT JOIN + array_agg

- Use for_ instead of explicit null checks

Error Handling & Observability:

- Add logging for missing/deleted teams in monitor notifications

- Improve error handling for addTeamsToDashboards

- Add graceful fallback when configured teams are deleted

Code Cleanup:

- Extract dispatchTeamNotifications helper function

- Remove redundant project query

- Use idiomatic Haskell patterns

* Auto-format code with fourmolu

* Fix variable shadowing in email validation

* Refactor for code succinctness

- Simplify NonEmpty to Vector conversion (remove redundant toList)

- Extract handleQueryMonitorThreshold into focused helper functions

- Add logMissingTeams for team logging

- Add createAndInsertIssue for issue creation

- Add calculateThreshold for threshold calculation

- Add buildMonitorAlert for alert construction

- Add sendNotifications for notification dispatch

- Add sendFallbackNotifications for fallback handling

* Auto-format code with fourmolu

---------

Co-authored-by: Yussif Mohammed <yousiph77@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-18 23:38:00 +01:00
Yussif Mohammed
a85be17184
Cherry pick files (#232)
* cherry pick files

* Auto-format code with fourmolu

* add more files

* Auto-format code with fourmolu

* finx undefined var

* review changes

* Auto-format code with fourmolu

* discord channel' type rename

* Auto-format code with fourmolu

* claude rec fixes

* Auto-format code with fourmolu

* fix notification typo

* Auto-format code with fourmolu

* discord get channel log error

* fix typo

* rm reswap related code from System.Types.hs

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Anthony Alaribe <anthonyalaribe@gmail.com>
2025-12-18 12:13:39 +01:00
Anthony Alaribe
e212df0b96
Tests in prs. And fix hlint warnings and failing UI tests (#230)
* Enable tests and hlint in pull request workflow

- Add hlint job to run on all PRs

- Make test jobs run even if build fails (using if: always())

- Fix shadowing binding in Table.hs colAttrs function

- Fix LLM.hs type error by using langchain-hs standard pattern

- Fix TypeScript error in log-worker-functions.ts with optional chaining

This ensures CI checks run independently and provide feedback even when some jobs fail.

* Convert PR workflow from stack to cabal

- Replace stack with cabal commands throughout

- Update caching to use dist-newstyle and ~/.cabal/store

- Use awalsh128/cache-apt-pkgs-action for system deps

- Set OpenSSL env vars properly for GitHub Actions

- Add fail-fast: false to test matrix

- Add ::group:: annotations for better log organization

* Revert LLM.hs changes - they were stack-related, not actual bugs

* minor linting error

* run hlint refactor in prs

* Apply hlint fixes across codebase

Fixed 239 hlint warnings: use toText, simplify encoding chains, replace fromMaybe with maybe, use ordNub, convert to guards, use unless, eta reduction, list comprehensions, newtype conversions, and remove unused imports. Updated .hlint.yaml to allow flexible imports for Data.List and Data.Aeson.

* Auto-format code with fourmolu

* Fix UI test failures in GitHub Actions

Update Node.js version from 18 to 20 to satisfy happy-dom requirement

Add CSS.escape mock for Monaco Editor theme initialization

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-17 00:34:01 +01:00
Anthony Alaribe
e9f828e866
Attempt at a versatile table component (#229)
* attempt at a versatile table component

* Auto-format code with fourmolu

* pr updates based on feedback

* Auto-format code with fourmolu

* refactor

* fix ui differences in the tables

* Auto-format code with fourmolu

* remove redundancies

* Auto-format code with fourmolu

* remove redundancies

* Auto-format code with fourmolu

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-12-16 22:38:46 +01:00
Yussif Mohammed
03107e3adc fix tests and docker file 2025-11-28 10:28:18 +00:00
Anthony Alaribe
ba651f5040 Fix GHC 9.12 TypeAbstractions errors in test files
Replace type synonym Projects.ProjectId with UUIDId constructor
in all test files to fix "Illegal term-level use of type constructor"
errors that occur with GHC 9.12's TypeAbstractions extension.
2025-11-27 23:29:55 +01:00
Anthony Alaribe
4fe33fac2e Consolidate Telemetry, Anomalies, and Monitors modules
- Merged Pages/Telemetry/Metrics.hs and Trace.hs into Pages/Telemetry.hs
- Moved Pages/Anomalies/AnomalyList.hs to Pages/Anomalies.hs
- Moved Pages/Monitors/Alerts.hs to Pages/Monitors.hs
- Fixed FromRow type errors in several files (Only wrapper)
- Fixed import issues in Pages/Projects.hs
2025-11-27 23:29:54 +01:00
Anthony Alaribe
318b62d430 Consolidate Pages/Projects into single module
Merged CreateProject, Integrations, ListProjects, and ManageMembers
into Pages.Projects, reducing ~60 lines from import overhead.
2025-11-27 23:29:38 +01:00
Anthony Alaribe
ddf832f621 Consolidate modules to reduce codebase size
- Delete unused Pkg.Google (empty) and Models.Projects.ProjectsEmail (unused)
- Merge Pkg.Parser.Core into Pkg.Parser.Expr
- Merge Models.Apis.Fields.Query into Fields.Types, delete Fields.hs wrapper
- Merge Models.Projects.LemonSqueezy into Projects.hs
- Merge Pkg.Components.Modals into Pages.Components
- Merge Models.Apis.Formats into Models.Apis.Fields.Types

Reduces codebase from ~33k to ~32.8k lines by eliminating 9 modules.
2025-11-27 23:29:16 +01:00
Anthony Alaribe
e1397ea721 Fix type mismatch in ProjectsSpec integration tests
The ListProjectsGet handler returns a 3-tuple containing projects, demo project, and showDemoProject flag. Updated test destructuring to match the actual return type.
2025-11-23 21:01:20 +01:00
Anthony Alaribe
873b71e13c Refactor test infrastructure and fix onboarding session caching
- Add refreshSession and runTestEffect helpers to eliminate duplication
- Skip session cache for ONBOARDING projects (actively being updated)
- Use pattern guards in sessionAndProject for cleaner control flow
- Simplify test setup: UPDATE sudo status instead of INSERT with conflict handling
- Restructure BusinessFlowsSpec with TestContext and withTestProject
- Rename projectOnboarding to projectOnboardingH for consistency
- Fix LemonSqueezy payment plan enum (FREE vs Free)
2025-11-17 17:16:41 +01:00
Anthony Alaribe
4b0e92659b Fix integration test compilation errors after testServant refactoring
Update all integration tests to properly unpack tuple response from testServant helper, which now returns (RespHeaders a, a).

Key changes:
- Add servant and servant-htmx to integration test dependencies
- Fix tuple unpacking in all test specs (AnomalyList, Log, Alerts, ManageMembers, Projects, BusinessFlows, Reports, Api, ApiCatalog, GrpcIngestion)
- Fix BusinessFlowsSpec imports to use ResponseHeader data constructor
- Fix type-level string usage for header lookups
- Fix ProjectId to Text conversions using .toText
- Add missing pattern match cases to avoid incomplete pattern warnings
2025-11-17 11:30:07 +01:00
Anthony Alaribe
c13704adf3 Rename onboarding handlers for consistency and cleanup config
- Renamed onboardingInfoPost -> onboardingInfoPostH
- Renamed onboardingConfPost -> onboardingConfPostH
- Updated Routes to use renamed handlers
- Removed unused notifChannels function
- Cleaned up BusinessFlowsSpec comments
- Updated auto-instrument config (commented out ATBackgroundCtx target and some span attributes)
2025-11-17 09:25:29 +01:00
Anthony Alaribe
f10795b158 Refactor integration tests to use simplified testServant helper
Simplified test code by:
- Replacing verbose toServantResponse pattern with concise testServant helper
- Changed test lambdas from \tr@TestResources{..} to \tr for cleaner syntax
- Updated field access to use dot notation (tr.trPool, tr.trATCtx, etc.)

This reduces boilerplate and improves test readability across all integration
test suites while maintaining the same functionality.

Affected test suites:
- Pages (ApiSpec, LogExplorer, Anomalies, Projects, Endpoints, Reports,
  Monitors, BusinessFlows, Share)
- MonitoringSpec
- ProcessMessageSpec
2025-11-17 09:04:28 +01:00
Anthony Alaribe
04e21f37ee Add business flows integration test suite
Add comprehensive integration tests for business-critical workflows:

- Onboarding flow: Test all steps (Info, Survey, NotifChannel,
  Integration) through handlers, verifying data persistence via
  GET endpoints
- LemonSqueezy billing: Table-driven tests for webhook events
  (subscription_created, cancelled, resumed, expired)
- Replay session recording: Test event ingestion and retrieval
- S3 configuration: Validation and removal tests (pending Minio setup)

Tests use the new structured response types to verify handler behavior
without HTML parsing. Includes table-driven testing patterns for
webhook scenarios and helper functions for creating test payloads.
2025-11-16 01:46:02 +00:00
Anthony Alaribe
c8a9007920 Refactor OTLP test helpers into TestUtils module
Move test helper functions for creating API keys and ingesting
telemetry data (logs, traces, metrics) from GrpcIngestionSpec into
the shared TestUtils module. This includes:
- createTestAPIKey: Create API keys via handler
- ingestLog/Trace/Metric: Ingest via resource attributes
- ingestLogWithHeader/TraceWithHeader/MetricWithHeader: Ingest via gRPC Authorization header
- toBaseServantResponse: Run base context handlers in tests

Add necessary imports (Proto, OTLP modules, Api module) and derive
Generic for AuthContext to support the new test infrastructure.
2025-11-16 01:43:22 +00:00
Anthony Alaribe
8477228369 Update integration tests to pass logger to logging helper
Pass logger parameter to logBackgroundJobsInfo calls to support
the new structured logging interface.
2025-11-15 21:48:42 +00:00
Anthony Alaribe
8c2b7e1b3e Add gRPC metadata authentication and fix grapesy API compatibility
Metadata authentication:
- Add OtlpRequestMetadata type to parse Authorization header from gRPC metadata
- Support both 'Bearer <token>' and raw token formats
- Update processTraceRequest, processLogsRequest, processMetricsRequest to accept
  metadata API key parameter
- Add RPC handlers that extract API key from gRPC metadata
- Combine metadata API key with resource attribute keys for authentication
- Add test helpers for ingesting telemetry with gRPC headers

Grapesy API compatibility (for upgraded library):
- Replace NoMethods with NoMoreMethods constructor
- Update sendFinalOutput calls to pass tuple (defMessage, NoMetadata)
- Add type instance declarations for response metadata
2025-11-15 20:06:37 +00:00
Anthony Alaribe
499b7038c5 Fix test assertions and exception handling in GrpcIngestionSpec
Update expectLogsJson helper to use fail instead of expectationFailure
for proper IO type compatibility, add handling for LogsPatternList
constructor, and fix Test 3.2 to properly expect GrpcUnauthenticated
exception when API key is missing.
2025-11-15 05:59:13 +00:00
Anthony Alaribe
32a4be21c4 Fix type signatures and add missing import in GrpcIngestionSpec
- Add Data.Aeson qualified import
- Fix queryLogs return type: LogsResp -> LogsGet
- Make expectLogsJson type more specific
- Add LogsQueryLibrary case to expectLogsJson pattern match
2025-11-15 05:59:12 +00:00
Anthony Alaribe
8b0d315756 Add test infrastructure for gRPC ingestion tests
- Export gRPC handlers and process functions from OtlpServer for testing
- Add runQueryEffect helper in TestUtils for chart query testing
- Fix ProjectsSpec test to verify updates in list instead of relying on index
2025-11-15 05:59:12 +00:00
Anthony Alaribe
b977108665 Refactor GrpcIngestionSpec with helper functions
- Add testTimeRange constant for common time range setup
- Add helper functions: ingestLog, ingestTrace, ingestMetric
- Add queryLogs helper to replace repetitive 22-parameter apiLogH calls
- Add expectLogsJson helper for unified response extraction
- Use traverse and zip/zip3 for cleaner iteration patterns
- Reduced from 447 lines to 176 lines (60% reduction)
- All tests still target complete handler chains
2025-11-15 05:59:11 +00:00
Anthony Alaribe
a4ccb14bd2 Refactor integration tests to use TestResources pattern
Update integration tests to use the new TestResources pattern for better
test organization and consistency.

Changes:
- Replace withSetup callback with withTestResources
- Use runTestBg helper instead of runTestBackground
- Access test resources via TestResources record fields
- Remove redundant imports (execute from DBT)
- Simplify test setup code

This refactoring improves test readability and reduces boilerplate.
2025-11-15 05:59:09 +00:00
Anthony Alaribe
5ab5c35edd improve background job handling and make tests more precise in job handling 2025-11-15 05:54:10 +00:00
Anthony Alaribe
614715b313 fix tests and reduce default limit to 500 for weaker conections 2025-10-26 23:10:32 +01:00
Yussif Mohammed
d6fa7c1f66 fix integration tests with events table updates enabled 2025-10-22 21:00:39 +00:00
Yussif Mohammed
446604315f fix test and remove redundant imports 2025-10-14 18:14:58 +00:00
Anthony Alaribe
f344f88dac fix the argument issues from apiLogH in the tests, so tests compile 2025-10-12 20:17:13 +02:00
Yussif Mohammed
172d56083d fix tests 2025-10-05 07:58:27 +00:00
Yussif Mohammed
3b2fcae21b fmt and fix tests 2025-10-02 11:22:14 +00:00
Yussif Mohammed
3678d62308 fix tests 2025-09-28 08:51:55 +00:00
Yussif Mohammed
da952749ca fix tests 2025-09-21 21:34:11 +00:00
Anthony Alaribe
31e5f55e3f deploy irrespective of the tests status 2025-09-14 22:53:50 +02:00
Anthony Alaribe
4b4ed0252a rename project to monoscope 2025-09-14 19:55:26 +02:00
Anthony Alaribe
63d8ef3369 remove base64-bytestring 2025-09-13 21:36:57 +02:00
Anthony Alaribe
b6711269aa
Support Basic auth (For opensource users) and investigate performance issue in onboading due to returning 401 unauthenticated, causing repeated authentication checks. (#193)
* support for basic auth for open source users

* implement basic auth support

* introduce support for basic auth and support disabling the client side monitoring via monoscope-browser

* pass in the entire config to bodywrapper

* support leaving unused fields as optional

* make fmt

* add posthog

* configure external scripts via env variables

* make fmt

* fix compile errors
2025-09-12 17:06:32 +02:00
Anthony Alaribe
7c60e95bdf introduce back anomaly list tests 2025-09-08 20:47:05 +02:00
Yussif Mohammed
f6b7fe1f7a fix failing tests 2025-09-06 21:06:12 +00:00
Anthony Alaribe
7cde215aa0 skip the anomaly list test for now, since it needs to be properly rewritten 2025-09-05 04:09:15 +02:00
Anthony Alaribe
988c220c68 comment out the anomaly list test for now 2025-09-05 03:58:14 +02:00
Anthony Alaribe
e5df126102 fix issue preventing the AlertsSpec from passing 2025-09-05 03:54:33 +02:00
Anthony Alaribe
0ac389984a fix test compilation error due to the byte libraris. would have to remove one of the libraries soon 2025-09-05 03:18:52 +02:00
Anthony Alaribe
09e67ab30c fix api catalog related failing tests especally for anomaly 2025-09-05 02:59:16 +02:00
Anthony Alaribe
4487a26482 fix issues so the projectspecs test passes 2025-09-05 02:30:31 +02:00
Anthony Alaribe
fc49553dbf fix the ProjectsSpec tests 2025-09-05 01:59:25 +02:00
Anthony Alaribe
0dd323ac90 disable refreshing non existent materialize views 2025-09-05 01:28:56 +02:00