learning_ai_common_plat/services/platform-service/src
saravanakumardb1 6bddc88f0f feat(fleet): reconcile PR state against GitHub (detect externally-merged PR)
A PR merged in the GitHub UI was invisible to the platform — prState only
flipped to `merged` when the platform merged it (ghMergePr on ship) or a runner
reported it, so the job details page kept showing the PR as open. This adds a
simple, pull-based reconcile (no inbound webhook / public ingress needed).

- coordinator.reconcileJobPrState(jobId, productId, fetcher?): finds the latest
  run carrying a prUrl and, when `gh pr view --json state` reports MERGED, flips
  the run's prState to `merged` and appends a `pr_merged` event (data.via:
  'reconcile'). The GitHub lookup is injectable for tests; pure `mapGhPrState`
  maps MERGED/OPEN/other. Best-effort: any gh failure is a no-op.
- POST /fleet/jobs/:id/pr/reconcile route; echoes the outcome to the tracker
  Item when a merge is detected.
- tracker-web: reconcilePrState() client + a "Refresh PR status" button on the
  job details PR section (shown until the PR is merged) that reconciles then
  refreshes the view.

Tests: +5 (mapGhPrState, reconcile merged/open/no_pr/not_found, route wiring);
full suite 1861 green; lint + tsc clean (service + tracker-web). Deployed: rebuilt
the docker platform-service; POST .../pr/reconcile returns 401 (wired), not 404.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-06-01 23:58:13 -07:00
..
lib feat(platform): product ownership + owner-scoped "my projects" + tenant guard 2026-06-01 16:47:05 -07:00
migrations refactor(platform-service): migrate webhooks/routes and migrations/runner from cosmos.js to datastore 2026-03-02 02:02:47 -08:00
modules feat(fleet): reconcile PR state against GitHub (detect externally-merged PR) 2026-06-01 23:58:13 -07:00
nodemailer.d.ts feat(platform-service): add smtp email delivery and postal setup 2026-03-14 05:52:28 +00:00
server.test.ts feat(runtime): add platform runtime projection api 2026-04-04 01:14:37 -07:00
server.ts fix(fleet): schedule the lease reaper so dead-factory jobs are recovered 2026-06-01 11:11:14 -07:00