Skip to content

[GH-P5] Previews de PR : instance par PR, commentaire unique, forks bloqués, nettoyage - #240

Merged
bobdivx merged 1 commit into
mainfrom
feat/gh-app-p5-previews
Oct 15, 2026
Merged

bobdivx merged 1 commit into
mainfrom
feat/gh-app-p5-previews

Conversation

@bobdivx

@bobdivx bobdivx commented Oct 15, 2026

Copy link
Copy Markdown
Owner

P5: previews de PR (GitHub App)

  • P5-01 pr_previews.rs:
    • pull_request.opened|synchronize|reopened on a repo linked to the installation (with pr_previews_enabled) deploys the head_sha (pinned) into its own instance per PR, pv{hash10} → df-pv….
    • Host is pr-<n>-<slug>.<prod zone>: one level, valid DNS, label ≤ 63 chars.
    • Environment is preview-<n>, so a synchronize cancels only the build of that same PR and never touches prod or dev.
    • Env: only variables flagged preview (new column project_env_vars.preview, default false), plus DEVFORGE_PREVIEW*. No production secrets.
    • Limits: memory DEVFORGE_PREVIEW_MEMORY (default 1g), CPU DEVFORGE_PREVIEW_CPUS (default 1), no host ports, no volumes, no GPU.
    • Forks: no deploy. A neutral check "Previews désactivées pour les forks" is posted instead.
  • P5-02 One comment per project, keyed by the marker <!-- devforge-preview:<uuid> -->. It is created once, then edited (PATCH). If the comment id is lost, it is found again by its marker. Table: Projet | Statut | Preview | Commit | Mis à jour (Paris time).
    • Check Run plus a GitHub Deployment Preview PR #n whose environment_url is the preview.
  • P5-03 closed removes the container, network, image and DNS, sets the deployment status to inactive, and edits the comment to "Preview supprimée".
    • Catch-up job in tick (at most once an hour): previews whose PR is closed, or inactive for more than 7 days, are cleaned up.
    • A preview interrupted by a restart is marked failed and is never replayed as a prod deploy.
    • Cancelling a preview deploy targets the right instance.
  • P5-04 New "Previews" tab (ProjectPreviewsPanel.tsx): list, Redéployer / Supprimer, pr_previews_enabled toggle, and a warning when the project is not linked yet.

No effect until the app exists and projects are linked (P7).

Tests

  • pr_previews_tests (11 tests):
    • DNS-valid host, ≤ 63 chars
    • unique instance per PR
    • classification (opened / sync / closed / ignored)
    • forks blocked
    • comment: 1 create followed by 3 synchronize edits gives 1 comment; a lost id is found again by its marker
    • Paris time
    • capped resources
    • targeted teardown
  • ProjectPreviewsPanel.test.tsx: empty state, list / redeploy / delete, toggle and unlinked project.

@bobdivx
bobdivx merged commit 9f540a7 into main Oct 15, 2026
4 checks passed
@bobdivx
bobdivx deleted the feat/gh-app-p5-previews branch October 15, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant