Commit Graph

58 Commits

Author SHA1 Message Date
Semih
c7346fd25e feat(home): founder daily overview
Replaces the previous "active spokes / planned / audit24h / audit7d" home
with a synthesizing daily-overview page. Pulls from every module shipped
to date (VIN observability, user management, BIP, audit log, Coolify
deploys) and answers a single question: "what should I look at today?"

Repo (lib/sase/daily-overview.ts)
- getSaseHealthSnapshot — 24h vs prior-24h success rate + volume; single
  raw query with FILTER aggs on the two windows.
- getInsightSummary — open insights grouped by severity (P0..P3), plus
  recent-7d created and 7d-shipped counts (from panel-pg insights).
- getSaseUserCounts — total/new/active-sub/trial/cancelled, suspended,
  banned, dormant payers (14d), empty-handed payers. Two correlated
  subqueries for dormant/empty since they need NOT EXISTS over
  query_logs.
- getRecentAdminActions — last N audit_log mutations (excluding GET and
  /api/internal/*). Maps each endpoint to a human label
  ("Impersonate", "Refund", …) and a deep-link target where possible.
- getRecentDeployStatuses — last N Sase Coolify deploys with
  regression-flag derived from the ±30min slice analyzer.
- buildActionItems — synthesizes "things you should look at" from all
  the above, sorted critical → low. Surfaces deploy regressions, open
  P0/P1 insights, big 24h success drop, dormant/empty payers,
  suspended users.

UI (app/page.tsx)
- Six-column KPI strip across the top: Sase 24h success (color-coded
  by threshold, with pp delta vs prior 24h), volume delta, active sub,
  new users 7d, open insight total, audit count.
- "Bugün bakmam gerekenler" action-item list, color-coded by severity,
  each clickable.
- Two-column split: open-insights-by-priority (links to /insights with
  the severity filter), Sase user health counts (dormant/empty/
  suspended/banned with links).
- Two-column split: last 5 deploys with Δ-success column + regression
  badge, last 10 admin actions with human label + status + deep link.
- Projects grid moved to the bottom as a compact strip (was the
  primary section before).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 14:04:36 +03:00
Semih
a10996f6c5 feat(sase): deploy regression Telegram alert
Closes the alert side of the deploy-regression view added in Faz 2b.
The dashboard table already flagged regressed deploys; this commit
pushes a Telegram when one happens, so MTTD doesn't depend on the
founder checking the dashboard.

Detection (panel)
- detectVinRegressions() pulls the last 20 Coolify deploys for the
  Sase.tr app, filters to those whose post-window has elapsed (≥30min
  since finishedAt) and isn't too old (≤180min since finishedAt), and
  reuses analyzeDeployRegressions to compute the 30min before/after
  success-rate slices. A row is flagged when:
    - both before and after have ≥5 samples, and
    - success rate dropped ≥10pp (severity 'high'; ≥15pp → 'critical').
- Returns a RegressionHit per flagged deploy with a 24h dedupe TTL
  keyed on deploymentUuid so each deploy alerts exactly once ever
  (regardless of how often the 5-min cron checks).

Endpoint
- GET /api/internal/vin-anomaly-check now returns
  { ok, current, baseline, anomalies, regressions }.

Worker
- sendTelegram() accepts an optional dedupeTtlSeconds override so
  per-call long-TTL dedupes (like deploy alerts) don't have to go
  through the global env default.
- New alertVinRegression() formats severity icon + before/after %
  + deploy commit/timestamp + dashboard link.
- runVinAnomalyDetect now also walks the regressions array and
  fires Telegram for each. Returns { anomalies, regressions,
  alertsFired, alertsDeduped }; pipeline log prints when either
  count is non-zero.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 13:33:07 +03:00
Semih
b5ba8919b8 feat(sase): VIN observability Faz 4 — trends + provider drill-down
Closes Phase 8: long-term capacity view + per-provider deep dive.
Alert-threshold config UI deferred to teknikborc — the cron defaults
are well-calibrated enough to ship without a config table.

Trends page — /projects/sase/vin-decode/trends
1. Son 90 gün — daily decode volume sparkline, success/total ratio
   shading.
2. Haftalık büyüme — WoW % change for last 12 weeks, color-coded.
3. Provider yük dağılımı — stacked area for the last 30 days, one bar
   per day decomposed by winning provider; legend below.
4. Düşük destekli markalar — brands with ≥20 30d volume but ≤75%
   success. New-provider/decoder investment signal.
5. Peak heatmap — 7×24 grid (day-of-week × hour) for the last 30d,
   intensity-shaded; B2B working-hours pattern + infra scaling guide.
6. Cache hit trend — daily cache hit rate sparkline + 30d average.
7. Verimlilik composite — daily score combining success (50%), cache
   (20%), latency (20%, 1.0 at <500ms decaying to 0 at >10s), and
   1-fallback (10%). 14-day table view.

Provider drill-down — /providers/[name]?range=7d|30d
- Four KPIs: wins total, success rate, avg/P95 latency, chain-attempt
  count (separately tracked for chain key vs winning-source).
- Daily wins sparkline scoped to the range.
- Top 10 brands the provider successfully decoded for.
- Fallback chains the provider participated in.
- 20 most recent failures with sanitized VIN + user-link drill.

Dashboard wiring
- Winning-provider and provider-attempts cards on the main VIN
  dashboard now link each provider row to /providers/[name]. The
  timings-key aliases (pcat → parts-catalogs, vin_api → vin-api) are
  remapped so the link reaches the right page.
- New "Trends →" pill in the header next to "Business →".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 13:13:19 +03:00
Semih
e583f6b6be feat(sase): VIN business-impact dashboard — Faz 3 (no-quota model)
Sase.tr has no monthly VIN quota — access is gated by plan.brandCount
+ user_brands assignments. The PRD's Faz 3 quota-centric metrics don't
apply; this commit ships the 8 business signals that DO apply to that
model. All queries are RO joins of query_logs to subscription/plan/brand.

1. Tier × decode volume (30d) — unique users, decode count, decodes/user,
   and success rate per plan. Plan derived from each user's most-recent
   active/trial subscription.
2. Brand-tier alignment — for plans with brandCount > 0, the fraction
   of decodes that landed on a brand the user actually has access to via
   user_brands. Low alignment = wrong tier or upsell signal.
3. Dormant payers — active subscription + no decode in the last 14 days.
   Sorted by lastDecodeAt ASC (most dormant first), 30 rows.
4. Empty-handed payers — active subscription + zero lifetime decodes.
   Onboarding-broken signal, sorted oldest start_date first.
5. Trial → paid funnel — bucket trial users by decodes-during-trial
   (0, 1–2, 3–5, 6–10, 11–25, 26+) and show the conversion rate (any
   subsequent active/cancelled subscription) per bucket. Answers
   "how many decodes is the aha moment".
6. Retention cohort — weekly signup cohorts (mature ≥30d), split by
   "had a successful decode in first 7 days" vs not; columns show 30d
   active rate per bucket and the retention lift (pp difference).
7. Power users — top 20 by 30d decode count: plan, decode count,
   brand diversity, top brand + occurrences, success rate.
8. Tier mismatch — brand-spesifik plan kullanıcıları whose 30d decodes
   include ≥3 hits on brands they don't have access to. Upsell candidates
   (or refund/downgrade conversation).

All tables link emails to /projects/sase/users/[id] (existing detail page),
so the dashboard is a "find users to talk to" tool, not just numbers.

VIN dashboard header now has a "Business →" pill next to the time range
picker.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 12:49:14 +03:00
Semih
717e4ae369 feat(sase): VIN observability Faz 2 — error drill-down + deploy regression + BIP
Three additions to the VIN Decode Observability dashboard, all read-only.

Faz 2a — Error fingerprint drill-down
- New route /projects/sase/vin-decode/errors/[key] where [key] is one
  of the eight bucket keys (BUDGET_EXCEEDED, UNKNOWN_VIN, TIMEOUT, …).
- getErrorBucketDetail(key, range) returns: total + unique-user count,
  hourly time series, top 10 affected brands (joined to brands.name/
  slug), top providers (winning + chain attempts from timings keys),
  top 20 affected users with link to their detail page, six distinct
  sample error messages, last 30 raw failures (sanitized VIN, source,
  RT, message).
- Error breakdown cards on the main dashboard now link to this page
  with the current time range preserved.
- ERROR_BUCKET_KEYS + ErrorBucketKey exported so the [key] route
  validates against the same list.

Faz 2b — Deploy regression analysis
- listSaseDeploys(limit) fetches the Sase.tr Coolify app's recent
  finished deployments via the Coolify API (COOLIFY_API_TOKEN).
- analyzeDeployRegressions(deploys) slices a 30-minute window
  before deploy.startedAt and after deploy.finishedAt, computes the
  success-rate delta, and flags rows where the drop ≥ 10pp (and
  both windows have ≥ 5 samples).
- Dashboard card lists last ~10 deploys with before/after rates and
  Δ pp, color-coded; "regression" badge on flagged rows.

Faz 2c — BIP integration
- getVinRelatedInsights() reads from the panel-pg `insights` table:
  type='provider_quality' (always VIN-related by prompt-tag routing)
  + bug_triage insights whose body mentions VIN/decode/provider
  keywords. Deduped, severity-then-recency sorted.
- New dashboard card surfaces insight titles with severity + type
  badges, occurrence/user counts, confidence, and a link to the
  Gitea issue if one was opened.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 12:31:27 +03:00
Semih
4694c1ffdb feat(sase): VIN decode anomaly detection + Telegram alerts
Adds the active half of Phase 8: dashboard was passive, this pushes
when something breaks. Targets MTTD < 10 minutes from the PRD.

Detection (panel-web)
- detectVinAnomalies() compares a 15-minute current window against a
  baseline built from the same 15-minute slot across the previous 7
  days (same-hour-of-day, average across days that had ≥ 1 sample).
- Five hits, two severities:
  * success_rate_drop — high at ≥ 5pp drop, critical at ≥ 15pp
  * p95_latency_spike — high at 2× baseline (and > 1s), critical at 3×
  * volume_drop — high at ≥ 80% below baseline, critical at ≥ 95%
  * volume_spike — high at ≥ 5× baseline
  * timeout_dominance — high when ≥ 50% of failures are timeouts
- Minimum-volume guards on both current and baseline so quiet hours
  don't generate noise (MIN_CURRENT_VOLUME=5, MIN_BASELINE_VOLUME=10).
- Each anomaly carries a 15-min-bucket dedupe key — same anomaly type
  fires at most once per bucket regardless of cron cadence.

Endpoint
- GET /api/internal/vin-anomaly-check, gated by x-internal-worker-token
  header (constant-time compare against INTERNAL_WORKER_TOKEN env).
  Returns { current, baseline, anomalies[] }.

Worker
- New job vin-anomaly-detect, BullMQ scheduler */5 * * * *.
  Fetches the panel endpoint, then for each anomaly calls
  alertVinAnomaly() — sendTelegram with the bucket dedupe key, so
  Redis SETEX NX dedupes across the 1h cooldown window.
- alertVinAnomaly() in worker/lib/telegram.ts formats the message with
  severity icon + baseline/observed/volume context + dashboard link.
- runVinAnomalyDetect returns { ok, checked, anomalies, alertsFired,
  alertsDeduped }; pipeline logs only when something happened or the
  check failed.

Env
- INTERNAL_WORKER_TOKEN set on both panel-web and panel-worker
  (32-byte hex, generated in Coolify).
- PANEL_INTERNAL_URL on panel-worker → coolify-network UUID hostname
  for panel-web, no Cloudflare/Tailscale hop on internal calls.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 12:22:02 +03:00
Semih
66a5828ee6 feat(sase): VIN Decode Observability dashboard — Phase 8 Faz 1
Süper Panel VIN Decode Observability Module (SP-VIN-001), Faz 1 MVP.
Reads directly from Sase.tr's query_logs via DATABASE_URL_SASE_RO —
no PostHog hop, no ingestion worker, no aggregation tables. Sase.tr's
existing query_logs.timings jsonb already captures the full chain
context (per-provider durations, cache source, circuit-breaker state).

Repo (apps/web/src/lib/sase/vin-decode.ts)
- getOperationalHealth(range) — total/success/failure counts, success
  & error rates, P50/P95/P99 + avg response time, cache hit rate,
  timeout rate, unknown-VIN rate. Single raw query with FILTER aggs.
- getWinningProviders(range) — group by source (decoded by), share +
  avg response time per provider.
- getProviderAttempts(range) — group by timings jsonb keys
  (pcat/emex/pl24/vin_api). A row may contribute to multiple providers
  if the chain ran through several.
- getFallbackChains(range) — multi-provider rows grouped into chain
  strings (e.g. 'pcat→emex→pl24') with frequency.
- getErrorBreakdown(range) — bucket errors via regex
  (BUDGET_EXCEEDED, UNKNOWN_VIN, TIMEOUT, …) on errorMessage.
- getDailyTrend(days) — date_trunc('day') volume + success + failure
  + avg latency. Filled with zero-rows so the sparkline is continuous.
- getBrandBreakdown(range, limit) — top brands joined to brands.name/slug
  with per-brand success rate.

Dashboard (/projects/sase/vin-decode)
- 4-button time range picker (1h/24h/7d/30d) via URL search-params.
- 6 KPI cards (Success, Error, P95 RT, Cache hit, Timeout, Unknown VIN)
  color-coded by threshold.
- Two parallel provider views: "winning provider" (decode resolver)
  vs "provider attempt" (timings keys — wider, includes fallthroughs).
- Fallback chain frequency table.
- Error bucket cards with example messages.
- Top brands by query volume with success rate cells (green/red).
- 30-day daily-volume sparkline with success/total ratio shading.

Sase landing gets a "VIN Decode →" link next to the Users link.

No new tables, no migrations, no workers. RO-only by design.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 12:06:41 +03:00
Semih
096ca9b4a3 feat(sase): brand picker — Phase F
Pairs with sase.tr#31 (POST /internal/admin/subscriptions/:id/brands).

Admin SDK
- setSubscriptionBrands({ subscriptionId, brandIds, reason, founderId }).
- BrandSetResult type; SASE_ADMIN_ENDPOINTS list updated.

Repo
- listBrands() helper (RO).
- getUser() now returns currentPlanBrandCount + brandIds for the picker.

Route
- POST /api/sase/subscriptions/[subId]/brands — auth + spoke-wired,
  brandIds array required, reason ≥ 5 chars. Audit on both paths.

UI (BrandPicker on the Billing tab, below subscription actions)
- Full plan (brandCount=0): shows "all brands automatic" badge list,
  no picker.
- Active/trial with brandCount > 0: checkbox grid of all active brands.
  Clicking past the plan limit shows an inline error. Visual deltas:
  outline "kaldırılacak" badge on rows being removed, default "yeni"
  badge on rows being added.
- Cancelled/expired: read-only message.
- Save button enabled only when selection is exactly plan.brandCount,
  there's a dirty diff, and a reason ≥ 5 chars is entered. Saves +
  router.refresh().

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:38:34 +03:00
Semih
0eacc32286 feat(sase): refund + bonus extension — Phase E
Pairs with sase.tr#30.

Refund
- admin-sdk: refundPayment({ paymentId, amount?, reason, founderId }) +
  RefundResult type; SASE_ADMIN_ENDPOINTS lists the new route.
- POST /api/sase/payments/[paymentId]/refund — auth + spoke-wired,
  reason ≥ 5 chars, amount > 0 when provided (full refund if omitted).
  Audit on success and failure.
- _refund-button.tsx: per-row [Refund] button in the Billing tab
  payments table. Modal has [✓] full vs partial input, reason, and a
  destructive submit. Hidden for payments that aren't refundable
  (status !== completed/partially_refunded).
- Payment row now exposes an "İşlem" column (only when spoke is wired).

Bonus extension (goodwill)
- BillingActions: new "Bonus +7g/+14g/+30g + özel" buttons surfaced
  for active subscriptions. Hits the same /trial/extend wire under the
  hood — the spoke generalized that endpoint to active too — but the
  panel uses "Bonus süre ekle (goodwill)" copy instead of "Trial uzat".

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 10:06:16 +03:00
Semih
631ca6b4c4 chore(sase): show emails in plain text — drop masking + reveal flow
User decision: emails should display openly on the panel (Tailscale-only,
single founder). The reveal-with-audit pattern was overkill for this
trust model and added a click per inspection.

- List page: u****@x.com → u.email
- Detail header: <EmailReveal/> → plain <span>{user.email}</span>
- Delete _email-reveal.tsx + /api/sase/users/[id]/reveal-email route
- Delete maskEmail() helper (no remaining callers)

Audit log no longer captures per-email reveals; the audit tab now only
shows lifecycle/billing/impersonation actions, which is what we actually
care about.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 09:53:54 +03:00
Semih
3621c0801f feat(sase): plan change + subscription cancel/resume — Phase D
Completes the billing surface; pairs with sase.tr#29.

Admin SDK
- changePlan(input) + cancelSubscriptionById(input) + resumeSubscription(input).
- PlanChangeResult + SubscriptionStateChange types exported.
- SASE_ADMIN_ENDPOINTS lists the three new spoke routes.

Route
- /api/sase/subscriptions/[subId] now accepts change-plan/cancel/resume
  in addition to trial-extend/activate. newPlanId required when
  action=change-plan. Reason ≥ 5 chars enforced. Audit captures the
  action + days + newPlanId + reasonLen on both paths.

Repo
- getUser() also returns currentPlanId for the plan picker.

UI
- BillingActions extended:
    active/trial → [Plan değiştir][İptal et]
    cancelled    → [Devam ettir]
- Change-plan modal lists active plans (current excluded) with brand
  count hint. The spoke flags brand-reassignment via response field;
  v1 surfaces only the confirmation.
- Cancel uses destructive variant + clear messaging.

Phase D ships the user-management mutation surface — A/B/C/D all live.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 09:47:05 +03:00
Semih
01bb820c57 feat(sase): trial extend + manual activate — Phase C
Billing tab on user detail page now has writable actions wired to spoke
endpoints landed in sase.tr#28.

Admin SDK
- extendTrial({ subscriptionId, days, reason, founderId }) + result type
- activateSubscription({ subscriptionId, reason, founderId }) + result type
- SASE_ADMIN_ENDPOINTS list updated

Repo
- getUser() now returns subscriptionId so the billing UI can act on it.

Route
- POST /api/sase/subscriptions/[subId] — single multiplexed endpoint:
  body { action: 'trial-extend' | 'activate', reason, days? }.
  Auth + spoke-wired + reason ≥ 5 chars + days 1..90 (trial-extend).
  Audit on success and failure paths.

UI
- BillingActions client component on the Subscription & Billing tab.
- Trial state: [+7g][+14g][+30g] quick buttons + custom days input +
  reason modal.
- Trial or pending state: [Subscription'ı aktive et] button.
- Other states show "no billing action available" hint.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 09:41:45 +03:00
Semih
b1ec7a5277 feat(sase): user lifecycle controls — Phase B
Suspend / Reactivate / Ban buttons on the user detail page; wired to
spoke endpoints (sase.tr#27).

Admin SDK
- suspendUser/reactivateUser/banUser on SaseAdmin + LifecycleResult.
- SASE_ADMIN_ENDPOINTS updated.

Route
- POST /api/sase/users/[id]/lifecycle (action + reason). Auth + spoke
  wired + min reason length checks. Audit on both success and failure.

RO model
- Sase Prisma schema adds status/statusReason/statusChangedAt/
  statusChangedBy. getUser() returns lifecycleStatus + statusReason.

UI
- LifecycleStatusBadge in header next to email reveal.
- LifecycleButtons renders the right actions for the current state.
- Modals with reason textarea; ban requires a double-confirm checkbox.
- Impersonate hidden when user is suspended/banned (AuthGuard rejects).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 09:38:07 +03:00
Semih
5b26d10485 feat(sase): founder notes — Phase A of user mutations
Panel-side only — first writable feature on the Sase user detail page.
Notes are stored in the panel database (sase_user_notes); the spoke is
never touched (KVKK minimize).

Model
- SaseUserNote { id, saseUserId, authorUserId, body, pinned, createdAt }
- Index on (saseUserId, pinned, createdAt) for the default render order

API
- GET  /api/sase/users/[id]/notes — list (pinned first, then newest)
- POST /api/sase/users/[id]/notes — { body, pinned } create (audit'li)
- PATCH/DELETE /api/sase/notes/[noteId] — toggle pin / hard delete

UI
- New "Notlar" tab on user detail. Textarea + pinned checkbox + submit;
  list shows TR-localized timestamps, per-row pin/unpin and delete.

Schema sync
- package.json `start` now runs `prisma db push --skip-generate` before
  `next start`. Panel uses db-push style (no migrations dir); this lets
  the new table land on next deploy without a separate manual step.
  Future destructive changes will require a smarter migration approach.

teknikborc.md updated: super_panel_reader role still needs to be created
on the new sase-postgres (current panel uses sase superuser).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 09:32:48 +03:00
Semih
d8c2bdd22f feat(sase): read-only impersonation from user detail page
Adım 3 — Süper Panel side of the readonly impersonation flow.

- admin-sdk/sase.ts: impersonateReadonly(userId, founderId, ttlMinutes,
  reason) — POSTs to /internal/admin/users/:id/impersonate-readonly.
  notWiredSdk stub returns same shape so type contract holds when env vars
  are absent.
- POST /api/sase/users/[id]/impersonate-readonly — auth-checked panel
  endpoint. Validates ttl ∈ {15,30,60} + reason ≥ 5 chars. Calls spoke SDK,
  writes audit (double-audit: AdminClient also logs at the wire), returns
  { redirectUrl, expiresAt, sessionIdPrefix }.
- _impersonate-button.tsx (client): shadcn Dialog. TTL pills (15/30/60) +
  reason textarea + submit. On success opens spoke redirectUrl in new
  window/_blank/noopener.
- Detail header gains [Impersonate (read-only)] button — gated on
  saseAdminWired() so it stays hidden until SASE_ADMIN_API_BASE +
  INTERNAL_API_TOKEN_SASE land in Coolify env.

Spoke side (sase.tr@79a2616 → … → next release): InternalAdminModule +
ImpersonationReadonlyGuard already merged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 00:51:38 +03:00
Semih
0b31685e95 feat(sase): user management Phase 7a — listing + detail (RO)
Adım 1 — User listesi sayfası
- Extend Sase RO Prisma schema: Plan, Brand, UserBrand, BankAccount, Payment, QueryLog
- listUsers() + listPlans() repo with filter/sort/page in apps/web/src/lib/sase/users.ts
- /projects/sase/users — TanStack-free server-rendered table with URL-param filters
  (plan multi-select, status, activity preset, search) + pager
- Sase landing "Users →" link

Adım 2 — User detay 360°
- /projects/sase/users/[id] — header (masked email + audit-logged reveal button)
  + 5 tabs: Özet · Subscription & Billing · Kullanım · Aktivite · Audit
- Usage stats: 30d/90d/lifetime queries, success rate, avg response, daily sparkline,
  brand/source distribution, top VINs
- Timeline: merged signup + subscriptions + payments + recent queries
- User-scoped audit trail (AuditLog endpoint LIKE filter)
- POST /api/sase/users/[id]/reveal-email — audit-logged full email reveal

teknikborc.md — Phase 7 PRD vs Sase.tr şeması gap'leri kaydedildi
(EFT yok, B2B yok, API keys/webhooks yok, vb.)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 00:42:59 +03:00
Semih
bc67c387cd fix(prompts): v3 — wider maxLength budgets for Turkish output
v2 prompts hit schema validation failures on Turkish output (quick_fix,
friction_point, suggested_action commonly exceeded 300 chars). Turkish is
naturally ~15-20% longer than English. Widened limits across all 7 schemas:

- title: 120 → 140
- *hypothesis*: 500 → 700
- friction_point / quick_fix / suggested_action: 300 → 500
- long_term_fix: 500 → 800
- block_point / unclear_concept / documentation_gap / suggested_in_app_help: 200/unbounded → 400
- feature_gap_hypothesis / suggested_intervention: 300 → 500
- pattern_bundle root_cause_hypothesis: 600 → 800
- business_impact_estimate / user_impact_estimate: 300 → 300-500
- affected_component_hypothesis: unbounded → 400
- error_signature: unbounded → 300
- pattern_name: 80 → 100
- priority_recommendation: 200 → 300

SASE_CONTEXT output rules clarified — schema enforces per-field maxLength.

v2 → v3 across all 7 templates. seed-runtime auto-deactivates v2 on next worker boot.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 11:40:09 +03:00
Semih
f6727665a3 fix(reprocess): include 'analyzed' status in 'all' scope + new 'analyzed' scope
Previously 'all' missed status='analyzed', so re-running v2 prompts on existing
analyzed sessions returned 0 reset.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 11:15:37 +03:00
Semih
752e69cd01 feat(llm,issues): Türkçe çıktı — prompt v2 + Gitea issue body Türkçe başlıklar
apps/worker/src/lib/prompts.ts:
- SASE_CONTEXT'e Türkçe çıktı kuralı eklendi (tüm doğal dil alanları Türkçe,
  enum/const/teknik tanımlayıcılar İngilizce kalır)
- 7 seed prompt v2'ye bump edildi (bug_triage, ux_friction, payment_issue,
  onboarding_stuck, upgrade_hesitation, pattern_bundle, provider_quality)
- name suffix "v2 (TR)"

apps/worker/src/lib/seed-runtime.ts:
- Yeni version insert ederken, aynı tag'in eski active versiyonlarını otomatik
  deactivate eder (publishPromptVersion ile aynı davranış)

apps/web/src/lib/gitea.ts (buildIssueBody):
- Tüm bölüm başlıkları Türkçe: Bağlam, Hipotez, Kullanıcı niyeti, Friction
  noktası, Tekrarlama adımları, Etkilenen alan, Hata imzası, Şüpheli provider,
  Hata modu, Hızlı çözüm, Uzun vadeli çözüm, Önerilen aksiyon, Araştırma
  önerisi, Tıkanma noktası, Anlaşılmayan kavram, Dokümantasyon eksiği,
  Önerilen in-app yardım, Tahmini efor, Kanıt, Definition of Done
- Önem/Tekrar/İlk/Son görüldü etiketleri

Sonraki analyze döngüsü itibarıyla yeni insight'ların metin alanları Türkçe.
Mevcut insight #cmp4o*, #cmp5e* (v1 ile üretilmiş) değişmez.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 10:45:43 +03:00
Semih
f93cabb932 feat(telegram): notify on Gitea issue creation
apps/web/src/lib/telegram.ts: server-side Telegram client + alertIssueCreated.
createGithubIssueForInsight action fires the alert after issue is created (after
audit log, before revalidate). Severity emoji + insight link + issue link.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 12:44:13 +00:00
Semih
b38721bb05 feat(api): POST /api/insights/[id]/status (status + optional notes) 2026-05-14 11:58:30 +00:00
Semih
a713505f44 feat(insights): Telegram alerts + daily brief push notifications
apps/worker/src/lib/telegram.ts:
- sendTelegram() with Redis-backed dedupe (NX SETEX, 1h TTL)
- Helpers: alertP0Insight, alertRegression, alertSanitizationAnomaly, alertBudgetCap

Wired into:
- analyze.ts: P0/P1 insight creation → instant alert (dedupe per insight_id);
  budget guard halt → daily cap alert (dedupe per state per day)
- validation.ts: regression detected (≥3 sessions w/ same fingerprint after shippedAt)
  → alert (dedupe per insight_id)
- compress-sessions.ts: sanitization anomaly (>500 tokens, 0 PII matches)
  → alert (dedupe per session_id) — possible PII leak warning

Daily Brief (jobs/daily-brief.ts):
- Cron @05:00 UTC (= 08:00 Europe/Istanbul)
- 24h: sessions/insights/cost/cache-hit + 3 top priorities + 7d shipped/validated/regressed
- POST /api/insights/brief/send for manual trigger / smoke test

Env: TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, PANEL_PUBLIC_URL (Coolify both apps).
Bot: @Pl24_mitm_bot (AiFactory), chat 7840804807. Source: airflow3 monitoring DAG.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 11:36:10 +00:00
Semih
74f0ff4935 fix(ingest): rolling lookback + ongoing-aware watermark to prevent missed sessions
Bug: previous logic advanced watermark to the latest session start_time including
ongoing sessions. PostHog session_recordings filters by start_time, so once a
session was 'seen' as ongoing the watermark moved past its start time and the
session was never re-fetched after it ended. Today 4 auth sessions on
/dashboard/vehicles/* and /dashboard/search (07:17-07:40 UTC) were lost this way.

Fix:
1. ROLLING_LOOKBACK_MINUTES (default 60): every cycle queries date_from =
   min(watermark, now - 60min). Sessions that just finished get re-fetched
   regardless of watermark drift. Upsert dedupes.
2. Track earliestOngoingStart; cap watermark to (earliestOngoingStart - 1s)
   so subsequent cycles re-read that range.

Also added GET/DELETE /api/insights/watermark for manual reset (used to
trigger 24h backfill after this deploy).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 10:53:38 +00:00
Semih
7edbf1d7ad docs: teknikborc — insight pipeline next-steps backlog
8-item insight category covering pilot success closure, push-notification
gap, Sase.tr Faz 0+1 prerequisites that unblock 9 dormant tag rules, eval
golden set requirement, and deferred volume-dependent work (bundle mode,
embedding similarity, multi-project routing).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 09:53:36 +00:00
Semih
dfc19c8f13 refactor(integrations): migrate issue tracker GitHub → Gitea
- apps/web/src/lib/gitea.ts: createIssue / getIssue / verifyWebhookSignature / buildIssueBody
  * Endpoint: git.semih.ai/api/v1 (configurable via GITEA_BASE_URL)
  * Auth: 'Authorization: token <PAT>' (Gitea convention)
  * Labels: Gitea expects numeric IDs not strings → ensureLabels() resolves/creates
    with color coding (P0/P1 red, P2 yellow, P3 green, type-* grey, default blue)
  * Webhook signature: X-Gitea-Signature (hex, no sha256= prefix)
- apps/worker/src/lib/gitea.ts: read-only getIssue() for sync polling
- _actions.ts + github-sync.ts now import from /lib/gitea
- Removed old apps/{web,worker}/.../lib/github.ts + /api/webhooks/github route
  (the receiver was already dead — sp.semih.ai is Tailscale-only)
- UI: 'GitHub' label → 'Gitea' on insight detail card
- github-sync job filters by githubIssueUrl.startsWith(GITEA_BASE_URL) so legacy
  GitHub-hosted insights (semihyesilyurt/sase.tr#20) stay frozen rather than
  collide with same-numbered Gitea issues at root/sase.tr.

Env migration (Coolify, panel-web + panel-worker):
- removed: GITHUB_TOKEN, GITHUB_REPO_SASE, GITHUB_WEBHOOK_SECRET
- added:   GITEA_TOKEN, GITEA_REPO_SASE=root/sase.tr, GITEA_BASE_URL=https://git.semih.ai

Provisioned Gitea PAT 'super-panel-insights' (scopes: write:repository + write:issue),
stored in Bitwarden.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 09:36:57 +00:00
Semih
d0c497d12d feat(panel-taxonomy): track Faz 2 sase.tr events (page_visibility, idle, shortcuts, referrals, settings, bulk)
7 new event names added to TRACKED_EVENTS so enrich.ts fetches them for compression
timeline interleaving + tagger context. No new tag rules yet (Faz 2 is enrichment,
not signal extraction).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 06:28:20 +00:00
Semih
b83d28c119 feat(eval): POST /api/insights/eval-sets thin wrapper (create + optional run)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 06:15:39 +00:00
Semih
b635b529e2 feat(phase6e): eval framework + prompt editor + daily brief + retention + bundle mode
Schema:
- eval_sets (promptTag, cases JSON: [{id, timeline, expected: {...}}])
- eval_runs (per-execution scoring: passedSchema/Severity/Rubric, cost, tokens, results)

Prompts:
- 2 new seed templates: upgrade_hesitation (flash), pattern_bundle (pro)
- pickPromptTag() routes 'upgrade_hesitation' tag to upgrade_hesitation prompt
- Editor UI at /insights/settings/prompts/[id]: edit system/user/schema/tier/temp,
  publishPromptVersion() creates new version + deactivates old (CRUD with auto bump)
- setPromptActive() to toggle versions

Daily Brief (/insights/brief):
- Last 24h: sessions processed, insights produced (with severity breakdown),
  cost, cache hit rate; today's top 5 priorities; week stats (shipped/validated/regressed)

Retention cron (04:15 UTC daily):
- Delete sessions_meta + session_custom_events older than 90d (unless referenced by
  active insight)
- Delete compressed_sessions rows + MinIO timeline blobs older than 180d
- raw_metadata 30d (currently no-op; we don't persist raw metadata to MinIO)

Eval framework:
- apps/worker/src/jobs/eval-run.ts: runs cases against current/specified prompt version,
  scores schema_pass + severity_match + rubric_substring; stores EvalRun
- apps/worker BullMQ queue handler for 'eval-run' job name
- apps/web installed bullmq; /lib/queue.ts thin Queue accessor
- Web actions: createEvalSet, triggerEvalRun (enqueues job to insight-pipeline queue)
- UI: /insights/settings/eval-sets list, /new create form (paste JSON cases),
  /[id] detail with Run button + recent runs + per-case JSON

Bundle mode (analyze job):
- Pull 3x batch, group by fingerprint
- Groups ≥ INSIGHT_BUNDLE_THRESHOLD (default 3) → use 'pattern_bundle' prompt
- Timeline = primary rep + PATTERN BUNDLE summary block (occurrences, unique users, deltas)
- Insight stores ALL group session IDs as relatedSessionIds; all marked analyzed in one tx
- Cost amortized: 1 LLM call per group

Nav/Cmd+K:
- Inbox header links: Brief, Patterns, Eval sets
- Palette: Daily brief, Eval sets entries

Deferred to backlog: embedding-similarity cross-fingerprint clustering, Telegram brief delivery,
Sase.tr-side data-private audit (separate repo).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 06:11:48 +00:00
Semih
9c7682ae63 feat(phase6d): GitHub polling sync — outbound-only state mirror (Tailscale-only panel)
Webhook can't reach sp.semih.ai from internet (Tailscale-only DNS). Switched to a
worker job that polls GitHub for tracked issue states every 10 minutes.

apps/worker/src/lib/github.ts: read-only getIssue() client
apps/worker/src/jobs/github-sync.ts: scan insights with githubIssueNumber + not validated/dismissed/duplicate,
  fetch remote state, reflect transitions:
    open → closed = shipped + shippedAt + validationStartedAt
    closed → open = in_progress + clear validation state

Scheduler: github-sync@*/10min added.

The /api/webhooks/github route stays (works if reachable in future) but is no longer
the source of truth.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 05:54:58 +00:00
Semih
0c6350db2d feat(insights): POST /api/insights/[id]/create-issue thin wrapper around server action
Useful for programmatic smoke tests and future automation. Auth-gated via underlying action.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 05:49:20 +00:00
Semih
c5acdfc8ec feat(phase6d): GitHub action loop — issue creation, webhook, validation cron, patterns view
Schema:
- Insight.+githubIssueNumber (user-visible #N, separate from id BigInt)

GitHub integration (apps/web/src/lib/github.ts):
- repoFor(projectKey): env-based GITHUB_REPO_<KEY>=owner/repo mapping
- createIssue / getIssue REST wrappers
- verifyWebhookSignature (HMAC-SHA256 timing-safe)
- buildIssueBody: renders structured markdown from insight + LLM body
  (hypothesis, reproduce steps, affected route/provider, quick/long fixes,
  suggested investigation, evidence links to panel, DoD checklist)

Server action createGithubIssueForInsight:
- Auth-gated, audited; idempotent (refuses if issue already exists)
- Labels: insight-driven, severity-<P>, type-<T>, <project>-pilot
- Sets status=in_backlog, stores githubIssueUrl/Id/Number/State

Webhook /api/webhooks/github:
- Signature verify with GITHUB_WEBHOOK_SECRET
- issues.closed → status=shipped + shippedAt + validationStartedAt
- issues.reopened → status=in_progress + clear validation state
- issues.opened → status=in_backlog
- PR linking placeholder (passthrough only for now)

Validation cron (worker, daily 5:00 UTC):
- For each insight in 'shipped' state:
  - Count sessions with same fingerprint after shippedAt
  - >= INSIGHT_REGRESSION_THRESHOLD (default 3) → status=regressed + regressionDetected=true
  - validationPeriodDays elapsed with no regression → status=validated + validatedAt

UI:
- Insight detail: GithubActions card — Create button (when no issue),
  external link + issue # + state (when present)
- New /insights/patterns page: clusters insights by type + affected_route/provider,
  shows ≥2-insight or ≥5-occurrence groups sorted by max severity
- Inbox header link to Patterns
- Cmd+K palette: Patterns entry

Env needed: GITHUB_TOKEN, GITHUB_REPO_SASE, GITHUB_WEBHOOK_SECRET.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 05:45:48 +00:00
Semih
5beb89f771 feat(phase6c): insight inbox actions + filters + keyboard shortcuts + budget UI + prompt registry view
Server actions (apps/web/src/app/insights/_actions.ts):
- setStatus / bulkSetStatus (11 allowed states)
- setFounderNotes / setFounderPriority / setSeverityOverride
- updateBudgetSetting (key whitelist)
All audit-logged + revalidate /insights paths.

Inbox enhancements:
- Filter bar: severity / status (active default = new+triaged+in_backlog+in_progress+regressed)
  / type chips with live counts, query-param driven
- Per-row action buttons: Backlog / Defer / Dismiss with toast feedback
- Keyboard shortcuts (j/k navigate, Enter open, b backlog, e defer, d dismiss, ? help)
  Skipped when input/textarea focused.

Insight detail (/insights/i/[id]):
- FounderForm component: 6 status buttons, severity override dropdown,
  founder_priority pin input, founder_notes textarea (saved separately)

Budget settings (/insights/settings/budgets):
- Editable rows for monthly/daily caps, per-call max, min_score_for_analysis,
  cache_ttl_hours, analysis_paused (kill switch)

Prompt registry (read-only, full editor in 6e):
- /insights/settings/prompts list
- /insights/settings/prompts/[id] detail w/ system prompt, user template,
  output schema, recent cost ledger rows for this template

Cmd+K palette extended with Insights group:
- Inbox, Cost dashboard, Pipeline, Budget settings, Prompt registry

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 23:32:41 +00:00
Semih
0295b88981 fix(phase6b): DeepSeek V4 disable thinking by default + parse text block (not first content)
- thinking={type:disabled} skips reasoning trace → output_tokens drop 10x
- find first content block of type='text' (V4 may emit thinking before text)
- DEEPSEEK_THINKING=true env to re-enable if needed for hard problems

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 23:11:09 +00:00
Semih
95c7e8e321 feat(phase6b): LLM analysis layer — DeepSeek + insights + cost ledger + budget guard
Schema:
- insights (fingerprint dedup, occurrence_count, related_session_ids[], priority_score)
- cost_ledger (per-call, cache_hit/miss/output token split + USD)
- prompt_templates (versioned, per-tag, with JSON schema + tier + temperature)
- budget_settings (global key/value: monthly_hard_cap_usd, daily_soft/hard, per_call_max, analysis_paused)

Worker:
- lib/deepseek.ts: Anthropic-compat endpoint client (deepseek-v4-flash | deepseek-v4-pro),
  usage→USD with V4 promo pricing, cache_read_input_tokens awareness, extractJson() helper
- lib/budget.ts: checkBudget() returns active|soft_throttled|hard_paused|monthly_paused,
  forces flash tier on soft cap, halts on hard/monthly cap or analysis_paused
- lib/prompts.ts: 5 seed templates (bug_triage P, ux_friction F, payment_issue P,
  onboarding_stuck F, provider_quality F) with embedded JSON schemas + Sase.tr context;
  pickPromptTag() maps session tags → prompt
- lib/json-validate.ts: lightweight schema validator (no ajv dep)
- lib/seed-runtime.ts: idempotent upsert of prompts + default budget settings on worker boot
- lib/minio.ts: +getText() for compressed timeline fetch
- jobs/analyze.ts: budget guard → 6h fingerprint cache (attach session to existing insight) →
  template lookup → severity-based tier override → DeepSeek call → JSON parse + validate →
  insert insight (or aggregate occurrence) → write cost_ledger
- scheduler: analyze@*/4min on insight-pipeline queue

UI:
- /insights (was pipeline view) → now Insight Inbox: priority-sorted list w/ KPI strip
  (new/in_backlog/shipped/today $/month $), severity badges, link to detail
- /insights/i/[id]: insight detail with structured body render, related sessions,
  per-session cost breakdown, raw JSON collapsible
- /insights/costs: KPI cards (today, month, avg, cache hit), daily 30d bar table,
  by-model + by-prompt breakdowns, top 10 expensive, recent errors
- /insights/pipeline: moved old session-pipeline view here
- /insights/sessions/[id]: unchanged session timeline viewer

Defaults:
- monthly cap $30, daily soft $1.50 / hard $3, per-call $0.20, analysis_paused=false
- Severity→Tier: P0/P1=pro, P2/P3/INFO=flash; budget soft-cap forces flash

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 23:01:55 +00:00
Semih
978b71d818 fix(phase6a-v1.2): PostHog event filter client-side + backfill distinct_id + power_user_path rrweb fallback
- listSessionEvents: PostHog only honors single event= param; switched to client-side filter
- tag-sessions: backfill posthogDistinctId from getRecording when null (for rows pre-column)
- tagger: power_user_path v1 fallback (auth + clicks>=20 + no errors), vin_decode_no_outcome P3
- ingest upsert: always update posthogDistinctId (idempotent)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 22:43:44 +00:00
Semih
7606e1b0bf feat(insights): /api/insights/reprocess auth-gated endpoint to re-run pipeline on existing sessions
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 22:26:13 +00:00
Semih
fc6a3f7a39 feat(phase6a-v1.2): dual-mode custom-event enrichment (v1.0 + v2.0 aliases)
- Prisma: posthog_person_cache (24h TTL), posthog_group_cache, session_custom_events
- SessionMeta: +posthogDistinctId, +groupKey, +customEventCount
- PostHog client: listSessionEvents, getPerson, getGroup
- posthog-cache.ts: cache-with-stale-refresh for person + group properties
- event-taxonomy.ts: dual-mode alias map (vin_decoded↔vin_decode_initiated,
  vin_decode_success↔vin_decode_succeeded, vin_decode_error↔vin_decode_failed,
  payment_success↔payment_succeeded). 56 tracked event names total.
- enrich.ts: per-session custom events fetch, persist to session_custom_events,
  attach user_properties + group_properties via cache.
- tagger.ts: 14 new custom-event tags
  (vin_decode_fail_pattern, provider_reliability_issue, payment_friction,
   payment_ui_silent_failure (P0), payment_failed_session, checkout_abandonment,
   downgrade_pending, compatibility_quality_gap, parts_export_abandoned,
   search_validation_friction, onboarding_stuck, upgrade_hesitation,
   power_user_path, at_risk_active_session, provider_mismatch,
   api_key_friction, webhook_setup_struggle); group-context priority bump.
- heuristic.ts: customEventPromoteReasons() — 10 custom-event promote signals.
- compress.ts: merge_rrweb_and_custom_events interleaving with ⤷ EVENT: prefix,
  ±1.5s grouping, standalone flush for events with no nearby rrweb. Adds
  company_context header line; key_events lists top-5 custom event counts.
- /insights page: +Events column. /insights/sessions/[id]: collapsible custom
  events table + group key display.

Graceful: when Sase.tr emits 0 custom events the pipeline falls back to
rrweb-only tagging from Phase 6a v1.1.

PRD: behavioral-insight-pipeline-prd-1.md (v1.2),
     sase-posthog-events-prd.md (Sase.tr-side, separate codebase).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 22:17:18 +00:00
Semih
93499faeaa fix(phase6a): PostHog snapshot blob fetch uses start_blob_key/end_blob_key; parse [window_id,event] tuples
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 21:26:36 +00:00
Semih
795528982e fix(phase6a): increase BullMQ lockDuration to 5min (network/db calls exceed 30s)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 21:15:06 +00:00
Semih
1a7a1b5787 feat(phase6a): behavioral insight pipeline ingestion + tagging + compression
- prisma: sessions_meta, compressed_sessions, ingestion_watermarks
- worker: PostHog client (eu.i.posthog.com), heuristic filter
- worker: BullMQ insight-pipeline queue (ingest 5min / tag 2min / compress 3min)
- worker: tagger (bug_suspected, ux_friction, upgrade_hesitation, etc.) + severity scoring
- worker: rrweb -> semantic timeline transform + 8-pattern PII sanitization
- worker: fingerprint hash + MinIO upload (bucket: insight-compressed)
- web: /insights pipeline dashboard + session timeline viewer
- sidebar: Insights nav entry

LLM (Phase 6b), insight inbox, cost dashboard, GitHub loop deferred to later phases.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 20:58:36 +00:00
Semih
608ab0e6c7 chore: remove teknikborc.md 2026-05-13 20:36:34 +00:00
Semih
7c8330e315 docs: technical debt registry — deferred items, hacks, cleanup triggers 2026-05-13 20:33:24 +00:00
Semih
31040a76b4 feat(phase5): coolify ops + backup status dashboard
- lib/coolify.ts typed client (whitelisted apps)
- /operations: deploy/restart server actions per app, audited
- /operations: backup status cards reading MinIO listings
- lib/minio.ts shared client
- docs/phase5-deferred.md (migration runner + stripe webhook rationale)
2026-05-13 11:22:59 +00:00
Semih
909cacf7b3 feat(phase4): rate limit + audit archive + panel backup + DR docs
- src/lib/rate-limit.ts (Redis sliding window, fail-open)
- before-hook on /sign-in/email: 5 attempts/min per IP+email
- worker job audit-archive (daily 03:30, JSONL → MinIO, 90d retention)
- worker job panel-backup (daily 04:00, pg_dump -Fc -Z9 → MinIO)
- Dockerfile adds postgresql16-client
- scripts/restore-drill.sh restores latest dump into panel_drill
- docs/disaster-recovery.md + docs/phase4-deferred.md (mTLS + Infisical rationale)
2026-05-13 11:14:36 +00:00
Semih
ed79f4eacd feat(phase3c): SSE /api/events/stream + live /events page 2026-05-13 11:06:32 +00:00
Semih
b9709ed07e feat(phase3): worker container + event bus + scheduled jobs
apps/worker:
- BullMQ nightly scheduler (cron 0 3 * * *)
- Redis Streams consumer-group per wired/active project
- Persists events to Event model

schema:
- Event model (streamId unique, project + type indexed)
2026-05-13 11:03:58 +00:00
Semih
5ef1597842 feat: pnpm add-spoke scaffolder for new spokes
Usage:
  pnpm add-spoke <key> [--name X] [--description Y]

Generates per-spoke prisma schema + db client + admin-sdk stub,
patches package.json (prisma generate chain) and prisma/seed.ts.
Prints SQL + Coolify env checklist for finishing the wiring.
2026-05-13 11:00:47 +00:00
Semih
e455ebbfce feat(phase2): planned badge, Cmd+K palette, per-project dashboard cards
- Project.status (planned/wired/active) + seed updates
- ProjectBadge component
- CommandPalette (⌘K) wired in PanelShell with project + nav + sign-out
- Dashboard '/' shows per-project cards + KPI strip
- Added doner312 to seeded projects
2026-05-13 10:54:07 +00:00
Semih
7b83ef8f11 feat(phase1d): sase admin-sdk skeleton + endpoint inventory on /projects/sase 2026-05-13 10:43:07 +00:00
Semih
e4e734fc66 feat(phase1c): audit sign-in / sign-out via better-auth after hook 2026-05-13 10:40:26 +00:00