Skip to content

fix(ci): auto RC generation on develop merge via pull_request trigger - #81

Merged
matheus-souza merged 6 commits into
developfrom
fix/auto-rc-on-develop-merge
Aug 10, 2026
Merged

fix(ci): auto RC generation on develop merge via pull_request trigger#81
matheus-souza merged 6 commits into
developfrom
fix/auto-rc-on-develop-merge

Conversation

@matheus-souza

@matheus-souza matheus-souza commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace push: branches: [develop] trigger with pull_request: types: [closed] + merged guard in Release Pipeline
  • Fix checkout ref to use merge_commit_sha (tags the actual merge commit, not the test merge ref)
  • Fix git push credentials for tag creation (explicit git remote set-url with token, needed because persist-credentials: false)
  • Add concurrency group keyed on target branch to prevent duplicate runs
  • Fix WASM loading: disable webpack content-hash on .wasm assets so Kotlin/WASM and Skiko can load them by original name
  • Fix SPA handler: return 404 for missing static assets instead of silently serving index.html (prevents HTML-as-WASM MIME errors)

Root Cause (Release Pipeline)

auto-merge.yml uses GITHUB_TOKEN to squash-merge PRs into develop. GitHub suppresses push events from GITHUB_TOKEN actions to prevent infinite loops (CONTEXT.md #32). The Release Pipeline was triggering on push: 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 .wasm files by hardcoded original names (inframap-frontend-wasm-js.wasm, skiko.wasm). SPA handler served index.html (text/html) for missing unhashed paths, causing WebAssembly.compile to reject the wrong MIME type.

What Changed

Release Pipeline (release.yml)

Before: on: push: branches: [develop, main] — never triggers on auto-merge
After: on: pull_request: types: [closed]: branches: [develop, main] — fires on all merged PRs

Webpack Config (new: frontend/webpack.config.d/wasm-assets.js)

Override WASM asset output to [name][ext] — preserves original filenames

SPA Handler (backend/internal/platform/spa/handler.go)

Missing static assets (.wasm, .js, .css, etc.) now return 404 instead of SPA fallback

Test plan

  • Merge this PR to develop and verify Release Pipeline triggers automatically
  • Verify RC tag is auto-created with correct increment
  • Verify container image is built and pushed to ghcr.io
  • Verify WASM app loads correctly on homelab (no MIME type errors)
  • Verify SPA client-side routes still work (fallback to index.html)
  • Verify missing asset requests return 404 (not HTML)

Summary by CodeRabbit

  • Novos recursos

    • Arquivos WASM agora são publicados com seus nomes e extensões originais.
    • O aplicativo identifica corretamente recursos estáticos, como scripts, estilos, dados, imagens e fontes.
  • Correções

    • Recursos estáticos inexistentes agora retornam erro 404, em vez de carregar incorretamente a página inicial.
    • Arquivos WASM usam cache público com revalidação.
    • Erros inesperados ao acessar recursos retornam erro 500.
    • Publicações após merges ficaram mais seguras e previsíveis, com controle de concorrência e validações adicionais.

…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.
@github-actions
github-actions Bot enabled auto-merge (squash) August 10, 2026 17:36
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@matheus-souza, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 123f352d-52f5-4293-a28e-7f93f3777447

📥 Commits

Reviewing files that changed from the base of the PR and between 4f9e5b6 and 30bc212.

📒 Files selected for processing (1)
  • backend/internal/platform/spa/handler_test.go

Walkthrough

O PR atualiza o workflow de release para executar após merges em develop ou main, publicar tags com autenticação explícita e controlar execuções concorrentes. Também preserva arquivos .wasm no webpack e diferencia respostas 404 e 500 no servidor SPA.

Changes

Pipeline de release

Layer / File(s) Summary
Gatilho e checkout do release
.github/workflows/release.yml, CONTEXT.md
O workflow usa pull_request: closed, verifica o merge, controla concorrência e faz checkout do commit de merge. As diretrizes documentam essas regras.
Determinação da branch e das tags
.github/workflows/release.yml
A branch base do pull request define TARGET_BRANCH e a seleção das tags de release.
Publicação autenticada das tags
.github/workflows/release.yml
O workflow usa autenticação explícita e interrompe a execução quando git push falha.

Assets WebAssembly no SPA

Layer / File(s) Summary
Geração e tratamento de assets WASM
frontend/webpack.config.d/wasm-assets.js, backend/internal/platform/spa/handler.go, backend/internal/platform/spa/handler_test.go, CONTEXT.md
O webpack preserva nomes e extensões .wasm. O servidor retorna 404 para assets ausentes, 500 para outros erros de fs.Stat e usa public, no-cache para WASM. Os testes cobrem esses comportamentos.

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
Loading

Possibly related PRs

Suggested labels: released on @develop``

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título descreve claramente a principal alteração: gerar automaticamente versões RC após merges em develop usando o gatilho pull_request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/auto-rc-on-develop-merge

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

📊 Code Coverage Summary Report

Package / Module Covered Lines Total Lines Coverage Status
internal/platform/crypto 29 36 80.6% 🟡
internal/platform/eventbus 45 55 81.8% 🟡
internal/platform/httputil 94 98 95.9% 🟢
internal/platform/logger 1 1 100.0% 🟢
internal/platform/sdk 10 11 90.9% 🟢
internal/platform/spa 45 45 100.0% 🟢
modules/audit 13 14 92.9% 🟢
modules/configuration 0 2 0.0% 🔴
modules/configuration/controller 25 25 100.0% 🟢
modules/configuration/dto 14 17 82.4% 🟡
modules/configuration/repository 0 72 0.0% 🔴
modules/configuration/usecase 25 29 86.2% 🟢
modules/credentials 4 4 100.0% 🟢
modules/credentials/controller 59 60 98.3% 🟢
modules/credentials/dto 11 11 100.0% 🟢
modules/credentials/repository 42 44 95.5% 🟢
modules/credentials/usecase 50 54 92.6% 🟢
modules/discovery 0 6 0.0% 🔴
modules/discovery/collectors 204 228 89.5% 🟢
modules/discovery/controller 63 63 100.0% 🟢
modules/discovery/dto 23 23 100.0% 🟢
modules/discovery/engine 234 248 94.4% 🟢
modules/discovery/repository 0 72 0.0% 🔴
modules/discovery/usecase 122 137 89.1% 🟢
modules/identity 0 3 0.0% 🔴
modules/identity/controller 37 44 84.1% 🟡
modules/identity/dto 8 8 100.0% 🟢
modules/identity/repository 6 58 10.3% 🔴
modules/identity/usecase 74 86 86.0% 🟢
modules/integrations 2 2 100.0% 🟢
modules/integrations/controller 23 26 88.5% 🟢
modules/integrations/dto 5 5 100.0% 🟢
modules/integrations/providers/docker 64 73 87.7% 🟢
modules/integrations/providers/proxmox 67 78 85.9% 🟢
modules/integrations/registry 20 20 100.0% 🟢
modules/inventory 0 10 0.0% 🔴
modules/inventory/controller 123 124 99.2% 🟢
modules/inventory/dto 17 17 100.0% 🟢
modules/inventory/repository 0 87 0.0% 🔴
modules/inventory/usecase 174 181 96.1% 🟢
modules/realtime 1 1 100.0% 🟢
modules/realtime/controller 36 41 87.8% 🟢
modules/realtime/dto 3 3 100.0% 🟢
modules/realtime/gateway 71 78 91.0% 🟢
modules/topology 5 5 100.0% 🟢
modules/topology/controller 59 63 93.7% 🟢
modules/topology/dto 22 22 100.0% 🟢
modules/topology/repository 0 112 0.0% 🔴
modules/topology/usecase 82 93 88.2% 🟢

Note

Total Filtered Application Coverage: 77.5% (2012 / 2595 lines) 🟡

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.41%. Comparing base (e00536f) to head (30bc212).
⚠️ Report is 3 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
backend 86.25% <100.00%> (-0.07%) ⬇️
frontend 90.19% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
backend/internal/platform/spa/handler.go 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

auto-merge was automatically disabled August 10, 2026 17:45

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 376b952 and 107a81f.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • CONTEXT.md
  • frontend/webpack.config.d/wasm-assets.js

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
Comment thread .github/workflows/release.yml Outdated
…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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
backend/internal/platform/spa/handler_test.go (1)

196-210: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cubra 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, .woff2 e .ttf. Sem esses casos, uma regressão pode voltar a servir index.html com 200 para 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

📥 Commits

Reviewing files that changed from the base of the PR and between 107a81f and 938b2ee.

📒 Files selected for processing (4)
  • .github/workflows/release.yml
  • CONTEXT.md
  • backend/internal/platform/spa/handler.go
  • backend/internal/platform/spa/handler_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release.yml

Comment thread backend/internal/platform/spa/handler.go
Comment thread backend/internal/platform/spa/handler.go
Comment thread CONTEXT.md Outdated
…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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 938b2ee and 4f9e5b6.

📒 Files selected for processing (4)
  • .github/workflows/release.yml
  • CONTEXT.md
  • backend/internal/platform/spa/handler.go
  • backend/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

Comment thread backend/internal/platform/spa/handler_test.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.
@matheus-souza
matheus-souza merged commit 0522be8 into develop Aug 10, 2026
12 checks passed
@matheus-souza
matheus-souza deleted the fix/auto-rc-on-develop-merge branch August 10, 2026 23:03
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