Commit graph

447 commits

Author SHA1 Message Date
111ef56e45 feat(12-01): add migration 093 for pax8 orders + company matching schema
- Enable pg_trgm extension for fuzzy company-name matching
- Add per-company id, billing period, and dual-cost columns to pax8_order_items
- Add auto-match columns (autotask_company_id, match_confidence, match_method, matched_at) to pax8_companies
- Applied to dev DB and verified idempotent
2026-07-10 22:40:03 -04:00
f68e1c50b6 docs(12): create phase plan 2026-07-10 22:27:17 -04:00
fcc93b38f4 docs(12): tag D-01/D-02/D-04 citations in must_haves 2026-07-10 22:26:33 -04:00
1a9c491b03 docs(12): create phase plan
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LHRgZqkzBHBbAbc3KHneuR
2026-07-10 22:15:05 -04:00
6d8b2610bb docs(phase-12): add validation strategy 2026-07-10 22:00:08 -04:00
b99f84ffa0 docs(12): research phase domain 2026-07-10 21:59:05 -04:00
85687bf893 docs(state): record phase 12 context session 2026-07-10 21:35:38 -04:00
410652dedb docs(12): capture phase context 2026-07-10 21:35:33 -04:00
5044c2de8a docs(phase-11): evolve PROJECT.md after phase completion 2026-07-10 21:06:58 -04:00
a25343a7f9 docs(phase-11): complete phase execution 2026-07-10 21:06:22 -04:00
dee3bdf28d docs(phase-11): add code review report 2026-07-10 21:02:11 -04:00
d4630dd7de docs(phase-11): update tracking after wave 3 2026-07-10 20:54:46 -04:00
1008388511 docs(11-03): complete live verification checkpoint (SUMMARY.md)
Confirmed via direct service call (session-gated route bypassed for
verification): 118 companies, 445 subscriptions with dual cost, 46
referenced-only products with readable name+category, 0 unreferenced
products, stable soft-delete on re-run, zero PAX8 write calls.
2026-07-10 20:54:37 -04:00
b1decd503f docs(phase-11): update tracking after wave 2 2026-07-10 19:48:42 -04:00
c2bfd692e2 chore: merge executor worktree (worktree-agent-a4c0354896eb8e9de) 2026-07-10 19:47:47 -04:00
f748655f68 docs(11-02): add plan 02 execution summary
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 19:47:28 -04:00
ad992f3f6d feat(11-02): add fire-and-forget POST/GET /api/pax8/sync route
- POST returns 409 if a sync is already in progress, otherwise starts
  Pax8SyncService.fullSync() without awaiting and returns immediately
- GET reports inProgress, non-deleted row counts across the three PAX8
  tables, and the last 10 sync_history rows for entity_type='pax8'
- Route stays behind the session-cookie check (not added to
  middleware.ts's public allowlist) — matches itglue/veeam sync routes
2026-07-10 19:46:34 -04:00
cf3ae61dcb feat(11-02): add Pax8SyncService (companies/subscriptions/referenced catalog)
- fullSync() orchestrates companies -> subscriptions -> referenced-only
  products, each with independent try/catch returning Pax8EntitySyncResult
- Referenced product catalog resolved in a single pass: listAllProducts()
  fetched once, filtered in-memory to subscription-referenced ids (D-01/D-02)
- Each entity's UUID-array tombstone soft-deletes rows PAX8 no longer
  returns (is_deleted=true, deleted_at set), skipped when zero ids seen
- sync_history row (entity_type='pax8', sync_type='full') tracks
  started/completed/failed with base columns only
- No PAX8 writes: only Pax8Client's read methods are called
2026-07-10 19:46:11 -04:00
6c64aaf7bb docs(phase-11): update tracking after wave 1 2026-07-10 19:42:50 -04:00
ccc5bcb18b chore: merge executor worktree (worktree-agent-acb31b2f09d1736a0) 2026-07-10 19:40:57 -04:00
4b9643ac15 docs(11-01): complete company catalog subscription sync data-contract plan
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 19:40:26 -04:00
c3a0432869 feat(11-01): implement PAX8 client read-only pagination helpers
- listAllCompanies/listAllSubscriptions/listAllProducts each loop pages via
  the existing fetchJson (inherits 429/Retry-After backoff), size=200
- Shared private paginateAll() helper stops once page.number >= totalPages-1
- Existing listCompanies(page, size) signature unchanged
- GET-only, no mutating method ever set (PAX8-08)
2026-07-10 19:39:26 -04:00
19fe788778 test(11-01): add failing tests for PAX8 client pagination helpers
- listAllCompanies/listAllSubscriptions/listAllProducts multi-page concat
- size=200 param assertion, single-page no-infinite-loop case
- Assert every request is GET with Authorization: Bearer header
2026-07-10 19:39:00 -04:00
0d819badc2 feat(11-01): extend PAX8 types with cost fields and sync-result shapes
- Pax8Subscription: price, partnerCost, currencyCode, productName, endDate, updatedDate
- Pax8Product: vendorName, shortDescription
- New Pax8EntitySyncResult / Pax8SyncResult mirroring AppgateSyncResult shape
- Note pre-existing unrelated tsc errors in sync-scheduler.ts (missing untracked
  appgate-factory/appgate-sync-service files in this worktree) in deferred-items.md
2026-07-10 19:38:24 -04:00
b0f6de0e8b feat(11-01): add PAX8 subscription cost columns (migration 092)
- ALTER TABLE pax8_subscriptions to add price/partner_cost/currency
- Additive, idempotent (IF NOT EXISTS), matches currency convention from 091
- Applied to dev DB via docker exec (Postgres init won't re-run on existing volume)
2026-07-10 19:37:16 -04:00
dc997f9629 docs(11): add pattern map, cite D-02/D-07/D-08 in plan truths
Pattern mapper output for Phase 11 was missing from the initial plan
commit. Decision coverage gate also flagged D-02/D-07/D-08 as
implemented-but-uncited in 11-02-PLAN.md's must_haves.truths block —
added explicit citations so the translation gate passes cleanly.
2026-07-10 19:10:34 -04:00
c8dd64f766 docs(11): create phase plan
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LHRgZqkzBHBbAbc3KHneuR
2026-07-10 19:04:29 -04:00
eee3c77e32 docs(state): record phase 11 context session 2026-07-10 18:43:01 -04:00
e557e7f4a6 docs(11): capture phase context 2026-07-10 18:42:56 -04:00
72ffcc230c docs(phase-10): add/update validation strategy 2026-07-10 18:27:09 -04:00
148e6c1a83 docs(phase-10): add/update security threat verification 2026-07-10 18:21:50 -04:00
253e37e1e2 docs(phase-10): evolve PROJECT.md after phase completion 2026-07-10 18:11:49 -04:00
5cec100def docs(phase-10): complete phase execution 2026-07-10 18:11:02 -04:00
d1e5a522c4 docs(10): add code review report 2026-07-10 18:07:33 -04:00
70f23c6b13 docs(phase-10): update tracking after wave 2 2026-07-10 18:02:13 -04:00
120e55b9ed chore: merge executor worktree (worktree-agent-a6d8ca4687c637b52) 2026-07-10 18:01:51 -04:00
59a8152075 docs(10-03): complete PAX8 live auth-proof plan
- Task 2 checkpoint resolved: developer ran scripts/verify-pax8-auth.ts with real credentials, confirmed live OAuth2 token exchange + /companies read (118 total companies)
- Phase 10 Success Criterion #2 verified end-to-end (not mocked)
2026-07-10 18:01:18 -04:00
72bba30007 docs(10-03): log pre-existing tsc errors as deferred (unrelated to plan) 2026-07-10 17:45:00 -04:00
076c8629b3 feat(10-03): add live PAX8 auth-proof script + document PAX8 in CLAUDE.md
- scripts/verify-pax8-auth.ts loads .env.local, calls getPax8Client().listCompanies(0,1), logs only counts/status (never token/secret)
- CLAUDE.md External integrations table gains a PAX8 row (PAX8_* prefix)
- INTEGRATIONS.md does not exist at repo root; edit skipped per plan instructions (noted in SUMMARY)
2026-07-10 17:44:56 -04:00
2c7d059a0f docs(phase-10): update tracking after wave 1 2026-07-10 17:41:44 -04:00
4614e287bf chore: merge executor worktree (worktree-agent-aa3a717ced7b6de6f) 2026-07-10 17:36:09 -04:00
4a6f3e496a chore: merge executor worktree (worktree-agent-a2bb09637c4029677) 2026-07-10 17:36:09 -04:00
5fd3a3b20b docs(10-01): append self-check results to SUMMARY.md 2026-07-10 17:35:15 -04:00
472612cca9 docs(10-01): complete PAX8 client auth foundation plan
- SUMMARY.md documents Task 1-3 commits, decisions, and the git-stash recovery incident
- REQUIREMENTS.md marks PAX8-01/PAX8-02 complete
- deferred-items.md logs two pre-existing, unrelated failures (out of scope)
2026-07-10 17:35:02 -04:00
e531c5f6ea docs(10-02): append self-check results to plan summary
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LHRgZqkzBHBbAbc3KHneuR
2026-07-10 17:34:40 -04:00
bf1eb35855 docs(10-02): add plan summary for PAX8 schema migration
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LHRgZqkzBHBbAbc3KHneuR
2026-07-10 17:34:28 -04:00
532ca96dd0 feat(10-01): implement pax8-factory config check + singleton
- isPax8Configured(): both PAX8_CLIENT_ID and PAX8_CLIENT_SECRET required
- getPax8Client(): throws exact error naming both env vars when missing;
  caches singleton Pax8Client instance
- _resetPax8Client(): test seam to clear the cached singleton
- follows appgate-factory.ts / 10-RESEARCH.md Pattern 2 verbatim
2026-07-10 17:33:56 -04:00
a07fe4574a test(10-01): add failing tests for pax8-factory config check + singleton 2026-07-10 17:33:52 -04:00
4d20e45ce8 feat(10-02): create PAX8 schema migration 091
- Six tables: pax8_companies, pax8_products, pax8_subscriptions,
  pax8_orders, pax8_order_items, pax8_company_match_review
- Header/line-item design (D-01) with hard FK order_items->orders CASCADE
- Monetary NUMERIC(12,2) + currency CHAR(3) DEFAULT 'USD' (D-04)
- raw_payload JSONB safety net on all five non-review tables (D-03)
- pax8_company_match_review modeled field-for-field on device_link_review
  (migration 080), with soft-ref BIGINT[] candidates and hard FK to
  pax8_companies + nullable FK to companies(id)
2026-07-10 17:33:27 -04:00
1da08093eb feat(10-01): implement Pax8Client token exchange + auth-proof call
- getToken() JSON-body OAuth2 client-credentials exchange with audience field
  (deviates from msgraph-client.ts's form-encoded body per 10-RESEARCH.md Pitfall 3)
- 60s expiry-buffer token cache, reused across calls
- fetchJson<T>() with 429/Retry-After retry copied from msgraph-client.ts
- listCompanies() auth-proof call parsing the {content,page} envelope
- secret never interpolated into any throw/console call
2026-07-10 17:32:25 -04:00