Ground Truth — What Exists Today (2026-07-18)
Recon of groupon/groupon-monorepo, groupon/encore-ts-sample, groupon/architecture (cloud github.com, cloned in ../repos/) + full GHE estate survey (github.groupondev.com). Raw agent reports: raw-recon-output.json.
1. The three estates
| Estate | Where | Size | State |
|---|---|---|---|
| Legacy (Continuum) | GHE, 20,463 repos / 949 orgs | ~70M LOC claim plausible; only 581 repos (2.8%) pushed in last 90 days | ~93–97% dormant. Real platform = I-Tier (466 repos, Node/JS/Coffee) + J-Tier (372 repos, Java) + Rails remnants. “Continuum” is the C4-model name only — zero GHE hits. |
| Target (Stack 2.0) | Cloud groupon/groupon-monorepo |
13,292 TS files ≈ 1.44M lines + 79k lines Go; 124 Encore services (SERVICES.md says 93 — drifted), 2,060 test files | Created 2025-02, 101 contributors, ~290 PRs/month, default branch staging, staging→production release-train PRs, no merge queue. |
| Architecture model | groupon/architecture (Structurizr C4) |
141 legacy services / 21 domains federated; 206 Encore containers | Auto-maintained by a Claude agent workflow (automap-repos.yml, Mon/Thu, opus-pinned) — agentic architecture federation already runs in production. |
2. Target architecture (encore-ts-sample = codified rules)
- App-per-system (~10 systems), service = dir with
encore.service.ts; one Gateway + authHandler per app; every app hashealthservice. - Per-service
package.json= dependency encapsulation boundary, enforced by dependency-cruiser gate (service-deps-must-be-declared), not physics (node-linker=hoistedload-bearing). - Clean architecture per service:
domain/(framework-free) ←application/←infrastructure/+composition/container.ts+presentation/. Declarativearch-contract.yamlper service;pnpm arch:check. - Services born compliant:
pnpm gen:servicescaffolder (plop); hand-creating services forbidden by AGENTS.md “Prime Directive”. - Data: raw parameterized
sqldbdefault, Drizzle opt-in (ADR-0004) — conflicts with monorepo.rules/encore-ts-standards.mdwhich mandates Drizzle. Must pick a winner. - Seams: intra-system
~encore/clientsRPC + pub/sub; cross-system generated@acme/client-<system>packages; expand-contract migrations with destructive-DDL footgun lint. - Testing: integration-first
encore testvs real Dockerised Postgres;pnpm verify= build:libs → typecheck → lint → depcruise → arch:check → footgun.
3. Conformance delta (monorepo vs target rules) — the actual refactor
The monorepo violates every headline rule of its own sample today:
- 2
encore.appfiles, not ~10 — all 124 TS services in ONE app (groupon-encore-83x2) + one Go app. The core refactor is a 1→N app split. - 0 per-service package.json (target: one per service).
- No dependency-cruiser — only bespoke check scripts with
.exceptions.jsonescape hatches. - No
node-linker=hoisted;.npmrccontains an expired hard-coded GitHub Packages token (housekeeping). - Drizzle-mandated vs raw-SQL-default rules conflict.
At ~290 PRs/month, a long-lived restructure branch has a merge-conflict half-life of hours → incremental service-by-service moves through the existing train only.
4. Migration doctrine
- Vision:
_documentation/Stack 2.0 Groupon vision.md(Zaruba & Sima, 2025–2026, 2-year plan). “Calm revolution”: Encore grows around legacy; GAPI/UMAPI chokepoints die; per-tribe 2-year plans (B2B done, B2C underway, Core Ops preparing Order 2.0). - Observed pattern: wrapper-first strangler —
_proxy_to_legacy/with ~24 proxies (dc, dmapi, umapi, m3, gims, mds, gazebo, lazlo, orders, accounting, vss…) + MBUS WebSocket bridge for legacy events. - Sanctioned doctrine (GHE
zblut/encore_migration_guide, a Claude Code plugin, 2026-03): “Default recommendation is a Clean Break — not a cautious strangler fig”, numeric risk score (0–2 clean break; 5+ justify strangler), Phase-0 “should this service exist at all” check, DELETE-first audit, worked examples (bhuvan, barcode-service). - Strangler frontier is SOX-scoped: most wrapped legacy sources live in
sox-inscope(simultaneously the most-active GHE org — 66 repos active) → migrations carry compliance overhead. Several proxied sources are already dead upstream (dmapi last push 2016, deal-catalog 2022, GIMS 2018) → clean-break candidates.
5. Agent infrastructure already institutionalized
.agents/skills/— ~50 skills, single source shared by Claude Code, Codex, Cursor (AGENTS.md+CLAUDE.md+.cursor/+.junie/+.aiassistant/). Ops fleet (encore-deploy-monitor, log-scanner, trace-monitoring, incident-management, release-train skills), autonomous partner-onboarding pipeline with a hard gate (“any gap stops the run… posts missing fields on the Jira” — an existing question-triage precedent), BYOD program (agents operate APIs, no admin UI).- Temporal in production:
@temporalio/*1.13, 13 workflow workers tribe-sharded, Workflow Management service + AdminIQ UI, docs incl.agentic_workflow_patterns.md(LLM agents as durable workflows — action-discriminator + MAX_ITERATIONS loops); live exampleworkflow_oncall_agent. Vision: “Temporal = how AI thinks, retries, corrects itself, and keeps state.” - AI gateway:
_core_system/ai-gateway→ LiteLLM, Langfuse project registry (LANGFUSE_PROJECT_ECHELONet al.). Mastra app hosts oncall-triage agent. Production MCP servergroupon-iq-mcpatapi.enc.groupon.com. CodeRabbit reviews PRs. - CI: 36 workflows; architecture gates (controller→repository layering, cross-service imports, duplicate types), doc-drift-check, ORR metadata check, diff coverage, Happo visual, Playwright cron; hall-of-shame culture bot.
6. Access map (for the agent fleet)
| Surface | Token | State |
|---|---|---|
Cloud groupon/* (monorepo, architecture, sample) |
GROUPON_GITHUB_CLOUD_READ_TOKEN (ervojacek-png) |
✅ read-all, approved |
| GHE 20k legacy repos | GROUPON_GHE_READ_TOKEN (e-rvojacek) |
✅ broad read |
monorepo-development + monorepo-infra (the refactor repos, per Robert’s screenshot) |
GROUPON_GITHUB_CLOUD_GRPN2_TOKEN |
❌ org-blind as of 2026-07-18 — pending org approval or wrong resource owner; org name unknown. Blocker for direct recon of the actual refactor repos. |
monorepo-infra (per screenshot description): “Infrastructure monorepo: Temporal, Grafana, GKE, everything self-hosted” — matches the Stack 2.0 self-hosted direction; unverified beyond that.