Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
3 issues found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/proto/api/openstatus/status_page/v1/service.proto">
<violation number="1" location="packages/proto/api/openstatus/status_page/v1/service.proto:199">
P2: `repeated Locale locales` in an update message cannot distinguish "don't change" from "clear all locales" — both are an empty list on the wire in proto3. Consider wrapping it in a message (e.g., `message LocaleList { repeated Locale locales = 1; }`) and using `optional LocaleList locales` so that presence is trackable, or adopt a `FieldMask` pattern.</violation>
</file>
<file name="apps/server/src/routes/rpc/services/status-page/index.ts">
<violation number="1" location="apps/server/src/routes/rpc/services/status-page/index.ts:287">
P2: Once `locales` are set on a status page, they can never be cleared via `updateStatusPage`. An empty `req.locales` array is silently ignored instead of resetting the field to `null`, unlike the create path and the pattern used for other nullable fields like `homepageUrl`.</violation>
</file>
<file name="apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts">
<violation number="1" location="apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts:588">
P2: These two tests share the slug `${TEST_PREFIX}-locale-create-slug`. If the first test fails after page creation but before its inline cleanup, the second test will also fail with a 409 slug conflict. Use a distinct slug for the second test (e.g., `${TEST_PREFIX}-locale-default-slug`) to isolate them.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts
Show resolved
Hide resolved
|
@claude review |
|
Claude finished @mxkaske's task in 1m 24s —— View job Code Review
This PR adds Issues1.
|
There was a problem hiding this comment.
Pull request overview
This PR adds locale support to the Status Page API surface (protobuf + ConnectRPC implementation), allowing a status page to expose a default locale and a set of enabled locales.
Changes:
- Extend
StatusPage,CreateStatusPageRequest, andUpdateStatusPageRequestprotobuf definitions withdefault_localeandlocales, plus a newLocaleenum. - Implement DB↔proto locale conversions and persist locale fields in the StatusPage RPC service.
- Add RPC-level tests covering create/update/get behaviors for the new locale fields.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/proto/api/openstatus/status_page/v1/status_page.proto | Adds Locale enum and locale fields to StatusPage. |
| packages/proto/api/openstatus/status_page/v1/service.proto | Adds locale fields to create/update requests. |
| packages/proto/gen/ts/openstatus/status_page/v1/status_page_pb.ts | Regenerated TS bindings reflecting new locale fields/enum. |
| packages/proto/gen/ts/openstatus/status_page/v1/service_pb.ts | Regenerated TS bindings reflecting updated request shapes. |
| apps/server/src/routes/rpc/services/status-page/index.ts | Persists locale settings on create/update. |
| apps/server/src/routes/rpc/services/status-page/converters.ts | Adds proto/DB locale conversion + includes locale fields in StatusPage responses. |
| apps/server/src/routes/rpc/services/status-page/tests/status-page.test.ts | Adds test coverage for locale fields across RPC methods. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (req.locales.length > 0) { | ||
| updateValues.locales = req.locales.map(protoLocaleToDb); |
There was a problem hiding this comment.
UpdateStatusPage only updates locales when req.locales.length > 0, which makes it impossible for clients to clear/reset locales (e.g., set it to empty/null) via the API. If clearing is a supported operation (DB uses null for “no locales configured”), consider adding an explicit way to clear it (e.g., treat an empty list as “clear”, or add a separate boolean/field-mask-style signal).
| if (req.locales.length > 0) { | |
| updateValues.locales = req.locales.map(protoLocaleToDb); | |
| if (req.locales !== undefined) { | |
| updateValues.locales = | |
| req.locales.length > 0 ? req.locales.map(protoLocaleToDb) : null; |
| defaultLocale: req.defaultLocale | ||
| ? protoLocaleToDb(req.defaultLocale) | ||
| : "en", |
There was a problem hiding this comment.
In createStatusPage, req.defaultLocale ? ... : "en" will treat Locale.UNSPECIFIED (enum value 0) as falsy and silently coerce it to "en". Use an explicit undefined check (or handle UNSPECIFIED) so an explicitly provided enum value doesn’t change behavior due to JS truthiness.
| defaultLocale: req.defaultLocale | |
| ? protoLocaleToDb(req.defaultLocale) | |
| : "en", | |
| defaultLocale: | |
| req.defaultLocale !== undefined | |
| ? protoLocaleToDb(req.defaultLocale) | |
| : "en", |
| if (req.defaultLocale !== undefined) { | ||
| updateValues.defaultLocale = protoLocaleToDb(req.defaultLocale); | ||
| } | ||
| if (req.locales.length > 0) { | ||
| updateValues.locales = req.locales.map(protoLocaleToDb); | ||
| } |
There was a problem hiding this comment.
Locale fields are written without validating the invariant that defaultLocale must be included in locales when locales is provided (this is enforced in other code paths via packages/db/src/schema/pages/validation.ts). As-is, UpdateStatusPage can persist inconsistent combinations when updating either field independently; add server-side validation/normalization before saving.
| defaultLocale: req.defaultLocale | ||
| ? protoLocaleToDb(req.defaultLocale) | ||
| : "en", | ||
| locales: | ||
| req.locales.length > 0 ? req.locales.map(protoLocaleToDb) : null, | ||
| }) |
There was a problem hiding this comment.
CreateStatusPage also writes defaultLocale/locales without enforcing that the default is contained in the enabled locales list when locales is provided. Consider validating or auto-including the default locale to avoid persisting an inconsistent configuration.
|
@claude carefully review this |
|
Claude finished @thibaultleouay's task in 1m 50s —— View job Code Review
This PR adds Issues1. Asymmetric API design:
|
There was a problem hiding this comment.
3 issues found across 6 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts">
<violation number="1" location="apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts:586">
P2: Test name claims to cover "or empty" but only tests the omitted case. The removed "clears locale settings when empty LocaleList is sent" test has no replacement — consider adding a case that sends `locales: []` to verify whether empty arrays are treated as no-op or as a clear operation.</violation>
</file>
<file name="apps/server/src/routes/rpc/services/status-page/index.ts">
<violation number="1" location="apps/server/src/routes/rpc/services/status-page/index.ts:303">
P2: The condition `req.locales.length > 0` makes it impossible to clear locales. Previously, an empty wrapper message would enter the block and set `locales` to `null`. Now, an empty array skips the block entirely. Since protobuf repeated fields default to `[]`, there's no way for a client to distinguish "not provided" from "clear locales." If clearing locales is a supported operation, this needs a different signaling mechanism (e.g., a separate `clearLocales` boolean field, or reverting to a wrapper message).</violation>
</file>
<file name="packages/proto/api/openstatus/status_page/v1/service.proto">
<violation number="1" location="packages/proto/api/openstatus/status_page/v1/service.proto:199">
P1: Switching from `optional LocaleList` to `repeated Locale` in an update message loses the ability to distinguish "field not sent" (don't change) from "field sent empty" (clear locales). In proto3, a `repeated` field has no presence — both cases deserialize to an empty list. This means an update request that omits `locales` entirely will be interpreted the same as one that explicitly clears them.
Consider keeping a wrapper message (e.g., `optional LocaleList`) or using a field mask to preserve patch semantics, consistent with the `optional` pattern used by every other field in this message.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| optional Locale default_locale = 7; | ||
|
|
||
| // New enabled locales for the status page (optional). | ||
| repeated Locale locales = 8; |
There was a problem hiding this comment.
P1: Switching from optional LocaleList to repeated Locale in an update message loses the ability to distinguish "field not sent" (don't change) from "field sent empty" (clear locales). In proto3, a repeated field has no presence — both cases deserialize to an empty list. This means an update request that omits locales entirely will be interpreted the same as one that explicitly clears them.
Consider keeping a wrapper message (e.g., optional LocaleList) or using a field mask to preserve patch semantics, consistent with the optional pattern used by every other field in this message.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/proto/api/openstatus/status_page/v1/service.proto, line 199:
<comment>Switching from `optional LocaleList` to `repeated Locale` in an update message loses the ability to distinguish "field not sent" (don't change) from "field sent empty" (clear locales). In proto3, a `repeated` field has no presence — both cases deserialize to an empty list. This means an update request that omits `locales` entirely will be interpreted the same as one that explicitly clears them.
Consider keeping a wrapper message (e.g., `optional LocaleList`) or using a field mask to preserve patch semantics, consistent with the `optional` pattern used by every other field in this message.</comment>
<file context>
@@ -196,8 +196,7 @@ message UpdateStatusPageRequest {
// New enabled locales for the status page (optional).
- // When absent: don't change. When present but empty: clear locales. When present with values: set locales.
- optional LocaleList locales = 8;
+ repeated Locale locales = 8;
}
</file context>
apps/server/src/routes/rpc/services/status-page/__tests__/status-page.test.ts
Outdated
Show resolved
Hide resolved
|
@claude review this again |
|
Claude finished @thibaultleouay's task in 3m 6s —— View job Code Review
This review covers the current state after all 4 commits. Several issues from the previous reviews have been resolved — the proto design regression introduced in recent commits is the main remaining concern. Issues1.
|
No description provided.