# Phase 13: Scheduler & Admin Toggle - Discussion Log

> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.

**Date:** 2026-07-11
**Phase:** 13-scheduler-admin-toggle
**Areas discussed:** Toggle enforcement scope, Daily sync timing, Failure visibility

---

## Toggle Enforcement Scope

| Option | Description | Selected |
|--------|-------------|----------|
| PAX8-only inline check | Check inside executeScheduledSync's pax8-daily case, mirrors isAppgateConfigured()/isMsgraphConfigured() guard style | ✓ |
| General scheduler mechanism | Shared isIntegrationEnabled(key) helper applied to every sync_type | |

**User's choice:** PAX8-only inline check
**Notes:** Rejecting the general mechanism explicitly to avoid changing behavior for ~10 existing integrations in a phase scoped only to PAX8-07/PAX8-09.

| Option | Description | Selected |
|--------|-------------|----------|
| Yes, block it too | POST /api/pax8/sync returns 403 when PAX8 is disabled | ✓ |
| No, manual trigger still works | Only the scheduled cron respects the toggle | |

**User's choice:** Yes, block it too
**Notes:** "Disabled" should mean fully off, no side door via the manual route.

| Option | Description | Selected |
|--------|-------------|----------|
| Let it finish | In-progress fullSync() completes normally; disabled flag only blocks the next tick/trigger | ✓ |
| Abort immediately | Requires threading cancellation into fullSync()'s per-entity loop | |

**User's choice:** Let it finish
**Notes:** Rare edge case, not worth the added complexity.

---

## Daily Sync Timing

| Option | Description | Selected |
|--------|-------------|----------|
| 6:00 AM | Matches engagement-daily/zoom-daily | |
| 4:00 AM | Groups with contract-services (4am) and tickets-reconcile (4:30am) | ✓ |
| You decide | No strong preference | |

**User's choice:** 4:00 AM
**Notes:** None beyond the selection.

---

## Failure Visibility

| Option | Description | Selected |
|--------|-------------|----------|
| Silent, admin-dashboard only | Matches Veeam full sync / contract-services precedent — last_status/last_error only | ✓ |
| Post a Teams alert on failure | Follows integration-health/ticket-digest precedent of pushing an Adaptive Card | |

**User's choice:** Silent, admin-dashboard only
**Notes:** Keeps phase scoped to scheduling + toggle, not a new alerting feature.

---

## Claude's Discretion

- Migration mechanics for seeding the `sync_schedules` row — follow
  `migrations/089_appgate_tables.sql`'s `INSERT ... WHERE NOT EXISTS`
  precedent exactly, `is_enabled: false` by default. Not asked as a
  question — unambiguous precedent match.
- `/admin/integrations` row wiring — add PAX8 to `checkConfigOnly()` in
  `integration-health.ts` following the `qbo`/`appgate` call sites.
  Mechanical, no real alternative.
- Exact `PAX8_*` env var names for that call — confirm against
  `pax8-factory.ts`'s `isPax8Configured()` rather than guessing.

## Deferred Ideas

None — discussion stayed within Phase 13's scope.
