Files
coe-mirror/notes.md
T
n0mad1k 22b1415b43 Guard probe_target against creating phantom mountpoint dir
probe_target() unconditionally ran mkdir(parents=True) on TARGET_DIR. When
TARGET_DIR sits under an unmounted FUSE drive, this materialized the mount
root (e.g. ~/pCloudDrive) as a plain local directory, occupying the
mountpoint and blocking the pCloud client from ever mounting.

Add optional mount_root config key (env COE_MIRROR_MOUNT_ROOT). When set,
probe_target requires the path to be a live mountpoint and TARGET_DIR to be
under it before any mkdir; otherwise it returns False and the run queues to
pending. Unset preserves prior behavior for local targets.
2026-07-10 14:37:40 -04:00

31 lines
2.9 KiB
Markdown

# coe-mirror notes
- **Created**: 2026-06-11. Purpose: autonomous mirroring of Nightmare_Eclipse repos from Church of Malware to local pCloud storage.
- **Source API**: Forgejo public REST at `git.churchofmalware.org`, no auth needed.
- **Owner being mirrored**: `Nightmare_Eclipse` (8 active repos as of creation).
- **Destination**: `~/pCloudDrive/Hacking/Nightmare_Eclipse/`.
- **Schedule**: 00:00 + 12:00 daily, catch-up on boot via Persistent timer + OnBootSec.
- **Design rationale**:
- FUSE-safe placement uses `shutil.copy2 + size verify + unlink`, not `os.rename`, to handle pCloud FUSE semantics.
- pCloud daemon auto-start was rejected — no user unit exists; DISPLAY=:0 spawning is unreliable. Tool relies on Persistent timer + pending-flush for recovery.
- `commit.sha` is NOT in the repo-list API response — two-call approach (list, then per-repo branch) is retained.
- **DevTrack**: Not created at creation time (oraculo offline, Tailscale last seen 2d ago, carbon roaming off home LAN). Add a `coe-mirror` project + item retroactively when oraculo returns.
- **Matrix notification**: Stub-only at creation time, Matrix server down. Real implementation deferred until home Matrix server is back.
## 2026-06-14 — Matrix notification swap
- Replaced `notify()` stub with real Synapse send. Targets General room (`!MBpPtYlQYMcngtpvJt:m.mealeyfamily.com`).
- Auth: password login via `MATRIX_USER` + `MATRIX_PASSWORD` from Infisical `matrix/` at refresh time. Token cache at `~/.local/share/coe-mirror/matrix-token.json` (chmod 0600), refreshed when <30 min left or on 401.
- Non-fatal failures — Matrix outage does not break the mirror.
- Env overrides: `COE_MIRROR_MATRIX_ROOM`, `COE_MIRROR_MATRIX_HOMESERVER`.
- Pre-deploy step: invite `@intel-bot:m.mealeyfamily.com` to General once Synapse is back. Without joined membership, sends will 403.
- DevTrack: #1172.
## 2026-07-10 — mount_root guard (phantom pCloudDrive fix)
- **Bug**: `probe_target()` did `TARGET_DIR.mkdir(parents=True, exist_ok=True)` unconditionally. When pCloud FUSE was unmounted, this created `~/pCloudDrive/...` as plain LOCAL dirs, occupying the mountpoint and blocking the pCloud client from mounting. Live state on carbon confirmed: `~/pCloudDrive` was a plain dir, not a mountpoint, with 22 stray zips inside.
- **Fix**: new optional config key `mount_root` (env `COE_MIRROR_MOUNT_ROOT`). When set, `probe_target()` requires `os.path.ismount(mount_root)` AND that `TARGET_DIR` is under `mount_root` before any mkdir; otherwise returns False (queues to pending). Never creates the mount root. Empty/unset = old behavior (local targets like `~/coe-mirror`).
- Local config sets `mount_root = "~/pCloudDrive"`.
- **Recovery run**: stopped/masked timer, staged the 22 zips aside, removed the local `~/pCloudDrive`, relaunched pCloud, verified mountpoint, moved zips onto the live mount, unmasked timer.
- DevTrack: #1307.