skulpturenz / shared-resources

MIT License
0 stars 0 forks source link

feat: sort env keys #250

Closed nmathew98 closed 2 weeks ago

github-actions[bot] commented 2 weeks ago

Title

feat: sort env keys


PR Type

Enhancement, Tests, Other


Description


Changes walkthrough ๐Ÿ“

Relevant files
Tests
cat_set_test.go
Add sorting logic and tests for environment keys                 

kryptos/commands/cat_set_test.go
  • Added sorting logic to ensure environment keys are sorted
    case-insensitively.
  • Introduced test assertions to verify the order of environment keys.
  • Imported new packages maps, slices, and strings to support sorting.
  • +12/-0   
    Enhancement
    kryptos.go
    Order environment keys case-insensitively in SQL query     

    kryptos/kryptos/kryptos.go - Modified SQL query to order environment keys case-insensitively.
    +2/-1     
    Configuration changes
    go.mod
    Update Go version in go.mod                                                           

    kryptos/go.mod - Updated Go version from 1.22.4 to 1.23.0.
    +1/-1     
    Dependencies
    go.sum
    Clean up go.sum by removing unused dependencies                   

    kryptos/go.sum - Removed unused dependencies.
    +0/-3     

    ๐Ÿ’ก PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    github-actions[bot] commented 2 weeks ago

    PR Reviewer Guide ๐Ÿ”

    Here are some key observations to aid the review process:

    โฑ๏ธ Estimated effort to review: 3 ๐Ÿ”ต๐Ÿ”ต๐Ÿ”ตโšชโšช
    ๐Ÿ… Score: 85
    ๐Ÿงช PR contains tests
    ๐Ÿ”’ No security concerns identified
    โšก Recommended focus areas for review

    Logic Verification
    The sorting logic for the keys in `keysFinal` should be verified to ensure it correctly sorts the keys in a case-insensitive manner. The assertion compares the sorted keys with the initial keys, which may not be valid if the initial keys are not sorted. SQL Query Review
    The SQL query has been modified to include an additional condition. Ensure that this change does not affect the expected results and that it is tested properly.
    github-actions[bot] commented 2 weeks ago

    PR Code Suggestions โœจ

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Improve the sorting function to handle nil or empty keys safely ___ **Ensure that the sorting function handles cases where keys may be nil or empty to
    avoid potential panics.** [kryptos/commands/cat_set_test.go [88-90]](https://github.com/skulpturenz/shared-resources/pull/250/files#diff-d00d75b9a98908126bd6ec41a6d5a008e4f9a7eb6235cc354f334ee18cfffbf5R88-R90) ```diff slices.SortStableFunc(keysFinal, func(a string, b string) int { + if a == "" || b == "" { + return 0 // Handle empty strings gracefully + } return strings.Compare(strings.ToLower(a), strings.ToLower(b)) }) ```
    Suggestion importance[1-10]: 7 Why: The suggestion addresses a potential panic by ensuring the sorting function can handle empty strings, which is a relevant concern for robustness in the code.
    7
    Possible issue
    Ensure the SQL query accounts for scenarios with no project environments ___ **Verify that the SQL query correctly handles cases where no project environments
    exist to avoid unexpected results.** [kryptos/kryptos/kryptos.go [135]](https://github.com/skulpturenz/shared-resources/pull/250/files#diff-52d822dfcf5c61ba100975219c933d7bf9d7eb252bc0bbd2c88c408bb68855edR135-R135) ```diff WHERE NOT EXISTS(SELECT * FROM project_environments WHERE project_environments.key = global_environments.key) +OR (SELECT COUNT(*) FROM project_environments) = 0 ```
    Suggestion importance[1-10]: 5 Why: The suggestion is relevant as it aims to improve the SQL query's handling of edge cases, but the proposed change does not significantly alter the existing logic, resulting in a moderate score.
    5
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on authnz/skulpture/shared-authnz

    Pulumi report
    Previewing update (shared-authnz)
    
    View Live: https://app.pulumi.com/skulpture/authnz/shared-authnz/previews/1d0169f6-f9ec-4554-bd62-91a215b60691
    
    @ Previewing update.....
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin cloudflare-5.42.0: starting
    Downloading plugin gcp-7.38.0: done
    Downloading plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: starting
    Installing plugin cloudflare-5.42.0: starting
    @ Previewing update....
    Installing plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update...........................................................................
    pulumi:pulumi:Stack authnz-shared-authnz running 
    @ Previewing update....
    pulumi:pulumi:Stack authnz-shared-authnz  
    Resources:
    4 unchanged
    
    
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on telemetry/skulpture/shared-telemetry

    Pulumi report
    Previewing update (shared-telemetry)
    
    View Live: https://app.pulumi.com/skulpture/telemetry/shared-telemetry/previews/6a66739c-56b4-4f8e-833f-661cc3e7f3de
    
    @ Previewing update.......
    Downloading plugin cloudflare-5.42.0: starting
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin cloudflare-5.42.0: done
    Downloading plugin gcp-7.38.0: done
    Installing plugin cloudflare-5.42.0: starting
    Installing plugin gcp-7.38.0: starting
    @ Previewing update....
    Installing plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update...............................................................................
    pulumi:pulumi:Stack telemetry-shared-telemetry running 
    @ Previewing update....
    pulumi:pulumi:Stack telemetry-shared-telemetry  
    Resources:
    4 unchanged
    
    
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on network/skulpture/shared-infrastructure

    Pulumi report
    Previewing update (shared-infrastructure)
    
    View Live: https://app.pulumi.com/skulpture/network/shared-infrastructure/previews/85b328c3-e52c-409e-9556-672e526527c9
    
    @ Previewing update......
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin digitalocean-4.34.0: starting
    Downloading plugin digitalocean-4.34.0: done
    Installing plugin digitalocean-4.34.0: starting
    Downloading plugin gcp-7.38.0: done
    Installing plugin digitalocean-4.34.0: done
    Installing plugin gcp-7.38.0: starting
    @ Previewing update....
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update.....................................................................
    pulumi:pulumi:Stack network-shared-infrastructure running 
    @ Previewing update....
    pulumi:pulumi:Stack network-shared-infrastructure  
    Resources:
    12 unchanged
    
    
    github-actions[bot] commented 2 weeks ago

    :tropical_drink: preview on rollout/skulpture/shared-rollout

    Pulumi report
    Previewing update (shared-rollout)
    
    View Live: https://app.pulumi.com/skulpture/rollout/shared-rollout/previews/8bf3a4e8-c9e6-4cff-9363-6f3a4eb4c21d
    
    @ Previewing update.....
    Downloading plugin gcp-7.38.0: starting
    Downloading plugin cloudflare-5.42.0: starting
    Downloading plugin gcp-7.38.0: done
    @ Previewing update....
    Downloading plugin cloudflare-5.42.0: done
    Installing plugin gcp-7.38.0: starting
    Installing plugin cloudflare-5.42.0: starting
    Installing plugin cloudflare-5.42.0: done
    @ Previewing update....
    Installing plugin gcp-7.38.0: done
    
    @ Previewing update................................................................................
    pulumi:pulumi:Stack rollout-shared-rollout running 
    @ Previewing update....
    pulumi:pulumi:Stack rollout-shared-rollout  
    Resources:
    4 unchanged