Skip to content

Commit 5bac013

Browse files
authored
tests: faster dev loop + hpack dep dedup; misc hasql fixes (#411)
* hasql-interpolate + record-dot migration; telemetry derive instances; misc fixes Squashed from 19 commits on telemetry-derive-row-instances. Backup branch: telemetry-derive-row-instances-backup. * hpack: share library deps with test-dev via !include Move the library dependency list into hpack-includes/lib-deps.yaml and reference it from both 'library' and 'tests.test-dev' via !include. Eliminates the manual mirror that drifted (vector-split was missing from test-dev, breaking live-test-dev after rebase). hpack 0.38 does not splice list-position !include, so test-only deps (hspec, uuid-quasi, ki, pg-transact, aeson-pretty, process) also live in the shared file; the library declares them unused, silenced by the existing -Wno-error=unused-packages. Document make live-test-dev + the include-file pattern in CLAUDE.md (local-only; CLAUDE.md is gitignored in this repo). * review: drop dup base16-bytestring; widen more bigint COUNT to Int64; Makefile fixes - hpack-includes/lib-deps.yaml: remove the second base16-bytestring entry (was a carry-over from the old package.yaml). - BackgroundJobs.hs: same Int -> Int64 fix as 66a565a applied to the three remaining COUNT(*)::bigint sites (issueCounts, alertCounts, usage audit rows). - Makefile: add live-test-dev to .PHONY; quote TEST_MATCH in the --match arg so values with spaces / glob chars don't get shell-mangled. * review: headDef, drop test-dev -threaded dup, window-scoped tmux pin - BackgroundJobs.stuck: headDef 0 instead of fromMaybe 0 . listToMaybe (from Data.List.Extra, already in deps). - test-dev ghc-options: drop -threaded (already in global ghc-options; hpack was concatenating to a duplicate flag). - Makefile @build-pane: -w (window-scoped) instead of -g (global). Two project windows pinning concurrently no longer clobber each other. (Reviewer also noted hspec/uuid-quasi/ki/pg-transact/aeson-pretty/process leak into the library's build graph via lib-deps.yaml; that's the hpack-0.38 list-splice limit and can be revisited if/when hpack ships proper support — left as-is for now.) * 89 cols
1 parent e863f6a commit 5bac013

6 files changed

Lines changed: 599 additions & 164 deletions

File tree

Makefile

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ live-test-reload-unit:
3737
live-test-reload-all:
3838
ghcid --test 'cabal test monoscope:tests --test-show-details=streaming'
3939

40+
# Integration tests with lib+test in ONE GHCi target (Jade's "cabal test-dev" trick).
41+
# `:reload` crosses src/<->test/ boundaries — no relink between iterations.
42+
# `-osuf dyn_o -hisuf dyn_hi` reuses .dyn_o artifacts cabal already wrote.
43+
# Filter with: TEST_MATCH=/MonitoringSpec/ make live-test-dev
44+
TEST_MATCH ?=
45+
live-test-dev:
46+
USE_EXTERNAL_DB=true LOG_LEVEL=attention \
47+
ghcid --command 'cabal repl monoscope:test:test-dev --ghc-options="-osuf dyn_o -hisuf dyn_hi -O0" --with-compiler=$(GHC)' \
48+
--test ':main $(if $(TEST_MATCH),--match="$(TEST_MATCH)")' --warnings 2>&1 | tee build-test-dev.log
49+
4050
hot-reload:
4151
livereload -f reload.trigger static/public/ & \
4252
ghcid --command 'cabal repl' --test ':run Start.startApp' --test ':! (sleep 1 && touch static/public/reload.trigger)' --warnings
@@ -188,21 +198,31 @@ build-chart-cli:
188198
build-chart-cli-linux:
189199
cd web-components && bun build --compile --target=bun-linux-x64 src/chart-cli.ts --outfile ../chart-cli
190200

201+
# Pin a build pane once (`make tmux-pin-here` from the pane you want), then
202+
# every tmux-live-reload* reuses it. Pin survives ghcid restarts because we
203+
# track the pane id in a tmux user option instead of grepping for the command.
191204
define tmux_run
192-
@PANE=$$(tmux list-panes -F '#{pane_id} #{pane_current_command}' 2>/dev/null | grep -E 'ghcid|make|tee' | head -1 | awk '{print $$1}'); \
193-
if [ -n "$$PANE" ]; then \
194-
echo "Reusing pane $$PANE (sending C-c first)"; \
205+
@PANE=$$(tmux show-option -wv -q @build-pane 2>/dev/null); \
206+
if [ -n "$$PANE" ] && tmux list-panes -a -F '#{pane_id}' | grep -qx "$$PANE"; then \
207+
echo "Reusing pinned pane $$PANE"; \
195208
tmux send-keys -t "$$PANE" C-c; sleep 0.5; \
196209
tmux send-keys -t "$$PANE" '$(1)' Enter; \
197210
elif [ -n "$$TMUX" ]; then \
198-
echo "Splitting a new pane"; \
199-
tmux split-window -d -h '$(1)'; \
211+
PANE=$$(tmux split-window -d -h -P -F '#{pane_id}' '$(1)'); \
212+
tmux set-option -w @build-pane "$$PANE"; \
213+
echo "Pinned new pane $$PANE (use 'make tmux-unpin' to clear)"; \
200214
else \
201215
echo "Not in tmux — running in foreground"; \
202216
$(1); \
203217
fi
204218
endef
205219

220+
tmux-pin-here:
221+
@tmux set-option -w @build-pane "$$TMUX_PANE" && echo "Pinned build pane to $$TMUX_PANE"
222+
223+
tmux-unpin:
224+
@tmux set-option -wu @build-pane && echo "Unpinned build pane"
225+
206226
tmux-live-reload:
207227
$(call tmux_run,make live-reload 2>&1 | tee build.log)
208228

@@ -221,4 +241,4 @@ test-e2e-real: e2e-install
221241
test-e2e-ui: e2e-install
222242
cd e2e && npx playwright test --ui
223243

224-
.PHONY: all test fmt lint fix-lint live-reload live-reload-cli live-reload-doctests build-chart-cli build-chart-cli-linux tmux-live-reload tmux-live-reload-cli web-components-watch e2e-install test-e2e test-e2e-real test-e2e-ui gen-proto sync-otel-proto update-otel-proto minio-local timefusion-start timefusion-stop test-integration-tf
244+
.PHONY: all test fmt lint fix-lint live-reload live-reload-cli live-reload-doctests live-test-dev build-chart-cli build-chart-cli-linux tmux-live-reload tmux-live-reload-cli tmux-pin-here tmux-unpin web-components-watch e2e-install test-e2e test-e2e-real test-e2e-ui gen-proto sync-otel-proto update-otel-proto minio-local timefusion-start timefusion-stop test-integration-tf

hpack-includes/lib-deps.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
- base
2+
- relude >= 1.2.0.0
3+
- colourista
4+
- proto-lens
5+
- proto-lens-runtime
6+
- vector-algorithms
7+
- vector-split
8+
- effectful
9+
- effectful-core
10+
- effectful-th
11+
- effectful-postgresql
12+
- monad-time-effectful
13+
- wai-log
14+
- log-base
15+
- log-effectful
16+
- Unique
17+
- aeson
18+
- aeson-extra
19+
- aeson-qq
20+
- attoparsec
21+
- attoparsec-aeson
22+
- async
23+
- barbies
24+
- bytestring
25+
- base64
26+
- mtl
27+
- base16-bytestring
28+
- http-types
29+
- cache >= 0.1.3.0
30+
- case-insensitive
31+
- clock
32+
- containers
33+
- cookie
34+
- safe-exceptions
35+
- annotated-exception
36+
- safe
37+
- cryptonite
38+
- jose-jwt
39+
- crypton
40+
- crypton-x509
41+
- crypton-x509-store
42+
- temporary
43+
- memory
44+
- data-default
45+
- deriving-aeson
46+
- dotenv
47+
- envy
48+
- errors
49+
- mmark
50+
- extra
51+
- slugify
52+
- fmt
53+
- PyF
54+
- retry
55+
- generic-lens
56+
- gogol
57+
- gogol-core
58+
- gogol-pubsub
59+
- hw-kafka-client
60+
- hashable
61+
- hashtables
62+
- http-api-data
63+
- lens
64+
- lens-aeson
65+
- lucid >= 2.9.12.1
66+
- lucid-aria >= 0.1.0.1
67+
- lucid-htmx >= 0.1.0.7
68+
- lucid-hyperscript >= 0.1.0.2
69+
- lucid-svg >= 0.7.1.1
70+
- megaparsec
71+
- neat-interpolation
72+
- odd-jobs
73+
- parser-combinators
74+
- pg-entity
75+
- postgresql-migration
76+
- postgresql-simple
77+
- hasql
78+
- hasql-pool
79+
- hasql-th
80+
- hasql-transaction
81+
- hasql-interpolate
82+
- hasql-dynamic-statements
83+
- hs-opentelemetry-instrumentation-hasql
84+
- regex-tdfa
85+
- regex
86+
- resource-pool
87+
- resourcet
88+
- unliftio-pool
89+
- scientific
90+
- servant
91+
- servant-htmx
92+
- servant-lucid
93+
- servant-server
94+
- servant-queryparam-core
95+
- servant-queryparam-server
96+
- text
97+
- text-display
98+
- text-builder-linear
99+
- typed-process
100+
- unliftio
101+
- time
102+
- tz
103+
- unordered-containers
104+
- uuid
105+
- valor >= 1.0.0.0
106+
- vector
107+
- wai
108+
- wai-cors
109+
- wai-extra
110+
- warp
111+
- time-manager
112+
- wreq
113+
- xxhash
114+
- parallel
115+
- pretty-relative-time
116+
- tmp-postgres
117+
- directory
118+
- network-uri
119+
- scotty
120+
- filepath
121+
- file-embed
122+
- http-client
123+
- wai-middleware-static
124+
- template-haskell
125+
- cryptohash-md5
126+
- casing
127+
- yaml
128+
- hs-opentelemetry-sdk
129+
- hs-opentelemetry-api
130+
- hs-opentelemetry-instrumentation-wai
131+
- hs-opentelemetry-instrumentation-auto
132+
- postgresql-libpq
133+
- ki-effectful
134+
- grapesy
135+
- langchain-hs
136+
- openai
137+
- minio-hs
138+
- conduit
139+
- mime-mail
140+
- smtp-mail
141+
- stm
142+
- zlib
143+
- openapi3
144+
- servant-openapi3
145+
- insert-ordered-containers
146+
# === extras shared with test-dev (hpack !include cannot splice lists, so these
147+
# live here too; the library declares them unused, silenced by
148+
# -Wno-error=unused-packages set globally on ghc-options) ===
149+
- hspec
150+
- uuid-quasi
151+
- ki
152+
- pg-transact
153+
- aeson-pretty
154+
- process

0 commit comments

Comments
 (0)