feat: Add AppSetting for frontend asset base url and param in cli#18850
feat: Add AppSetting for frontend asset base url and param in cli#18850bjorntore wants to merge 20 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughReplace cookie-based frontend version overrides with a configurable AppFrontendAssetBaseUrl used in Development; HomeController/IndexPageGenerator use the setting, PdfGeneratorClient no longer injects the cookie or depends on host/http-context, CLI adds --dev-frontend and propagates the value to run environments and image builds, tests and fixtures updated accordingly. ChangesLocal Frontend Asset URL Configuration
Sequence Diagram(s)sequenceDiagram
participant CLI
participant RunCommand
participant Topology
participant EnvBuilder
participant ImageBuilder
participant Runtime
participant HomeController
participant IndexPageGenerator
CLI->>RunCommand: parse --dev-frontend
RunCommand->>Topology: query for frontend dev-server base URL
Topology-->>RunCommand: return dev-server base URL
RunCommand->>EnvBuilder: pass appFrontendAssetBaseUrl
EnvBuilder->>Runtime: set AppSettings__AppFrontendAssetBaseUrl env var (process/container)
RunCommand->>ImageBuilder: call SetAppFrontendAssetBaseURL(spec, value)
Runtime->>HomeController: HTTP GET /
HomeController->>IndexPageGenerator: Generate(..., appFrontendAssetBaseUrlOverride)
IndexPageGenerator-->>HomeController: HTML using {{appFrontendAssetBaseUrl}} for CSS/JS
HomeController-->>Runtime: 200 OK (index page)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
1ae637f to
2890688
Compare
2890688 to
3319e9b
Compare
8af13cf to
7064ccb
Compare
7064ccb to
d75d9d1
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/App/backend/test/Altinn.App.Api.Tests/Controllers/PdfControllerTests.cs (1)
221-223: ⚡ Quick winUse xUnit type assertions in this test.
Replace
result.Should().BeOfType(typeof(FileStreamResult));withAssert.IsType<FileStreamResult>(result);to align with the project's test assertion conventions. Note: there is an additional instance of this pattern at line 154 that should also be updated.🤖 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 `@src/App/backend/test/Altinn.App.Api.Tests/Controllers/PdfControllerTests.cs` around lines 221 - 223, The test in PdfControllerTests asserts the result type using FluentAssertions; change the assertion to xUnit style by replacing the FluentAssertions call with Assert.IsType<FileStreamResult>(result) for the GetPdfPreview test (method invoking pdfController.GetPdfPreview) and update the other identical assertion in the same test class (the other instance that currently checks FileStreamResult) so both follow the project's xUnit convention.
🤖 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.
Nitpick comments:
In `@src/App/backend/test/Altinn.App.Api.Tests/Controllers/PdfControllerTests.cs`:
- Around line 221-223: The test in PdfControllerTests asserts the result type
using FluentAssertions; change the assertion to xUnit style by replacing the
FluentAssertions call with Assert.IsType<FileStreamResult>(result) for the
GetPdfPreview test (method invoking pdfController.GetPdfPreview) and update the
other identical assertion in the same test class (the other instance that
currently checks FileStreamResult) so both follow the project's xUnit
convention.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 75b39984-bc26-4a46-b027-a21250d46a07
📒 Files selected for processing (18)
src/App/backend/src/Altinn.App.Api/Controllers/HomeController.cssrc/App/backend/src/Altinn.App.Core/Configuration/AppSettings.cssrc/App/backend/src/Altinn.App.Core/Infrastructure/Clients/Pdf/PdfGeneratorClient.cssrc/App/backend/src/Altinn.App.Core/Internal/App/IIndexPageGenerator.cssrc/App/backend/src/Altinn.App.Core/Internal/App/IndexPageGenerator.cssrc/App/backend/src/Altinn.App.Core/Internal/Auth/AuthenticationTokenResolver.cssrc/App/backend/test/Altinn.App.Api.Tests/Controllers/HomeControllerTest_AppFrontendAssetBaseUrl.cssrc/App/backend/test/Altinn.App.Api.Tests/Controllers/PdfControllerTests.cssrc/App/backend/test/Altinn.App.Core.Tests/Internal/Auth/AuthenticationTokenResolverTest.cssrc/App/backend/test/Altinn.App.Core.Tests/Internal/Pdf/PdfServiceTests.cssrc/App/backend/test/Altinn.App.Core.Tests/PublicApiTests.PublicApi_ShouldNotChange_Unintentionally.verified.txtsrc/App/backend/test/Altinn.App.Integration.Tests/_fixture/AppFixture.cssrc/App/backend/test/Altinn.App.Integration.Tests/_fixture/StudioctlEnvironment.cssrc/cli/internal/cmd/app/env.gosrc/cli/internal/cmd/app/run.gosrc/cli/internal/cmd/app/run_test.gosrc/cli/internal/cmd/run.gosrc/cli/internal/cmd/run_internal_test.go
💤 Files with no reviewable changes (1)
- src/App/backend/src/Altinn.App.Core/Infrastructure/Clients/Pdf/PdfGeneratorClient.cs
✅ Files skipped from review due to trivial changes (1)
- src/App/backend/src/Altinn.App.Core/Internal/Auth/AuthenticationTokenResolver.cs
…are linked between frontend and backend
…hen running github workflows
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/actions/app-run-local-env/action.yaml:
- Line 124: The args array currently always includes '--dev-frontend' which
enables a frontend even when the 'run-frontend' toggle/input is false; update
the logic that builds args (the const args = [...] construction) to only push
'--dev-frontend' when the frontend toggle/input (e.g., runFrontend or
inputRunFrontend) is truthy, and also export that input into the action/script
environment so downstream code can read it (add it to the env passed to the
script or use core.exportVariable); reference the args array and the frontend
input name so the flag is conditionally included.
In `@src/Runtime/localtest/src/Views/Home/Index.cshtml`:
- Around line 71-73: The option tag currently emits selected="`@app.Selected`"
which will render selected="False" for non-selected items; instead conditionally
render the selected attribute only when app.Selected is true. Update the option
generation that uses app.Value, app.Selected and app.ShowFrontendVersionSwitcher
so that selected is emitted (e.g., selected or selected="selected") only when
app.Selected is true, leaving no selected attribute for false values.
🪄 Autofix (Beta)
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
Run ID: dbd2b247-f687-4b73-9819-138ff31e397c
📒 Files selected for processing (29)
.github/actions/app-run-local-env/action.yaml.github/workflows/app-frontend-cypress.ymlinfra/runtime/apps-config/base/apps-runtime-common-env.yamlinfra/runtime/apps-config/base/apps-runtime-common.yamlsrc/App/backend/src/Altinn.App.Core/Configuration/PlatformFrontendSettings.cssrc/App/backend/src/Altinn.App.Core/Internal/App/IndexPageGenerator.cssrc/App/backend/test/Altinn.App.Api.Tests/Controllers/PdfControllerTests.cssrc/App/frontend/src/features/devtools/DevToolsControls.tsxsrc/App/frontend/src/features/devtools/components/VersionSwitcher/VersionSwitcher.tsxsrc/App/frontend/src/setupTests.tssrc/App/frontend/src/types/shared.tssrc/App/frontend/src/utils/urls/appUrlHelper.tssrc/App/frontend/src/utils/versioning/versionCompare.test.tssrc/App/frontend/src/utils/versioning/versionCompare.tssrc/App/frontend/src/utils/versioning/versions.tssrc/App/frontend/template.envsrc/App/frontend/test/e2e/config/localtest.jsonsrc/App/frontend/test/e2e/config/tt02.jsonsrc/App/frontend/test/e2e/support/start-app-instance.tssrc/Runtime/localtest/src/Controllers/HomeController.cssrc/Runtime/localtest/src/Models/StartAppModel.cssrc/Runtime/localtest/src/Views/Home/Index.cshtmlsrc/Runtime/localtest/src/Views/Shared/_Layout.cshtmlsrc/cli/internal/appimage/spec.gosrc/cli/internal/appimage/spec_test.gosrc/cli/internal/cmd/app.gosrc/cli/internal/cmd/app_build_test.gosrc/cli/internal/cmd/run.gosrc/cli/internal/cmd/run_internal_test.go
💤 Files with no reviewable changes (16)
- src/App/frontend/src/utils/versioning/versions.ts
- src/App/frontend/src/utils/versioning/versionCompare.test.ts
- src/App/frontend/test/e2e/config/tt02.json
- src/App/frontend/src/types/shared.ts
- src/App/frontend/src/utils/versioning/versionCompare.ts
- src/App/frontend/src/utils/urls/appUrlHelper.ts
- src/App/frontend/src/features/devtools/components/VersionSwitcher/VersionSwitcher.tsx
- src/App/frontend/test/e2e/config/localtest.json
- src/App/frontend/src/setupTests.ts
- src/App/backend/src/Altinn.App.Core/Configuration/PlatformFrontendSettings.cs
- src/App/frontend/template.env
- infra/runtime/apps-config/base/apps-runtime-common-env.yaml
- infra/runtime/apps-config/base/apps-runtime-common.yaml
- src/App/frontend/src/features/devtools/DevToolsControls.tsx
- src/App/frontend/test/e2e/support/start-app-instance.ts
- src/App/backend/test/Altinn.App.Api.Tests/Controllers/PdfControllerTests.cs
✅ Files skipped from review due to trivial changes (1)
- src/Runtime/localtest/src/Views/Shared/_Layout.cshtml
… those when running github workflows" This reverts commit 73c7fa9
… any longer and all callers ran frontend. Running an app without frontend is not even currently supported.
# Conflicts: # src/App/backend/test/Altinn.App.Core.Tests/Internal/Auth/AuthenticationTokenResolverTest.cs
studioctl run --dev-frontendorstudioctl app build --dev-frontend--dev-frontend)--dev-frontendVerification
Summary by CodeRabbit
New Features
Bug Fixes / Behaviour
Tests