Commit 09dc0bbe by PLN (Algolia)

docs(tasks): archive the Douanier birth + Foundry demos (2026-06-25 session)

Rich archive entries (blog/video source material) for the day's shipped work:
the Douanier Audio-Intelligence API's first endpoints (#22/#36 scaffold+emotion
walking skeleton, #23 SQLite auth+CLI, #26 content-addressed cache with the
measured 5663x repeat speedup) and the Foundry sampling-classics demo sources.
Each entry stands alone for a cold reader — goal, what shipped (commit hashes),
non-obvious learnings + numbers.
parent 6f850128
......@@ -141,3 +141,57 @@ below is measured; honest negatives kept honest.
- **Deps:** the chain feeds #19 (auto-tune settings against the grader) and #20 (batch-explore
many sources). Engine registry now seeds the product/API/service direction PLN wants.
---
# Douanier — birth of the Audio-Intelligence API (2026-06-25)
Designed live with PLN via a long AskUserQuestion co-design (5 rounds), then built lean. The
product: a self-hosted, token-authed, async API in `armada/api/` exposing the fleet's engines
(emotion, samples, features, separation, loops) to hexa (Shipow) + future seats. Full design in
memory `project_douanier_api`. Named after Le Douanier Rousseau (the customs gate).
## #22 / #36 — Scaffold + emotion walking skeleton
- **Description:** stand up the service shell + ONE real endpoint to de-risk the three seams
(engines import · service runs · client can auth) before building auth/jobs/cache.
- **Done:** FastAPI app (`app.py`) versioned `/v1`; `/v1/healthz` + synchronous
`POST /v1/analyze/emotion` (upload → valence/arousal via the tide-table CLAP seam
sample_semantics.embed_audios → emotion_ontology.score); `engines/` lazy-import adapter;
runs in `~/.virtualenvs/douanier` (--system-site-packages). Commit 7f558a7.
- **Learnings:** lean rewire — the cheap "ears" don't need the job queue/quota for one trusted
customer, so a walking skeleton (sync + stub token) reaches value in ~1 session vs 6 tasks.
Arch PEP-668 blocks system pip → venv that INHERITS the multi-GB ML stack, adds only FastAPI.
CLAP cold-load is ~34 s (→ later #28 warms it once in the worker). Real pipeline proven on a
synthetic clip end-to-end.
- **Deps:** root of the whole Douanier tree.
## #23 — Bearer-token auth + scopes + the `douanier` CLI
- **Description:** replace the dev-token stub with a real self-hosted token store.
- **Done:** `db.py` (stdlib sqlite3, WAL for API+worker concurrency); `auth.py` — mint()
returns plaintext ONCE, stores only sha256 (DB leak unreplayable), verify() → Principal with
scope/expiry checks, `require_scope()` dependency (401/403); `douanier.py` admin CLI
(token mint/list/revoke). `/v1/me` echoes identity. Commit fe9ca02.
- **Learnings:** scope='*' wildcard for hexa; dev-token kept as a documented local-only
bootstrap (prod never sets it) so curl works without minting. 15/15 tests; mint expiry landed
exactly 31 days out.
- **Deps:** unblocks #24 quota, #33 hexa token; gates every future engine route.
## #26 — Content-addressed cache (the margin lever)
- **Description:** identical audio analyzed once, served forever — the economic core.
- **Done:** `cache.py` — content_id = sha256 of DECODED PCM (re-encodes dedupe) + raw-bytes
fallback; params_hash folds engine settings; get/put (JSON inline or result_ref path);
yt-id/url→content_id aliases; LRU/size-cap gc() that unlinks evicted artifacts. Wired into
`/v1/analyze/emotion` (`X-Douanier-Cache: hit|miss`). Commit 394bec0.
- **Learnings:** **measured 5663× on a real CLAP run** (10.6 s miss → 0.002 s hit). Cache keys
on the engine so clap/light don't collide. 22/22 tests. This is the margin story vs cloud
egress that justified self-hosting.
- **Deps:** underpins every engine endpoint + job idempotency; unblocks #27.
## (no task) — Sampling-classics demo sources (Foundry)
- **Done:** `tools/foundry/demos.json` — 10 classics (Amen/Funky Drummer/Apache breaks, Chic
bass, Loituma vocal, Mozart no-drums, Rickroll, GM Flash, Humpty, Think) + loader + `foundry
demos` CLI + `/api/demos` + UI quick-picks; `/api/fetch` accepts `ytsearch1:`. Commit fd1fae8.
- **Learnings:** only verified-id URLs ship as links (Loituma from the repo fixture, Rickroll);
the rest are `ytsearch1:` queries so we never ship a guessed/broken video id. Pedagogically
diverse on purpose — fuel for #19 autotune + #20 batch-explore.
- **Deps:** feeds #19 / #20.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment