Skip to content

Conversation

@gridcell
Copy link
Contributor

@gridcell gridcell commented Jan 31, 2025

Summary by CodeRabbit

  • New Features

    • Added unique UUID generation for record identifiers across multiple SQL models.
    • Expanded data storage capabilities for biomass and percent cover fields.
    • Introduced new fields for tracking benthic observations, habitat complexity scores, and observation counts.
  • Improvements

    • Enhanced data integrity by ensuring unique identifiers for database records.
    • Increased precision for decimal field storage in various models.
    • Improved SQL query structures to support new data fields and unique IDs.
  • Technical Updates

    • Refactored summary cache utility with new SQL-focused functions.
    • Updated SQL model implementations to generate dynamic record identifiers.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 31, 2025

## Walkthrough

The pull request introduces systematic modifications across multiple SQL model files in the project. The primary changes involve replacing `NULL` with dynamically generated UUIDs for the `id` field in various SQL models, ensuring unique record identification. Additionally, some models have been updated with new fields or adjusted field configurations, such as increasing decimal precision for biomass measurements and adding JSON fields to capture more complex data structures. The changes aim to enhance data integrity and expand the models' capabilities for storing and representing scientific observation data.

## Changes

| File | Changes |
|------|---------|
| `src/api/models/sql_models/beltfish.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` <br> - Increased `biomass_kgha` max digits from 11 to 13 |
| `src/api/models/sql_models/benthiclit.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` |
| `src/api/models/sql_models/benthicpit.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` <br> - Added `percent_cover_benthic_category` JSON field <br> - Added `percent_cover_life_histories` JSON field |
| `src/api/models/sql_models/benthicpqt.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` <br> - Added `num_points_nonother` field |
| `src/api/models/sql_models/bleachingqc.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` |
| `src/api/models/sql_models/habitatcomplexity.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` <br> - Removed duplicate `sample_time` field <br> - Added `score_avg` and `score_sd` decimal fields |
| `src/api/models/summary_sample_events.py` | - Changed `id` generation from `NULL` to `uuid_generate_v4()` |
| `src/api/utils/summary_cache.py` | - Added multiple new SQL-related utility functions <br> - Replaced existing cache update functions with SQL-focused implementations |

## Possibly related PRs

- data-mermaid/mermaid-api#551: Modifies summary cache update logic by removing a transaction lock wrapper around an update call; related as both touch update mechanisms but differ in abstraction and scope.
- data-mermaid/mermaid-api#528: Also modifies the `biomass_kgha` field's `max_digits` attribute in `BeltFishSUSQLModel`, increasing precision, directly related to the same model and field changes.
- data-mermaid/mermaid-api#526: Introduces UUID generation for the `id` field in `BeltFishSUSQLModel`, similar to changes in this PR, indicating a strong connection in how unique identifiers are handled.

## Suggested reviewers

- gridcell
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

cdk diff Success

Show Output
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
start: Building 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
success: Built 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
start: Publishing 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
success: Published 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack mermaid-api-infra-common
There were no differences
start: Building 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Built 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
start: Publishing 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Published 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-static-site
There were no differences
start: Building 3eb410d5064cde8d191924783dfba8a05dbbb46c802d038785ce95f584e23957:554812291621-us-east-1
success: Built 3eb410d5064cde8d191924783dfba8a05dbbb46c802d038785ce95f584e23957:554812291621-us-east-1
start: Publishing 3eb410d5064cde8d191924783dfba8a05dbbb46c802d038785ce95f584e23957:554812291621-us-east-1
success: Published 3eb410d5064cde8d191924783dfba8a05dbbb46c802d038785ce95f584e23957:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",

start: Building fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Built fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
start: Publishing fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Published fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-static-site
There were no differences
start: Building 5d604890246928434dbf799eece8800cdbfe7dda3eef06f3cf36ac3b7b2d01cb:554812291621-us-east-1
success: Built 5d604890246928434dbf799eece8800cdbfe7dda3eef06f3cf36ac3b7b2d01cb:554812291621-us-east-1
start: Publishing 5d604890246928434dbf799eece8800cdbfe7dda3eef06f3cf36ac3b7b2d01cb:554812291621-us-east-1
success: Published 5d604890246928434dbf799eece8800cdbfe7dda3eef06f3cf36ac3b7b2d01cb:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-api-django
IAM Statement Changes
┌───┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────┬──────────────────────────────────┬──────────────────────────────────────────┬───────────┐
│   │ Resource                                                                                                                                                     │ Effect │ Action                           │ Principal                                │ Condition │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ ${SummaryCacheTaskDef/ExecutionRole.Arn}                                                                                                                     │ Allow  │ sts:AssumeRole                   │ Service:ecs-tasks.amazonaws.com          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ ${SummaryCacheTaskDef/SummaryCacheUpdateContainer/LogGroup.Arn}                                                                                              │ Allow  │ logs:CreateLogStream             │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ logs:PutLogEvents                │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ ${SummaryCacheTaskDef/TaskRole.Arn}                                                                                                                          │ Allow  │ sts:AssumeRole                   │ Service:ecs-tasks.amazonaws.com          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ *                                                                                                                                                            │ Allow  │ ssmmessages:CreateControlChannel │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│   │                                                                                                                                                              │        │ ssmmessages:CreateDataChannel    │                                          │           │
│   │                                                                                                                                                              │        │ ssmmessages:OpenControlChannel   │                                          │           │
│   │                                                                                                                                                              │        │ ssmmessages:OpenDataChannel      │                                          │           │
│ + │ *                                                                                                                                                            │ Allow  │ logs:DescribeLogGroups           │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│ + │ *                                                                                                                                                            │ Allow  │ ecr:GetAuthorizationToken        │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:ecr:us-east-1:554812291621:repository/cdk-hnb659fds-container-assets-554812291621-us-east-1                                            │ Allow  │ ecr:BatchCheckLayerAvailability  │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ ecr:BatchGetImage                │                                          │           │
│   │                                                                                                                                                              │        │ ecr:GetDownloadUrlForLayer       │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:logs:us-east-1:554812291621:log-group:{"Fn::ImportValue":"mermaid-api-infra-common:ExportsOutputRefECSExecLogGroup95B1C6C87E932D48"}:* │ Allow  │ logs:CreateLogStream             │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│   │                                                                                                                                                              │        │ logs:DescribeLogStreams          │                                          │           │
│   │                                                                                                                                                              │        │ logs:PutLogEvents                │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/admins-z5Y80V                                                          │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/auth0_domain-K9a7w2                                                    │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/drf-recaptcha-secret-key-MdFr2W                                        │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/email-host-password-CI6hBI                                             │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/email-host-user-afLrHz                                                 │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/mc-api-key-xSsQOk                                                      │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/mc-api-list-id-Am5u1G                                                  │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/secret-OcuWCl                                                          │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/superuser-u3SSj4                                                       │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/mermaid-api-signing-secret-3625sz                                        │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/mermaid-management-api-client-id-Kb3Sty                                  │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/mermaid-management-api-client-secret-HHVBL1                              │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/spa-admin-client-id-8GJ1mU                                               │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/spa-admin-client-secret-5oMItZ                                           │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ {"Fn::ImportValue":"mermaid-api-infra-common:ExportsOutputFnGetAttecsExecKmsKey22C03821Arn262DB0C8"}                                                         │ Allow  │ kms:Decrypt                      │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│   │                                                                                                                                                              │        │ kms:GenerateDataKey              │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ {"Fn::ImportValue":"mermaid-api-infra-common:ExportsOutputRefDBCredentialsSecretAttachment8D28662CBA0EF0C2"}                                                 │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
└───┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────┴──────────────────────────────────┴──────────────────────────────────────────┴───────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Resources
[+] AWS::IAM::Role SummaryCacheTaskDef/TaskRole SummaryCacheTaskDefTaskRole7701C0B9
[+] AWS::IAM::Policy SummaryCacheTaskDef/TaskRole/DefaultPolicy SummaryCacheTaskDefTaskRoleDefaultPolicy51F5DA73
[+] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D
[+] AWS::Logs::LogGroup SummaryCacheTaskDef/SummaryCacheUpdateContainer/LogGroup SummaryCacheTaskDefSummaryCacheUpdateContainerLogGroupD8B09ED2
[+] AWS::IAM::Role SummaryCacheTaskDef/ExecutionRole SummaryCacheTaskDefExecutionRole375AA2BD
[+] AWS::IAM::Policy SummaryCacheTaskDef/ExecutionRole/DefaultPolicy SummaryCacheTaskDefExecutionRoleDefaultPolicy516A8891
[+] AWS::ECS::Service SummaryCacheService/Service SummaryCacheService62034AF5
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::Service ApiService/Service ApiServiceC9037CF0 replace
 ├─ [-] CapacityProviderStrategy
 │   └─ [{"CapacityProvider":"mermaid-api-infra-common-AsgCapacityProvider760D11D9-iqzBF6LfX313","Weight":100}]
 ├─ [~] DeploymentConfiguration
 │   └─ [+] Added: .DeploymentCircuitBreaker
 ├─ [+] DeploymentController (requires replacement)
 │   └─ {"Type":"ECS"}
 └─ [+] LaunchType (requires replacement)
     └─ EC2
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::Service General/Worker/QueueProcessingService/Service GeneralWorkerQueueProcessingService2ABCF4FE replace
 ├─ [~] DeploymentConfiguration
 │   └─ [+] Added: .DeploymentCircuitBreaker
 └─ [+] DeploymentController (requires replacement)
     └─ {"Type":"ECS"}
[~] AWS::CloudWatch::Alarm General/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm GeneralWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarm4B2B5156
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100
[~] AWS::CloudWatch::Alarm General/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm GeneralWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarmC9F7D808
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:ddcf0b254ae50b4384b4ea60c653ad6a43108d6ba38bc515e8f39141bd9f7dba"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::Service ImageProcess/Worker/QueueProcessingService/Service ImageProcessWorkerQueueProcessingServiceABC33BC0 replace
 ├─ [~] DeploymentConfiguration
 │   └─ [+] Added: .DeploymentCircuitBreaker
 └─ [+] DeploymentController (requires replacement)
     └─ {"Type":"ECS"}
[~] AWS::CloudWatch::Alarm ImageProcess/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm ImageProcessWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarm1C3667BE
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100
[~] AWS::CloudWatch::Alarm ImageProcess/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm ImageProcessWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarm68835CDE
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100


✨  Number of stacks with differences: 2

Workflow: pr

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (9)
src/api/utils/summary_cache.py (8)

67-75: Consider adding a docstring to _convert_to_sql.
A short docstring can boost readability and clarify the function's purpose.


111-140: Refactor repeated pattern for improved maintainability.
This function uses a delete-then-insert approach also seen elsewhere. Extracting shared logic into a helper could simplify maintenance.


142-175: Maintain consistent error handling and logs.
Similar to _sql_update_cache(). Consider a uniform logging or exception strategy for easier debugging.


177-190: Unify redundant delete-insert flow.
This function also performs a delete-then-insert operation. Creating a unifying helper can reduce repeated code.


Line range hint 407-417: Repeated sample unit block.
This code is similar across protocols. Factoring out shared logic would improve clarity.


Line range hint 431-441: Consider merging BenthicPIT logic.
Check if this code can be part of a generalized solution for sample units.


Line range hint 443-453: Keep parameter patterns consistent.
The parameter ordering in _sql_update_cache calls can be standardized for readability.


455-458: Bleaching QC summary mirrors other sample units.
Investigate combining these repeated steps into a common function.

src/api/models/summary_sample_events.py (1)

Line range hint 125-450: Consider adding indexes for frequently joined columns.

The query performs multiple joins on columns like sample_event_id, project_id, and management_id. Consider adding indexes if not already present to improve query performance.

Suggested indexes:

CREATE INDEX IF NOT EXISTS idx_sample_event_site_id ON sample_event(site_id);
CREATE INDEX IF NOT EXISTS idx_sample_event_management_id ON sample_event(management_id);
CREATE INDEX IF NOT EXISTS idx_site_project_id ON site(project_id);
CREATE INDEX IF NOT EXISTS idx_management_compliance_id ON management(compliance_id);
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e194b53 and 4457482.

📒 Files selected for processing (8)
  • src/api/models/sql_models/beltfish.py (1 hunks)
  • src/api/models/sql_models/benthiclit.py (1 hunks)
  • src/api/models/sql_models/benthicpit.py (1 hunks)
  • src/api/models/sql_models/benthicpqt.py (1 hunks)
  • src/api/models/sql_models/bleachingqc.py (1 hunks)
  • src/api/models/sql_models/habitatcomplexity.py (1 hunks)
  • src/api/models/summary_sample_events.py (1 hunks)
  • src/api/utils/summary_cache.py (8 hunks)
🔇 Additional comments (16)
src/api/utils/summary_cache.py (7)

77-79: Looks good to me!
Function _columns is straightforward and returns model fields for usage.


81-105: Ensure column matching and potential docstring.
If the subselect in sql does not include all columns from model_cls, it may fail. Consider verifying column alignment or adding a fallback.


107-109: Sanitize critical parameters to prevent injection.
While check_uuid helps mitigate the risk, ensure every code path correctly validates project_id.


307-307: Double check test project skip logic.
Early return might omit needed actions. Verify that this cannot produce partial data states.


Line range hint 419-429: LIT protocol update is consistent.
No significant issues spotted here.


Line range hint 461-471: Confirm model references for HabitatComplexity.
Ensure these models align with the new schema changes and are tested after the modifications.


472-472: Ensures project summary updates at the end.
Implementation looks correct.

src/api/models/sql_models/habitatcomplexity.py (1)

134-134: Use of uuid_generate_v4() is a solid choice.
It ensures unique identifiers. Confirm that the corresponding database extension is enabled.

src/api/models/sql_models/benthicpit.py (1)

283-283: Switching from NULL to uuid_generate_v4() for the id field is beneficial.
This improves data integrity by guaranteeing unique IDs.

src/api/models/sql_models/benthicpqt.py (1)

292-292: LGTM! Using UUID for unique record identification.

The change from NULL to uuid_generate_v4() ensures each record has a unique identifier, improving data integrity.

src/api/models/sql_models/benthiclit.py (1)

294-294: LGTM! Using UUID for unique record identification.

The change from NULL to uuid_generate_v4() ensures each record has a unique identifier, improving data integrity.

src/api/models/sql_models/beltfish.py (2)

287-287: LGTM! Using UUID for unique record identification.

The change from NULL to uuid_generate_v4() ensures each record has a unique identifier, improving data integrity.


287-287: Verify the impact of increased biomass_kgha precision.

The max_digits increase from 11 to 13 for biomass_kgha allows for larger values. Please ensure this change doesn't affect any downstream calculations or reports.

Run the following script to check for any potential overflow in existing biomass values:

✅ Verification successful

The biomass_kgha precision change is safe to implement

The increase from 11 to 13 digits in max_digits while maintaining 2 decimal places is safe because:

  • All biomass calculations and aggregations remain unchanged
  • No validation logic or downstream calculations depend on the field size
  • The change only increases the maximum possible value without affecting precision
  • Existing test cases use biomass values well within both old and new limits
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential overflow in biomass values
# Test: Search for biomass values that might exceed the old limit
rg -A 5 "biomass_kgha.*>.*99999999999" # Old limit was 11 digits

Length of output: 40


Script:

#!/bin/bash
# Find table definition and biomass_kgha usage
echo "=== Table Definition ==="
rg -A 10 -B 10 "CREATE TABLE.*beltfish" 

echo -e "\n=== Biomass Usage in Calculations ==="
rg -A 5 -B 5 "biomass_kgha" --type sql

echo -e "\n=== Python Code Using Biomass ==="
ast-grep --pattern 'biomass_kgha'

Length of output: 837


Script:

#!/bin/bash
# Get detailed field definitions and validation
echo "=== DecimalField Definitions ==="
rg -A 3 -B 1 "biomass_kgha.*=.*DecimalField" 

echo -e "\n=== Range Filter Usage ==="
rg -A 5 -B 5 "class.*RangeFilter.*biomass_kgha"

echo -e "\n=== Validation Logic ==="
rg -A 5 "validate.*biomass"

Length of output: 68720


Script:

#!/bin/bash
# Search for biomass calculations and validations
echo "=== Biomass Calculations ==="
rg -A 5 "biomass.*=|biomass_kgha.*=" --type python

echo -e "\n=== SQL Calculations ==="
rg -A 5 "biomass_kgha" --type sql

echo -e "\n=== Validation Logic ==="
rg -A 5 "def clean.*biomass|validate.*biomass" --type python

Length of output: 408


Script:

#!/bin/bash
# Search for biomass calculations and validations without file type restrictions
echo "=== Biomass Calculations ==="
rg -A 5 "biomass.*=|biomass_kgha.*="

echo -e "\n=== SQL Calculations ==="
rg -A 5 "SELECT.*biomass_kgha|UPDATE.*biomass_kgha|INSERT.*biomass_kgha"

echo -e "\n=== Validation Logic ==="
rg -A 5 "def clean.*biomass|validate.*biomass|def validate"

Length of output: 65680


Script:

#!/bin/bash
# Search for biomass calculations excluding JSON files
echo "=== Biomass Field Definitions ==="
fd -e py | xargs rg "biomass_kgha.*=.*DecimalField"

echo -e "\n=== Biomass Calculations ==="
fd -e py | xargs rg "biomass.*=|calculate.*biomass"

echo -e "\n=== SQL Queries ==="
fd -e sql | xargs rg "biomass_kgha"

Length of output: 16472

src/api/models/sql_models/bleachingqc.py (1)

347-347: LGTM! Using UUID for unique record identification.

The change from NULL to uuid_generate_v4() ensures each record has a unique identifier, improving data integrity.

src/api/models/summary_sample_events.py (2)

Line range hint 8-591: LGTM! Well-structured model hierarchy.

The model structure follows Django best practices with proper use of abstract base classes, JSON fields, and model managers.


125-125: LGTM! Verify PostgreSQL extension requirement.

The change from NULL to uuid_generate_v4() for the id field improves data integrity by ensuring unique identifiers.

Run this script to verify the uuid-ossp extension is enabled:

@github-actions
Copy link

cdk diff Success

Show Output
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
start: Building 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
success: Built 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
start: Publishing 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
success: Published 38a275de6067e69cf220e10f4c9d3260dbbc73d27300eb0139cf7ac85736c547:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack mermaid-api-infra-common
There were no differences
start: Building 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Built 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
start: Publishing 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Published 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-static-site
There were no differences
start: Building 89b805ed949ce7d11f4e2b8aaa4372e013420911f64e665156052d90a245fbe7:554812291621-us-east-1
success: Built 89b805ed949ce7d11f4e2b8aaa4372e013420911f64e665156052d90a245fbe7:554812291621-us-east-1
start: Publishing 89b805ed949ce7d11f4e2b8aaa4372e013420911f64e665156052d90a245fbe7:554812291621-us-east-1
success: Published 89b805ed949ce7d11f4e2b8aaa4372e013420911f64e665156052d90a245fbe7:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:735b99cc9ce7efa170700b9e0ff54a872494bcf6bf73cdc50848bf1b7a1a11c5"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",

start: Building fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Built fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
start: Publishing fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Published fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-static-site
There were no differences
start: Building 1f560ce594a9ec5b0ca2cef1a890e7ce5d8ae4800679acde7b0c2d27d012e2ff:554812291621-us-east-1
success: Built 1f560ce594a9ec5b0ca2cef1a890e7ce5d8ae4800679acde7b0c2d27d012e2ff:554812291621-us-east-1
start: Publishing 1f560ce594a9ec5b0ca2cef1a890e7ce5d8ae4800679acde7b0c2d27d012e2ff:554812291621-us-east-1
success: Published 1f560ce594a9ec5b0ca2cef1a890e7ce5d8ae4800679acde7b0c2d27d012e2ff:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-api-django
IAM Statement Changes
┌───┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────┬──────────────────────────────────┬──────────────────────────────────────────┬───────────┐
│   │ Resource                                                                                                                                                     │ Effect │ Action                           │ Principal                                │ Condition │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ ${SummaryCacheTaskDef/ExecutionRole.Arn}                                                                                                                     │ Allow  │ sts:AssumeRole                   │ Service:ecs-tasks.amazonaws.com          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ ${SummaryCacheTaskDef/SummaryCacheUpdateContainer/LogGroup.Arn}                                                                                              │ Allow  │ logs:CreateLogStream             │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ logs:PutLogEvents                │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ ${SummaryCacheTaskDef/TaskRole.Arn}                                                                                                                          │ Allow  │ sts:AssumeRole                   │ Service:ecs-tasks.amazonaws.com          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ *                                                                                                                                                            │ Allow  │ ssmmessages:CreateControlChannel │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│   │                                                                                                                                                              │        │ ssmmessages:CreateDataChannel    │                                          │           │
│   │                                                                                                                                                              │        │ ssmmessages:OpenControlChannel   │                                          │           │
│   │                                                                                                                                                              │        │ ssmmessages:OpenDataChannel      │                                          │           │
│ + │ *                                                                                                                                                            │ Allow  │ logs:DescribeLogGroups           │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│ + │ *                                                                                                                                                            │ Allow  │ ecr:GetAuthorizationToken        │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:ecr:us-east-1:554812291621:repository/cdk-hnb659fds-container-assets-554812291621-us-east-1                                            │ Allow  │ ecr:BatchCheckLayerAvailability  │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ ecr:BatchGetImage                │                                          │           │
│   │                                                                                                                                                              │        │ ecr:GetDownloadUrlForLayer       │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:logs:us-east-1:554812291621:log-group:{"Fn::ImportValue":"mermaid-api-infra-common:ExportsOutputRefECSExecLogGroup95B1C6C87E932D48"}:* │ Allow  │ logs:CreateLogStream             │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│   │                                                                                                                                                              │        │ logs:DescribeLogStreams          │                                          │           │
│   │                                                                                                                                                              │        │ logs:PutLogEvents                │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/admins-z5Y80V                                                          │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/auth0_domain-K9a7w2                                                    │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/drf-recaptcha-secret-key-MdFr2W                                        │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/email-host-password-CI6hBI                                             │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/email-host-user-afLrHz                                                 │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/mc-api-key-xSsQOk                                                      │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/mc-api-list-id-Am5u1G                                                  │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/secret-OcuWCl                                                          │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:common/mermaid-api/superuser-u3SSj4                                                       │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/mermaid-api-signing-secret-3625sz                                        │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/mermaid-management-api-client-id-Kb3Sty                                  │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/mermaid-management-api-client-secret-HHVBL1                              │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/spa-admin-client-id-8GJ1mU                                               │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ arn:${AWS::Partition}:secretsmanager:us-east-1:554812291621:secret:prod/mermaid-api/spa-admin-client-secret-5oMItZ                                           │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ {"Fn::ImportValue":"mermaid-api-infra-common:ExportsOutputFnGetAttecsExecKmsKey22C03821Arn262DB0C8"}                                                         │ Allow  │ kms:Decrypt                      │ AWS:${SummaryCacheTaskDef/TaskRole}      │           │
│   │                                                                                                                                                              │        │ kms:GenerateDataKey              │                                          │           │
├───┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────┼──────────────────────────────────┼──────────────────────────────────────────┼───────────┤
│ + │ {"Fn::ImportValue":"mermaid-api-infra-common:ExportsOutputRefDBCredentialsSecretAttachment8D28662CBA0EF0C2"}                                                 │ Allow  │ secretsmanager:DescribeSecret    │ AWS:${SummaryCacheTaskDef/ExecutionRole} │           │
│   │                                                                                                                                                              │        │ secretsmanager:GetSecretValue    │                                          │           │
└───┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────┴──────────────────────────────────┴──────────────────────────────────────────┴───────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)

Resources
[+] AWS::IAM::Role SummaryCacheTaskDef/TaskRole SummaryCacheTaskDefTaskRole7701C0B9
[+] AWS::IAM::Policy SummaryCacheTaskDef/TaskRole/DefaultPolicy SummaryCacheTaskDefTaskRoleDefaultPolicy51F5DA73
[+] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D
[+] AWS::Logs::LogGroup SummaryCacheTaskDef/SummaryCacheUpdateContainer/LogGroup SummaryCacheTaskDefSummaryCacheUpdateContainerLogGroupD8B09ED2
[+] AWS::IAM::Role SummaryCacheTaskDef/ExecutionRole SummaryCacheTaskDefExecutionRole375AA2BD
[+] AWS::IAM::Policy SummaryCacheTaskDef/ExecutionRole/DefaultPolicy SummaryCacheTaskDefExecutionRoleDefaultPolicy516A8891
[+] AWS::ECS::Service SummaryCacheService/Service SummaryCacheService62034AF5
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::Service ApiService/Service ApiServiceC9037CF0 replace
 ├─ [-] CapacityProviderStrategy
 │   └─ [{"CapacityProvider":"mermaid-api-infra-common-AsgCapacityProvider760D11D9-iqzBF6LfX313","Weight":100}]
 ├─ [~] DeploymentConfiguration
 │   └─ [+] Added: .DeploymentCircuitBreaker
 ├─ [+] DeploymentController (requires replacement)
 │   └─ {"Type":"ECS"}
 └─ [+] LaunchType (requires replacement)
     └─ EC2
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::Service General/Worker/QueueProcessingService/Service GeneralWorkerQueueProcessingService2ABCF4FE replace
 ├─ [~] DeploymentConfiguration
 │   └─ [+] Added: .DeploymentCircuitBreaker
 └─ [+] DeploymentController (requires replacement)
     └─ {"Type":"ECS"}
[~] AWS::CloudWatch::Alarm General/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm GeneralWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarm4B2B5156
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100
[~] AWS::CloudWatch::Alarm General/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm GeneralWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarmC9F7D808
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:b0d4941fd5ff6fe6f82e29d45388468cfacb611ecf0dddf8ff99007492703cb4"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:6dea3f66a9769a44b49a1ba408e660294d14abd0a3f2303ee6667329a794cac8"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::Service ImageProcess/Worker/QueueProcessingService/Service ImageProcessWorkerQueueProcessingServiceABC33BC0 replace
 ├─ [~] DeploymentConfiguration
 │   └─ [+] Added: .DeploymentCircuitBreaker
 └─ [+] DeploymentController (requires replacement)
     └─ {"Type":"ECS"}
[~] AWS::CloudWatch::Alarm ImageProcess/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/LowerAlarm ImageProcessWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingLowerAlarm1C3667BE
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100
[~] AWS::CloudWatch::Alarm ImageProcess/Worker/QueueProcessingService/TaskCount/Target/QueueMessagesVisibleScaling/UpperAlarm ImageProcessWorkerQueueProcessingServiceTaskCountTargetQueueMessagesVisibleScalingUpperAlarm68835CDE
 └─ [~] Threshold
     ├─ [-] 10
     └─ [+] 100


✨  Number of stacks with differences: 2

Workflow: pr

@github-actions
Copy link

github-actions bot commented Mar 4, 2025

cdk diff Success

Show Output
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
start: Building 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
success: Built 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
start: Publishing 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
success: Published 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack mermaid-api-infra-common
There were no differences
start: Building 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Built 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
start: Publishing 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Published 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-static-site
There were no differences
start: Building 81ed1b3d8ac33cc06a7bfadba6aef2d7e16fa112d3f35635847455a0f16a2c77:554812291621-us-east-1
success: Built 81ed1b3d8ac33cc06a7bfadba6aef2d7e16fa112d3f35635847455a0f16a2c77:554812291621-us-east-1
start: Publishing 81ed1b3d8ac33cc06a7bfadba6aef2d7e16fa112d3f35635847455a0f16a2c77:554812291621-us-east-1
success: Published 81ed1b3d8ac33cc06a7bfadba6aef2d7e16fa112d3f35635847455a0f16a2c77:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:82329db21403123c3d3893586f158a47cca87e8c76f4b4cdb4b509cc1d5a36da"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:82329db21403123c3d3893586f158a47cca87e8c76f4b4cdb4b509cc1d5a36da"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:82329db21403123c3d3893586f158a47cca87e8c76f4b4cdb4b509cc1d5a36da"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:82329db21403123c3d3893586f158a47cca87e8c76f4b4cdb4b509cc1d5a36da"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:82329db21403123c3d3893586f158a47cca87e8c76f4b4cdb4b509cc1d5a36da"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",

start: Building fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Built fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
start: Publishing fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Published fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-static-site
There were no differences
start: Building be19684da229bf2edf56e356ebb1348c8a8c28f07cc321eb2b0bf08396132fc2:554812291621-us-east-1
success: Built be19684da229bf2edf56e356ebb1348c8a8c28f07cc321eb2b0bf08396132fc2:554812291621-us-east-1
start: Publishing be19684da229bf2edf56e356ebb1348c8a8c28f07cc321eb2b0bf08396132fc2:554812291621-us-east-1
success: Published be19684da229bf2edf56e356ebb1348c8a8c28f07cc321eb2b0bf08396132fc2:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d22e400f2a831e07effc07ab6f5d974abe9d7f546d36084b60b40f4f2515596"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d22e400f2a831e07effc07ab6f5d974abe9d7f546d36084b60b40f4f2515596"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d22e400f2a831e07effc07ab6f5d974abe9d7f546d36084b60b40f4f2515596"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d22e400f2a831e07effc07ab6f5d974abe9d7f546d36084b60b40f4f2515596"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d22e400f2a831e07effc07ab6f5d974abe9d7f546d36084b60b40f4f2515596"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:5d1f714bd117fff2b599025e05654f38bdc84fb50e9a50143a2e00bf72bc00cc"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",


✨  Number of stacks with differences: 2

NOTICES         (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)

32775	(cli): CLI versions and CDK library versions have diverged

	Overview: Starting in CDK 2.179.0, CLI versions will no longer be in
	          lockstep with CDK library versions. CLI versions will now be
	          released as 2.1000.0 and continue with 2.1001.0, etc.

	Affected versions: cli: >=2.0.0 <=2.1005.0

	More information at: https://github.com/aws/aws-cdk/issues/32775


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 32775".

Workflow: pr

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/api/utils/summary_cache.py (3)

107-108: Use parameter binding for safety and consistency.
Currently, the project_id is string-interpolated into the SQL, which can be safe if strictly validated by check_uuid. However, adopting parameter binding (e.g., placeholders) is a more robust pattern.

Below is a conceptual diff (requires redesign of how _delete is invoked):

-def _delete(model_cls, project_id):
-    return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = '{project_id}';"
+def _delete(model_cls):
+    return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = %s"

111-141: Multiple concatenated statements can obscure partial failures.
Joining several DELETE and INSERT statements for different tables into a single cur.execute("".join(sql)) can hide which part failed in case of errors. Consider separating them or wrapping each in a try/except for easier debugging.


408-473: Consider reducing repetitive calls for each protocol.
Each if sample_unit is None or sample_unit == X_PROTOCOL: block essentially calls _sql_update_cache(...) or _sql_update_bleaching_qc_summary(...) in a similar pattern. Extracting a map from protocol to function could streamline maintenance and reduce repetition.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4457482 and 7f3c360.

📒 Files selected for processing (2)
  • src/api/models/summary_sample_events.py (1 hunks)
  • src/api/utils/summary_cache.py (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/api/models/summary_sample_events.py
🔇 Additional comments (5)
src/api/utils/summary_cache.py (5)

67-75: Consider potential size limitations with mogrify output.
While mogrify safely parameterizes the query, for extremely large or complex queries, it may generate a very large SQL string that risks exceeding memory or length limits. It's worth verifying that all upstream queries remain reasonably bounded by project-level filters.

Would you like a script to check related usages of _convert_to_sql throughout the codebase?


77-80: Good use of Django model introspection.
Retrieving field names via model_cls._meta.fields is a straightforward approach and helps keep _insert logic flexible. This looks good.


81-105: Validate handling of default or auto-increment fields in _insert logic.
By mapping extra columns like created_on to now() selectively, the insert logic is carefully overriding certain fields. Ensure that auto-increment primary keys or fields with default constraints do not result in unexpected collisions or duplication.


142-175: Consistency issue: parallel functions for BleachingQC.
You have _sql_update_bleaching_qc_summary plus the older _update_bleaching_qc_summary. Similar to a past comment on line 173, consider removing or consolidating one of them to maintain consistency.


177-190: Validate partial updates with skip logic.
When skip_updates is True, _delete(...) calls are skipped. Ensure that subsequent inserts won’t lead to duplicate records if data already exists for the same project.

@github-actions
Copy link

cdk diff Success

Show Output
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
start: Building 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
success: Built 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
start: Publishing 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
success: Published 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack mermaid-api-infra-common
There were no differences
start: Building 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Built 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
start: Publishing 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Published 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-static-site
There were no differences
start: Building c353c9cd3a104ffda72b4d2059c5e8981520c3f6428ab39cffb95b282723efaf:554812291621-us-east-1
success: Built c353c9cd3a104ffda72b4d2059c5e8981520c3f6428ab39cffb95b282723efaf:554812291621-us-east-1
start: Publishing c353c9cd3a104ffda72b4d2059c5e8981520c3f6428ab39cffb95b282723efaf:554812291621-us-east-1
success: Published c353c9cd3a104ffda72b4d2059c5e8981520c3f6428ab39cffb95b282723efaf:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",

start: Building fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Built fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
start: Publishing fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Published fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-static-site
There were no differences
start: Building 7ec16d20e42c23ad9e5cfa27dabdd572df8bad782f75006de1e5340d903de3c8:554812291621-us-east-1
success: Built 7ec16d20e42c23ad9e5cfa27dabdd572df8bad782f75006de1e5340d903de3c8:554812291621-us-east-1
start: Publishing 7ec16d20e42c23ad9e5cfa27dabdd572df8bad782f75006de1e5340d903de3c8:554812291621-us-east-1
success: Published 7ec16d20e42c23ad9e5cfa27dabdd572df8bad782f75006de1e5340d903de3c8:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:87a970239c2b1b6080d75914077ccbe4b8ddc1e889f1d83f1e5231484d47e55e"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",


✨  Number of stacks with differences: 2

NOTICES         (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)

32775	(cli): CLI versions and CDK library versions have diverged

	Overview: Starting in CDK 2.179.0, CLI versions will no longer be in
	          lockstep with CDK library versions. CLI versions will now be
	          released as 2.1000.0 and continue with 2.1001.0, etc.

	Affected versions: cli: >=2.0.0 <=2.1005.0

	More information at: https://github.com/aws/aws-cdk/issues/32775


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 32775".

Workflow: pr

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/api/utils/summary_cache.py (3)

67-75: Consider adding a docstring to _convert_to_sql for future maintainability.
It might also be helpful to integrate logging or robust error handling in case the generated SQL string needs debugging in production environments.


77-79: Add a brief explanation for _columns usage.
While this function is straightforward, a short docstring clarifying its purpose would aid maintainers.


142-175: Keep the pattern consistent and add docstring.
_sql_update_bleaching_qc_summary follows the same pattern of delete-then-insert. Consider documenting the rationale for each step or clarifying the reliance on a single transaction context.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f3c360 and c3b5c0a.

📒 Files selected for processing (1)
  • src/api/utils/summary_cache.py (9 hunks)
🔇 Additional comments (12)
src/api/utils/summary_cache.py (12)

81-105: Validate insert logic against unexpected or invalid data.
Since this function dynamically builds an INSERT statement from an existing query, ensure data columns match. Consider if an upsert mechanism or additional constraints are needed to avoid duplicates.


107-108: Confirm the unconditional deletion approach.
_delete removes all rows for a given project_id. If partial deletions or archiving is required later, a more selective method might be necessary.


111-141: Evaluate transaction handling for large updates.
Performing bulk deletes and inserts in a single transaction is fine, but in the event of partial failures, all changes are rolled back. Confirm if this all-or-nothing approach aligns with business requirements.


177-189: Implementation looks consistent.
No immediate concerns with _sql_update_project_summary_sample_event. The logic is straightforward.


192-197: No functional issues spotted in _get_suggested_citation.
Keeping it as a separate function is fine. You might consider logging when a project is missing to aid debugging.


307-316: Double-check skip_updates usage for this path.
Ensure that skipping updates for FISHBELT is indeed intended when the project is in test status or meets other conditions.


319-328: No issues with BenthicLIT data flow.
This call to _sql_update_cache maintains a consistent pattern.


331-340: Maintains consistent logic for BenthicPIT.
All arguments align with _sql_update_cache. No further changes needed.


343-352: Matches existing pattern for BenthicPhotoQuadratTransect.
No concerns. The code is uniform and clear.


355-358: Ensure bleaching QC summary checks align with skip logic.
Verify that calls to _sql_update_bleaching_qc_summary properly handle skip_test_project or partial-skip scenarios if needed.


361-370: No issues for HabitatComplexity updates.
The call to _sql_update_cache is consistent.


372-372: Final summary sample event update is correct.
This call to _sql_update_project_summary_sample_event completes the multi-step update process logically.

@github-actions
Copy link

cdk diff Success

Show Output
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
[WARNING] aws-cdk-lib.aws_cloudfront_origins.S3Origin#bind is deprecated.
  Use `S3BucketOrigin` or `S3StaticWebsiteOrigin` instead.
  This API will be removed in the next major release.
start: Building 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
success: Built 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
start: Publishing 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
success: Published 8cc542105b4018a9dd39091c988290e762a8020d13221a9f0fdad65c64a9179a:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack mermaid-api-infra-common
There were no differences
start: Building 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Built 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
start: Publishing 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
success: Published 20f0ea1e47d11e86e87f49fc00d4e5729524413f86141472fbb6d7f598729b14:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-static-site
There were no differences
start: Building 29873a0270339910d342fda4a939ec19943fcd42e8d738c1d17d23aea175dbe8:554812291621-us-east-1
success: Built 29873a0270339910d342fda4a939ec19943fcd42e8d738c1d17d23aea175dbe8:554812291621-us-east-1
start: Publishing 29873a0270339910d342fda4a939ec19943fcd42e8d738c1d17d23aea175dbe8:554812291621-us-east-1
success: Published 29873a0270339910d342fda4a939ec19943fcd42e8d738c1d17d23aea175dbe8:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack dev-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:2f35106ea86a0e8fc6d9b555b0d6d0740636dabb972742ae28df44a60ed4634b"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",

start: Building fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Built fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
start: Publishing fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
success: Published fd65879b47b028fd91d9f1395a2fe744750675ac4e4af81009ecf991697d02ad:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-static-site
There were no differences
start: Building c06d4754ea229dc4eb96c6c5f87bdbd2bc205c35892c11fdebb74cce8b220cb8:554812291621-us-east-1
success: Built c06d4754ea229dc4eb96c6c5f87bdbd2bc205c35892c11fdebb74cce8b220cb8:554812291621-us-east-1
start: Publishing c06d4754ea229dc4eb96c6c5f87bdbd2bc205c35892c11fdebb74cce8b220cb8:554812291621-us-east-1
success: Published c06d4754ea229dc4eb96c6c5f87bdbd2bc205c35892c11fdebb74cce8b220cb8:554812291621-us-east-1
Could not create a change set, will base the diff on template differences (run again with -v to see the reason)
Stack prod-mermaid-api-django
Resources
[~] AWS::ECS::TaskDefinition ScheduledBackupTaskDef ScheduledBackupTaskDef48789D5A replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition SummaryCacheTaskDef SummaryCacheTaskDefFAAC683D replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -118,7 +118,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ApiTaskDefinition ApiTaskDefinition51EA709E replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -113,7 +113,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition General/Worker/QueueProcessingTaskDef GeneralWorkerQueueProcessingTaskDef1C2A1522 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",
[~] AWS::ECS::TaskDefinition ImageProcess/Worker/QueueProcessingTaskDef ImageProcessWorkerQueueProcessingTaskDefACA5B138 replace
 └─ [~] ContainerDefinitions (requires replacement)
     └─ @@ -125,7 +125,7 @@
        [ ] ],
        [ ] "Essential": true,
        [ ] "Image": {
        [-]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:fbbe95150b480367490a36e4e457c1de2ea7725712d03a139bb743d55794e208"
        [+]   "Fn::Sub": "554812291621.dkr.ecr.us-east-1.${AWS::URLSuffix}/cdk-hnb659fds-container-assets-554812291621-us-east-1:c8a398c771283648c5d5e59113c4058ced98000346da93fcdbbd73ca40fdb4b0"
        [ ] },
        [ ] "LogConfiguration": {
        [ ]   "LogDriver": "awslogs",


✨  Number of stacks with differences: 2

NOTICES         (What's this? https://github.com/aws/aws-cdk/wiki/CLI-Notices)

32775	(cli): CLI versions and CDK library versions have diverged

	Overview: Starting in CDK 2.179.0, CLI versions will no longer be in
	          lockstep with CDK library versions. CLI versions will now be
	          released as 2.1000.0 and continue with 2.1001.0, etc.

	Affected versions: cli: >=2.0.0 <=2.1005.0

	More information at: https://github.com/aws/aws-cdk/issues/32775


If you don’t want to see a notice anymore, use "cdk acknowledge <id>". For example, "cdk acknowledge 32775".

Workflow: pr

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
src/api/utils/summary_cache.py (1)

111-140: ⚠️ Potential issue

SQL operations need to handle parameters securely

The implementation of _sql_update_cache collects SQL strings but doesn't handle the parameters that should accompany the SQL to prevent injection vulnerabilities. This needs to be updated to work with the parameter-based versions of _insert and _delete.

You should refactor this to collect SQL and parameters separately and then execute them properly:

def _sql_update_cache(...):
    suggested_citation = _get_suggested_citation(project_id)
-    sql = []
+    sql_parts = []
+    params = []
    if skip_updates is not True:
-        sql.append(_delete(obs_model, project_id))
-        sql.append(_delete(su_model, project_id))
-        sql.append(_delete(se_model, project_id))
+        delete_sql, delete_params = _delete(obs_model, project_id)
+        sql_parts.append(delete_sql)
+        params.extend(delete_params)
+        # Similar changes for other _delete calls

    # Similar changes for _insert calls
    
    with connection.cursor() as cur:
-        cur.execute("".join(sql))
+        # Execute with all collected parameters
+        cur.execute("".join(sql_parts), params)
🧹 Nitpick comments (1)
src/api/utils/summary_cache.py (1)

192-197: Function for suggested citation seems to be reintroduced

This function _get_suggested_citation appears to be a reintroduction after it was possibly removed in a previous version. The function itself looks correct, but as noted in a past review comment, there seems to be inconsistency in how functions are handled - some are deleted and replaced with SQL equivalents while others are kept.

For consistency, consider either:

  1. Keeping both SQL and non-SQL versions of all functions, or
  2. Replacing all non-SQL functions with SQL equivalents and removing the original functions.
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c3b5c0a and 12bccd8.

📒 Files selected for processing (1)
  • src/api/utils/summary_cache.py (10 hunks)
🔇 Additional comments (12)
src/api/utils/summary_cache.py (12)

67-75: Well-structured SQL conversion function

The _convert_to_sql function effectively converts a Django queryset to a raw SQL string. The pattern of using mogrify to safely handle parameters prevents SQL injection vulnerabilities.


77-78: Useful helper for extracting column names

This utility function provides a clean way to extract column names from a model class, which improves code readability throughout the module.


142-175: Same SQL injection concerns in _sql_update_bleaching_qc_summary

This function has the same SQL injection vulnerabilities as the previous one. It needs to be refactored to properly handle parameters.

Additionally, there's a variable naming issue in lines 160-165. The variable colonies_obs_sql is reused for quadrat benthic percent observations, which could lead to confusion.

-    colonies_obs_sql = _convert_to_sql(
+    quadrat_obs_sql = _convert_to_sql(
         BleachingQCQuadratBenthicPercentObsSQLModel.objects.all().sql_table(project_id=project_id)
     )
     sql.append(
-        _insert(BleachingQCQuadratBenthicPercentObsModel, colonies_obs_sql, suggested_citation)
+        _insert(BleachingQCQuadratBenthicPercentObsModel, quadrat_obs_sql, suggested_citation)
     )

177-190: SQL injection concerns in _sql_update_project_summary_sample_event

This function has the same SQL injection vulnerabilities as mentioned in previous comments. The function should be refactored to handle parameters properly.

Also, there are extra blank lines after line 190.

A few extra lines here as noted in a previous review comment.


313-322: Appropriate update to use the new SQL function

The change from the previous _update_cache to _sql_update_cache is correctly implemented here.


325-334: Appropriate update to use the new SQL function

The change from the previous _update_cache to _sql_update_cache is correctly implemented here as well.


337-346: Appropriate update to use the new SQL function

The change from the previous _update_cache to _sql_update_cache is correctly implemented here as well.


349-358: Appropriate update to use the new SQL function

The change from the previous _update_cache to _sql_update_cache is correctly implemented here as well.


361-364: Appropriate update to use the new SQL function

The change from the previous _update_bleaching_qc_summary to _sql_update_bleaching_qc_summary is correctly implemented.


367-376: Appropriate update to use the new SQL function

The change from the previous _update_cache to _sql_update_cache is correctly implemented here as well.


378-378: Appropriate update to use the new SQL function

The change from the previous _update_project_summary_sample_event to _sql_update_project_summary_sample_event is correctly implemented.


284-289:

Details

❓ Verification inconclusive

Behavior change in project queue checks

The code now filters projects with attempts=3 when checking for existing queue entries, which is a change from the previous behavior. Make sure this is intentional and consistent with the expected behavior of the queue system.


🏁 Script executed:

#!/bin/bash
# Check for occurrences of the attempts filter elsewhere in the codebase
rg -A 2 -B 2 "attempts\s*=\s*3" --glob "*.py" | grep -v "src/api/utils/summary_cache.py"

Length of output: 88


Attention: Confirm the New Queue Filtering Criteria

The changes in src/api/utils/summary_cache.py (lines 284–289) now filter queue entries with attempts=3 before deletion. The grep search did not reveal any other instances of filtering by attempts=3, so this appears to be an isolated change. However, please verify manually that this new condition is intentional and that it aligns with the overall expected behavior of the queue system.

  • Verify that filtering on attempts=3 is the correct logic for this specific queue behavior.
  • Ensure that this change doesn’t inadvertently affect other parts of the queue system.

Comment on lines +107 to +108
def _delete(model_cls, project_id):
return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = '{project_id}';"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Potential SQL injection risk in _delete function

The project_id parameter is directly interpolated into the SQL string, which could lead to SQL injection if project_id comes from an untrusted source. Consider using a parameterized query approach.

-def _delete(model_cls, project_id):
-    return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = '{project_id}';"
+def _delete(model_cls, project_id):
+    return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = %s;", [project_id]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _delete(model_cls, project_id):
return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = '{project_id}';"
def _delete(model_cls, project_id):
return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = %s;", [project_id]

Comment on lines 81 to 104
def _insert(model_cls, sql, suggested_citation):
cols = _columns(model_cls)
extras = {
"created_on": "now()",
"suggested_citation": f"'{suggested_citation}'",
}

def _delete_existing_records(project_id, target_model_cls):
target_model_cls.objects.filter(project_id=project_id).delete()
insert_cols = ", ".join(cols)

# update any columns from cols that are in extras
updated_cols = []
for col in cols:
if col not in extras:
updated_cols.append(col)
else:
updated_cols.append(f"{extras[col]} AS {col}")

def _update_records(records, target_model_cls, created_on, suggested_citation, skip_updates=False):
if skip_updates or not records:
return
idx = 0
while True:
batch = records[idx : idx + BATCH_SIZE]
_set_created_on(created_on, batch)
_set_suggested_citation(suggested_citation, batch)
if not batch:
break
target_model_cls.objects.bulk_create(batch, batch_size=BATCH_SIZE)
idx += BATCH_SIZE
select_cols = ", ".join(updated_cols)

return f"""
INSERT INTO {model_cls._meta.db_table}
({insert_cols})
SELECT {select_cols} FROM ({sql}) AS foo;
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Consider parameterizing suggested_citation to prevent SQL injection

While most of the function looks well-designed, there's a potential SQL injection vulnerability in line 85 where suggested_citation is directly interpolated into the SQL string.

Apply this fix to prevent SQL injection:

-        "suggested_citation": f"'{suggested_citation}'",
+        "suggested_citation": "%(suggested_citation)s",

And update the return statement to include the parameter:

-    return f"""
-        INSERT INTO {model_cls._meta.db_table}
-        ({insert_cols})
-        SELECT {select_cols} FROM ({sql}) AS foo;
-    """
+    return f"""
+        INSERT INTO {model_cls._meta.db_table}
+        ({insert_cols})
+        SELECT {select_cols} FROM ({sql}) AS foo;
+    """, {"suggested_citation": suggested_citation}

Then update the calling code to handle the returned tuple of SQL and parameters.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _insert(model_cls, sql, suggested_citation):
cols = _columns(model_cls)
extras = {
"created_on": "now()",
"suggested_citation": f"'{suggested_citation}'",
}
def _delete_existing_records(project_id, target_model_cls):
target_model_cls.objects.filter(project_id=project_id).delete()
insert_cols = ", ".join(cols)
# update any columns from cols that are in extras
updated_cols = []
for col in cols:
if col not in extras:
updated_cols.append(col)
else:
updated_cols.append(f"{extras[col]} AS {col}")
def _update_records(records, target_model_cls, created_on, suggested_citation, skip_updates=False):
if skip_updates or not records:
return
idx = 0
while True:
batch = records[idx : idx + BATCH_SIZE]
_set_created_on(created_on, batch)
_set_suggested_citation(suggested_citation, batch)
if not batch:
break
target_model_cls.objects.bulk_create(batch, batch_size=BATCH_SIZE)
idx += BATCH_SIZE
select_cols = ", ".join(updated_cols)
return f"""
INSERT INTO {model_cls._meta.db_table}
({insert_cols})
SELECT {select_cols} FROM ({sql}) AS foo;
"""
def _insert(model_cls, sql, suggested_citation):
cols = _columns(model_cls)
extras = {
"created_on": "now()",
"suggested_citation": "%(suggested_citation)s",
}
insert_cols = ", ".join(cols)
# update any columns from cols that are in extras
updated_cols = []
for col in cols:
if col not in extras:
updated_cols.append(col)
else:
updated_cols.append(f"{extras[col]} AS {col}")
select_cols = ", ".join(updated_cols)
return f"""
INSERT INTO {model_cls._meta.db_table}
({insert_cols})
SELECT {select_cols} FROM ({sql}) AS foo;
""", {"suggested_citation": suggested_citation}

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
src/api/utils/summary_cache.py (1)

109-111: ⚠️ Potential issue

Unresolved SQL-injection risk in _delete()

The project-id is still interpolated directly into the SQL string, leaving the door open for injection if an untrusted id ever reaches this path. A very similar issue was pointed out in previous reviews but has not been addressed. Switch to a parametrised statement so the driver handles quoting for you.

-def _delete(model_cls, project_id):
-    return f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = '{project_id}';"
+def _delete(model_cls, project_id):
+    # Return a tuple so the caller can pass sql & params straight to `execute`
+    return (
+        f"DELETE FROM {model_cls._meta.db_table} WHERE project_id = %s;",
+        [project_id],
+    )
🧹 Nitpick comments (2)
src/api/utils/summary_cache.py (2)

140-142: Execute statements individually or via sql.split(';') for clarity

Concatenating many statements into one string obscures error reporting (Postgres returns the first error only) and makes it harder to log/inspect what went wrong. Iterating and execute()-ing each statement (or using executemany where possible) improves observability and keeps the transaction semantics identical.


286-291: Only deleting rows with attempts = 3 may leave stuck queue items

If an entry failed twice it will never be purged, so a subsequent call
will raise a unique-constraint conflict and silently skip queuing.
Consider attempts__gte=3 (or resetting attempts to 0) to guarantee a clean slate.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 12bccd8 and 53d70bc.

📒 Files selected for processing (1)
  • src/api/utils/summary_cache.py (11 hunks)

Comment on lines +86 to +100
"created_on": "now()",
"suggested_citation": f"'{escaped_suggested_citation}'",
}

def _delete_existing_records(project_id, target_model_cls):
target_model_cls.objects.filter(project_id=project_id).delete()
insert_cols = ", ".join(cols)

# update any columns from cols that are in extras
updated_cols = []
for col in cols:
if col not in extras:
updated_cols.append(col)
else:
updated_cols.append(f"{extras[col]} AS {col}")

def _update_records(records, target_model_cls, created_on, suggested_citation, skip_updates=False):
if skip_updates or not records:
return
idx = 0
while True:
batch = records[idx : idx + BATCH_SIZE]
_set_created_on(created_on, batch)
_set_suggested_citation(suggested_citation, batch)
if not batch:
break
target_model_cls.objects.bulk_create(batch, batch_size=BATCH_SIZE)
idx += BATCH_SIZE
select_cols = ", ".join(updated_cols)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Column-order coupling is brittle – derive SELECT list from _columns()

_insert() assumes that the column order produced by model_sql.objects.all().sql_table() exactly matches model_cls._meta.fields. If a field is reordered, added, or the SQL view changes, the INSERT … SELECT will silently mismatch columns, producing corrupt data.

Safer pattern:

  1. Build the SELECT list directly from cols (using foo.column_name).
  2. Append/overwrite extras in that same loop.
  3. Avoid SELECT *.

That guarantees positional alignment.

Comment on lines +83 to +88
escaped_suggested_citation = adapt(suggested_citation).getquoted().decode("utf-8").strip("'")
cols = _columns(model_cls)
extras = {
"created_on": "now()",
"suggested_citation": f"'{escaped_suggested_citation}'",
}
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

suggested_citation=None becomes the string 'NULL'

adapt(None).getquoted() returns the literal NULL (without quotes).
After strip("'") you end up with the four-letter word NULL, which is then wrapped in quotes, storing the text 'NULL' instead of an actual SQL NULL.

Add an explicit check for None (and possibly blank strings) so the column
remains nullable.

-escaped_suggested_citation = adapt(suggested_citation).getquoted().decode("utf-8").strip("'")
-extras = {
-    "created_on": "now()",
-    "suggested_citation": f"'{escaped_suggested_citation}'",
-}
+if suggested_citation is None:
+    sc_value = "NULL"
+else:
+    sc_value = adapt(suggested_citation).getquoted().decode("utf-8")
+
+extras = {
+    "created_on": "now()",
+    "suggested_citation": sc_value,
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
escaped_suggested_citation = adapt(suggested_citation).getquoted().decode("utf-8").strip("'")
cols = _columns(model_cls)
extras = {
"created_on": "now()",
"suggested_citation": f"'{escaped_suggested_citation}'",
}
# Handle NULL specially so we don’t end up storing the literal string 'NULL'
if suggested_citation is None:
sc_value = "NULL"
else:
# adapt(...).getquoted() already includes surrounding quotes for strings
sc_value = adapt(suggested_citation).getquoted().decode("utf-8")
cols = _columns(model_cls)
extras = {
"created_on": "now()",
"suggested_citation": sc_value,
}

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.

3 participants