|
| 1 | +# SOP-013: Post-Publish Consumer Smoke Test |
| 2 | + |
| 3 | +Status: active\ |
| 4 | +Target version: v0.21.10+\ |
| 5 | +Owner: CI + release owner\ |
| 6 | +Related: SOP-011, SOP-012, ADR-0041 |
| 7 | + |
| 8 | +## Objective |
| 9 | + |
| 10 | +Verify that freshly published JSR packages form a complete, buildable consumer |
| 11 | +project. This is the final release gate — it catches problems that pre-publish |
| 12 | +testing cannot because the new version does not yet exist on JSR. |
| 13 | + |
| 14 | +## Problem |
| 15 | + |
| 16 | +SOP-012 tests against already-published JSR versions. It validates the last |
| 17 | +release, not the current one. The publish workflow (`publish.yml`) currently |
| 18 | +publishes all packages and then stops — there is no verification that the |
| 19 | +published packages actually work together. |
| 20 | + |
| 21 | +The v0.21.9 hotfix (removing optional packages from the resolver) would have |
| 22 | +been caught immediately if a post-publish smoke had existed. |
| 23 | + |
| 24 | +## Implementation |
| 25 | + |
| 26 | +Add a `consumer-smoke` job to `.github/workflows/publish.yml` that runs after |
| 27 | +all packages are published. |
| 28 | + |
| 29 | +### Job Definition |
| 30 | + |
| 31 | +```yaml |
| 32 | +consumer-smoke: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + needs: [publish] |
| 35 | + steps: |
| 36 | + - uses: denoland/setup-deno@v2 |
| 37 | + with: |
| 38 | + deno-version: '2' |
| 39 | + - name: Wait for JSR propagation |
| 40 | + run: sleep 30 |
| 41 | + - name: Generate consumer project from JSR |
| 42 | + env: |
| 43 | + TEMP_DIR: ${{ runner.temp }}/lessjs-post-publish-smoke |
| 44 | + run: | |
| 45 | + rm -rf "$TEMP_DIR" |
| 46 | + mkdir -p "$TEMP_DIR" |
| 47 | + cd "$TEMP_DIR" |
| 48 | + deno run -A jsr:@lessjs/create test-blog |
| 49 | + - name: Build consumer project |
| 50 | + env: |
| 51 | + TEMP_DIR: ${{ runner.temp }}/lessjs-post-publish-smoke |
| 52 | + run: | |
| 53 | + cd "$TEMP_DIR/test-blog" |
| 54 | + deno task build |
| 55 | + - name: Verify output |
| 56 | + env: |
| 57 | + TEMP_DIR: ${{ runner.temp }}/lessjs-post-publish-smoke |
| 58 | + run: | |
| 59 | + test -f "$TEMP_DIR/test-blog/dist/index.html" || { |
| 60 | + echo "::error::dist/index.html not found — build failed silently" |
| 61 | + exit 1 |
| 62 | + } |
| 63 | +``` |
| 64 | +
|
| 65 | +### Key Constraints |
| 66 | +
|
| 67 | +- **No checkout needed** — this test runs against the JSR-published packages, |
| 68 | + not the local source. This is the whole point: it tests what the consumer |
| 69 | + actually receives. |
| 70 | +- A 30-second wait allows JSR to propagate the newly published versions. This |
| 71 | + may need adjustment based on JSR's actual propagation delay. |
| 72 | +- The job must depend on `publish` (all packages published first). |
| 73 | +- If any package failed to publish, this job will naturally fail because |
| 74 | + `deno run -A jsr:@lessjs/create` will pull a version mismatch. |
| 75 | + |
| 76 | +## Acceptance Criteria |
| 77 | + |
| 78 | +- [ ] `consumer-smoke` job exists in `publish.yml` after the publish step |
| 79 | +- [ ] Job does NOT checkout the repository (tests pure JSR consumption) |
| 80 | +- [ ] Job verifies `dist/index.html` exists after build |
| 81 | +- [ ] A broken publish (e.g., missing package) causes this job to fail |
| 82 | + |
| 83 | +## Relationship to SOP-012 |
| 84 | + |
| 85 | +| | SOP-012 (CI Pre-Publish) | SOP-013 (Post-Publish) | |
| 86 | +|---|---|---| |
| 87 | +| **When** | Every push to dev/main | After publish completes | |
| 88 | +| **Tests against** | Last published JSR version | Freshly published JSR version | |
| 89 | +| **Catches** | Regressions in already-shipped code | New-version integration bugs | |
| 90 | +| **Needs checkout** | Yes (for create scaffolding) | No (pure JSR consumption) | |
| 91 | + |
| 92 | +Both are needed. SOP-012 catches regressions early in PR CI. SOP-013 is the |
| 93 | +final gate that proves the release is actually shippable. |
| 94 | + |
| 95 | +## Validation |
| 96 | + |
| 97 | +This can only be validated during an actual publish cycle. Manual test: |
| 98 | + |
| 99 | +```powershell |
| 100 | +# After publishing a new version |
| 101 | +Start-Sleep -Seconds 30 |
| 102 | +$tmp = Join-Path $env:TEMP "lessjs-post-publish-smoke" |
| 103 | +Remove-Item -LiteralPath $tmp -Recurse -Force -ErrorAction SilentlyContinue |
| 104 | +New-Item -ItemType Directory -Path $tmp | Out-Null |
| 105 | +Set-Location $tmp |
| 106 | +deno run -A jsr:@lessjs/create test-blog |
| 107 | +Set-Location test-blog |
| 108 | +deno task build |
| 109 | +Test-Path dist/index.html |
| 110 | +``` |
0 commit comments