Skip to content

Dev - #3

Merged
AtmegaBuzz merged 10 commits into
mainfrom
dev
Sep 27, 2026
Merged

Dev#3
AtmegaBuzz merged 10 commits into
mainfrom
dev

Conversation

@AtmegaBuzz

Copy link
Copy Markdown
Member

No description provided.

AtmegaBuzz and others added 10 commits September 26, 2026 18:47
docs/persona/{architecture,A2A,GROUPS,theme,AUDIT_REPORT,
IMPLEMENTATION_MEMORY_BRIEF,linkedin-portability-pre-apply,seo-plan}.md are
gone from the working tree — still recoverable from history
(git log --all --oneline -- '**/architecture.md') since they came in with
the persona import.

services/persona-api/CLAUDE.md still said 'full design docs live at the
repo root' and named architecture.md/A2A.md/GROUPS.md/theme.md as if they
were there — reworded so it doesn't point at files that no longer exist.
Same for the docs/persona row and further-reading links in AGENTS.md and
README.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Seven ZYND_*.md docs (architecture/HLD/LLD, the monorepo build plan, the
cards-move and DB-unify plans, and the paused Stage 2 plan) only lived on
one machine outside any repo — no other employee's Claude session had
access to them. Moved in as-is (relative cross-links between them already
worked; left the historical /Users/apple/Desktop/p3ai path in
ZYND_MONOREPO_PLAN.md's build-log code block alone since it's an accurate
record of the commands actually run, not a broken reference).

docs/plans/README.md orders them: background (architecture/HLD/LLD) → how
this repo came to exist (monorepo plan) → active (DB-unify, supersedes part
of the cards-move plan) → paused (Stage 2). Linked from AGENTS.md and
README.md.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…projects

The previous version was written before we had the real catalogs. With the
full aafo and xmfj catalogs in hand (2026-09-26), the plan now pins down:
the exact aafo baseline (28 tables, 43 indexes, 4 functions, 1 trigger,
72 policies, realtime publication) and how to prove it matches prod without
a DB connection; the exact cards DDL for aafo, including the new
owner_user_id link to auth.users; the Drizzle package layout, workflow and
CI; the auth switch (no user copy, multi-issuer trust window); the data
copy and cutover runbook with per-step rollback; and the open questions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
No staging exists and dev.persona runs on the prod database, so the plan now
rehearses every migration locally and requires expand-only migrations. Cards
reuses persona's LinkedIn-only login (magic link waits for an email
provider), which adds a check on how many card owners signed in with Google.
xmfj's unused copies of the persona tables get an activity check and a
guarded rename-then-drop script; keyword_posts is left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
…tabase

Persona and cards are moving onto one Supabase database, and its schema
had no tracked history (three SQL folders, nothing recording what ran).
packages/db is now the only place schema changes come from:

- src/schema: Drizzle definitions of all 28 persona tables and the 4 cards
  tables, with constraint/index/policy names matching prod exactly.
- 0000 is the baseline of prod aafo as of 2026-09-26. On prod it is recorded
  (db:baseline-sql), never run; a fresh database built from it matches the
  prod catalog. 0001 is a persona policy change; 0002-0004 add the cards
  tables, search functions and grants.
- db:migrate wraps drizzle-orm's migrator with a dry run, real error output
  and guards against the dashboard project and an unrecorded baseline;
  db:drift compares a real database to a fresh build of the migrations.
- CI applies every migration to an empty pgvector Postgres 17 and fails if
  the schema and migrations disagree.

The old SQL folders get "frozen" READMEs, persona-web loses its db:policies
script, and AGENTS.md points schema work at packages/db.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
A root package.json now runs every app and service (`npm run setup`, `npm
run dev`, `npm test`), with fixed local ports so they don't collide. It is a
script runner, not an npm workspace: pm2 and Vercel install inside each app
folder, and a root lockfile would change Next.js's root detection, so
/package-lock.json is gitignored.

infra/local/docker-compose.yml brings up memory's Postgres + Redis. persona
and cards keep pointing at hosted Supabase through env vars. Every service
now has an env template listing what it reads, and docs/LOCAL_DEV.md
explains the setup, including that there is no dev Supabase project yet, so
local runs would hit prod data until one exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
Persona and cards share one database but should own their schema changes
independently. Postgres schemas are now the boundary, each with its own
Drizzle history, folder and tracking table (drizzle.__<name>_migrations):

- identity (schema `identity`): the one layer both products share. Empty for
  now; the shared user id is still auth.users. Stage 2's account tables go here.
- persona (schema `public`, where its tables have always been): the verified
  baseline and the policy fix, moved from the single history unchanged.
- cards (new schema `cards`): its tables and search functions, service-role
  only through schema grants rather than per-table revokes.

db:migrate/db:drift/db:lint/db:check now handle all three (or one with
--project). baseline-sql writes to __persona_migrations and carries over a
__drizzle_migrations table if the earlier instructions already created one.
The catalog query covers all three schemas.

cards-api reads SUPABASE_DB_SCHEMA (default public, so today's xmfj setup is
unchanged) as its Supabase client's default schema; at cutover it becomes
`cards` with no query code changes. Plan, AGENTS.md and READMEs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
next dev regenerates these on every run; committing them keeps the working
tree clean, same as apps/persona-web.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
check-drift loaded the Supabase stubs and ran the migrations on the same
connection. The stubs put `extensions` on the database's search_path, which
only reaches new sessions, so cards' vector column couldn't resolve and the
CI drift step failed. It now migrates on a fresh connection, as CI's migrate
step and Supabase itself do.

docs/LOCAL_DEV.md now lists, per app and service, the env vars needed to
run everything locally against a hosted Supabase project, which values must
match across services, and which ones only switch on a single integration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
…tained

main's only commit (2003f6b, a squash of dev) has exactly the tree of dev at
6e3ba12, which dev already contains, so dev's files are kept unchanged. This
just joins the histories so the next dev -> main merge has no conflicts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ovJhmvpWGUdmHPiEJ87p
@AtmegaBuzz
AtmegaBuzz merged commit 9b7a6c5 into main Sep 27, 2026
1 check passed
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