monoscope/static/migrations
Anthony Alaribe bccc1bbacd
Github 2-way sync with a repo (#244)
* add git sync for dashboards

* fix: improve git sync reliability and code quality

- Fix race condition: store root tree SHA instead of file entry SHA

- Fix empty token handling: preserve existing token when form empty

- Improve decryption: return Nothing on failure

- Replace inefficient JSON parsing with parseMaybe

- Replace manual toHex with base16-bytestring

- Add uuid-quasi for compile-time UUID validation in tests

* refactor: consolidate git sync helpers and reduce code duplication

* Auto-format code with fourmolu

* refactor: improve git sync code quality

- Webhook validation now returns Either for better error messages
- Add SQL column constant to reduce duplication
- Simplify Map construction with inline lambda
- Improve pattern matching exhaustiveness in gitSyncPushDashboard
- PackageImports kept for explicit crypto package disambiguation

* Auto-format code with fourmolu

* refactor: improve code quality and fix SQL injection risk

- Use pg-entity _selectWhere/_delete instead of manual column lists
- Fix SQL injection in selectDashboardsSortedBy with whitelist approach
- Add Entity instance for GitHubSync for type-safe queries
- Replace two-pass partition with single-pass foldl' in git sync
- Parallelize file fetching during git sync using Ki.scoped
- Qualify SqlQQ import to avoid collision with Variable.sql field
- Rename key params to encKey to avoid shadowing Data.Aeson.Lens.key

* Auto-format code with fourmolu

* feat: add comprehensive GitHub sync setup instructions

- Show full webhook URL with copy button
- Add step-by-step guide for creating GitHub personal access token
- Document expected repository structure (dashboards/*.yaml)
- Show example dashboard YAML format
- Include webhook setup instructions for auto-sync

* refactor: use markdown for git sync setup instructions

- Replace verbose HTML with markdown quasi-quotes
- Use MMark to render markdown to HTML
- Much cleaner and easier to maintain documentation
- Removes mmark from unused packages warning

* refactor: improve code quality and add decryption logging

- Add logging when GitHub sync token decryption fails to aid debugging
- Replace foldl' partition with idiomatic list comprehensions
- DRY duplicated SQL queries in selectDashboardsSortedBy
- Use pg-entity _selectWhere for type-safe query building
- Use RecordDot syntax instead of fromOnly in getDashboardByBaseTemplate

* Auto-format code with fourmolu

* refactor: improve code quality and security

- Add warning log when webhook accepted without secret validation
- Extract withDecryption helper to DRY decrypted getter functions
- Use foldMap for efficient buildSyncPlan implementation
- Extract delete fields in list comprehension to avoid pattern warnings
- Remove unused imports (foldl', Data.Map.Strict)

* style: fix hlint suggestions

- Use point-free style for Ki.fork composition
- Remove redundant toStrict call
- Parenthesize unary negation for clarity
- Remove redundant brackets around V.fromList

* style: remove unnecessary package qualification for base16-bytestring

* Auto-format code with fourmolu

* fix: resolve CI warnings and errors

- Add fromJust import to GitSyncSpec.hs
- Remove unused Job parameter from processBackgroundJob
- Fix ambiguous record fields in DashboardsSpec.hs using lens syntax
- Remove undefined usage in BusinessFlowsSpec.hs

* refactor: simplify withDecryption using maybe and either

* Auto-format code with fourmolu

* refactor: simplify git sync error handling and use pg-entity

* fix: resolve CI compile errors in tests

* fix: resolve DashboardVM field access ambiguity in tests

* fix: use record dot syntax for DashboardVM, qualified for DashboardForm

* security: use constant-time comparison for HMAC validation

* refactor: use point-free style for encryptToken

* refactor: flatten nested case with tuple pattern matching

* refactor: use lens for decryptSync, fix constEq type ambiguity

* refactor: use bimap for base64 errors, Ki.awaitAll for parallel exec

* Auto-format code with fourmolu

* refactor: simplify sort field handling with lookup table

* perf: fix N+1 query by pre-fetching teams before parallel sync

* fix: use mkDashboard helper to avoid ambiguous record update

* perf: use T.filter instead of T.replace for newline removal

* refactor: use point-free style for titleToFilePath

* feat: add GitHub sync E2E tests and fix empty repo handling

- Add comprehensive E2E integration tests for GitHub sync

- Handle 404 from GitHub tree API as empty tree (for repos with all files deleted)

- Add updateTags function to update dashboard tags during sync

- Fix SyncUpdate to also update tags when pulling from GitHub

- Add Default instance for GitHubSync

- Add detectDefaultBranch function for auto-detecting repo branch

* Auto-format code with fourmolu

* Github.hs

* Auto-format code with fourmolu

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
History 2025-12-26 01:19:12 +01:00
..
0001_create_monoscope_tables.sql Alerts view & Error details page (#225) 2025-12-23 17:54:20 +01:00
0002_logs_traces_metrics.sql add error column to otel logs and spans table 2025-09-06 18:28:18 +00:00
0003_facets_table.sql unit tests pass. checkpoint towards passing integration tests 2025-07-03 15:15:11 +02:00
0006_add_llm_enhancement_tracking.sql fixes for integration tests 2025-10-18 02:17:33 +02:00
0007_rebuild_issues_table.sql fix migration files 2025-08-25 21:47:57 +00:00
0008_use_non_defferable_contraint_on_issues.sql fix log pattern extraction memory usage 2025-09-29 10:12:42 +00:00
0009_make_retention_policy_30.sql increase retention policy to 30 days 2025-08-30 20:08:52 +00:00
0010_requbild_ers_view.sql fix endpoints list page 2025-09-01 10:03:39 +00:00
0011_host_request_stats.sql make apicatalog a materialized view 2025-09-01 11:29:52 +00:00
0012_drop_materialized_views.sql drop views 2025-09-01 14:59:02 +00:00
0013_log_patterns.sql Log patterns (#200) 2025-09-27 10:58:23 +00:00
0014_alerts_config.sql configure endoins and error alerts 2025-10-02 10:40:45 +00:00
0015_summary_pattern.sql generate patterns for summary 2025-10-12 05:58:08 +00:00
0016_drop_overly_restrictive_issues_constraint.sql Fix issues table constraint to allow multiple query alerts 2025-11-15 05:59:08 +00:00
0016_reports_start_and_end_time.sql New Reports UI (#207) 2025-11-13 07:45:20 +00:00
0017_teams_table.sql Teams rebased (#233) 2025-12-18 23:38:00 +01:00
0018_store_monitor_runs_as_events.sql Alerts view & Error details page (#225) 2025-12-23 17:54:20 +01:00
0019_add_trace_id.sql Alerts view & Error details page (#225) 2025-12-23 17:54:20 +01:00
0020_github_sync.sql Github 2-way sync with a repo (#244) 2025-12-26 01:19:12 +01:00