oficina / meet Public

Clone
git clone https://amadan.net/oficina/meet

Plain git — no account needed to clone.

Download

Download this file

1export GOTOOLCHAIN := go1.26.5
2export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git,amadan.net/oficina/agent-access.git
3
4# The gate's toolchain. TestCreditsMatchProductionDependencies puts the Go
5# version into the credits inventory, so the gate refuses any toolchain
6# but the one the credits were generated with, and the CI runner's own Go
7# moved on (go1.26.10): main's CI failed on that alone. Memoria and
8# Calendar export it for the whole Makefile; here it is scoped to the
9# gate's targets, so the native builds keep whichever Go they had.
10vet test race migration-check spacing ci credits: export GOTOOLCHAIN := go1.26.5
11
12APP := calls
13
14# What `carlos ship -target` defaults to, and therefore what a release
15# must be built for. Building for your own machine and shipping that is a
16# silent architecture mismatch: the binary uploads fine and fails to exec
17# on the instance. Override for a one-off:
18# make release RELEASE_GOARCH=amd64
19RELEASE_GOOS ?= linux
20RELEASE_GOARCH ?= arm64
21RELEASE_BIN := releases/$(APP)-$(RELEASE_GOOS)-$(RELEASE_GOARCH)
22
23# What the running binary reports from GET /api/version. An unstamped
24# binary answers "dev" from every build, so the platform's deploy
25# verification can never disagree with itself. Stamping is what gives
26# that check the ability to fail. Outside a repository, or before the
27# first commit, name it yourself: make release VERSION=v0.1.0
28VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null)
29
30.PHONY: build release version-check test vet fmt-check migration-check spacing ci race browser
31
32# build is the compile check: with more than one package matched, go
33# build discards the output, so this catches a broken package without
34# producing an artifact.
35build:
36 CGO_ENABLED=0 go build ./...
37
38# release is what ships. -s -w drops the symbol table and DWARF, which on
39# this family's apps is 23-31% off the binary and 45-53% off the
40# compressed artifact — and compressed size is what actually gets
41# transferred. carlos is built the same way (see platform's Makefile).
42#
43# What survives: panic traces keep their function names AND line numbers
44# (Go's pclntab is untouched by these flags), debug.ReadBuildInfo works,
45# and go version -m still reports module metadata. What you lose is
46# source-level debugging with delve or gdb — build without the flags for
47# that. rastrillo dev never strips, for the same reason.
48release: version-check
49 @mkdir -p releases
50 CGO_ENABLED=0 GOOS=$(RELEASE_GOOS) GOARCH=$(RELEASE_GOARCH) \
51 go build -ldflags="-s -w -X 'amadan.net/rastrillo/rastrillo.BuildVersion=$(VERSION)'" \
52 -o $(RELEASE_BIN) ./cmd/$(APP)
53 @echo
54 @echo "built $(RELEASE_BIN) reporting version $(VERSION)"
55 @echo "ship it with:"
56 @echo " carlos ship -app $(APP) -mail submit -target $(RELEASE_GOOS)-$(RELEASE_GOARCH) $(RELEASE_BIN)"
57 @echo "then promote it (carlos deploy has no -mail flag yet; see README/AGENTS):"
58 @echo " carlos promote -app $(APP) <version>"
59
60version-check:
61 @if [ -z "$(VERSION)" ]; then \
62 echo "make release: no version to stamp."; \
63 echo " git describe found nothing here: no repository, or no commit yet."; \
64 echo " Commit, or name it: make release VERSION=v0.1.0"; \
65 exit 1; \
66 fi
67 @case "$(VERSION)" in *-dirty) \
68 echo "make release: the tree is dirty, so $(VERSION) does not name what you are about to ship."; \
69 echo " Commit first, or name it: make release VERSION=v0.1.0-wip"; \
70 exit 1;; \
71 esac
72
73test:
74 go test ./...
75
76# The browser-tagged files are vetted too, so a typo in one is found by
77# the gate rather than on the day someone runs make browser.
78vet:
79 go vet ./...
80 go vet -tags browser ./internal/calls/ ./internal/callstest/
81
82# The race gate, and the one place in this repo that sets CGO_ENABLED=1.
83# `-race` refuses to build without cgo, and AGENTS.md's cgo-free rule is
84# about what ships: this builds a test binary and never a release, so the
85# exception costs the deployed artifact nothing. It is not folded into
86# `ci` for that reason — `ci` must stay cgo-free — and runs as its own
87# CI step (.amadan/ci.d/50-race) where the runner has a C compiler.
88#
89# Slice 2 is the first slice with real concurrency: a hub behind a mutex,
90# a tick goroutine, one goroutine per stream and three atomics. Run this
91# before every push that touches internal/calls/hub or the stream.
92race:
93 CGO_ENABLED=1 go test -race ./internal/...
94
95fmt-check:
96 @out=$$(gofmt -l .); if [ -n "$$out" ]; then echo "gofmt needed:"; echo "$$out"; exit 1; fi
97
98# A step of its own, not folded into another target's recipe: ci.d/
99# steps each exec one make target, so migration-check needs its own
100# name to get its own reported step on a runner with step support.
101#
102# go run, not a bare "rastrillo": go.mod already requires rastrillo, so
103# this needs nothing on PATH but the Go toolchain, and works offline
104# after go mod download. A bare "rastrillo migration check" failed a
105# fresh clone's very first CI run with "make: rastrillo: Command not
106# found", and nothing in the scaffold said what to install.
107migration-check:
108 go run amadan.net/rastrillo/rastrillo/cmd/rastrillo migration check
109
110# spacing is Fiesta's stylesheet half of the spacing rhythm (Paul,
111# 2026-11-22: no ad-hoc spacing): every margin, padding and gap in
112# static/ is a var(--rst-sp-N) step, or says why not with
113# /* spacing-allow: why */ where it is written. The call window's
114# allowances are its geometry, pinned to the Mac app's. tokens.css is
115# rastrillo's, vendored and pinned byte for byte (vendored_test.go), so
116# it is skipped; estilo's files are read like Calls' own. The rendered
117# half is the rhythm audit, TestEveryPageKeepsTheRhythm, in make browser.
118spacing:
119 go tool fiesta spacing -skip tokens.css internal/calls/static
120
121# ci is the one gate: what a runner executes and what you run before
122# pushing are the same definition. amadan's runner falls back to this
123# target when .amadan/ci is absent; ci.d/ carries the same targets,
124# reported one by one, for a runner with step support. migration-check
125# fails the build the moment models.go and migrations/ disagree,
126# instead of at boot on whatever machine notices next. If the app
127# declares manifest resources, also add: rastrillo generate --check
128ci: vet fmt-check test migration-check spacing
129
130# The browser gate: a real call between two real Chromium contexts, with
131# fake camera and microphone. The scenarios, and the order they run in,
132# are the `scenarios` slice in internal/callstest/browser_test.go — that
133# list is the one that has to be right, so it is not copied here.
134#
135# Deliberately NOT part of `ci`. It needs node and `npm install`, and the
136# one gate the team runs on every push must not depend on a toolchain the
137# app itself does not use. Run it before every review that touches a page
138# or the client.
139#
140# The vet runs first because the whole gate is behind a build tag (make
141# vet also vets it now, so make ci compiles browser_test.go too).
142#
143# `npm install` fetches the driver, not the browser — playwright 1.62.1
144# has no postinstall step — so `playwright install` is a separate line,
145# and without it this target passes only on a machine whose Playwright
146# cache someone has already warmed. `--with-deps` is deliberately not
147# used: it installs system packages and needs root, which is the
148# operator's call and not a test target's.
149#
150# It also needs UDP. Inside the Claude Code bash sandbox Chromium gathers
151# zero ICE candidates and every call fails with frames stuck at 0 — run
152# this target with the sandbox off.
153#
154# -count=1 because call.mjs is not an input to Go's test cache: node
155# opens it, not the test, so an edited browser script would otherwise be
156# answered with a cached pass from before the edit.
157# The .test.mjs files run first because they need no browser at
158# all: they lift functions out of room.js and chat.js by name — pure
159# ones for their answers, whole loops for what they do — and check
160# §5.1's glare decision against the W3C truth table; §6's DOM safety,
161# the log cap and §4.4's byte counter; §5.4's camera-or-screen judgement
162# with §4.3's fan-out wire shape; and the two sequencing contracts,
163# every sender on the broadcast lane answered exactly once and one
164# gesture taking one capture; and the gate's own observation helper,
165# which is the one piece of call.mjs that can be wrong in a way that
166# makes the gate quieter rather than louder. Under a second between
167# them. Named explicitly rather than by directory — node's test runner treats
168# everything under test/ as a test file, and call.mjs is not one.
169browser:
170 go vet -tags browser ./internal/callstest/
171 node --test test/browser/negotiation.test.mjs
172 node --test test/browser/chat.test.mjs
173 node --test test/browser/room-share.test.mjs
174 node --test test/browser/room-mute.test.mjs
175 node --test test/browser/room-space.test.mjs
176 node --test test/browser/room-hearing.test.mjs
177 node --test test/browser/room-screen.test.mjs
178 node --test test/browser/room-reconnect.test.mjs
179 node --test test/browser/room-recovery.test.mjs
180 node --test test/browser/room-adapt.test.mjs
181 node --test test/browser/room-connecting.test.mjs
182 node --test test/browser/room-glow.test.mjs
183 node --test test/browser/room-layout.test.mjs
184 node --test test/browser/room-window.test.mjs
185 node --test test/browser/room-lane.test.mjs
186 node --test test/browser/room-quality.test.mjs
187 node --test test/browser/room-wake.test.mjs
188 node --test test/browser/room-portrait.test.mjs
189 node --test test/browser/room-self.test.mjs
190 node --test test/browser/media.test.mjs
191 node --test test/browser/audio.test.mjs
192 node --test test/browser/devices.test.mjs
193 npm install --no-save playwright@1.62.1
194 npx playwright install chromium
195 # selfviewwebkit (2026-10-21) holds the self view in WebKit too.
196 npx playwright install webkit
197 go test -tags browser -count=1 -timeout 20m -run TestCallInARealBrowser -v ./internal/callstest/
198 # The smart door (signin_browser_test.go): every sign-in state at
199 # 320px and 1280px, forced light. No media, no UDP.
200 go test -tags browser -count=1 -timeout 10m -run TestSmartDoorInABrowser -v ./internal/calls/
201 # Fiesta's rhythm audit (rhythm_browser_test.go) over Calls' own
202 # pages, at 1280px and 390px, with script and without. No media
203 # beyond Chromium's fake devices, no UDP.
204 go test -tags browser -count=1 -timeout 10m -run TestEveryPageKeepsTheRhythm -v ./internal/callstest/
205
206# Native builds isolate gomobile's cgo bridge from the cgo-free server.
207.PHONY: native-mac native-test native-browser native-pair
208native-mac:
209 ./native/scripts/build-mac.sh
210
211native-test:
212 CGO_ENABLED=0 go test ./callscore ./protocol
213 cd native && CGO_ENABLED=0 go test ./bridge
214 CGO_ENABLED=1 go test -race ./callscore
215
216native-browser: native-mac
217 # The gate runs CallsInterop, which native-mac does not build; without
218 # this it runs whatever binary a previous build left behind.
219 swift build --package-path native/apple --product CallsInterop
220 CALLS_DEEPFILTER_MODEL=$(CURDIR)/native/build/DeepFilterNet3_onnx.tar.gz CGO_ENABLED=0 go test -tags browser -count=1 -timeout 30m -run 'TestNative(MacBarLayout|MacCallsBrowser|MacChat|MacScreenMotion|MacScreenRecovery|MacPortraitVideo|BrowserAuthentication|BrowserAppLink|MacAudioSelfTest|MacAudioStartStall|MacIceBrowser)' -v ./internal/callstest/
221
222# The Mac app in a call with Playwright's WebKit (not iOS Safari; see
223# test/browser/native-webkit.mjs): codecs, Opus FEC, a thin path, and the
224# tab getting its camera and microphone back; and the app's screen to
225# WebKit and Chromium, still, slow, moving and wedged
226# (native-screen-receivers.mjs). Apart from native-browser because it
227# needs WebKit installed.
228.PHONY: native-webkit
229native-webkit: native-mac
230 swift build --package-path native/apple --product CallsInterop
231 npm install --no-save playwright@1.62.1
232 npx playwright install webkit chromium
233 CALLS_DEEPFILTER_MODEL=$(CURDIR)/native/build/DeepFilterNet3_onnx.tar.gz CALLS_SYNTHETIC_SCREEN_HEIGHT=1246 CGO_ENABLED=0 go test -tags browser -count=1 -timeout 45m -run 'TestNativeMac(WebKit|ScreenReceivers)' -v ./internal/callstest/
234
235# Two apps in one call, sharing screens to each other, and spec §15.28's
236# connection that never comes up (TestNativeMacIceRecovery). Separate from
237# native-browser because two unsigned apps on one Mac do not reliably
238# connect, which looks like the macOS firewall: see TestNativeMacScreenShare.
239# It runs CallsInterop too, so it builds it for the same reason.
240native-pair: native-mac
241 swift build --package-path native/apple --product CallsInterop
242 CALLS_DEEPFILTER_MODEL=$(CURDIR)/native/build/DeepFilterNet3_onnx.tar.gz CGO_ENABLED=0 go test -tags browser -count=1 -timeout 30m -run 'TestNativeMac(Screen(Share|PairRecovery)|IceRecovery)' -v ./internal/callstest/
243
244.PHONY: iphone iphone-device iphone-browser
245iphone:
246 ./native/scripts/build-iphone.sh simulator
247iphone-device:
248 ./native/scripts/build-iphone.sh device
249iphone-browser:
250 xcodegen generate --spec native/ios/project.yml
251 CGO_ENABLED=0 go test -tags browser -count=1 -timeout 10m -run 'TestIPhone(SafariAuthentication|NativeMedia)' -v ./internal/callstest/
252
253.PHONY: credits
254credits:
255 @set -eu; notices_tmp=$$(mktemp -d); trap 'rm -rf "$$notices_tmp"' EXIT; \
256 GOOS=$$(go env GOHOSTOS) GOARCH=$$(go env GOHOSTARCH) CGO_ENABLED=0 \
257 go build -o "$$notices_tmp/notices" amadan.net/oficina/estilo.git/cmd/oficina-notices; \
258 GOOS=linux GOARCH=arm64 CGO_ENABLED=0 "$$notices_tmp/notices" \
259 -package ./cmd/calls -lucide -onest \
260 -exclude amadan.net/oficina/agent-access.git,amadan.net/oficina/estilo.git,amadan.net/oficina/home/connect,amadan.net/oficina/home/handoff,amadan.net/oficina/home/roster,amadan.net/oficina/home/teammode \
261 > "$$notices_tmp/notices.json"; \
262 mv "$$notices_tmp/notices.json" internal/calls/credits/notices.json
263