* 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
* 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
* 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).
- 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.
* 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>
* 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
* 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.
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).
* 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>
`-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.
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.
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.
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.
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.
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.
Written after `git add -A` + `reset --hard` destroyed another session's
uncommitted work on 2026-09-02 and every ref-based check came back clean —
`git log --all`, branch diffs and prod-vs-master HTML can only see work that
reached a ref, and a dangling commit has not.
- `dangling-work.sh` lists commits no ref can reach, and (PRESERVE=1)
snapshot-tags every dirty worktree via `git stash create`, which builds the
commit object WITHOUT touching the index or working tree — safe against a
checkout another session is editing. Its first run tagged 11 dirty checkouts,
several 8+ days stale, none of them recoverable if anyone had reset them.
- `dangling-triage.sh` answers "is this orphan actually lost?" by the identifiers
a commit introduced rather than its lines. Line comparison is useless here:
fourmolu and the deep-clean sweeps reword everything, so landed work scores
100% missing. Identifiers survive refactors and scored 14 of 18 correctly.
Out of scripts/local/ (gitignored) because neither reads a secret or touches a
database — they are pure git, and the whole point is that someone else can run
them. The repo list is now derived from this checkout and its siblings rather
than hardcoded to one machine's home directory.
`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.
An empty team picker posts `teams=` — one empty value meaning "none selected" —
which the derived [UUID] decoder read as a malformed UUID and rejected the whole
form over. Creating a dashboard, a widget alert, or an alert without assigning a
team answered with a bare 400 page instead of the toast those handlers raise for
every other kind of bad input.
Utils.FormWithOptional carries the fix as a DerivingVia wrapper, so all three
forms stay derived — field names, Maybe handling and repeated values are still
whatever the generic instance does. Four doctests pin the invariant, including
that other keys are untouched and an absent key is not invented; those run in
CI's doctests check, unlike Playwright.
Also:
- KQL suggestions after `|` offered comparison operators instead of commands.
The segment-boundary branch only handled the first segment.
- ~50 suggestion tests asserted nothing: they reached for
monaco.languages.CompletionItemProviderRegistry, an internal that no longer
exists, behind an unguarded `if`. They now drive computeSuggestions through
the component's own schemaAccess.
- scripts/e2e.sh runs the suite against a throwaway server on 8081 built from
.env.example, so it cannot reach the production database that .env points at.
playwright.config.ts no longer defaults to 8080, which is what `make
live-reload` serves. 48 specs, green from a dropped database and a warm one.
- New spec puts one widget of every type on a canvas and checks each is adopted
by GridStack and survives a refresh; dashboard-grid.spec.ts now builds its own
fixture instead of opening whichever dashboard sorted first.
- Live-tail specs asserted a Start button and service gate the component
deliberately does not have; billing/onboarding used renamed plan-card ids.
- Four tests for <live-tail>'s follow behaviour: rows arriving must not yank a
reader who scrolled up.
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.
`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.
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.
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.
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.
The CLI no longer needs the frontend build, proto codegen, or the eight
Homebrew packages the macOS job used to install — none of that is reachable
from monoscope-cli. Removing openapi3 from the shared package (a CLI has no use
for schema generation; the ToSchema instances move to Pkg.DeriveUtils and the
new Web.WireSchemas) takes the stripped -O2 binary from 107MB to 97MB.
- cli-release.yml: builds monoscope-cli:exe:monoscope only, with -O2
-split-sections plus --gc-sections/-dead_strip and strip.
- scripts/check-cli-linkage.sh fails the build if the binary links libpq,
librdkafka, grpc, protobuf or a compression library — the no-prerequisites
promise is now enforced rather than assumed. It also rejects /opt/homebrew
paths, and the macOS job repoints Homebrew's zlib at /usr/lib and re-signs,
which would otherwise have shipped a binary that only runs on a Mac with brew.
- cli-tests now run in the main CI workflow; make cli-build/cli-test/
cli-release-build for local use.
Measured but not taken: dropping brick/vty saves only 4MB, which does not pay
for losing the arrow-key project picker at login.
Raise the replay message-size ceiling end-to-end so full rrweb session
recordings land instead of being parked as replay:oversize_message poison
(2026-07-10: the 10 MiB cap was silently dropping a steady drip of 10-41 MB
rrweb blobs into otlp_deadletter-parking).
- Replay.hs: maxReplayMessageBytes 10 MiB -> 100 MiB (payload accept cap)
- Queue.hs producer: message.max.bytes 64 -> 120 MiB, receive.message.max.bytes
100 -> 160 MiB (socket buffer must exceed message cap; 20 MiB header headroom)
- Queue.hs consumer: max.partition.fetch.bytes / fetch.max.bytes 64 -> 120 MiB,
receive.message.max.bytes -> 160 MiB
- BackgroundJobs.hs parking-redrive consumer: same 120/160 MiB caps
- dlq-redrive tool: BrokerMaxReadBytes 32 -> 160 MiB (the hard socket cap that
must clear the largest message; KIP-74 returns oversized singles beyond the
small WAN-friendly fetch limits), ProducerBatchMaxBytes -> 120 MiB
Broker side raised in tandem (rpk): cluster kafka_batch_max_bytes and the
rrweb-client + otlp_deadletter{,-parking,-retry-60s,-retry-600s} topic
max.message.bytes overrides all set to 120 MiB.
Additions from the 2026-07-09 a0c2640 incident backfill (TF acked inserts
with no DLQ copy; TS + mainline Kafka were the only sources):
- -synth-tf-headers: consume a raw OTLP mainline topic (no headers) and
synthesize the DLQ-replay contract (ce-type via topicToCeType mirror,
original-topic, monoscope-write-failure=tf-failed, pg-succeeded=true) so
the carousel retries ONLY the TimeFusion leg. Guarded to mainline topics.
- HARD offset bound at the snapshotted window end inside EachRecord: kgo
keeps fetching past the window, and with src==dst the consumer reaches
its own re-produced copies — remaining-count alone let it self-amplify
(555k excess produced before the kill).
- Used to backfill 02:42-03:26 UTC: 103,395 otlp_spans + 56,322 otlp_logs
re-driven, zero failures.
The tool the DLQ runbook's recoveries B/B2 depend on lived only in the
gitignored scripts/local scratch dir — force-added so the documented
procedures are runnable from a fresh checkout (binary stays ignored).
Changes from the 2026-07-09 TF backfill run (4.77M messages re-driven):
- -from-ts/-to-ts: re-drive a time slice of the base DLQ itself; window
end is hard-bounded per record — with src==dst, counting alone lets the
consumer reach its own re-produced copies (self-amplifying loop)
- -state: checkpoint the ACKED per-partition frontier (flush barrier)
every minute; restarts resume instead of re-producing the window
- 3-min produce-stall watchdog (WAN runs wedge ~10-15min in; exit for a
wrapper retry loop) and 8MB fetch sizes (64-128MB wedges over WAN)
- -trim refused outside whole-window parking re-drives
- LogItem: rewrite request/service/error extraction via aeson-lens; typed
detail/http/json tab components + empty states
- Utils: single collapse/expand toggle button (bulk-writes .tree-toggle checked
state); reorder field context-menu actions, add "Copy key == value"
- Parser: skip user columns that resolve to a default SELECT expr (dedup); allow
normalizeKeyPath alias chars in splitTrailingAlias
- session-replay: compact header, icon-only utility buttons with tooltips
- Add `make fa-add` + scripts/fa-add.py to append FA symbols to the sprite sheet
* fix(charts): don't advance query-cache watermark on failed delta fetch
Time-series chart widgets could render permanent holes: in the partial-hit
path, a delta fetch that failed (timeout / TF planning error / dropped conn,
swallowed into an empty MetricsData by withChartSpan) still advanced cached_to
to the request end. That orphaned the [cachedTo, reqTo] window forever, since
every later delta starts from the advanced watermark — so short ranges rendered
near-empty while wider ranges (a separate bin_interval cache entry) looked fine.
Gate updateCache on `isNothing deltaData.error` in both the PartialHit and
CacheMiss branches, so the watermark never advances past data we actually
fetched. On a transient failure the next poll re-fetches [cachedTo, now] and
backfills the gap.
Regression tests in QueryCacheSpec: failed delta doesn't advance cached_to and
still serves the cached rows; a successful-but-empty delta still advances.
* minor updates
* refactor: extract mkPageCtx page-handler bootstrap
Replaces 25+ inlined BWConfig + sessionAndProject + ask AuthContext
sequences across Pages/* with a single mkPageCtx helper that returns
(Session, Project, BWConfig) seeded with the always-set fields
(sessM, currProject, config). Net: -102 LoC.
* refactor: extract toastError helper for validation/error responses
Collapses the recurrent 'addErrorToast msg Nothing >> addRespHeaders payload'
shape across Pages/Projects.hs and Pages/Dashboards.hs. Net: -5 LoC plus
+5 LoC for the helper and re-export = breakeven, but eliminates a duplicated
two-line pattern at every site.
* refactor: extract withCardFrame for widget renderer card shell
Collapses the duplicated outer flex-wrapper + optional widget header +
flex-1 fill + surface-raised card shell shared between renderLogsWidget,
renderTraceTable, and renderTable into a single helper.
* refactor: derive FieldTypes/FieldCategoryEnum JSON via WrappedEnumSC
Replaces manual ToJSON/FromJSON instances and the parseFieldTypes,
parseFieldCategoryEnum, fieldTypeToText helper functions with a single
deriving-via clause that piggybacks on the existing WrappedEnumSC wrapper.
Net: -50 LoC.
* refactor: distill CLI; reuse server types (Schema, Paged, MetricsData)
Replace ad-hoc AE.Value field-name probing in the CLI with typed parsing
against the server's existing response types so wire-shape changes
surface as compile errors:
- filterSchema now takes Models.Telemetry.Schema.Schema
- normalizeList decodes via Web.ApiTypes.Paged
- metrics renderers/assertion take Pages.Charts.Types.MetricsData
Also: factor validateDurationOrDie/validateAndNormalizeKind helpers,
fold three case-of-OutputMode triplets through renderWith, derive
ServiceRow/ConfigGetJson/AuthStatusJson/TraceSummary JSON via CustomJSON.
* Auto-format code with fourmolu
* docs: add agentic-pipeline showcase to README
Show the discover -> search -> context -> triage chain with the stable
JSON envelope each command exposes, so a reader scanning the README sees
why the CLI is agent-friendly before getting to the Claude Code Skills
section.
* refactor(cli): apply hlint fixes (errors + warnings + suggestions)
Drops 2 errors and 7 warnings from `hlint cli` to 0:
- Resource.hs: `>> pure n` -> `$> n` for the apply-batch counter
- Commands.hs: `ExceptT . pure` -> `hoistEither`; manual `maybe ... Right` -> `maybeToRight`
- Config.hs: `either (const x) id` -> `fromRight x`
- UI.hs: `T.unlines` -> Relude's `unlines`
- Validate.hs: drop redundant `void`
Plus higher-impact suggestions:
- `data` -> `newtype` for ServicesCommand, ConfigGetOpts, ServicesListOpts, FormEditorName
- `fmap (fmap f) x` -> `f <<$>> x` in 6 list/schema/facets handlers
- `Set.singleton` -> Relude's `one`
- `pure ()` -> `pass` in UI event handlers
- `\_ -> action` -> `const action`
- `(\c -> Map.lookup c idxMap)` -> `(`Map.lookup` idxMap)`
Build green: `All good (8 modules)`. The two remaining hlint hints
(`Data.Set as Set` alias, `universe` import) belong in `.hlint.yaml`
rather than the code.
* fix(test): unwrap IssueL through .base.id in ErrorPatternsSpec
IssueL is a list-view wrapper around Issue (`{ base :: Issue, ... }`),
so the `id` field is reached through `.base`. Four sites in
ErrorPatternsSpec called `issue.id` directly, which type-errored after
IssueL gained its current shape. Matches the pattern used in
src/Pages/Anomalies.hs (`errL.base.id`).
* fix(cli): accept uppercase --since suffixes (1H, 24H)
The platform's TimePicker emits uppercase ("1H", "24H") — the same
strings the CLI itself injects as defaults via buildSearchParams /
runServicesList — but the validator only accepted lowercase, so a user
who copy-pasted the displayed default got rejected client-side. Fold
the suffix to lowercase before checking the whitelist; preserve
original casing in the returned value.
Add a regression test in CLIE2ESpec asserting `--since 1H` is accepted.
* fix(cli): four review nits — flag-aware duration error, single decode, doc/comment fixes
1. validateDurationOrDie now takes the flag name, so --window failures
read "--window must match …" instead of "--since must match …".
Three call sites updated (--since x2, --window x1).
2. aggregateServices keeps its `Map.lookup "service"` but with a comment
pinning the contract: the server aliases resource___service___name to
the short "service" column in colIdxMap (Pages.LogExplorer.Log.allCols).
Added an e2e regression in CLIE2ESpec that asserts services-list still
returns {services, count} so a column rename can't silently zero the
output.
3. docs/cli.md agentic-incident-workflow: replace .items[] with .data[]
in the issues-list and log-patterns-list jq pipes — they'd break
against the now-normalised list envelope.
4. runEventsContext --summary used to walk logsData twice (once in
normalizeEventsResponse, once in withTraceSummary). Introduce a
`DecodedEvents` record that carries idxMap/rows/raw, decode once at
the call site, and thread it through both functions.
* perf(cli): back services list with /api/v1/facets instead of 10k-event scan
Previously runServicesList fetched up to 10,000 events and aggregated
client-side because /api/v1/metrics returned empty for `summarize ... by`.
The facets endpoint (precomputed in apis.facet_summaries via a background
job) is one indexed lookup — sub-millisecond regardless of project size.
- Drop the events-scan fallback; switch to GET /api/v1/facets?field=resource.service.name
- ServiceRow loses the `last_seen` field (facets don't track per-value
recency). The remaining {name, events} is what the use-case actually
needs ("what services exist? how busy are they?").
- e2e regression in CLIE2ESpec already covers the {services, count}
envelope; comment updated to pin the facets-backed contract.
- docs/cli.md and monoscope-skills/README.md output-shape tables drop
last_seen.
* chore: trailing review nits — unused asks, V.take, normaliseList warning, debug-comment
Server side:
- dashboardsGetH: drop the appCtx ask; bw.config.liveReloadDashboards
carries the flag now that mkPageCtx threads config through.
- teamAlertsGetH: drop appCtx + sess + project, all genuinely unused
bindings.
(dashboardGetH / dashboardTabGetH / dashboardTabContentGetH /
unifiedMonitorOverviewH still bind appCtx — they read appCtx.env.* which
isn't on bw.config, so the binding is required.)
CLI:
- takeFirstEvent: V.take 1 arr instead of take 1 (toList arr); avoids the
Vector→List→Vector round-trip.
- Resource.normalizeList split into normalizeListE returning Either, with
Left carrying the raw payload on shape mismatch. runList now flags the
unrecognised case via printDebug so contributors see when the server
envelope drifts.
- Core.renderParams: comment pinning the "debug-only, NOT URL-encoded,
redact if you ever pass auth via query params" contract.
* fix(cli): CI doc uses .data, emitFirstEventId avoids list round-trip
- docs/cli.md CI/Automation example said `jq '.items | length'` —
inconsistent with the agentic-workflow section above and broken since
normalizeList moved everything to `.data`.
- emitFirstEventId now uses `arr V.!? 0` instead of `head (toList arr)`
— same V.take optimisation as takeFirstEvent, no intermediate list
allocation.
Bug #2 from the review (renderEventsTable in runEventsContext receiving
raw `val`) is intentional: the table renderer reads `cols`/`logsData`
out of the raw envelope to produce a dense table; the JSON path uses
the named-field `enriched` form. Passing `enriched` to the table
renderer would render an empty table because the normalised shape
doesn't carry `cols`/`logsData`. The split is by design — table mode is
column-oriented, JSON mode is record-oriented.
* fix(cli): six review items — agent-mode truthy check, --first table parity, single decode, derived facets, forall pinning
3. isAgentMode no longer fires on `CI=` (empty) or `CI=false` — many dev
shells export CI unconditionally; treat empty/"false"/"False"/"FALSE"/"0"
as off.
4. --first parity in table mode: takeFirstRow trims the raw envelope's
logsData to one row, so table output matches the JSON path's
takeFirstEvent slice instead of silently dumping all rows.
5. Free-floating Haddock above DecodedEvents merged into the actual
docstring (the orphan would have triggered a -Wmissing-signatures-ish
warning eventually).
6. runEventsSearch now decodes once and threads DecodedEvents through
normalizeDecoded, matching the pattern in runEventsContext. No more
double walk of logsData on the JSON path.
7. parseServiceFacets decodes via Models.Apis.Fields.FacetValue
(FromJSON via DAE.CustomJSON) — drops 6 lines of hand-rolled
KM.lookup/AE.String/AE.Number unpacking and surfaces server wire
changes at compile time.
8. withMetricsData now forwards aeson's Error message through
printDebug so a server envelope drift is visible under --debug
instead of vanishing into the raw-JSON fallback.
Plus: explicit `forall es a b` on apiGetJson/apiPostJson/apiPutJson/
apiPatchJson so TypeApplications at call sites
(`apiPostJson @_ @_ @AE.Value`) survive future constraint reordering by
fourmolu/hlint. Without this, alphabetical resort of
`(AE.FromJSON b, AE.ToJSON a, Environment :> es, ...)` flips the
implicit type-var order and the third `@AE.Value` lands on `es` instead
of the body type.
Run fourmolu over the touched files; #10 (double blank lines) is
auto-fixed.
* chore: round-three review nits — null instead of "", helpCases coverage, dead code
3. normalizeDecoded now emits `null` for missing fields (row shorter
than colIdxMap) instead of silently coercing to "". Agents can now
tell "field present but empty" from "field missing".
4. Comment on the --debug setEnv site explaining the single-shot, pre-
thread-spawn placement (so future readers know it's not a race).
6. emitCompletion lifts to IO once at the entry instead of per-branch.
7. CLIBinarySpec helpCases extended with `facets`, `schema`, `services
list`, `events {search,context,tail}`, `metrics {query,chart}`,
`auth login`, `completion` — every top-level subcommand now has a
--help smoke test.
8. dashboardGetH/dashboardTabGetH: replace appCtx.config.hostUrl with
bw.config.hostUrl now that mkPageCtx threads config through; appCtx
binding stays because appCtx.env.apiKeyEncryptionSecretKey isn't on
bw. dashboardTabContentGetH untouched — no mkPageCtx, no bw.
Style:
- Drop dead extractNumericRows from Pkg.CLIFormat (no callers since the
metrics path moved to MetricsData).
- Export validateDurationFor so the doctest examples (which reference it)
resolve at doctest runtime.
Re #2 (parseServiceFacets via FromJSON) and #10 (double blank lines):
already landed in commit 2a54bd0b.
Re #5 (renderParams allowlist): keeping the comment-only enforcement.
The CLI doesn't put credentials in query params today (Bearer + project
go via headers), and a type-level distinction would touch every API
helper for a hypothetical leak. The doc note is sufficient guard for
contributor review.
* fix(cli): trace-summary error count, KQL injection guard, small wins
Core bug:
- withTraceSummary used `cell "severity"` to count errors per trace, but
the events colIdxMap (Pages.LogExplorer.Log.allCols) doesn't expose a
"severity" column — only the boolean "errors" flag. Result: every
trace summary reported error_count=0 regardless of traffic. Now reads
cell "errors" and treats "true" as 1. Also added a defensive fallback
for service ("service" <|> "resource.service.name") in case a future
column-set rename hides the alias.
KQL safety:
- runEventsGet escapes `\` and `"` in opts.eventId before splicing into
the query string. Event IDs aren't UUIDs (synthetic-… span ids,
log_pattern integers, …) so format validation is wrong; escaping
defends against injection regardless of shape.
Small wins:
- isAgentMode: fold suffix to lowercase once via `map toLower v` rather
than enumerating "false"/"False"/"FALSE".
- filterSchema: `Map.take n filtered` instead of
`Map.fromList (take n (Map.toList filtered))` (containers ≥ 0.6.3).
Doctests note:
- The earlier "doctest comment" the review flagged was already removed
in a prior commit. Pure validators are still covered end-to-end via
CLIE2ESpec ("--since 1xyz", "--kind banana") which exercise the real
binary. Wiring CLI/* into the lib doctest target would need moving
the modules into src/ — out of scope for this round.
Pushed back:
- AuthStatus method ADT: the strings "env"/"token" appear in two
adjacent lines of one function. A two-constructor ADT + custom ToJSON
is more boilerplate than the leak it prevents (no other consumer).
- Map merge tuple readability: a record would cost two lines and one
data declaration to save zero compile errors. The merge fits on one
line; leaving it.
* chore: clarify intent — `mempty` empty bodies, capFacets exhaustiveness comment
- Pages/Projects.hs: replace seven `toastError "…" ""` and three
`addRespHeaders ""` with `mempty`. Reads as "no body" rather than
"empty string body" — the underlying type is `Html ()` whose Monoid
identity is the empty Html, same wire effect.
- cli/Main.hs `capFacets`: comment on the trailing wildcard clause so
the (Just n) + non-Object fallthrough is explicitly documented vs the
Nothing case the first clause already handles.
Re facets in CLIBinarySpec helpCases: already added in 76ebf71c.
* chore: clear hlint warnings across src/
BackgroundJobs.hs: 6× displayException + 2× fromException were
resolving to Control.Exception.* (because the file did
`import Control.Exception (ErrorCall (..))` which exposed the
Control.Exception namespace to GHC's resolver and tripped
.hlint.yaml's "use Relude version" rule). Drop the unqualified
import; ErrorCall now goes through `Control.Exception qualified as CE`
so the only `Control.Exception` reference is the explicit qualifier
and unqualified displayException/fromException resolve through Relude.
Pages.Anomalies.hs:
- NE.head -> head (Relude)
- two whenJust lambdas -> point-free (toHtml composition)
- when (... `notElem` ...) -> unless (... `elem` ...)
Pages.Settings.hs: sortOn fst -> sortWith fst (no caching needed for
projection on first component).
Pages.Telemetry.hs: MapS.singleton k v -> one (k, v) (Relude polymorphic
container constructor).
Pages.LogExplorer.Log.hs: two `\j -> (j, x)` lambdas -> tuple sections
(TupleSections is part of GHC2024, already on).
Verified clean: `hlint src/BackgroundJobs.hs src/Pages/Anomalies.hs
src/Pages/Settings.hs src/Pages/Telemetry.hs src/Pages/LogExplorer/Log.hs`
reports "No hints".
* Auto-format code with fourmolu
* fix(cli): forward Paged decode error, lenient body decode, unambiguous null
3. normalizeListE now returns Either (rawValue, reason) — when an Object
fails @Paged@ decoding the aeson Error message is captured and
surfaced through runList's --debug log. Contributors see *what*
shape changed instead of a generic "did not match envelope".
normalizeList stays pure with `either fst id . normalizeListE`.
4. httpExToError now uses TE.decodeUtf8With lenientDecode for both the
status reason and the response body. The body field of
StatusCodeException is the truncated raw bytes (≤1024B) and may be
gzip leftovers, HTML, or arbitrary upstream junk; strict decodeUtf8
would throw at the error-handling boundary, masking the real HTTP
failure with a UnicodeException.
6. isAgentMode: replace `not (null v)` with `v /= ""` to dodge the
Prelude.null vs Relude container-null ambiguity. v is String here.
Re prior style notes:
- Double blank lines between top-level bindings: produced by fourmolu
format pass; project convention is enforced by the formatter.
- AuthStatusJson / ConfigGetJson: kept as records — the CamelToSnake
derivation pins the wire shape (an inline AE.object [...] silently
drifts when fields are added).
- runConfigGet OutputMode asymmetry vs init/set: noted; init takes no
output path (interactive form) and set has no payload to format.
Follow-up if it surfaces in user feedback.
- normalizeList = either fst id . normalizeListE (was either id id;
shape changed when Left started carrying the reason).
- CLI/UI.hs `currentValue = T.strip . unlines . BE.getEditContents`:
verified — `unlines` here is the Relude re-export, which is polymorphic
over the IsList/Foldable instance. Compiles clean.
* fix(test): unwrap IssueL through .base.issueType in AnomaliesSpec
Same pattern as the ErrorPatternsSpec fix in f0ab87d7: IssueL wraps
Issue in `base`, so the issueType field lives at `c.base.issueType`,
not `c.issueType`.
* fix(test): add http-types to integration-tests build-depends
CLIE2ESpec imports Network.HTTP.Types.Status (statusCode) for the
reachability probe but http-types wasn't on the test target's deps.
The library has it (line 173), the test suite didn't inherit it.
* fix(test): drop System.Environment lookupEnv import — Relude already exports it
* fix(cli/test): try @SomeException → tryAny, plus seven review nits
Build break: UnliftIO.Exception.try's forall is (m, e, a); the @SomeException
TypeApplication landed on m and tripped a kind error. Switch to tryAny
(MonadUnliftIO m => m a -> m (Either SomeException a)) — same semantics,
no type-arg juggling. Drops the redundant Data.List (isInfixOf) import
along the way (Relude already has it).
Review items:
- AuthStatus: extract printStatus helper for the env/token branches —
3 lines repeated → 1 helper.
- apiFacets: replace addUTCTime (-86400) with negate nominalDay (Data.Time
re-export). No more 86400-second magic.
- capFacets: drop the now-redundant `Nothing` clause; the wildcard at the
end already covers it (and `Just n` + non-Object).
- parseDurationMs: T.toLower the input via a view pattern so --watch 5M
is treated like --watch 5m, matching validateDurationFor's case-insensitive
suffix check.
- reqOpts: collapse the broken multi-line `& W.header "Accept" .~ [...]`
formatter artifact into a single parenthesised line so subsequent `&`
chain elements align under W.defaults.
- Resource.runList: route the unrecognised-envelope reason through
printError (always-on stderr) instead of printDebug — agents
expecting {data, pagination} need to see when the server returns
something else.
- DecodedEvents: decode count / has_more / cursor at construction
instead of carrying the raw KeyMap. Three lookups eliminated, intent
is local to decodeEvents.
Re minor nits noted:
- isAgentMode/isDebugMode re-read env on each call: kept; called at
most a handful of times per invocation, no hot path.
- Data.Char (toLower): kept the explicit import — Relude does re-export
it but the explicit form documents which `toLower` we mean (vs
Data.Text.toLower which operates on Text).
* fix(test): restore Data.List (isInfixOf) — Relude does not re-export it
* fix(test+ci): two CLI test failures, default e2e suite to the public demo project
CI failures:
1. CLIBinarySpec "auth status exits and shows status message" — when CI
is set, isAgentMode auto-enables and `auth status` emits the JSON
envelope ({authenticated, method, api_url, project}). The test
predicate only matched plain-text "Not authenticated" / "Authenticated".
Extend it to also accept the JSON shape ("authenticated" key).
2. CLIBinarySpec "completion --help" exited 1. The completion subparser
declared a positional SHELL argument but didn't attach `<**> helper`,
so `--help` got consumed as the SHELL value and fell through to the
"unknown shell" branch. Adding helper makes optparse intercept --help
and emit usage with exit 0.
Default e2e suite to prod demo project:
CLIE2ESpec.getE2EConfig now defaults @MONOSCOPE_API_URL@ to
https://api.monoscope.tech and @MONOSCOPE_PROJECT@ to the public demo
00000000-0000-0000-0000-000000000000. Only @MONOSCOPE_API_KEY@ has no
safe default (read keys for other projects would leak). The pendingWith
message names the missing variable specifically so it's obvious how to
unlock the suite.
Wired up in CI: pullrequest.yml's integration-tests step now reads
MONOSCOPE_API_KEY from secrets.MONOSCOPE_DEMO_API_KEY. Repo owner needs
to mint a read-only key on the demo project and store it in repo
secrets — then every PR/push runs the suite against prod. Forks (no
secret) still get the CLIBinarySpec smoke tests.
docs/cli.md updated with the new default-driven workflow.
* fix(test): assert specific merge edge instead of fragile global count
ErrorPatternsSpec test 12 ("Full LLM pipeline") asserted
`length mergedTypeErrors == 1` after merging one (childId, canonId)
pair. The query counted ALL TypeError patterns with canonical_id set
across the project, so any earlier test that merged a TypeError made
the count drift up. CI now sees 2 because some upstream change in the
LLM/notify pipeline produced an additional pre-merged pattern by the
time test 12 runs.
Switched to a behaviour-level assertion: query the specific childId's
canonical_id and require it equals canonId. This tests what
`assignErrorsToCanonical` actually does, with no dependence on the
global state earlier tests left behind.
* refactor(cli): lens-based shape ops, guards, precomputed indices
- takeFirstEvent / takeFirstRow rewritten with Data.Aeson.Lens
(`AL.key … . AL._Array %~ V.take 1`). 14 lines of pattern-match-and-
reinsert collapsed to two one-liners. AL is qualified to avoid
collision with the `key` record fields on ConfigSet/GetOpts.
- foldFiltersIntoQuery: case (T.null …, T.null …) → pattern guards.
Reads top-down instead of as a tuple-match puzzle.
- normalizeListE: AEKM.member → has (AL.key …) lens accessor; the
branch matches on the value directly, no need to destructure
AE.Object obj first.
- extractColIdxMap: round → floor on the Scientific. Column indices are
already-integral non-negative ints; floor documents that intent and
drops banker's rounding semantics that don't apply here.
- parseDurationMs: drop the bare-number-as-seconds fallback. validateDurationFor
rejects unsuffixed values upstream, so the only paths that reach
parseDurationMs have a recognised suffix; a typo now returns the
5s default loudly instead of silently treating "5" as five seconds.
- runMetricsChart: validateDurationOrDie "--watch" before entering the
forever loop, so a bad --watch string fails at flag parse rather
than burning HTTP requests every 5s.
- withTraceSummary: precompute svcIdx / errIdx / tidIdx once instead
of re-Map.lookup'ing the same column path per row. Saves one Map
lookup per cell per row — measurable on large
`events context --summary` payloads.
Build deps: cli exe gains `lens-aeson` (already in lib deps for the
server's Data.Aeson.Lens usage). hpack regenerated monoscope.cabal.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Rewrite docs/cli.md to cover all commands: events/logs/traces,
metrics, services, config, schema, version, global flags, env vars,
config files, and all command flags previously missing
- Add CLI install quickstart and reference link to README.md
- Add CLI install section to docs/getting-started.md
- Fix scripts/install.sh binary/archive name to monoscope (was mono)
Add monoscope-skills Claude Code plugin (monoscope-tech/skills):
- .claude-plugin/marketplace.json and plugin.json for marketplace install
- skills/kql-reference/SKILL.md — full KQL dialect reference sourced
from src/Pkg/AI.hs and src/Models/Telemetry/Schema.hs: operators,
aggregations, time binning, scalar functions, schema fields, examples
- skills/investigate/SKILL.md — incident investigation workflow
- skills/triage/SKILL.md — on-call triage workflow
- AGENTS.md and README.md with install instructions for both
`claude plugin` and `npx skills add monoscope-tech/skills`