# Production Reconcile Notes (2026-05-26)

## Canonical deploy path

```bash
git push origin main          # requires GitHub token with `workflow` scope if .github/workflows changed
./scripts/deploy-lichun-master.sh
```

## If `git push` is blocked (workflow scope)

Use a **git bundle** (still version-tracked by commit SHA):

```bash
# On Mac (after commits exist locally)
git bundle create /tmp/lichun-reconcile.bundle origin/main..HEAD
scp /tmp/lichun-reconcile.bundle lichun-master:/tmp/

# On lichun-master
cd /var/www/lichun.app/lichun
sudo -u www-data git stash push -m "pre-deploy-$(date +%Y%m%d)"   # saves tracked edits
# Move root-owned untracked junk if stash -u fails (see .env.bak.*)
sudo -u www-data git fetch /tmp/lichun-reconcile.bundle HEAD:refs/heads/reconcile-incoming
sudo -u www-data git merge --ff-only reconcile-incoming
sudo -u www-data git branch -d reconcile-incoming
cd server && sudo -u www-data npm install
sudo systemctl restart baolife-websocket.service
sudo -u www-data git log -1 --oneline   # must match local HEAD
```

## Recovery artifacts

| Location | Contents |
|----------|----------|
| Mac: `.deploy-backups/lichun-pre-reconcile-20260526-172923/` | Production `working-tree.patch`, `debug.ts`, `payloadHelpers.ts`, `liveActivityManager.ts` |
| Server: `/tmp/lichun-pre-reconcile-20260526-172923/` | Same backup on host |
| Server: `git stash` | `pre-reconcile-20260526-173120-tracked` — production edits before bundle merge |

To inspect prod stash: `ssh lichun-master 'sudo -u www-data git -C /var/www/lichun.app/lichun stash show -p stash@{0}'`

## Current production target

Commit: `9278909d` — `feat: add debug grant tools and git-tracked production deploy`

`DEBUG=true` must remain in `server/.env` (not in git).
