Commit graph

50 commits

Author SHA1 Message Date
Anthony Alaribe
34b3ba81cb
Failed local CI keeps the services' logs before anyone tears them down (#904)
Integration flakes that read back nothing after an ingest were undiagnosable:
the retry's `make ci-down` removed the services and their logs with them.
2026-11-14 00:04:02 +01:00
Anthony Alaribe
8cf7fc99c2
Proofs wait for their base's workspace build; checks get 15 minutes, reviews 45 (#883) 2026-11-12 22:18:43 +01:00
Anthony Alaribe
54fb404503
Image builds on a stale base no longer overwrite the shared compile cache (#865)
#862 changed only TypeScript, yet its image build recompiled 133 modules for
26 minutes: the cache's last writer predated #859, so every module #859 touched
looked changed. Only builds containing master write back now.
2026-11-11 19:34:27 +01:00
Anthony Alaribe
72a7b4b47e
repo-lint check: actionlint over the workflows and hpack-check over monoscope.cabal (#866)
Nothing parsed the workflows (#859 broke Deploy with an expression no check read), and CI
regenerates monoscope.cabal before building, so a stale committed file (#858) passed every gate.
2026-11-11 18:07:26 +01:00
Anthony Alaribe
25e32eb274
Sign-offs with nothing left to run no longer queue behind the local CI lock (#863)
Attestations are checked before the lock, and hlint and release-tests run on
the host outside it; only pending container checks wait.
2026-11-11 17:02:58 +01:00
Anthony Alaribe
3027245589
Deploys wait for the Mac's image; image-follow; reliable sign-off; typed dashboard edit refusals (#859)
* Deploys wait for the Mac's image; image-follow builds master's head; CI image bakes ffmpeg/graphviz; dashboard edits refuse missing dashboards, tabs and widgets

- release.sh: the deploy's image step waits up to wait_minutes for the image, and stops early once master moves on
- make image-follow: builds only master's newest head, cancelling a superseded build
- Dockerfile.deps bakes ffmpeg/graphviz; ci.sh's fallback install is bounded
- query-preview test polls for CodeMirror's time-sliced highlighting
- EditRefusal: DashboardGone/TabGone/WidgetGone join EditReadOnly in the route types
- CLI: disambiguate EventsSearchOpts record updates

* log-list test: poll for the load-newer reveal scroll, which lands on a later frame under load

* image-follow: an image already built for the merged tree counts

* hpack: list migration 0278 in monoscope.cabal
2026-11-11 14:56:55 +01:00
Anthony Alaribe
9806402c06
Proof comments: issues found while testing, many claims per recording, a player bar and a rating link (#858)
* Proof comments: issues found while testing, many claims per recording, a player bar, and a rating link

Recordings can prove several planned claims (covers), a review can check up to twelve, and anything
a recording shows broken that the PR does not claim becomes a caution callout. The preview's
timeline brackets the clip with its start and end times; the footer asks whether the proof got it
right through signed Yes and No links.

Also: deploys restart the proof worker only once no review is running; a saved proof setup is
dropped when .monoscope/PROOF.md changed since it was recorded; Live Tail keeps three-digit
milliseconds; plan_proofs is tested through the native host.

* Rating asks before it records; review follow-ups

A rating link only asks, and the button POSTs, so mail scanners and unfurlers that open every link
cannot answer. An issue must cite its recording; a retry clears an old rating; the rating question
appears only with recordings. A failed image pull fails the deploy again, and a second ship reuses
the pending restart. A truncated GitHub comparison and a failed one are both logged and drop the
saved setup. The player bar's right-hand time is the video's length.
2026-11-11 13:52:17 +01:00
Anthony Alaribe
bb7b012808
Reviews: a re-ask after a finished review starts fresh; retries are bounded per chain; ship redeploys the proof worker (#823)
A second delivery of @monoscope prove it re-queued a completed review. Its fresh execution found
no saved session and the finished review's model calls, and failed as a lost session; every
retry then landed on a zero-slot node that re-deferred it as a new job with fresh odd-jobs
attempts, so it failed 54 times. The session guard now applies only to continuations, a lost
session ends the chain, and agent retries stop after three executions in one chain.
Publication recovery reuses the stored result and keeps retrying until it reconciles.

make ship now rebuilds the proof worker from the deployed production image (only its own
layers build) and restarts it on IMPACT_WORKER_HOST; make deploy-worker does it alone.
2026-11-10 00:52:09 +01:00
Anthony Alaribe
0f16b1dd89
Reap orphaned GHCi sessions and CI stacks; cap GHCi heap at 16g (#800)
ghcid stops cabal repl but not its setup/ghc children, which reparent to
launchd and keep 5-50 GB each (15 of them, ~132 GB, froze the Mac; two held
:8080 with stale code). Both watchers now reap before each start and after
each load. CI stacks of deleted clones are swept on every local run and down.
2026-11-06 14:34:59 +01:00
Anthony Alaribe
8f7b3438d0 Consolidate src/Pkg (45 -> 29 modules); nested monitor YAML config
Pkg consolidation:
- Slack OAuth, rate limiting and MCP reads -> Pkg.Slack
- ErrorMetrics -> Metrics; Sampling -> IngestBudget; Pkg.UUID inlined into Telemetry
- Rum -> Parser; Facets -> Components.Table; TraceSessionCache -> QueryCache
- PatternMerge -> Drain (stripCodeBlock moves to Data.Effectful.LLM to drop the Pkg.AI edge)
- SchemaLearning Catalog+Hot -> Pkg.SchemaLearning; the flush worker -> Models.Apis.SchemaCatalog
- AgentOperation -> AgentCatalog (AgentAwaitingReview -> CodeReview.Types to break the cycle)
- TestClock -> Data.Effectful.Hasql, beside runHasqlPool
- Icons.TH -> DeriveUtils, icon table -> Utils
- StackTrace folded into ErrorFingerprint: one StackFrame type and one renderer;
  the runtime grammar stays frozen (fingerprints), framesFor is the lossless view grammar
- OperationCall and AgentPolicy JSON derived via deriving-aeson; wire format unchanged,
  the never-shipped nullary Administration decoder and its spec block removed
- Qualified aliases renamed to their modules

Also: nested condition/evaluation/notify monitor YAML (shared Pkg.MonitorConfig),
docs moved to monoscopehq.com, npm CLI packages removed, tests/golden -> test/golden.
2026-11-05 00:54:10 +01:00
Anthony Alaribe
923b293093
Reuse local production images after dependency tag updates (#776)
* Reuse verified local production images across dependency tag updates

* Clarify source-tree alias verification in local CI guide
2026-11-02 12:27:04 +01:00
Anthony Alaribe
d5671d62ee
Unify autonomous agents across Slack, web and native jobs (#619)
Slack, web conversations, routines and native review/fix jobs share the capability catalog, current authority checks, run ledger and operation receipts. Runs, charts and saved reports open inside the conversation inspector.

Consolidates duplicate regression suites and documentation while retaining the product contracts, native recovery evidence and migration baseline transition.

Validation: all eleven exact-input local checks pass, including 1,216 integration examples (25 pending VM cases), 2,105 doctests, 315 unit examples, 16 CLI examples, 1,041 UI tests and 172 browser tests (one skip). Separate native/KVM acceptance is recorded in the review. The exact Linux AMD64 image was built locally on this Mac with OrbStack/Rosetta.
2026-11-02 11:15:00 +01:00
Anthony Alaribe
cf8df3eefd
Escape dashboard variables in query templates; harden local CI and dev tooling (#752)
* Escape dashboard variables in query templates; harden local CI and dev tooling

Security
- Dashboard templates quote request variables ('{{var-x}}' in SQL, "{{var-x}}" in
  KQL) but received them verbatim, so a quote in a URL value ended the literal and
  the rest ran as SQL. fillQueryTemplate now takes the template language and escapes
  var- values for it, once, where text becomes a query (maps stay raw, so the cache
  key path that re-feeds presets no longer double-escapes). Server presets are
  merged after request params, so a request can no longer re-point project_id or
  time_filter. Variable/constant KQL queries use the KQL presets.
- Bump overrides for dompurify (^3.4.17) and tmp (^0.2.6), pin katex for
  micromark-extension-math, and override @babel/core and postcss-selector-parser;
  root lock regenerated with npm 10 (npm 11 drops bundled optional deps and breaks
  npm ci).

CI / dev
- Local CI builds its Linux chart-cli to a container path (CHART_CLI_PATH) instead
  of overwriting the host's native ./chart-cli through the bind mount.
- scripts/e2e.sh refuses a server binary older than the Haskell source.
- Watchers restart ghcid when it gives up after a branch switch, and log it.
- hpack-check runs before ci-signoff.
- Integration shards record their exit status; a shard that crashes after a
  clean summary is now reported with its signal instead of skipped.
- Heavier widget-drawer e2e tests get test.slow() and longer inner waits.

Cleanup
- Weekly report chart URLs are Maybe Text end to end (no "" sentinel).
- tab.slug is the single tab-name slug rule.
- streamFrames/completeFrame live in TestUtils; specs render via renderT.

* Pass the template language in DashboardTemplatesSpec
2026-10-30 15:25:27 +01:00
Anthony Alaribe
f3a3a9ce89
Add RUM audience breakdowns and reusable segments (#740)
* Highlight the selected visualization tab with brand colors

* Add RUM audience breakdowns, investigation filters, and saved segments

* Declare form decoding dependency for integration tests

* Check expanded RUM templates for query scoping

* Supply required summaries in RUM browser fixtures

* Prepare shared npm dependencies before parallel CI lanes

* Target the segment disclosure explicitly in browser coverage
2026-10-26 17:35:20 +01:00
Anthony Alaribe
8890344e96
Share local CI caches across checkouts (#711)
* Share local CI dependency caches across checkouts

Each checkout path got its own cabal/npm/playwright volume set, so every
worktree and signoff clone leaked ~8GB of content-keyed caches; 35 sets had
piled up. Share those. dist-newstyle stays per checkout: sharing it was tried
and weeder then reported live functions as dead, because unchanged modules
lost their .hie files after another branch built into the volume.

* Note that local sign-off must stay fast

* Share dist-newstyle across checkouts; weeder repairs missing .hie files

After another branch built into a shared dist, GHC can leave a live module
compiled without its .hie, so weeder misses every reference it makes and
reports live functions dead. The weeder check now recompiles any tracked
module missing one (dropping cabal's build stamp, since a touch leaves the
source hash unchanged) instead of every checkout paying a cold build.
2026-10-25 13:40:21 +01:00
Anthony Alaribe
e98d6858a8 Stop rebuilding the production image from scratch in CI
The image job took ~66 min because CI almost never found a prebuilt
image: local sign-off built it emulated (slow, and it crashed the local
Docker), and the fourmolu bot ran a different version than laptops, so
it rewrote signed-off trees and changed the image's tree fingerprint.
When CI did build, the dist-newstyle cache mount died with the runner.

- Default the image builder to the native amd64 builder when it exists.
- Pin fourmolu in the Makefile for both laptops and the bot; sign-off and
  ship refuse an unformatted tree.
- Carry dist-newstyle across runners via the Actions cache (master saves,
  PRs restore read-only).
2026-10-24 13:24:16 +02:00
Anthony Alaribe
d8b3bf853a
Add project wiki with revision history and permission checks (#689)
* Add project wiki with revision history and permission checks

* Address wiki review and disclose bounded lists

* Use typed wiki pages and shared morph navigation
2026-10-22 13:48:09 +02:00
Anthony Alaribe
713be27289
Rare error rates no longer read 0; cap explorer rows server-side; #678/#679 review fixes (#681)
* WIP: review follow-ups, rare-rate display, explorer truncation test

* WIP: avoid shadowing tokens

* WIP: cap explorer row cells server-side

* WIP: doctest type

* live-test-dev prints its active .test-args into the log

* capRowValue via lens-aeson's Plated Value

* fmt

* Live Tail tab previews long bodies instead of laying them out whole

* Local e2e pins the asset fingerprint, as the image build does

The shared dist-newstyle volume kept an asset-hash splice built against another
tree's bundle, so pages referenced chunks the current build did not have.

* Rebuilt Vite bundle re-splices asset URLs: cabal now monitors the manifest

Cabal ignores TH addDependentFile, so a dist-newstyle reused across trees kept
the old entry chunk. Replaces the local e2e fingerprint pin, which edited the
bind-mounted tree and never ran under sign-off.

* Live tail preview keeps the truncated marker; row cap lives in Pkg.LiveTail

Review: freeTextLongest inlined at its one use; doctest pins has_all before has.

* log-list: MAX_FIELD_CHARS points at Pkg.LiveTail
2026-10-20 23:21:14 +02:00
Anthony Alaribe
7591c7c22a
Parser follow-ups: typed operators and query hints; kafka-topics on bash 3.2 (#679)
* Parser follow-ups: typed query hints, FreeTextMatch, kafka-topics on bash 3.2

- QueryError carries a hint ("Did you mean…", "quote it…") apart from the
  message; queryErrorText joins them for one-line surfaces, the editor joins
  them for display. Drop validateFields: live tail re-ran the unknown-field
  check parseQueryToAST had just run.
- FreeTextMatch = Word | Sequence derives the phrase regex in one place.
- kafka-topics.sh crashed silently under macOS bash 3.2 with no SASL user
  (empty array under set -u); strip quotes from .env values.
- Document that And/Or short-circuit; pin "a b" == x as an error.
- Explicit ping and frame flags in live-stream/log-list.

* Expr: Cmp/Match/ValCmp over operator enums instead of 24 constructors

Each operator is spelled once (cmpTokens/matchTokens) and the parser tables are
generated from the enums, so Display/ToQueryText/Eval/traverseAst are total by
construction: no table scan, no error arms, and a new operator is a compile
error at every site that must handle it. SQL and KQL rendering is unchanged
(every display/toQText doctest output is byte-identical).

* Type operator identity through SQL and jsonpath lowering

displayExprHelper, renderJsonpathSQL and lowerPred took the rendered SQL token
and re-parsed it (lookup tables, stripPrefix "NOT "). They now take
Either CmpOp MatchOp; matchPolarity gives negation, and the unreachable
UnknownOp becomes Negated MatchOp.

* fmt

* Guard kafka-topics.sh on bash 3.2 without SASL creds; tighten sqlOp

ci-selftest runs the script under /bin/bash with a stub rpk and no username,
the case that died silently on an empty array under set -u.

* Validate test reads the suggestion from hint
2026-10-20 13:55:49 +02:00
Anthony Alaribe
5d92f681ef
Fix live tail freeze, free-text search, Databases tab errors; clear live_tail Kafka (#677)
* Cap live-tail bodies inside lists; make live_tail retention actually delete

Live tail capped only top-level strings, so the raw log body rode inside the
summary list and multi-MB rows reached the browser. Truncate recursively.

The live_tail topic had 10-minute retention but default 14-day segments, so
no segment ever closed and nothing was deleted (oldest row was 9.3 days old).
scripts/kafka-topics.sh converges the topic config (make kafka-topics; run
best-effort by make ship).

* Stop live tail freezing the tab on high-volume projects

- Merge pushed rows once per animation frame instead of per SSE frame.
- At the retention cap, cut the far end without remounting the virtualizer
  while the reader sits at the insertion edge (it remounted per frame).
- Split a drain into frames of at most 100 rows.
- Heartbeat is a ping event; the client reconnects after 25s of silence
  instead of showing a dead stream as live.
- Cap rendered summary elements at 8000 chars in the list.

* Search free text with a quoted string

A standalone quoted string ("deadlock") now matches body, status_message or
name case-insensitively, in the explorer and in live tail. Span errors such
as MySQL deadlocks live in status_message, which body-only searches missed.
A bare unknown word still errors, now with a hint to quote it.

* Databases tab: count errors, show them, make queries copyable

17 errors in 1.4M MySQL queries rounded to 0.00%. DB tables and the stat
tile now show error counts, a Recent Database Errors table shows each
failure's message and query with a link to the matching spans, query cells
get a copy button, and rows without a click action no longer look clickable.

* fmt

* Say a log query timed out instead of showing a JSON parse error

A gateway 504/524 returns HTML; the worker parsed it as JSON and the list
showed "Unexpected token '<'".

* Plan and status for the Shipbubble Loom feedback

* Bound live rows buffered in a hidden tab; keep row hover on all tables

* Simplify pass: shared caps and hints, short-circuit Or, validate free-text columns

* fmt

* Review fixes: exhaustive Expr rendering, andM/orM, safer kafka-topics

- Display/ToQueryText list every binary constructor instead of a catch-all,
  so a new Expr constructor is a compile error, not a runtime one.
- Evaluator short-circuits with andM/orM.
- Doctests pin single-quoted free text and that an unterminated quote errors.
- kafka-topics.sh reads .env as data (no eval), passes rpk args as arrays,
  and notes partitions apply on create only; make ship warns loudly on failure.
- !has row matches has; drop the working plan doc (the PR body carries it).
2026-10-20 11:30:54 +02:00
Anthony Alaribe
7b716603fe Consolidate shared UI components, distill backend, enforce per-handler project membership (#670)
- Shared component surface (tone pills, options_, disclosure_, lazyPanel_, TableResponse); distilled pages, models, jobs and ingestion
- Project membership enforced on handlers that skipped it; an explicit role binds sudo users too
- Widget-add toast server-side only; metric rows push URL via htmx
- Doctest fixes; weeder step drops orphaned .hie files from restored caches
2026-10-11 09:48:06 +02:00
Anthony Alaribe
2f1419a968
Prepare CLI v0.6.31 and fix installed-version detection (#669) 2026-10-10 23:40:42 +02:00
Anthony Alaribe
f3645bd7bb
Add first-class repositories and improve settings workflows (#665)
* Show billing downgrade recovery and customer super-admin notices

* Unify repositories, source context, reviews and multi-repository dashboard sync

* Show read-only repository settings without unavailable editing actions

* Connect repositories with tokens independently of dashboard sync

* Preserve unpublished dashboards and recover repository imports

* Add repository lifecycle controls and require explicit dashboard ownership

* Queue the first dashboard import for token connections

* Harden repository sync and polish settings permissions and recovery

* Enforce stored roles for project settings and deletion

* Restrict member role changes and removal to project admins

* Auto-format code with fourmolu

* Canonicalize GitHub identities and recover legacy repository selection

* Initialize reactive extensions before processing the page

* Keep reactive initialization off the parser path

* Bound repository sync retries and batch imports and exports

* Keep Prometheus target filtering compatible with shared search helper

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-10-10 16:54:17 +02:00
Anthony Alaribe
ffd46239ad Faster local sign-off: build the deploy image alongside the checks
- make ci-signoff builds the deploy image in parallel with the checks when the
  tree is committed, so make ship only has to deploy.
- Deploy images build on this machine by default; the SSH builder (the
  production host) is opt-in via MONOSCOPE_BUILDER.
- Local builds skip the registry cache export (minutes per image); GitHub
  runners, which start without a cache, keep it.
- Local e2e runs with more Playwright workers (E2E_WORKERS, default 6);
  GitHub keeps 2.
- Doctests join integration and e2e as background lanes after build, running
  the prebuilt binary; release-tests run on the host meanwhile.
- CI Postgres runs without fsync: each example's CREATE DATABASE drops ~1s.
- Dockerfile: GIT_HASH is declared after the runtime apt layer (it rebuilt
  that layer, ~2 min emulated, on every commit), and COPY --chown replaces a
  chown -R layer that duplicated 170MB into every push.
- e2e: the template-modal layout check measures after the open transition.

Signoff 5.5 min -> under 3 min with the image built in parallel.
2026-10-07 02:17:45 +02:00
Anthony Alaribe
2d6b08019b
Reuse PR production images and reject stale deployments (#651)
* Reuse PR production images and reject stale deployments

* Use existing Node tooling for release regression tests

* Cover digest deployments and explicit rollbacks

* Seed Cabal cache mounts from prebuilt dependency image

* Wait for dashboard tab arrival before renaming widgets

* Use Docker digest output and clarify deployment guards

* Preserve registry lookup diagnostics during image builds

* Dismiss onboarding notices before switching framework guides
2026-10-06 23:17:48 +02:00
Anthony Alaribe
383463e7dd
Fix CapRover app token deployment (#622) 2026-10-01 12:10:40 +02:00
Anthony Alaribe
250cb9bfb1
Fix dashboard bug reports; exploratory sweep fixes and tests (#618)
* Fix dashboard list scroll, favorites star, widget counts, widget editor saves/toggles, AI palette time range

- #itemsListPage no longer clips the table (h-full overflow-hidden)
- unstarred favorites star is always visible as a grey outline
- widget count covers tab and group widgets (Dashboards.allWidgets)
- expand drawer saves to the widget's tab; PUT resolves the tab itself, updates group
  children, and 404s instead of toasting success for a widget it never found
- widget editor keeps non-chart widget types, drops the explorer-only Hide timeline /
  Create monitor toggles, and links to its Monitors tab instead
- command palette: first Cmd+K no longer closes itself, Ask AI is clickable, keeps the
  AI time range and sends the timezone
- every time picker on a page reflects the URL range (AI results, widget drawer)

* Widget monitors refuse SQL-only widgets; e2e for dashboard list, drawer rename and palette AI

A raw-SQL widget posts an empty KQL query, which compiled to an all-traffic count.
The Monitors tab now explains instead, and the handler rejects the empty query.

* Modals close on Escape; dashboard tabs keep the picked range; overview Infra stats decode

- modalWith_ heard Escape only on its hidden toggle, never from focused modal content;
  closeModal left body.overflow-hidden behind
- tab and variable links sent the server-rendered since/from/to, so a range picked
  client-side reset on the next tab switch; they now take it from the live picker
- getTimeRange read a nonexistent #custom_range_input and always returned empty
- _overview Infra stats selected ::text || '%' into the numeric stat decoder; every one
  rendered an error overlay

* e2e: a picked range survives a dashboard tab switch

* Lazy-load Tagify so the explorer's monitor teams picker works

The log explorer skips Tagify for load time, but its lazily swapped monitor form
has a tag input; init threw 'Tagify is not a constructor' and teams could not be
picked. Pages without it now carry the asset URLs and fetch it on first use.

* Issue page: live log-pattern seen/count; keep multi-word summary values in one chip

A log-pattern issue row is written at detection, so Last seen and the all-time count
froze while the pattern kept firing (prod: '7 hrs ago, 8 all time' vs 2 min, 92).
Summary text was split on spaces, orphaning '<*> min' outside its chip.

* AI chat widgets get addressable ids; pickers share the URL range; Tagify init stays sync for live instances

- model widgets carry no id, so chat tables targeted '#' and threw in htmx
- time-picker vitest now states the new contract: a URL range relabels every picker
- an input that already holds a Tagify instance is reconciled synchronously

* Review: Plated traversals for the widget tree, exhaustive payload case, chat-id doctest

- allWidgets/overWidgetTree via universeOf/transformOf; dashboardQueryText and
  countWidgetsWithMetric reuse allWidgets (the latter now sees group children)
- patternM matches every IssuePayload constructor instead of a catch-all
- the chat widget-id regression is a doctest on aiChatHistoryView_

* Widget editor links to Monitors only for KQL widgets

* Widget save keeps the sent tab only when the widget is on it; repair stored overview Infra stats

- a stale or missing tab slug falls back to the widget's own tab; a widget id that repeats
  across tabs still updates the tab the client named
- 0209 gives the 3 dashboards holding a copy of the old overview template the numeric
  Infra stat SQL (they rendered 'Query execution failed')
- DashboardTemplatesSpec reuses Dashboards.allWidgets

* Auto-format code with fourmolu

* Improve dashboard template creation previews

* Document production impact review scope

* Build CI test executables during signoff

* Wait for both infrastructure fixture windows

* Allow inventory shell to finish before browser assertion

* Auto-format code with fourmolu

* Repair saved overview stat units and simplify template selection

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-10-01 11:56:14 +02:00
Anthony Alaribe
5f4739f4c3
Overlap serialized browser checks with doctests (#614) 2026-09-30 20:02:49 +02:00
Anthony Alaribe
6ffc45affa
Clean up CI background jobs and shard failures (#613) 2026-09-30 19:43:01 +02:00
Anthony Alaribe
2cfba01b6d
Speed up local CI signoff (#608)
* Skip attested checks before starting local CI services

* Overlap integration and browser checks in local signoff

* Bring full local CI signoff under four minutes

* Keep browser checks responsive under full signoff load

* Run built test binaries during local signoff

* Trim redundant signoff work and stabilize browser readiness
2026-09-30 19:23:12 +02:00
Anthony Alaribe
5bee041d4c
Widget: stat tiles skip the no-data overlay (#608)
* Speed up local CI signoff with parallel builds and browser tests

* Widget: stat tiles skip the no-data overlay

Inside a 7rem stat tile the two-line "No data in this time range" overlay
overflowed and was clipped under the value (production RUM, Browser errors
at 0). The value already says 0; the overlay is for chart panels.
2026-09-30 13:19:53 +02:00
Anthony Alaribe
679a6de51e
CI: derived cabal file is not a fingerprint input; pin hpack 0.39.6 (#606)
The master deploy for 37d5a5951 built green and then exited 1 with
"PASSED build, but inputs changed during the run": CI's hpack 0.39.5
rewrote monoscope.cabal (generated by 0.39.6 locally), and the end-of-run
guard read that as a concurrent edit. package.yaml and hpack-includes are
the inputs; the derived file is regenerated at the start of every run.
Verified with make ci-status: the build fingerprint no longer moves when
the cabal header changes (it did before).
2026-09-30 11:40:21 +02:00
Anthony Alaribe
37d5a59513
Improve RUM, sessions and infrastructure: performance, correctness and live updates (#604)
* Fix RUM sessions, cache concurrency, and infrastructure drilldowns

* Exercise RUM guards against native cache and independent fixtures

* Preserve session list focus and scroll on live refresh

* Cache explicit empty RUM searches briefly

* Verify fresh empty RUM searches reuse cached results

* Fix RUM page links and preserve Explorer regex queries

* Preserve container identity through inventory and drilldowns

Keep namespace, cluster, node and typed scope through inventory grouping, drawer selection, charts and log links. Preserve time ranges and show recovery for ambiguous legacy links.

Regression reproduced collapsed rows and cross-container chart values before fixing. All 13 Containers examples pass on PostgreSQL and fresh native TimeFusion; browser guards pass at 390 and 1280px. Native chart tests use a bracketed explicit test pool because the existing test harness keeps its postgres-simple TF pool on PostgreSQL.

* Preserve RUM session search URLs and service scope

* Address cache review and verify CPU charts through the selected backend

* Revalidate stale RUM session lists inside their swap target

* Expose container identity in narrow table rows

Show full pod, namespace, cluster and node labels beneath container names when the corresponding columns collapse. Wrap UUIDs while preserving the existing desktop columns.

Retained e2e regression covers five same-name identities, including replicas on the same node. Missing namespace and Pod checks failed before the fixes; normal deferred navigation, full metadata visibility and viewport fit now pass at 390 and 1280px. All 13 focused Containers examples pass; formatter, Hlint and review loops are clean.

* Count distinct RUM sessions across the full time window

* Use exposed Servant API parser in container regression

* Preserve native JSON predicates and invalidate stale compiled filters

* Keep loaded RUM summary values visible during live refresh

* Keep Kubernetes container drilldowns within their cluster

* Keep error lifecycle fixture clocks and job stages ordered

* Keep session form windows aligned with the time picker

* Keep container inventory focused on finding entities

* fix(rum): refresh panels with the current picker window

* fix(rum): replace initial panel requests when the window changes

* test(kql): round-trip escaped quoted regex patterns

* Show singleton observations in line charts

* Preserve inventory facets when changing filters

* Keep inventory search accessible on mobile

* Compute RUM web vitals from observation populations

Share scalar and explicit-histogram populations across field, trend and exact URL views. Preserve cumulative baselines, coverage, scalar atoms and metric siblings when capping pages.

Validated: native handler 9/0, PostgreSQL RUM 28/0, formatting and HLint, two review rounds. Styled browser proof remains pending after capture harness timeouts; local doctests failed before examples because the monoscope package was not registered. Combined CI must verify codecs and integrated behavior.

* Keep primary container CPU visible with mobile filters

* Fix mixed vital atoms above finite histogram bounds

* Keep vital trend axes and coverage accurate

* Accept optional starts for delta vital populations

* Keep collector container CPU visible on mobile

* Preserve explicit RUM windows when since is absent

* Reuse RUM cache entries for blank window fields

* Match container summary to its selected time slice

* Use singular labels for individual vital observations

* Reuse RUM populations across equivalent explicit window requests

* Keep RUM vital observations and coverage visible on phones

* Keep partial vital trend buckets inside the selected axis

* test(rum): check singleton point within short time axis

Extend the existing axis browser guard with a fixed 30-second window and actual plotted point containment, scrolling the lazy chart into view. Browser proof remains pending authoritative CI: isolated WAI attempts failed before the existing 1H axis check, so they do not reproduce clipping. The b4 handler regression remains verified.

* Refresh container inventory when its time window changes

* fix(time-picker): apply automatic refresh menu choices

Use native querySelector in the existing hyperscript click handler; keep the hx-live proxy bindings unchanged. The browser regression reproduces Off retaining interval 15000, then verifies default, Off, 30s and 15s states and selection at mobile and desktop widths after the fix. Focused browser: 1 passed (4.0s); formatting and lint passed. Full CI remains pending parent verification.

* Load RUM panels before application globals initialize

* Refresh infrastructure inventory when its time window changes

* Keep page vital measurements readable on mobile

* Keep infrastructure refresh hyperscript covered by parser checks

* Preserve refreshed chart registry through HTMX settling

* Preserve captured error identity in regression lifecycle fixture

* Keep initial RUM requests alive during automatic ticks

* Await infrastructure fixture visibility through shared snapshot cache

* Preserve pending RUM updates and remove redundant prewarming

* Preserve ownership of replacement session searches

* Avoid a separate epoch read for noncumulative RUM vitals

* Scope RUM query-count guard to its handler

* Load selected session details independently of the list

* Send RUM summary widgets as SQL so TimeFusion serves them from rollups

The four summary stats and the activity chart now send the exact
browserScope, pageViewPredicate and errorPredicate SQL that TimeFusion's
rum_* rollup measures declare. KQL's lowering (startswith as a regex,
exception.type != null as a JSON search) could never match them. The chart
becomes one aggregate unpivoted to two series; a page view that errored
now counts in both.

* RUM improvements

* Auto-format code with fourmolu

* Simplify RUM population queries and type query failures

* Harden RUM vital SQL and consolidate regex parsing

* improve signoff

* Consolidate repeated RUM, infrastructure and test logic

- Derive SQL encoding for VitalCoverage/VitalReadKind instead of 12 label bindings
- panelSwapAttrs owns the panel URL and hx-sync; share timeWindowVals_ with Components
- One kqlFilter plus node/cluster fields for container, host and Kubernetes pivots
- linkParams/renderedWidget test helpers; shared histogram and panel-loading builders

* Cache npm downloads and e2e node_modules in local CI

* Auto-format code with fourmolu

* RUM sessions list: paint the newest slice first and bound the follow-up scans

A cold session list over a wide window scanned the whole window three times in sequence
(core, enrichment by id, recording cross-lookup); the panel took 22-97s on a busy project.
Wide cold lists now paint the newest three hours (1.7s) and revalidate the full range
through the stale-serve path; the follow-up scans are bounded to the rows already found;
the recording cross-lookup runs only for text searches.

* RUM: morph live-tick panel refreshes, keep the pulse widgets across revalidation, one empty state for missing Web Vitals

Every panel replaced itself with outerHTML on the 15s tick, and a stale pulse panel re-rendered
its four self-fetching widgets on revalidation — a 2-10s spinner flash on first load. Rendered
panels now morph; a populated pulse skips revalidation. A project that reports no Web Vitals
gets one explanation on the Performance tab instead of five No-data rows and two empty panels.

* Infrastructure snapshot: reduce to the newest datapoint per series before the blob lookups

The pivot evaluated ~20 resource/attributes JSON lookups on every datapoint in the 15-minute
slice (49.9K rows on the demo project) although only the newest row per series survives. A
first window over series_id keeps those survivors, so the lookups run over ~750 rows:
projection 1.37s -> 40ms, cold infra pages 2.4-3.5s -> 0.85-0.92s.

* Charts: update a live echarts instance in place instead of dispose+init; stop the 401 reload loop

A morphed panel keeps its chart element, but every re-init disposed the instance and drew it
again, which blanked all five Web Vitals charts on each 15s tick and cleared the stat tiles'
values while their first fetch was in flight. chartWidget now updates a live instance in place
(hx-morph-skip on the slot), the server-rendered stat value stays until the response replaces
it, and a 401 from /chart_data is verified once before reloading, at most once a minute,
instead of reloading the page on every occurrence.

* RUM: local times, a second signal on rated numbers, family hues off the status hues, widen action on the empty vitals state

Top pages and browser errors printed UTC beside a header showing the viewer's zone; they render
through local-time now. P75 cells carried their rating by colour only and get a dot plus a
screen-reader label. Audience chips used the warning, success and error hues for Linux, Android
and Firefox. The sessions workspace gives the last-page column room to show the distinguishing
tail. The empty Web Vitals state's primary action now does what its copy advises.

* RUM: never cache the newest-3h slice; clamp span pads to the window; release charts a morph left detached

A cached slice would be served as the final list whenever the full revalidation failed. The
recording pad could reach outside the selected range. Charts kept alive across a morph were
never disposed when the fragment that held them left with a tab switch.

* RUM: spanScope doctest builds its scope from the module's own imports

* RUM: show the refreshing hint at the top of a provisional session list

* e2e: a refreshed vital chart keeps its instance on its element

* Infrastructure pages: denser host list, honest drawer empty state, one live region per table, status color only for status

Integration chips no longer wrap into 65px rows or clip the last column, and the empty
Configuration column appears only when a host reports a provider or region. The host drawer's
metrics empty state reloads the drawer at one hour instead of navigating to the host map, and its
copy states the 15-minute freshness slice. Group-by and resource controls drop their duplicate
count live region. Brand and success fills used as decoration (drawer header, count pill, Ready
badges) become plain text with a dot; the one Not ready badge stands alone. Pod names and
workload badges truncate at the end. CPU renders as cores to three decimals on every list.

* RUM: rated cells keep their coverage tooltip; pin that a failed revalidation never serves the 3h slice as final

* e2e: the host drawer's one-hour retry is a button

* Charts: one sweep for registrations whose element is gone, on after:swap and after:settle

An outerMorph settles without firing after:swap, so charts kept alive across a morph and
then removed with the fragment were never released; the two sweeps are now one.

* RUM: refreshing hint on the Overview's recent sessions too; the session list fits a phone

The Overview's recent-sessions panel is served from the same newest-3h slice and now says so.
At phone width the list dropped its Duration column behind a 28rem minimum; the minimum applies
from sm up and the Activity counts hide below it.

* Speed up local CI signoff with cache reuse and serialized runners

* Keep RUM vital reads and session cache behavior correct

* Auto-format code with fourmolu

* Handle empty CI mounts and align host layout assertion

* Infrastructure: drawer retry reuses hostDetailUrl, empty state names the real freshness slice, wrapper divs folded

* Monitors: drop an unused import that fails -Werror

* RUM replay workspace: fact row in the header for every session, selected row scrolls into view, duration column fits a phone

The header showed only avatar, name and id for a session with a recording; duration, page
views, events, errors, last page and service now sit in one fact row for every session. A
shared link's selected row sat thousands of pixels down an unscrolled list; it scrolls into
view once on init and stays put on live ticks.

* Session replay player: fit the frame to the recording's aspect ratio, one-row compact toolbar

Full-width embeds used a fixed 550px frame, so a wide recording sat between black bands (280px at
1440, 367px on a phone). The frame now follows the recording's aspect ratio, clamped to the
viewport. Below 760px of player width the toolbar keeps one row: icon buttons with labels in
tooltips, and the identity no longer truncates.

* RUM: Web Vitals coverage notes say what the export did and what fixes it

* RUM: the Overview's recent sessions are the Sessions tab's list, one cache entry for both

The Overview ran its own span and recording queries under separate cache keys, so visiting both
tabs scanned the window twice. Both now read the unfiltered session search, which already merges
recordings; the two Overview-only query variants are gone.

* RUM panel cache: serve stale entries for twelve hours instead of one

The first visit of the morning paid a cold 24h scan because last night's entries were past the
one-hour horizon. Entries now serve stale and revalidate for twelve hours; the on-write prune
keeps the same bound.

* Infrastructure images: registry names stay on one line and tag pills wrap instead of clipping

* RUM: trim three comments the review pass found restating the code

* local-time: re-localize after a morph swap

A morph patches the element's text back to the server's UTC fallback without touching its
attributes or reconnecting it, so every live tick reverted the page's localized timestamps.

* RUM Overview: one pulse scan serves presence, the session count and the P75 tile

The presence probe was a LIMIT 1 while the four stat tiles each fetched their own number, so
the tiles spun 2–10s after the panel and never shared its cache. The probe is now one aggregate
over the window; the session and P75 tiles render with the panel (and are cached with it), and
the two sparkline tiles keep their own fetch, whose series is the same request as their number.

* RUM pulse: no row means no telemetry; the overview test pins the served tile values

* RUM Overview: all four headline tiles render from the pulse scan

A timeseries stat tile now shows a server-supplied value until its sparkline response brings
the stats, so page views and browser errors arrive with the panel like sessions and P75.

* Log explorer sessions: one grouped scan plus a page-bounded context read

The Sessions viz referenced a wide CTE four times (DataFusion inlines each
reference) with body::text in the projection: 54s on the demo project over
24h. Now one scan per session key with only rollup-servable aggregates
(any per-group distinct count forces the raw store: 7s vs 0.15s), sort,
paging and the header summary in Haskell, then landing url / user agent /
first error / services for the page only, bounded to the page's own span.
The header's service count is a GROUP BY service read on the first page.

traceCount is gone from SessionRow; the [+N] chip counts events, which is
what the expand endpoint returns, and grows with its count. sessionSortColumn
was left with only its doctest and is deleted.

Demo project, 24h: 54s -> 7-28s (scan cold vs warm), load-more 7.6s, 3h 2s.

* Log explorer sessions: a live poll skips the header and its service read

The client's 15s newer-poll sends cursor=… without a window; the sessions
route ignored it, so every tick re-ran the header summary and the service
read on top of the aggregation. The route now takes cursor and a poll gets
rows only; fetchSessions returns Maybe SessionSummary gated in one place.
Poll 1.4s -> ~1.0s on the demo project. Also from the second review pass:
uniqueServices pinned in Test 11.1, an orphaned Default deriving dropped,
the row copy via RecordWildCards.

* Log explorer sessions: run the header's service read under the grouped scan

On projects whose sessions span the whole day the page context read is a
window scan too, so the view was three raw TimeFusion scans in sequence
(7s + 5s + 10s on the main project). The service read is independent of
the scan, so it forks alongside it in a ki scope: 24h view 31.6s -> 16-19s.

* log-list: a live tick during the initial load no longer re-runs it

With the sessions viz on a big project the initial load took 24s, so the
15s tick fired before any row existed; without a cursor it issued a second
full aggregation (15s more TimeFusion time) for nothing. A tick while the
initial or refresh load is in flight is dropped.

* Log explorer sessions: retry transient TimeFusion errors like the data read does

Two concurrent raw scans from one request is the burst shape that trips
TimeFusion's transient resource errors, and the sessions handler was the
one explorer read without retryTransientEff around it.

* Apply the branch review: typed regex lowering, versioned RUM cache keys, explicit vital coverage rank, keyboard-reachable session actions

hs-distill / hs-evasion-review / hs-lob-review over the branch, applied:
- Expr: CaseMode reaches the jsonpath lowering as a type, not a string op;
  compileRegex lives in evalExpr; seedColumns is one modifyIORef'.
- RUM: PulseQuery + queryVersion/rumCacheDbKey replace per-constructor
  key suffixes in the handler; VitalEstimate is a record with optional
  bounds; VitalCoverage priority is an explicit rank, not spelling order;
  interpTimefusion folds the pool routing into one call.
- Widget: hx-morph-skip is static markup; a served stand-in lives in its
  own servedValue field with a null source so the sparkline still loads.
- Components: the table live-tick listener fires on after:settle (an
  outerMorph never fires after:swap); timeWindowVals_ uses window.params().
- Explorer sessions: SessionsRead sum type; the [+N] chip and Replay run on
  click so Enter works; the list header no longer prints a page-local event
  count as the total; histogram bars carry aria-labels; durations roll into
  min/h/d; URLs cap at 40ch.
- Tests: deferredBody/shellHtml shared in TestUtils; RUM spec fixtures
  deduped; doctests for routeKql, VitalEstimate, getDurationNSMS.

* Auto-format code with fourmolu

* Utils: integer literals in the getDurationNSMS doctest

* Shells read the query string inline again; a served stat value wins for any tile type

Two e2e contracts the review pass broke: deferred shells must resolve before
the application script arrives (window.params is not there yet), and the
Sessions / P75 tiles are plain stats whose served value the type-selected
fallback skipped, leaving the tiles blank.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-09-30 11:19:14 +02:00
Anthony Alaribe
5b8891a4c3
Add built-in observability routines (#585) 2026-09-19 23:09:05 +02:00
Anthony Alaribe
6e45e6c35e Improve endpoint analytics dashboard 2026-09-17 14:41:42 +02:00
Anthony Alaribe
70fac604bf
Repair generated manifest and self-contained doctest CI (#574)
* Regenerate cabal manifest for latest migrations

* Make doctest CI self-contained

* Update endpoint analytics E2E title
2026-09-17 13:34:22 +02:00
Anthony Alaribe
35b7a95fd1 Improve dashboard query and panel convergence 2026-09-17 02:03:31 +02:00
Anthony Alaribe
97b78681aa Give cabal its flag as its own argument
`-f-devtest` went into CABAL_OPTS, which every call site passes as ONE quoted
word so the RTS options stay part of --ghc-options' value. cabal read the whole
string as the flag assignment and refused it: "invalid argument to option `-f'".
Flags need their own argv entries, so they get their own unquoted variable.

Caught by `make ci-signoff` — the build check failed in the first seconds, which
is the point of running it locally rather than finding out 30 minutes into CI.
2026-09-16 13:14:39 +02:00
Anthony Alaribe
d530e59b5a Stop CI rebuilding what the deps image and the flag already settled
Two independent leaks, each worth most of a Deploy run's wall clock.

The deps image pre-built only the PROFILING way of every dependency. `profiling:
True` is part of a dependency's store hash — the prof-way entries are different
directories, not substitutes — so CI's ordinary `cabal build all` opened onto an
empty store and recompiled all 434 dependencies in-job, every run. That is the
whole of the ~31min "Build" step. It now builds both ways, vanilla last so the
image's cabal.project.local matches what CI's checkout produces.

`build-type: Custom` makes cabal build EVERY test suite in a package when you ask
it for one, so `cabal test doctests` compiled test-dev first — src/ plus every
integration spec, 210 modules — before running a single doctest, and again in
each later step. test-dev exists only for `make live-test-dev`'s GHCi session, so
it goes behind a `devtest` flag that CI turns off. The flag lives in CABAL_OPTS
because it is part of the plan hash: everywhere or nowhere, or the steps
invalidate each other. `cabal list-bin integration-tests` takes it too, since a
plan that disagrees points at a path the build never wrote.

Both are one-line edits away from silently coming back and nothing else would
notice, so ci-selftest now asserts all three: the gate exists, CABAL_OPTS passes
it, and Dockerfile.deps still builds twice.
2026-09-16 12:07:49 +02:00
Anthony Alaribe
bf5d4a670a Lint the shared and CLI packages too, and fix what that turned up
CI ran `hlint src/`, so monoscope-shared and monoscope-cli — 22 modules, including
the KQL parser and the binary we ship to users — were never linted. shared/src was
already clean; the CLI had eight issues, one of them error severity.

All mechanical, all Relude preferences the rest of the codebase already follows:
T.pack over a String where toText does, T.unwords/T.unlines where Relude's are in
scope, the Data.Set alias the hlint config pins, and a lambda that is a <=< .

cabal test monoscope-cli:cli-tests passes 16/16 and the binary links.
2026-09-16 05:11:44 +02:00
Anthony Alaribe
98c50716b7 Fingerprint the Haskell checks on the static/ dirs they compile in
Three static/ trees are Template-Haskell-embedded into the binary — dashboard
templates via DashboardTemplates, en/es translations via Web.I18n, and the FontAwesome
sprites via Pkg.Icons — but none were in @hs. 27 tracked files that decide what the
Haskell compiles contributed nothing to any fingerprint, so build, doctests,
unit-tests, integration-tests, weeder and e2e all reused stale passes for a change to
one of them.

That covers ordinary workflows: `make fa-add` writes a sprite, and a dashboard fix can
be YAML only — as the endpoint-stats.yaml span-kind fix nearly was. DashboardWidgetsSpec
also reads endpoint-stats.yaml at runtime, so integration-tests genuinely depends on it.

The vite manifest stays out on purpose: it is generated, not tracked, and @fe already
covers the sources it is derived from.
2026-09-16 04:18:22 +02:00
Anthony Alaribe
3fde4bba24 Fingerprint the frontend checks on the Haskell they actually read
ui-tests and frontend declared @fe, which is web-components plus tailwind config. But
the hyperscript guard parses every [__|…|] quasiquote in src/, issues-highlight-theme
reads a script out of Pages/Issues.hs, tailwind scans src/**/*.hs for class names, and
two specs load the vendored htmx builds. A Haskell-only change therefore left both
fingerprints unchanged, the gate reused an older pass, and those guards never ran —
which is how a test pointing at a file deleted in a8dc4fab5 stayed green, and why a
hyperscript parse error in a Lucid attribute reached a browser before it reached CI.

Verified: touching src/Pages/Issues.hs now moves the ui-tests fingerprint
(bebd0e67 -> e1f8601b); it did not before. make ci-selftest passes.
2026-09-16 04:07:30 +02:00
Anthony Alaribe
3bf1388abd Ship the whole deploy locally, so CI stops being the critical path
CI's image build takes ~71 minutes; the same image built natively on an amd64
box takes ~36 cold, and far less warm. Waiting on a remote queue for the slow
half of a deploy is what makes "push it and see what CI says" tempting, which is
how untested work reaches master.

`make ship` does all four steps here: checks (attesting each pass), build and
push the image, push the commit, deploy to CapRover. The order is deliberate —
checks first because everything after is expensive, image before push so CI's
probe skips its own build, push before deploy because production must run a
commit that exists on origin. It refuses to deploy a commit origin/master does
not contain, and refuses when any deploy-path check lacks an attestation for
this exact tree. weeder and hlint failures do not block it: they gate pull
requests, not deploys.

`make builder-setup` points buildx at a native amd64 host over SSH, capped so a
-j48 GHC build cannot starve whatever else that machine runs. Without one the
build falls back to the emulated local one, and a stale builder name falls back
too rather than failing a deploy. The build now shares CI's registry cache in
both directions, so a laptop build no longer starts cold.

`make tf-image` builds TimeFusion for this architecture, which is the only
reason integration-tests could not run on a Mac; ci.sh detects the result with
no exported variables. Its image is distroless, so the compose healthcheck could
never pass — readiness is now probed on the pgwire port from the runner, which
also proves the thing the check needs rather than that a container exists.

CI's deploy job asks `ci.sh deployed <sha>` and skips a commit already deployed
from a machine, so this cannot restart production twice with the same image.
Deploy credentials are env-only, via the per-app deploy token rather than the
admin password.
2026-09-10 08:42:19 +02:00
Anthony Alaribe
55ad13e747 Render failed chart queries explicitly without caching them 2026-09-09 12:17:29 +02:00
Anthony Alaribe
c2860941b2 Put the e2e suite in CI, and fix make ci resolving its root to /
`make ci` has been broken since 70ed1780a. That commit runs ci.sh from a copy at
/tmp so the script can be edited mid-run, but line 29 derives the repo root from
the script's own path — from /tmp that resolves to `/`, so every check died with
"unknown check ... (have: )" before doing any work. cmd_local now passes
CI_ROOT=/build, which the container's working_dir already is.

With that fixed, e2e joins ci/checks.tsv as a real check: it requires ghc, node
and pg, and runs in the same job as integration-tests because that is the only
one with all three. scripts/e2e.sh starts its own server, so the check only has
to supply the binary and chromium. Both workflows gate on it, and the gate lists
it.

Verified by running it in CI's own containers rather than by inspection: 48
passed on linux/aarch64, attested to
refs/ci-attest/v1/e2e/398ebd19.../linux-aarch64/ghc.minio.node.pg.

scripts/e2e.sh now honours DB_HOST/DB_PORT, which is what CI sets and what its
`pg` capability probes.
2026-08-20 01:40:34 +02:00
Anthony Alaribe
70ed1780a8
ci: run local CI from a snapshot, so editing ci.sh mid-run is safe (#497)
bash reads a script incrementally by file offset. The container ran ci.sh
straight off the bind mount, so editing scripts/ci/ci.sh while a run was in
flight made the running shell resume at a stale offset and die with

  scripts/ci/ci.sh: line 605: syntax error near unexpected token `;;'

The check itself had already passed and been attested; only the wrapper
died, which is precisely the "bookkeeping must not fail a green check"
failure this repo has hit twice now. And a `make ci` lasts tens of minutes,
so editing the script meanwhile is a normal thing to do, not a mistake.

Copy it into the container and exec the copy.
2026-08-16 21:19:07 +02:00
Anthony Alaribe
2039c53e1a
ci: one ghc-options string, so test steps stop recompiling the whole build (#495)
`build` compiled with `-O0 +RTS -A64m -n2m -RTS`; doctests, unit-tests and
cli-tests compiled with just `-O0`. cabal's build plan hash includes
ghc-options, so those are two different configurations and every test step
recompiled all ~184 modules that `build` had just compiled. That is most of
the wasted time in the job — and it was inherited from the workflow, not
introduced here.

It is also a memory cliff. Without `-A64m -n2m` GHC uses its default
allocation area, so the redundant recompile is far more GC-heavy, and on a
4-vCPU runner it dies with no error message at all — the log jumps from
"[182 of 184] Compiling …" straight to a failed step. That is exactly what
blocked the deploy of b052d6cf4: `build` passed, then `doctests` rebuilt
everything and was killed. The previous master run passed the same step,
because it had ~4.5k fewer lines to recompile.

One string everywhere. The test steps now reuse what `build` produced
instead of redoing it.
2026-08-16 20:58:28 +02:00
Anthony Alaribe
7ec090c51b
ci: reuse an already-built image, and document running CI locally (#493)
With tests cached the deploy is 4m22s, of which 3m52s is the image build — the
whole critical path. The image is not fingerprinted like the other checks
because it produces an artifact rather than a verdict, but it does not need to
be: it is tagged with the commit SHA, so the registry is already its cache and
the SHA is already its identity.

build-image now probes the registry and skips when the tag exists. Nothing
changes for a new commit; it collapses the repeat cases to ~30 seconds — a
re-run of a failed or cancelled deploy, a workflow_dispatch of an existing
commit, a revert to an already-built SHA. Skipping re-points :latest at the
reused image rather than leaving it on an older commit, since docker-compose.yml
pulls :latest.

The same probe lets a bigger machine pre-build the image (`make deploy-image`,
linux/amd64 — Rosetta on Apple Silicon, not QEMU). That moves the artifact that
runs in production outside CI, and unlike an attestation it cannot be verified
afterwards, because a Haskell build is not bit-reproducible. So the build
refuses a dirty tree, and the deploy job prints `built by: …` every time —
never fatally, since a provenance lookup must not be why a gated build fails to
reach production.

Docs: CONTRIBUTING gains the section a contributor needs, including the two
caveats that would otherwise surprise them — the first `make ci` is a cold
build, and publishing a result needs push access, so from a fork it is fast
local feedback but CI re-runs the checks itself. README links docs/local-ci.md.
2026-08-16 20:24:40 +02:00
Anthony Alaribe
d8242d549b
ci: stop emitting the run id twice in an attestation's provenance (#492)
Every attestation CI has published so far carries

  runner=github-run-3194584899031945848990

which is `github-run-` followed by run id 31945848990 twice, so the one
field that traces a proof back to the run that produced it cannot be
pasted into a URL.

`${X:+github-run-$X}${X:-$(whoami)@$(hostname)}` reads like an if/else and
is not one: the `:-` arm yields $X itself when X is set, so a set
GITHUB_RUN_ID takes BOTH arms. Spell the branch out.
2026-08-16 20:12:05 +02:00
Anthony Alaribe
f8514ee295
ci: let anyone run CI, and let CI skip what was already proven (#491)
CI re-runs work that has already been done: a PR run proves a tree, the squash
merge keeps that exact tree, and master builds and tests all of it again. On
4-vCPU runners that is ~20 minutes per push, and none of that capacity is
available to a developer whose laptop is faster than the runner.

ci/checks.tsv is now the one definition of what CI is; the workflows and
scripts/ci/ci.sh both read it. Each check is fingerprinted over the git blob
hashes of its declared inputs, and a pass publishes an attestation as a ref:

  refs/ci-attest/v1/<check>/<fingerprint>/<platform>/<capabilities>/<date>

A gate job resolves those with one ls-remote and no object fetches, and skips
any check already proven for the tree it is about to test — whether by an
earlier run, a re-run, or `make ci` on someone's machine. Producing one needs
push access, the same trust boundary as pushing code; forks can neither create
nor be affected by them.

Reuse is deliberately conservative because this gates a production deploy.
Checks declare the capabilities they need and attestations record the ones the
environment had, so a run that fell back to a stub service can never satisfy a
check that needs the real one. Fingerprints are pinned from the gate, so steps
that rewrite the tree (hpack, npm ci, hlint --refactor) cannot desync what gets
attested from what was looked up. The deploy condition is spelled out rather
than implied by `needs`: build-and-test may be skipped, but only when the gate
says every Haskell check was already proven.

Also switches the minio service to bitnamilegacy/minio. The bitnami/minio
repository was emptied in the Aug-2025 catalog change and now has no tags at
all; CI has only been working off a runner-side image cache, and an eviction
would have taken the integration suite down with nothing in the diff to blame.

Verified end to end: all six checks ran through ci.sh and published
attestations, and a clean checkout on macOS/arm64 then resolved CI's
linux-amd64 attestations and skipped the entire Haskell suite.

See docs/local-ci.md.
2026-08-16 19:20:59 +02:00