-
Notifications
You must be signed in to change notification settings - Fork 410
store pattern by key #1766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v25
Are you sure you want to change the base?
store pattern by key #1766
Conversation
WalkthroughThis change updates how pattern data is handled and referenced throughout the codebase. It renames properties and types related to patterns for clarity, shifts from using raw strings or arrays to structured objects and maps, and updates interfaces, schemas, and logic in both client and server code to use these new conventions. Error handling and privilege checks for patterns are also improved. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant UserSettings
participant Server
participant PrivilegeChecker
Client->>UserSettings: getSelectedPattern()
UserSettings->>UserSettings: Parse and validate pattern JSON
UserSettings-->>Client: Pattern object or undefined
Client->>Server: joinLobby({ patternName })
Server->>PrivilegeChecker: isPatternAllowed(patternName, flares)
PrivilegeChecker-->>Server: PatternResult (allowed/unknown/forbidden)
alt allowed
Server->>Client: Accept and assign patternData
else forbidden
Server->>Client: Reject with error and close connection
else unknown
Server->>Client: Log warning, allow without patternData
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (15)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (14)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
9dceac1
to
cb4b74b
Compare
cb4b74b
to
f00e65a
Compare
@@ -203,7 +203,7 @@ export const FlagSchema = z | |||
}, | |||
{ message: "Invalid flag: must be a valid country code or start with !" }, | |||
); | |||
export const RequiredPatternSchema = z | |||
export const RequiredPatternDataSchema = z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these renames makes it hard to read the diff
@@ -47,7 +47,7 @@ import { createRenderer, GameRenderer } from "./graphics/GameRenderer"; | |||
|
|||
export interface LobbyConfig { | |||
serverConfig: ServerConfig; | |||
pattern: string | undefined; | |||
patternName: string | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please check to make sure we're aligned on the desired outcome of #1602 ?
The conversion from pattern -> name and back only needs to happen at the localStorage boundary; everywhere else should continue to use the b64 pattern.
Description:
Describe the PR.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
DISCORD_USERNAME