fix(ci): auto RC generation on develop merge via pull_request trigger - #81
Conversation
…velop merge GITHUB_TOKEN auto-merges suppress push events, preventing the Release Pipeline from firing. Switch develop trigger from push to pull_request[closed] with merged guard, fix checkout ref to tag the actual merge commit, and configure explicit git credentials for tag push.
|
Warning Review limit reached
Next review available in: 54 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughO PR atualiza o workflow de release para executar após merges em ChangesPipeline de release
Assets WebAssembly no SPA
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant GitHub
participant ReleaseJob
participant Checkout
participant TagLogic
participant GitRemote
GitHub->>ReleaseJob: pull_request closed e merged
ReleaseJob->>Checkout: checkout do commit de merge
ReleaseJob->>TagLogic: calcular TARGET_BRANCH e tags
TagLogic->>GitRemote: publicar tags com autenticação
GitRemote-->>ReleaseJob: sucesso ou falha do git push
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Code Coverage Summary Report
Note Total Filtered Application Coverage: 77.5% (2012 / 2595 lines) 🟡 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #81 +/- ##
===========================================
- Coverage 87.44% 87.41% -0.04%
===========================================
Files 123 123
Lines 4350 4369 +19
Branches 158 162 +4
===========================================
+ Hits 3804 3819 +15
- Misses 386 388 +2
- Partials 160 162 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Branch protection rule check failed
Kotlin/WASM bootstrap loads .wasm files by their original names (skiko.wasm, inframap-frontend-wasm-js.wasm), but webpack's production build hashes them. The SPA handler serves index.html (text/html) for missing files, causing WebAssembly.compile to reject the wrong MIME type.
Static asset requests (.wasm, .js, .css, etc.) that don't exist in the embedded FS now return 404 instead of falling back to index.html. This prevents the browser from receiving HTML when it expects a binary asset, making missing file errors immediately visible in devtools.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Around line 77-80: Update the release workflow’s git authentication around the
tag push so GH_TOKEN is not persisted in .git/config by git remote set-url. Use
temporary authentication for the git push command, or restore/remove the
tokenized remote URL immediately afterward, while preserving the existing TAG
creation and push behavior.
- Around line 77-80: Replace persistent remote authentication in the release
workflow with temporary credentials scoped directly to each RC and stable-tag
git push at .github/workflows/release.yml lines 77-80 and 97-100, removing the
corresponding git remote set-url usage. Update guideline 100 in CONTEXT.md at
line 163 to recommend temporary push-scoped credentials instead of persisting
the token in the remote URL.
- Around line 25-29: Atualize a condição do job release no workflow para
permitir execuções workflow_dispatch somente quando github.ref for
refs/heads/main ou refs/heads/develop, mantendo as regras existentes para
eventos não manuais. Não permita que releases manuais originadas de outras refs
publiquem artefatos ou criem releases.
- Around line 21-23: Altere a configuração de concorrência do workflow,
especialmente o campo group, para usar um namespace único e global para todas as
execuções de release, em vez de separar por github.event.pull_request.base.ref
ou github.ref_name. Preserve cancel-in-progress como false e garanta que
releases de develop e main sejam serializados no mesmo grupo antes de publicar
tags.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: eabdd0ee-aef5-41e6-983f-00a28c44d24c
📒 Files selected for processing (3)
.github/workflows/release.ymlCONTEXT.mdfrontend/webpack.config.d/wasm-assets.js
…rrency, branch guard - Use temporary git -c http.extraHeader for tag push instead of persisting token via git remote set-url - Use single global concurrency group (release-pipeline) to serialize all releases across develop and main - Restrict workflow_dispatch to develop/main branches only
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
backend/internal/platform/spa/handler_test.go (1)
196-210: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCubra todas as extensões classificadas.
O teste verifica apenas 5 das 12 extensões reconhecidas por
isStaticAsset. Adicione casos para.svg,.png,.jpg,.ico,.woff,.woff2e.ttf. Sem esses casos, uma regressão pode voltar a servirindex.htmlcom200para assets ausentes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/internal/platform/spa/handler_test.go` around lines 196 - 210, Expand TestSPAHandler_MissingStaticAssetReturns404 to include missing .svg, .png, .jpg, .ico, .woff, .woff2, and .ttf paths in addition to the existing extensions, ensuring every extension recognized by isStaticAsset is verified to return 404.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/internal/platform/spa/handler.go`:
- Around line 64-67: Update the SPA cache-header handling around isStaticAsset
and setCacheHeaders so stable .wasm URLs are not served with one-year immutable
caching. Apply revalidation-specific headers for .wasm files while preserving
long-lived immutable caching for other hashed static assets.
- Around line 32-35: Na lógica que trata o erro de fs.Stat no handler, use
http.NotFound apenas quando errors.Is(err, fs.ErrNotExist) for verdadeiro; para
erros de permissão ou I/O, responda com http.StatusInternalServerError,
preservando o fluxo de retorno após a resposta.
In `@CONTEXT.md`:
- Around line 163-164: Remove the remaining on.push trigger from the release
workflow and eliminate the github.event_name == 'push' branch from the release
job condition. Keep release execution based on merged pull_request: closed
events, and preserve the existing workflow_dispatch restriction to develop and
main.
---
Nitpick comments:
In `@backend/internal/platform/spa/handler_test.go`:
- Around line 196-210: Expand TestSPAHandler_MissingStaticAssetReturns404 to
include missing .svg, .png, .jpg, .ico, .woff, .woff2, and .ttf paths in
addition to the existing extensions, ensuring every extension recognized by
isStaticAsset is verified to return 404.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 85d49553-bf36-45e9-9d9d-ecb601039a77
📒 Files selected for processing (4)
.github/workflows/release.ymlCONTEXT.mdbackend/internal/platform/spa/handler.gobackend/internal/platform/spa/handler_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/release.yml
…ache, push trigger cleanup - Classify fs.Stat errors: 404 for ErrNotExist, 500 for I/O/permission - Use revalidation cache (no-cache) for stable-named .wasm files instead of immutable (prevents stale WASM after release updates) - Remove push: branches: [main] from release.yml — pull_request: closed already covers all branch merges; keep only push: tags - Add tag-type guard to push event condition
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/internal/platform/spa/handler_test.go`:
- Around line 224-238: Corrija TestSPAHandler_StatErrorReturns500 para usar um
fs.FS que retorne um erro diferente de fs.ErrNotExist ao consultar
“missing.wasm” e valide http.StatusInternalServerError; remova o fixture
broken.wasm não utilizado. Se o teste permanecer cobrindo apenas ausência de
arquivo, renomeie-o para refletir o comportamento 404 e ajuste a expectativa.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 3a91a9dd-9eaf-46b2-8390-1c277f1131e4
📒 Files selected for processing (4)
.github/workflows/release.ymlCONTEXT.mdbackend/internal/platform/spa/handler.gobackend/internal/platform/spa/handler_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- .github/workflows/release.yml
- backend/internal/platform/spa/handler.go
…or path TestSPAHandler_StatErrorReturns500 used fstest.MapFS with Mode: 0, which does not cause fs.Stat to fail. The test actually exercised the ErrNotExist → 404 path. Replace with a custom statErrorFS that returns a disk I/O error, ensuring the 500 branch is covered.
Summary
push: branches: [develop]trigger withpull_request: types: [closed]+ merged guard in Release Pipelinemerge_commit_sha(tags the actual merge commit, not the test merge ref)git remote set-urlwith token, needed becausepersist-credentials: false).wasmassets so Kotlin/WASM and Skiko can load them by original nameRoot Cause (Release Pipeline)
auto-merge.ymlusesGITHUB_TOKENto squash-merge PRs into develop. GitHub suppressespushevents fromGITHUB_TOKENactions to prevent infinite loops (CONTEXT.md #32). The Release Pipeline was triggering onpush: develop— which never fired for auto-merged PRs. RC tags were never auto-created.Root Cause (WASM Loading)
Webpack production builds content-hash asset filenames (
a92a356b.wasm), but Kotlin/WASM bootstrap and Skiko Emscripten runtime load.wasmfiles by hardcoded original names (inframap-frontend-wasm-js.wasm,skiko.wasm). SPA handler servedindex.html(text/html) for missing unhashed paths, causingWebAssembly.compileto reject the wrong MIME type.What Changed
Release Pipeline (
release.yml)Before:
on: push: branches: [develop, main]— never triggers on auto-mergeAfter:
on: pull_request: types: [closed]: branches: [develop, main]— fires on all merged PRsWebpack Config (new:
frontend/webpack.config.d/wasm-assets.js)Override WASM asset output to
[name][ext]— preserves original filenamesSPA Handler (
backend/internal/platform/spa/handler.go)Missing static assets (
.wasm,.js,.css, etc.) now return 404 instead of SPA fallbackTest plan
Summary by CodeRabbit
Novos recursos
Correções