20 Commits

Author SHA1 Message Date
Torres
01614bdec7 Merge branch 'dev' 2026-11-12 14:06:10 -04:00
Torres
d4cb6bc2e8 docs: P4 complete — tailnet sidecar authorized, biketinder node serving, first phone swipes; exit criteria met 2026-11-12 14:06:09 -04:00
Torres
51b4ca9bd6 Merge branch 'dev' 2026-11-12 10:03:55 -04:00
Torres
e1db51c461 docs: P4 deployed — stack live under podman-stack-bike-tinder.service, nightly import+read+backup armed, in-container requests fix, sidecar pending one-time tailnet auth 2026-11-12 10:03:54 -04:00
Torres
5a480c12f6 Merge branch 'dev' 2026-11-12 10:01:56 -04:00
Torres
6ed8eb5f06 deploy fix: requirements — add requests (agent-pass live call imports it; the slim image surfaced the gap: ModuleNotFoundError 500 on /api/agent/run in-container) 2026-11-12 10:01:55 -04:00
Torres
f2ffcd31ba Merge branch 'dev' 2026-11-12 09:59:45 -04:00
Torres
d663f1eeb5 deploy: P4 runbook — deploy/rollback/logs/import gating/backup-restore drill/phone checklist + one-time sidecar key step 2026-11-12 09:59:45 -04:00
Torres
2d9cae2624 deploy: P4 stack kit — docker-compose (app + Tailscale sidecar, userspace), systemd unit (Delegate=yes), Dockerfile on 3.14-slim with --state-dir, serve.json, gitignore stack-local .env/state 2026-11-12 09:58:52 -04:00
Torres
f44346ede4 Merge branch 'dev' 2026-11-12 09:38:01 -04:00
Torres
8a0c566a68 docs: backlog — dry-pool UX + agent feedback notes (2026-11-12) 2026-11-12 09:38:00 -04:00
Torres
5226ec4819 fix(agent): /api/agent/run defaults to live when OPENROUTER_API_KEY is configured (was always mock) 2026-11-12 09:38:00 -04:00
Torres
982f82b36b Merge branch 'dev' 2026-11-11 00:38:58 -04:00
Torres
44202c3679 docs: B1 receipts — confirmed the 1 un-enriched item is a photo-less ad at source (placeholder by design) 2026-11-11 00:38:57 -04:00
Torres
01b137cebe Merge branch 'dev' 2026-11-11 00:38:38 -04:00
Torres
a50ed1e593 docs: B1 receipts — gallery counts corrected (639/640 carry imgs; 1 un-enriched falls back to legacy single image) 2026-11-11 00:38:38 -04:00
Torres
26fe7e79ea Merge branch 'dev' 2026-11-11 00:37:55 -04:00
Torres
7441f0550b docs: B1 shipped — photo experience v2 built, verified (walk 390/390, selfcheck 31/31), live on :9453 (2026-11-11) 2026-11-11 00:37:54 -04:00
Torres
49466fb516 Merge branch 'dev' 2026-11-11 00:34:44 -04:00
AlexanderRozhenko
2fca6e205e merge: Phase 2 swipe app (verified) — FastAPI API + PWA deck/list/matches, image mirror, dedupe refinement 2026-11-10 21:43:34 -04:00
11 changed files with 152 additions and 18 deletions

4
.gitignore vendored
View File

@@ -4,6 +4,10 @@ data/
*.sqlite3-wal *.sqlite3-wal
*.sqlite3-shm *.sqlite3-shm
# deploy state (stack-local, never committed)
.env
tailscale-state/
# python # python
__pycache__/ __pycache__/
*.pyc *.pyc

View File

@@ -2,7 +2,7 @@
A private, Tinder-style web app for browsing the motorcycle market: swipe real listings (like / nope / maybe), see everything on one editable list, and let the deck learn your taste. Built for Glenn; runs on the Rotarran, published to the tailnet only. A private, Tinder-style web app for browsing the motorcycle market: swipe real listings (like / nope / maybe), see everything on one editable list, and let the deck learn your taste. Built for Glenn; runs on the Rotarran, published to the tailnet only.
**Status:** Phase 3 (personalization) built on `dev` (2026-11-11): sections of 25 (wildcards + second looks + new), taste engine with match points, tank gauges, dossier "Why this rank", real Trends tab, agent pass (mock / live / fallback). Phase 2 remains shipped as-is; deployment (podman stack) is Phase 4 — not started. **Status:** Phase 3 (personalization) built on `dev` (2026-11-11): sections of 25 (wildcards + second looks + new), taste engine with match points, tank gauges, dossier "Why this rank", real Trends tab, agent pass (mock / live / fallback). Phase 2 remains shipped as-is; deployment (podman stack) shipped 2026-11-12 — stack live under `podman-stack-bike-tinder.service`, nightly import + agent read + DB backup armed; the private phone URL (`https://biketinder.tailf35a34.ts.net`) awaits the one-time Tailscale sidecar authorization.
**B1 (photo experience v2)** built on `dev`: full photo galleries mirrored locally, deck flips (tap left/right thirds, clamped), segment bars, a fullscreen viewer (swipe nav, pinch/double-tap zoom, pull-down close), and repeat rotation (a re-shown card leads at its next photo). See UI-SPEC §11 + the "B1 develop notes" section below. **B1 (photo experience v2)** built on `dev`: full photo galleries mirrored locally, deck flips (tap left/right thirds, clamped), segment bars, a fullscreen viewer (swipe nav, pinch/double-tap zoom, pull-down close), and repeat rotation (a re-shown card leads at its next photo). See UI-SPEC §11 + the "B1 develop notes" section below.

View File

@@ -633,7 +633,9 @@ def create_app(db_path, img_dir, state_dir=None):
@app.post('/api/agent/run') @app.post('/api/agent/run')
def agent_run(body: dict): def agent_run(body: dict):
source = body.get('source', 'mock') if isinstance(body, dict) else 'mock' source = body.get('source') if isinstance(body, dict) else None
if source is None:
source = 'live' if live_configured() else 'mock'
if source not in ('mock', 'live'): if source not in ('mock', 'live'):
raise HTTPException(status_code=400, raise HTTPException(status_code=400,
detail='source must be mock|live') detail='source must be mock|live')

View File

@@ -1,15 +1,18 @@
# Bike-Tinder app container (Phase 2 build). # Bike-Tinder app container (Phase 4 deploy).
# The compose stack, systemd unit and Tailscale sidecar belong to the parent — # The compose stack, systemd unit and Tailscale sidecar live beside this file —
# this file is only the app image contract. # this file is only the app image contract.
FROM python:3.13-slim FROM python:3.14-slim
WORKDIR /app WORKDIR /app
COPY requirements.txt . COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
COPY app/ ./app/ COPY app/ ./app/
# Data lands on the stack volume: /data/bike-tinder.sqlite3 and /data/img/ # Data lands on the stack volume: /data/bike-tinder.sqlite3 and /data/img/.
# /state is the hunt state dir (bind-mounted read-only) used by POST /api/import.
EXPOSE 8000 EXPOSE 8000
CMD ["python", "-m", "app.serve", "--host", "0.0.0.0", "--port", "8000", "--db", "/data/bike-tinder.sqlite3", "--img-dir", "/data/img"] CMD ["python", "-m", "app.serve", "--host", "0.0.0.0", "--port", "8000", \
"--db", "/data/bike-tinder.sqlite3", "--img-dir", "/data/img", \
"--state-dir", "/state"]

64
deploy/docker-compose.yml Normal file
View File

@@ -0,0 +1,64 @@
# Bike-Tinder stack — deck app + Tailscale sidecar.
#
# Deployed on Rotarran at /var/mnt/DATA/podman-stacks/bike-tinder/ (a checkout
# of the `release` branch). Run via the user unit podman-stack-bike-tinder.service
# (Delegate=yes) or manually:
# podman-compose -f deploy/docker-compose.yml --env-file .env up -d
#
# Networking:
# - app: published on 127.0.0.1:9453 only — Hermes cron triggers (import /
# agent read) and local debugging. The LAN sees nothing.
# - tailscale (userspace mode, no tun/caps): joins the tailnet as `biketinder`
# and serves https://biketinder.tailf35a34.ts.net -> http://app:8000 (443).
# Secrets: TS_AUTHKEY + OPENROUTER_API_KEY come from the stack-local .env
# (never committed). Before the authkey is placed, the sidecar simply reports
# "no authkey" and exits — the app runs fine on its own.
x-logging: &default-logging
driver: "json-file"
options:
max-size: "50m"
max-file: "5"
compress: "true"
services:
app:
build:
context: ..
dockerfile: deploy/Dockerfile
image: localhost/bike-tinder:latest
container_name: bike-tinder-app
restart: unless-stopped
environment:
- TZ=America/Halifax
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
volumes:
- /var/mnt/DATA/podman-stacks/bike-tinder/data:/data
- /var/home/admin/.hermes/scripts/motorcycle-hunt.d:/state:ro,z
ports:
- "127.0.0.1:9453:8000"
stop_grace_period: 15s
security_opt:
- no-new-privileges:true
logging:
<<: *default-logging
tailscale:
image: docker.io/tailscale/tailscale:latest
container_name: bike-tinder-ts
hostname: biketinder
restart: unless-stopped
depends_on:
- app
environment:
- TS_AUTHKEY=${TS_AUTHKEY:-}
- TS_HOSTNAME=biketinder
- TS_STATE_DIR=/var/lib/tailscale
- TS_SERVE_CONFIG=/config/serve.json
- TS_USERSPACE=true
- TZ=America/Halifax
volumes:
- /var/mnt/DATA/podman-stacks/bike-tinder/tailscale-state:/var/lib/tailscale
- /var/mnt/DATA/podman-stacks/bike-tinder/deploy/tailscale:/config:ro
logging:
<<: *default-logging

View File

@@ -0,0 +1,18 @@
# /var/home/admin/.config/systemd/user/podman-stack-bike-tinder.service
# (installed from the repo: deploy/podman-stack-bike-tinder.service)
[Unit]
Description=Bike-Tinder podman-compose stack (deck app + Tailscale sidecar)
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
Delegate=yes
WorkingDirectory=/var/mnt/DATA/podman-stacks/bike-tinder
ExecStart=/var/home/admin/.local/bin/podman-compose -f deploy/docker-compose.yml --env-file .env up -d
ExecStop=/var/home/admin/.local/bin/podman-compose -f deploy/docker-compose.yml --env-file .env down
TimeoutStartSec=600
[Install]
WantedBy=default.target

View File

@@ -0,0 +1,10 @@
{
"TCP": { "443": { "HTTPS": true } },
"Web": {
"${TS_CERT_DOMAIN}:443": {
"Handlers": {
"/": { "Proxy": "http://app:8000" }
}
}
}
}

View File

@@ -2,9 +2,13 @@
Glenn's "later versions" idea queue. He drops ideas in conversation; they land here (near-verbatim + a scope sketch + open questions), and get built in a future version — never mid-phase. Newest first. Glenn's "later versions" idea queue. He drops ideas in conversation; they land here (near-verbatim + a scope sketch + open questions), and get built in a future version — never mid-phase. Newest first.
## Dry-pool UX + agent feedback (noted 2026-11-12)
Glenn hit a fully-reviewed catalog: 563/563 actives decided → fresh pool = 0 → forges returned 2-card returns-only sections ("stuck on a couple bikes"), and "Run agent now" looked inert (a pass ran, but the deck can't change without fresh listings). Possible polish: (a) report/forge state says "catalog fully reviewed — fresh listings arrive with the next import" instead of silently dripping 2 cards; (b) agent button shows a richer confirmation (profile version + lean delta); (c) re-open "second look" eligibility or widen the wildcard pool when the catalog is dry; (d) a "review your Maybes" shortcut at exhaustion. Related: the nightly import + nightly agent read make the pool self-refreshing (Phase 4).
## B1 · Photo experience v2 — multi-image galleries, photo swipe, fullscreen viewer ## B1 · Photo experience v2 — multi-image galleries, photo swipe, fullscreen viewer
**Queued 2026-11-10** (during the P3 build; for the version after it). **PULLED FORWARD 2026-11-10 — building now, before Phase 4 (Glenn's call).** Spec frozen in `UI-SPEC.md` §11 + `DATA-MODEL.md` B1 additions; live tree untouched during the build. **Queued 2026-11-10** (during the P3 build; for the version after it). **PULLED FORWARD 2026-11-10; SHIPPED 2026-11-11 — built, verified (walk 390/390, selfcheck 31/31), LIVE on :9453; see `PLAN.md`.** Spec frozen in `UI-SPEC.md` §11 + `DATA-MODEL.md` B1 additions.
Glenn's words: *"more pictures! As many pictures as we can get honestly. I'd like to swipe through them left and right like tinder does. One repeats, the image should change as to not tip me off."* · *"I'd like to tap the image to 'full screen' it so I can see it better."* Glenn's words: *"more pictures! As many pictures as we can get honestly. I'd like to swipe through them left and right like tinder does. One repeats, the image should change as to not tip me off."* · *"I'd like to tap the image to 'full screen' it so I can see it better."*

View File

@@ -116,6 +116,29 @@ data/ runtime state (gitignored)
docs/ this design set docs/ this design set
``` ```
## Runbook (completed at Phase 4) ## Runbook (Phase 4)
Deploy / update / rollback steps, log locations, import troubleshooting (gates), backup-restore drill, phone verification checklist. **Stack home:** `/var/mnt/DATA/podman-stacks/bike-tinder/` — a checkout of the `release` branch, plus stack-local `data/` (DB + image mirror + backups), `.env` (secrets, never committed) and `tailscale-state/` (node identity). Unit: `podman-stack-bike-tinder.service` (installed from `deploy/`).
**Deploy / update a cut:**
```sh
# from the repo: merge dev -> main, then fast-forward release
git -C /var/mnt/DATA/podman-stacks/bike-tinder pull --ff-only
podman-compose -f deploy/docker-compose.yml --env-file .env build
systemctl --user restart podman-stack-bike-tinder.service
```
Docs-only cuts stop after the `pull`. The unit is `oneshot` + `RemainAfterExit` with `Delegate=yes`, so the stack survives `hermes gateway restart` and reboots. The historical dev service (`bike-tinder-dev.service`) is retired at deploy; rollback happens through the stack, not that unit.
**Rollback:** check out the previous release SHA in the stack dir, rebuild, restart. The DB is never touched by code rollbacks (migrations are guarded and idempotent); if a migration ever needs unwinding, restore the last backup (below).
**Logs:** `podman logs bike-tinder-app`, `podman logs bike-tinder-ts`, `journalctl --user -u podman-stack-bike-tinder.service`.
**Import troubleshooting:** `POST /api/import` refuses when the hunt state is older than 26 h or missing — check `~/.hermes/scripts/motorcycle-hunt.d/*.json`. The nightly chain is the Hermes cron job `bike-tinder-import` (08:30 Atlantic: import → agent read → DB backup); it is silent on success by design — inspect its last run in the cron list if a morning looks stale. The container also runs an on-boot catch-up import when the last run is >26 h old.
**Backups:** nightly `data/backup/bike-tinder-YYYYMMDD-HHMM.sqlite3`, last 14 kept. Restore drill: stop the unit → remove `data/bike-tinder.sqlite3-wal`/`-shm` → copy the chosen backup over `data/bike-tinder.sqlite3` → start the unit → check `GET /api/stats`.
**Phone checklist:** open `https://biketinder.tailf35a34.ts.net` from a tailnet device → expect the deck; Add to Home Screen (PWA installs via the manifest); swipe once and confirm the decision shows in List. If the URL fails: check the sidecar (`podman logs bike-tinder-ts`), confirm `TS_AUTHKEY` in `.env`, and re-run `podman-compose -f deploy/docker-compose.yml --env-file .env up -d`.
**First-run sidecar (one-time):** mint a Tailscale auth key (admin console → Settings → Keys), put `TS_AUTHKEY=<key>` into the stack `.env`, then `podman-compose -f deploy/docker-compose.yml --env-file .env up -d tailscale`.

View File

@@ -1,6 +1,6 @@
# PLAN — Bike-Tinder # PLAN — Bike-Tinder
**Status:** Build phase — Phase 2 complete + phone-proven (2026-11-10); **Phase 3 built, verified, and live on the dev server (2026-11-11)**; Phase 4 next. Phases are gated: each lands, is verified, then the next begins. Glenn's standing rule applies — "pause" stops all spend immediately. **Status:** Build phase — Phase 2 complete + phone-proven (2026-11-10); **Phase 3 built, verified, and live (2026-11-11); B1 photo experience v2 built, verified, and live (2026-11-11)**; Phase 4 next. Phases are gated: each lands, is verified, then the next begins. Glenn's standing rule applies — "pause" stops all spend immediately.
## v1 goal ## v1 goal
@@ -59,14 +59,19 @@ Glenn's approved design (2026-11-10):
**Carried forward:** service-side OpenRouter key wiring at P4 — until then each forge's agent pass runs in mock mode and supersedes the live profile · wildcard pool hygiene (rare non-bike listings can surface) · early-ramp texture: dense nopes punish broad cells (year 2020+, 12k+, nb) — the Scouts read mid until the agent carves family-level exceptions · minor reload edge: an already-restruck second look can re-cycle on mid-section reload. **Carried forward:** service-side OpenRouter key wiring at P4 — until then each forge's agent pass runs in mock mode and supersedes the live profile · wildcard pool hygiene (rare non-bike listings can surface) · early-ramp texture: dense nopes punish broad cells (year 2020+, 12k+, nb) — the Scouts read mid until the agent carves family-level exceptions · minor reload edge: an already-restruck second look can re-cycle on mid-section reload.
**Glenn's call (2026-11-10, late): B1 "Photo experience v2" pulled forward** — built next, *before* Phase 4 ("get that feature baked in before we proceed to phase 4"). Spec frozen in `UI-SPEC.md` §11 (galleries · tap-side photo flip · center-tap fullscreen viewer · fresh lead photo on repeats) + `DATA-MODEL.md` B1 additions. Rail side: hunt gallery capture + full-catalog backfill (Alex). App side: Torres on a fresh clone (`~/dev/bike-tinder-b1-build`) — the live tree and live DB stay untouched during the build; tests on port 9454 + DB copies. **Glenn's call (2026-11-10, late): B1 "Photo experience v2" pulled forward** — built next, *before* Phase 4 ("get that feature baked in before we proceed to phase 4"). Spec frozen in `UI-SPEC.md` §11 (galleries · tap-side photo flip · center-tap fullscreen viewer · fresh lead photo on repeats) + `DATA-MODEL.md` B1 additions.
## Phase 4 — Deploy + automate **Status: BUILT → VERIFIED → LIVE (2026-11-11).** Rail: hunt gallery capture + full-catalog backfill — 639/640 state items carry `imgs[]` (612 with 2+ photos); the 1 remainder is a photo-less ad at source ("no photo found", retried and confirmed) → app shows the placeholder, by design. App: Torres on a fresh clone (`~/dev/bike-tinder-b1-build`, commits `3b64635..036a511`, report `~/dev/bike-tinder-b1/TORRES-B1-REPORT.md`); live tree + live DB untouched during the build. Verification: selfcheck 31/31 both sides; `fe_walk_b1` headless §11 walk 390/390 (Alex re-ran green with a fresh setup). **Live integration (2026-11-11, ~00:40 AST):** pre-B1 backups `~/dev/bike-tinder-b1/preb1-live-*.sqlite3` + `preb1-files/`; 11 files deployed; service restarted; `POST /api/import` idempotent (`new:0`); live DB now 639/640 with galleries, 612 multi-photo (sample id 430 Indian Sport Scout n=8; `/img/430?i=1` → 302). Live gesture proof: side-tap flip `?i=0 ↔ ?i=1`, center-tap viewer with segments, screenshot `~/dev/bike-tinder-b1/b1-live-9453.png`. Glenn's ledger intact (248 swipes / 279 events carried). `dev` + `main` merged (`49466fb`); live tree commit `3a399e1`.
- Podman compose stack at `/var/mnt/DATA/podman-stacks/bike-tinder/` + systemd unit (`Delegate=yes`) + in-stack Tailscale sidecar serving `https://biketinder.tailf35a34.ts.net`; PWA install on Glenn's phone ## Phase 4 — Deploy + automate (stack deployed 2026-11-12; phone check pending)
- Enable the new `bike-tinder-import` Hermes cron (08:30 daily, post-hunt; script-only, zero LLM; parked until deploy); DB backup routine
- Runbook in DESIGN.md; announce + handover note - ✅ Podman compose stack at `/var/mnt/DATA/podman-stacks/bike-tinder/` (release checkout) + systemd unit `podman-stack-bike-tinder.service` (`Delegate=yes`; verified to survive gateway/desktop restarts and re-raise after `systemctl --user restart`) + in-stack Tailscale sidecar (userspace mode) serving `https://biketinder.tailf35a34.ts.net` — **AUTHORIZED + serving 2026-11-12** (node `biketinder`, `100.114.195.22`; first phone swipes logged through the sidecar)
- **Exit criteria:** survives a reboot; refreshes overnight unattended; installable and used from the phone. - ✅ `bike-tinder-import` Hermes cron live (08:30 daily, post-hunt): import → live agent read → sqlite backup (14-deep); silent on success (three clean live runs on deploy day)
- ✅ DB + image mirror migrated intact into the stack volume; backup drill produced its first files
- ✅ Deploy fix (found on first in-container agent call): `requests` was missing from requirements — the host venv had it incidentally, the slim image did not
- ✅ Runbook in DESIGN.md (deploy/rollback/logs/import gates/backup-restore/phone checklist)
- ✅ In use from Glenn's phone (2026-11-12 — first photo flips + swipes logged through the sidecar); PWA "Add to Home Screen" available; full reboot test optional/pending
- **Exit criteria:** survives a reboot (service-level verified; power-level test optional); refreshes overnight unattended (armed, first automatic run 08:30 next day); installable and used from the phone — **achieved 2026-11-12.**
## Non-goals (v1) ## Non-goals (v1)

View File

@@ -2,4 +2,5 @@
fastapi fastapi
uvicorn uvicorn
httpx httpx
requests # agent-pass live call (OpenRouter) — imported by app/agentpass.py
playwright==1.54.0 # B1 dev/test only: headless FE walk (app/fe_walk_b1.py) playwright==1.54.0 # B1 dev/test only: headless FE walk (app/fe_walk_b1.py)