Repository navigation
fix: accept ENVIRONMENT=preview for pull request previews - #141
Conversation
Previews deploy with ENVIRONMENT=preview, which settings rejected at startup. A preview serves unreleased code, so the frontend treats it as a staging site.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 54 minutes. View limit details
📝 Walkthrough
Priority: ➖ Normal Change: Bug fix Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
🧹 Nitpick comments: 1
frontend/src/hooks/useStagingMode.ts: 1
5-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover preview in the sparse-results chart test.
The banner test does not render
SampleSizeGate. The chart test covers staging only, and its helper currently excludes"preview". A regression in the preview chart-gate path can therefore pass all existing tests.Suggested fix
const renderChart = ( values: ReturnType<typeof model>[], mipEra?: "CMIP6" | "CMIP7", - environment: "production" | "staging" = "production", + environment: "production" | "staging" | "preview" = "production", ) => { ... it("plots a chart with too few models on a staging site", () => { renderChart([model("CMIP6", "A"), model("CMIP6", "B")], "CMIP6", "staging"); expect(screen.getByTestId("chart")).toBeInTheDocument(); expect( screen.queryByText("Not enough models to plot"), ).not.toBeInTheDocument(); }); + + it("plots a chart with too few models on a preview site", () => { + renderChart([model("CMIP6", "A"), model("CMIP6", "B")], "CMIP6", "preview"); + expect(screen.getByTestId("chart")).toBeInTheDocument(); + expect( + screen.queryByText("Not enough models to plot"), + ).not.toBeInTheDocument(); + });
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0296d71c-3e1b-4763-b095-2d944f58506b
📒 Files selected for processing: 7
backend/src/ref_backend/core/config.pybackend/src/ref_backend/models/about.pybackend/tests/test_core/test_config.pychangelog/141.fix.mdfrontend/src/client/types.gen.tsfrontend/src/components/app/stagingBanner.test.tsxfrontend/src/hooks/useStagingMode.ts
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
|
Added the preview case to the chart test in 27a34eb. |
Adds
previewto the allowedENVIRONMENTvalues. The pull request previews deploy withENVIRONMENT=preview, which the settings model rejected, so a preview pod could not start.The frontend treats
previewlikestaging, showing the staging banner and the sparse results a production site withholds, because a preview serves unreleased code against the same data as staging. The/aboutresponse type gains the value, so the client is regenerated.Summary by CodeRabbit