Skip to content

Zio to ce3#2

Open
adamnfish wants to merge 5 commits intomainfrom
zio-to-ce3
Open

Zio to ce3#2
adamnfish wants to merge 5 commits intomainfrom
zio-to-ce3

Conversation

@adamnfish
Copy link
Owner

Long overdue, will get released when I've a chunk of time to properly test it.

Switch to Scala 3 and CE3.

Also updates other Scala dependencies to latest versions.

To enable this, we drop Scanamo and switch to a custom codec implementation.

TODO: write error handling into the dynamodecs inferface
Tidies up a buunch of tech debt and switches to a more rigorously
effect-managed approach using the Typelevel ecosystem.

Sticks with Scanamo, since it provides an out-the-box integration with
CE3.
@adamnfish adamnfish requested a review from Copilot August 10, 2025 20:49
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the PokerDot application from ZIO to Cats Effect 3 and upgrades to Scala 3. The migration involves:

  • Updating build.properties to sbt 1.10.11
  • Refactoring lambda handlers to use Cats Effect IO instead of ZIO
  • Converting all integration tests to use AsyncIOSpec and IO-based effects
  • Updating services and persistence layer to use Cats Effect typeclasses

Reviewed Changes

Copilot reviewed 57 out of 59 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
project/build.properties Updates sbt version from 1.9.8 to 1.10.11
lambda/src/main/scala/io/adamnfish/pokerdot/Tracing.scala Creates new Tracing trait for CE3 with implementation
lambda/src/main/scala/io/adamnfish/pokerdot/Lambda.scala Migrates AWS Lambda handler from ZIO to Cats Effect IO
lambda/src/main/scala/io/adamnfish/pokerdot/AwsMessaging.scala Converts messaging service to use Cats Effect
integration/src/test/scala/io/adamnfish/pokerdot/integration/*.scala Migrates all integration tests to AsyncIOSpec
devserver/src/main/scala/io/adamnfish/pokerdot/*.scala Updates dev server components for CE3 compatibility
core/src/test/scala/io/adamnfish/pokerdot/*.scala Updates core tests to use Cats Effect and munit
frontend/package.json Updates Parcel and related dependencies

Comment on lines +57 to +62
apiGatewayManagementApiClient <- Resource.make(IO {
ApiGatewayManagementApiClient.builder()
.region(Region.EU_WEST_1)
.httpClient(UrlConnectionHttpClient.create())
.credentialsProvider(EnvironmentVariableCredentialsProvider.create())
.endpointOverride(URI.create(Properties.envOrElse("APIGATEWAY_ENDPOINT", "http://localhost:3001")))
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

Using a hardcoded localhost endpoint as a default is problematic for production deployments. Consider making this an error if the environment variable is not set, or use a more appropriate default that won't cause connection issues.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +59
// AWS clients
dynamoDbClient <- Resource.make(IO {
DynamoDbAsyncClient.builder()
.region(Region.EU_WEST_1)
.httpClient(crtAsyncHttpClient)
.credentialsProvider(EnvironmentVariableCredentialsProvider.create())
.build()
})(client => IO(client.close()))
apiGatewayManagementApiClient <- Resource.make(IO {
ApiGatewayManagementApiClient.builder()
.region(Region.EU_WEST_1)
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

The AWS region is hardcoded to EU_WEST_1. This should be configurable via environment variables to support deployments in different regions.

Copilot uses AI. Check for mistakes.
"bet" as 10,
"pot" as 0,
)
_ =playerDbsPreFlop.get(p3Welcome.playerId).value should have(
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

Missing space between underscore and variable name: should be _ = playerDbsPreFlop

Suggested change
_ =playerDbsPreFlop.get(p3Welcome.playerId).value should have(
_ = playerDbsPreFlop.get(p3Welcome.playerId).value should have(

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +29
private val client = DynamoDbAsyncClient.builder()
.endpointOverride(URI.create("http://localhost:8042"))
.region(Region.US_EAST_1) // not used for local dynamodb, but required
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create("dummykey", "dummysecret")))
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

Hardcoded dummy credentials in test code could potentially be copied to production code. Consider using constants or a more obvious test marker.

Suggested change
private val client = DynamoDbAsyncClient.builder()
.endpointOverride(URI.create("http://localhost:8042"))
.region(Region.US_EAST_1) // not used for local dynamodb, but required
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create("dummykey", "dummysecret")))
private val TEST_AWS_ACCESS_KEY_ID = "dummykey"
private val TEST_AWS_SECRET_ACCESS_KEY = "dummysecret"
private val client = DynamoDbAsyncClient.builder()
.endpointOverride(URI.create("http://localhost:8042"))
.region(Region.US_EAST_1) // not used for local dynamodb, but required
.credentialsProvider(StaticCredentialsProvider.create(
AwsBasicCredentials.create(TEST_AWS_ACCESS_KEY_ID, TEST_AWS_SECRET_ACCESS_KEY)))

Copilot uses AI. Check for mistakes.
}))
}
}
//package io.adamnfish.pokerdot
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

This entire file is commented out. If it's no longer needed, it should be deleted rather than left as commented code.

Copilot uses AI. Check for mistakes.
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