Skip to content

LVT-303: Add opt-in Cairn API and worker telemetry - #108

Draft
jackshim415 wants to merge 1 commit into
mainfrom
codex/cairn-server-telemetry
Draft

jackshim415 wants to merge 1 commit into
mainfrom
codex/cairn-server-telemetry

Conversation

@jackshim415

@jackshim415 jackshim415 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The API and import worker currently cannot send operational metadata to Cairn. This adds opt-in request timing/status reporting for Express and worker health routes, plus lease-fenced import-attempt events. Scouting reports, identities, raw URLs/query strings, provider bodies, and lease tokens are excluded. Collector failures do not change responses, execution, or retry scheduling.

The private SDK is a verbatim source snapshot of the merged Cairn SDK PR, pinned to fd029d1c90b100fd31313e902b065effeaac8712 with build-verified SHA-256 checksums. A local package follows the existing @lovat/db model, so CI and Docker need no cross-repository credentials or committed build artifacts. Hono is aligned to the SDK-compatible 4.13.16 patch. Cairn follow-up #2 fixes recurring/latest worker summary ordering on the receiver.

Areas affected

  • Server
  • Dashboard
  • Collection
  • Website
  • Shared documentation, CI, or deployment
  • Worker health, lifecycle reporting, and shutdown

Contracts and data

  • Request/report payloads, authentication, tenant/source-team filters, database schema, and season metrics are unchanged.
  • When explicitly enabled, the API adds a generated x-cairn-request-id response header. Unknown route mounts use a fixed placeholder rather than a raw path.
  • API and Worker use distinct service identities and must receive separate scoped ingestion credentials.
  • Every affected producer and consumer was reviewed together
  • Tenant and source-team visibility was reviewed
  • No credentials, production data, or private scouting notes are included

Verification

  • Node 22.20.0: Server build, application/test typechecks, 1,377 unit tests, and 100% per-file unit coverage for all four coverage measures pass.
  • Server format check passes; lint has zero errors and 80 existing warnings.
  • Bun 1.3.14: Worker typecheck and 40 behavior tests pass. Its 21 guarded database integration tests were skipped locally; CI retains disposable PostgreSQL integration checks.
  • Upstream checksum verification, monorepo structure check, lockfile checks, and changed-file credential scan pass.
  • Docker CLI is installed but its daemon is unavailable locally, so the two image builds remain for CI. No live producer-to-Cairn export was tested.

Deployment

Reporting defaults off. No Railway variables, real destinations, or ingestion credentials are configured, and no migrations are added. Enable only after a reviewed staging rollout using CAIRN_ENABLED=true, an HTTPS origin in CAIRN_URL, CAIRN_ENVIRONMENT, and the appropriate service-scoped CAIRN_INGESTION_TOKEN. Invalid/incomplete config leaves the service running with telemetry disabled. Docker/CI now prepare the local SDK package; API shutdown gains a bounded drain only when reporting is enabled. The user's existing dirty training checkout was preserved; this PR was built in an isolated checkout from current main.

Cairn issue linking

Tracking ticket: LVT-303 — Add opt-in Cairn API and worker telemetry. Keep LVT-303 in this PR's title or description so Cairn can associate the PR with that task.

  • Title convention: LVT-303: Add opt-in Cairn API and worker telemetry. For multiple tickets, include each exact identifier in the description, for example Cairn: LVT-303, <another-ticket-id>.
  • Cairn links only existing tickets in the team that owns the allowed repository. GitHub PR state (draft/open/closed/merged) remains separate from the ticket's workflow status.
  • While Cairn runs locally, use Team settings → GitHub → Sync PR links after creating or updating a PR. This reads the 100 most recently updated PRs; Refresh metadata also rechecks references on an already linked PR.
  • When Cairn has a public HTTPS endpoint, the signed pull_request webhook can apply the same convention automatically. A title convention alone does not configure webhook delivery. Private repository access requires the dedicated scoped read-only token; public Lovat metadata currently uses public GET requests.
  • Do not place ingestion tokens, API keys, telemetry payloads, or private scouting data in PR titles/descriptions. Middleware deployment/configuration requirements above remain unchanged.

See the Cairn GitHub integration guide for the current behavior.

Queue operational metadata without exposing scouting payloads or changing request and job outcomes. Pin the private SDK source and verify its checksums so each app can build without extra repository credentials.
@railway-app

railway-app Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the lovat-pr-108 environment in lovat

Service Status Web Updated
dashboard ✅ Success (View Logs) Web Nov 23, 2026 at 12:54 pm UTC
api ✅ Success (View Logs) Web Nov 23, 2026 at 12:53 pm UTC
website ✅ Success (View Logs) Web Nov 23, 2026 at 12:52 pm UTC
learn ✅ Success (View Logs) Web Nov 23, 2026 at 12:52 pm UTC
worker ❌ Build Failed (View Logs) Nov 6, 2026 at 1:30 am UTC
1 service not affected by this PR
  • support

@jackshim415 jackshim415 changed the title Add opt-in Cairn API and worker telemetry LVT-303: Add opt-in Cairn API and worker telemetry Nov 8, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 Connect your app to this PR deployment

Scan a QR code to use this PR's Server API. Worker changes use the same API;
the Worker has no public app endpoint.

Server URL: https://api-lovat-pr-108.up.railway.app

Lovat Collection

QR code — Lovat Collection

lovat-collection://set-url?u=https%3A%2F%2Fapi-lovat-pr-108.up.railway.app

Lovat Dashboard

QR code — Lovat Dashboard

com.frc8033.lovatdashboard:///set-url?u=https%3A%2F%2Fapi-lovat-pr-108.up.railway.app

This branch had an error being deployed

1 failed deployment
lovat / lovat-pr-108 — cf12cdf0 Deployed Nov 6, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant