Skip to content

[TT-11413] Fix apidef GlobalRateLimit migrations#6086

Merged
lghiur merged 2 commits into
masterfrom
fix/tt-11431/global_rate_limit-add-disabled-flag
Mar 6, 2024
Merged

[TT-11413] Fix apidef GlobalRateLimit migrations#6086
lghiur merged 2 commits into
masterfrom
fix/tt-11431/global_rate_limit-add-disabled-flag

Conversation

@titpetric

@titpetric titpetric commented Mar 1, 2024

Copy link
Copy Markdown
Contributor

Type

bug_fix, enhancement


Description

  • Added a Disabled boolean field to the GlobalRateLimit struct to explicitly enable or disable global rate limits.
  • Modified migration logic to consider the new Disabled flag, setting it to true if either Per or Rate is less or equal to 0.
  • Updated existing tests and added new ones to cover the changes in global rate limit logic.
  • Adjusted OpenAPI Specification (OAS) related code to utilize the new Disabled flag for rate limiting.

Changes walkthrough

Relevant files
Enhancement
api_definitions.go
Add Disabled Flag to GlobalRateLimit Struct                           

apidef/api_definitions.go

  • Added Disabled field to GlobalRateLimit struct.
  • This change allows for explicit disabling of global rate limits.
  • +3/-2     
    migration.go
    Enhance GlobalRateLimit Migration Logic                                   

    apidef/migration.go

  • Modified condition to disable global rate limit based on new Disabled
    flag.
  • Adjusted logic to set GlobalRateLimit.Disabled true if Per or Rate is
    less or equal to 0.
  • +4/-4     
    upstream.go
    Use GlobalRateLimit Disabled Flag in RateLimit Struct       

    apidef/oas/upstream.go

  • Updated RateLimit struct methods to use GlobalRateLimit.Disabled for
    enabling/disabling rate limits.
  • +2/-2     
    Tests
    migration_test.go
    Update Tests for GlobalRateLimit Migration                             

    apidef/migration_test.go

  • Updated tests to reflect new Disabled flag logic in global rate limit.
  • Added test cases for various scenarios of Per and Rate values.
  • +26/-3   
    oas_test.go
    Initialize GlobalRateLimit Disabled in Tests                         

    apidef/oas/oas_test.go

    • Initialized GlobalRateLimit.Disabled to false in test setup.
    +1/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @github-actions

    github-actions Bot commented Mar 1, 2024

    Copy link
    Copy Markdown
    Contributor

    API Changes

    --- prev.txt	2024-03-01 14:13:56.205265154 +0000
    +++ current.txt	2024-03-01 14:13:53.369236010 +0000
    @@ -1203,8 +1203,9 @@
     }
     
     type GlobalRateLimit struct {
    -	Rate float64 `bson:"rate" json:"rate"`
    -	Per  float64 `bson:"per" json:"per"`
    +	Disabled bool    `bson:"disabled" json:"disabled"`
    +	Rate     float64 `bson:"rate" json:"rate"`
    +	Per      float64 `bson:"per" json:"per"`
     }
     
     type GoPluginMeta struct {

    @github-actions

    github-actions Bot commented Mar 1, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Description updated to latest commit (1e4b48e)

    @titpetric
    titpetric force-pushed the fix/tt-11431/global_rate_limit-add-disabled-flag branch from 1e4b48e to fe494f6 Compare March 1, 2024 10:30
    @github-actions

    github-actions Bot commented Mar 1, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    3, because the PR involves changes across multiple files including struct modifications, migration logic, and test updates. Understanding the context and ensuring the changes are correct and consistent across the application requires a moderate level of effort.

    🧪 Relevant tests

    Yes

    🔍 Possible issues

    The migration logic change from && to || in checking Per and Rate might introduce unexpected behavior if not thoroughly tested with all possible combinations of Per and Rate values.

    The new tests added should ensure they cover edge cases, such as when Per or Rate is negative.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileapidef/migration.go
    suggestion      

    Consider adding a check for negative values of Per and Rate in the migration logic. This ensures that the Disabled flag is accurately set in scenarios where Per or Rate might be unintentionally set to negative values, which could be indicative of a misconfiguration. [important]

    relevant lineif a.GlobalRateLimit.Per <= 0 || a.GlobalRateLimit.Rate <= 0 {

    relevant fileapidef/migration_test.go
    suggestion      

    Add more comprehensive tests for the migration logic to cover scenarios where Per or Rate are negative. This will ensure the migration logic robustly handles all possible input values and sets the Disabled flag appropriately. [important]

    relevant lineassert.True(t, base.GlobalRateLimit.Disabled)

    relevant fileapidef/api_definitions.go
    suggestion      

    Ensure that the Disabled field in the GlobalRateLimit struct is accompanied by appropriate documentation comments. This helps developers understand the purpose of the field and its impact on the rate limiting functionality. [medium]

    relevant lineDisabled bool `bson:"disabled" json:"disabled"`

    relevant fileapidef/oas/upstream.go
    suggestion      

    Verify that the logic in ExtractTo and Fill methods correctly interprets the Disabled flag, especially in edge cases where the rate or per might be zero or negative. This ensures that the OAS related code accurately reflects the intended rate limiting behavior. [medium]

    relevant lineapi.GlobalRateLimit.Disabled = !r.Enabled


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.
    When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:

    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    

    With a configuration file, use the following template:

    [pr_reviewer]
    some_config1=...
    some_config2=...
    
    Utilizing extra instructions

    The review tool can be configured with extra instructions, which can be used to guide the model to a feedback tailored to the needs of your project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify the relevant sub-tool, and the relevant aspects of the PR that you want to emphasize.

    Examples for extra instructions:

    [pr_reviewer] # /review #
    extra_instructions="""
    In the 'possible issues' section, emphasize the following:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    How to enable\disable automation
    • When you first install PR-Agent app, the default mode for the review tool is:
    pr_commands = ["/review", ...]
    

    meaning the review tool will run automatically on every PR, with the default configuration.
    Edit this field to enable/disable the tool, or to change the used configurations

    Auto-labels

    The review tool can auto-generate two specific types of labels for a PR:

    • a possible security issue label, that detects possible security issues (enable_review_labels_security flag)
    • a Review effort [1-5]: x label, where x is the estimated effort to review the PR (enable_review_labels_effort flag)
    Extra sub-tools

    The review tool provides a collection of possible feedbacks about a PR.
    It is recommended to review the possible options, and choose the ones relevant for your use case.
    Some of the feature that are disabled by default are quite useful, and should be considered for enabling. For example:
    require_score_review, require_soc2_ticket, and more.

    Auto-approve PRs

    By invoking:

    /review auto_approve
    

    The tool will automatically approve the PR, and add a comment with the approval.

    To ensure safety, the auto-approval feature is disabled by default. To enable auto-approval, you need to actively set in a pre-defined configuration file the following:

    [pr_reviewer]
    enable_auto_approval = true
    

    (this specific flag cannot be set with a command line argument, only in the configuration file, committed to the repository)

    You can also enable auto-approval only if the PR meets certain requirements, such as that the estimated_review_effort is equal or below a certain threshold, by adjusting the flag:

    [pr_reviewer]
    maximal_review_effort = 5
    
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the review usage page for a comprehensive guide on using this tool.

    @github-actions

    github-actions Bot commented Mar 1, 2024

    Copy link
    Copy Markdown
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Add logging or metrics for tracking global rate limit disablement due to configuration.

    Consider adding a log statement or metric increment to track when the global rate limit is
    disabled due to invalid configuration (rate or per being less than or equal to 0). This
    can help in debugging and monitoring the system's behavior.

    apidef/migration.go [458-460]

     if a.GlobalRateLimit.Per <= 0 || a.GlobalRateLimit.Rate <= 0 {
         a.GlobalRateLimit.Disabled = true
    +    // Log or increment a metric here
     }
     
    Add a missing test case for when both Per and Rate are 0.

    To ensure comprehensive testing, add a test case where both Per and Rate are set to 0, and
    verify that GlobalRateLimit.Disabled is set to true. This case seems to be missing and is
    important for complete coverage.

    apidef/migration_test.go [801-810]

    -t.Run("per!=0,rate!=0", func(t *testing.T) {
    +t.Run("per=0,rate=0", func(t *testing.T) {
         base := oldTestAPI()
         base.GlobalRateLimit.Disabled = false
    -    base.GlobalRateLimit.Rate = 1
    -    base.GlobalRateLimit.Per = 1
    +    base.GlobalRateLimit.Rate = 0
    +    base.GlobalRateLimit.Per = 0
         _, err := base.Migrate()
         assert.NoError(t, err)
    -    assert.False(t, base.GlobalRateLimit.Disabled)
    +    assert.True(t, base.GlobalRateLimit.Disabled)
     })
     
    Best practice
    Initialize Rate and Per with default values to prevent unintentional disabling.

    Consider initializing Rate and Per with default values if they are not set, to avoid
    unintentionally disabling the rate limit. This can be done in the constructor or
    initialization function of GlobalRateLimit.

    apidef/api_definitions.go [745-747]

    -type GlobalRateLimit struct {
    -    Disabled bool    `bson:"disabled" json:"disabled"`
    -    Rate     float64 `bson:"rate" json:"rate"`
    -    Per      float64 `bson:"per" json:"per"`
    +// Assume default constructor or initialization function
    +func NewGlobalRateLimit() *GlobalRateLimit {
    +    return &GlobalRateLimit{
    +        Rate: 1, // Default rate
    +        Per: 60, // Default period in seconds
    +    }
     }
     
    Possible issue
    Handle conversion of fractional rates more carefully to avoid unexpected behavior.

    Ensure that when Rate is converted to an integer, it does not lead to unexpected behavior,
    especially when dealing with fractional rates. Consider using a more precise data type or
    handling the conversion more carefully.

    apidef/oas/upstream.go [505]

    -r.Rate = int(api.GlobalRateLimit.Rate)
    +// Example of handling fractional rates more carefully
    +r.Rate = math.Ceil(api.GlobalRateLimit.Rate)
     
    Maintainability
    Centralize the logic for disabling the global rate limit due to configuration errors.

    For consistency and to avoid potential bugs, ensure that the logic for disabling the
    global rate limit due to configuration errors is centralized and reused across different
    parts of the codebase, rather than duplicated.

    apidef/migration.go [458-460]

    -if a.GlobalRateLimit.Per <= 0 || a.GlobalRateLimit.Rate <= 0 {
    -    a.GlobalRateLimit.Disabled = true
    +// Example of a centralized method
    +func (gl *GlobalRateLimit) CheckAndDisable() {
    +    if gl.Per <= 0 || gl.Rate <= 0 {
    +        gl.Disabled = true
    +    }
     }
    +// Usage
    +a.GlobalRateLimit.CheckAndDisable()
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.
    When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:

    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    

    With a configuration file, use the following template:

    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    
    Enabling\disabling automation

    When you first install the app, the default mode for the improve tool is:

    pr_commands = ["/improve --pr_code_suggestions.summarize=true", ...]
    

    meaning the improve tool will run automatically on every PR, with summarization enabled. Delete this line to disable the tool from running automatically.

    Utilizing extra instructions

    Extra instructions are very important for the improve tool, since they enable to guide the model to suggestions that are more relevant to the specific needs of the project.

    Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Specify relevant aspects that you want the model to focus on.

    Examples for extra instructions:

    [pr_code_suggestions] # /improve #
    extra_instructions="""
    Emphasize the following aspects:
    - Does the code logic cover relevant edge cases?
    - Is the code logic clear and easy to understand?
    - Is the code logic efficient?
    ...
    """
    

    Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

    A note on code suggestions quality
    • While the current AI for code is getting better and better (GPT-4), it's not flawless. Not all the suggestions will be perfect, and a user should not accept all of them automatically.
    • Suggestions are not meant to be simplistic. Instead, they aim to give deep feedback and raise questions, ideas and thoughts to the user, who can then use his judgment, experience, and understanding of the code base.
    • Recommended to use the 'extra_instructions' field to guide the model to suggestions that are more relevant to the specific needs of the project, or use the custom suggestions 💎 tool
    • With large PRs, best quality will be obtained by using 'improve --extended' mode.
    More PR-Agent commands

    To invoke the PR-Agent, add a comment using one of the following commands:

    • /review: Request a review of your Pull Request.
    • /describe: Update the PR title and description based on the contents of the PR.
    • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
    • /ask <QUESTION>: Ask a question about the PR.
    • /update_changelog: Update the changelog based on the PR's contents.
    • /add_docs 💎: Generate docstring for new components introduced in the PR.
    • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
    • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

    See the tools guide for more details.
    To list the possible configuration parameters, add a /config comment.

    See the improve usage page for a more comprehensive guide on using this tool.

    @buger

    buger commented Mar 1, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - mongo44-sha256 env: success
    Branch used: refs/heads/master
    Commit: 5e0b679 TT-11413 Fix apidef GlobalRateLimit migrations (#6086)

    Type

    bug_fix, enhancement


    Description

    • Added a Disabled boolean field to the GlobalRateLimit struct to
      explicitly enable or disable global rate limits.
    • Modified migration logic to consider the new Disabled flag, setting
      it to true if either Per or Rate is less or equal to 0.
    • Updated existing tests and added new ones to cover the changes in
      global rate limit logic.
    • Adjusted OpenAPI Specification (OAS) related code to utilize the new
      Disabled flag for rate limiting.

    Changes walkthrough

    Relevant files
    Enhancement
    api_definitions.go
    Add Disabled Flag to GlobalRateLimit Struct                           

    apidef/api_definitions.go

  • Added Disabled field to GlobalRateLimit struct.
  • This change allows for explicit disabling of global rate limits.
  • +3/-2     
    migration.go
    Enhance GlobalRateLimit Migration Logic                                   

    apidef/migration.go

  • Modified condition to disable global rate limit based on new Disabled
    flag.
  • Adjusted logic to set GlobalRateLimit.Disabled true if Per or Rate is
    less or equal to 0.
  • +4/-4     
    upstream.go
    Use GlobalRateLimit Disabled Flag in RateLimit Struct       

    apidef/oas/upstream.go

  • Updated RateLimit struct methods to use GlobalRateLimit.Disabled for
    enabling/disabling rate limits.
  • +2/-2     
    Tests
    migration_test.go
    Update Tests for GlobalRateLimit Migration                             

    apidef/migration_test.go

  • Updated tests to reflect new Disabled flag logic in global rate limit.
  • Added test cases for various scenarios of Per and Rate values.
  • +26/-3   
    oas_test.go
    Initialize GlobalRateLimit Disabled in Tests                         

    apidef/oas/oas_test.go

    • Initialized GlobalRateLimit.Disabled to false in test setup.
    +1/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@lghiur)
    Execution page

    @buger

    buger commented Mar 1, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-sha256 env: success
    Branch used: refs/heads/master
    Commit: 5e0b679 TT-11413 Fix apidef GlobalRateLimit migrations (#6086)

    Type

    bug_fix, enhancement


    Description

    • Added a Disabled boolean field to the GlobalRateLimit struct to
      explicitly enable or disable global rate limits.
    • Modified migration logic to consider the new Disabled flag, setting
      it to true if either Per or Rate is less or equal to 0.
    • Updated existing tests and added new ones to cover the changes in
      global rate limit logic.
    • Adjusted OpenAPI Specification (OAS) related code to utilize the new
      Disabled flag for rate limiting.

    Changes walkthrough

    Relevant files
    Enhancement
    api_definitions.go
    Add Disabled Flag to GlobalRateLimit Struct                           

    apidef/api_definitions.go

  • Added Disabled field to GlobalRateLimit struct.
  • This change allows for explicit disabling of global rate limits.
  • +3/-2     
    migration.go
    Enhance GlobalRateLimit Migration Logic                                   

    apidef/migration.go

  • Modified condition to disable global rate limit based on new Disabled
    flag.
  • Adjusted logic to set GlobalRateLimit.Disabled true if Per or Rate is
    less or equal to 0.
  • +4/-4     
    upstream.go
    Use GlobalRateLimit Disabled Flag in RateLimit Struct       

    apidef/oas/upstream.go

  • Updated RateLimit struct methods to use GlobalRateLimit.Disabled for
    enabling/disabling rate limits.
  • +2/-2     
    Tests
    migration_test.go
    Update Tests for GlobalRateLimit Migration                             

    apidef/migration_test.go

  • Updated tests to reflect new Disabled flag logic in global rate limit.
  • Added test cases for various scenarios of Per and Rate values.
  • +26/-3   
    oas_test.go
    Initialize GlobalRateLimit Disabled in Tests                         

    apidef/oas/oas_test.go

    • Initialized GlobalRateLimit.Disabled to false in test setup.
    +1/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@lghiur)
    Execution page

    @sonarqubecloud

    sonarqubecloud Bot commented Mar 1, 2024

    Copy link
    Copy Markdown

    @titpetric titpetric changed the title [TT-11431] Fix apidef GlobalRateLimit migrations [TT-11413] Fix apidef GlobalRateLimit migrations Mar 1, 2024
    @lghiur
    lghiur merged commit 5e0b679 into master Mar 6, 2024
    @lghiur
    lghiur deleted the fix/tt-11431/global_rate_limit-add-disabled-flag branch March 6, 2024 09:12
    @lghiur

    lghiur commented Mar 6, 2024

    Copy link
    Copy Markdown
    Collaborator

    /release to release-5.3

    @lghiur

    lghiur commented Mar 6, 2024

    Copy link
    Copy Markdown
    Collaborator

    /release to release-5.3.0

    @tykbot

    tykbot Bot commented Mar 6, 2024

    Copy link
    Copy Markdown

    Working on it! Note that it can take a few minutes.

    1 similar comment
    @tykbot

    tykbot Bot commented Mar 6, 2024

    Copy link
    Copy Markdown

    Working on it! Note that it can take a few minutes.

    tykbot Bot pushed a commit that referenced this pull request Mar 6, 2024
    ## **Type**
    bug_fix, enhancement
    
    
    ___
    
    ## **Description**
    - Added a `Disabled` boolean field to the `GlobalRateLimit` struct to
    explicitly enable or disable global rate limits.
    - Modified migration logic to consider the new `Disabled` flag, setting
    it to true if either `Per` or `Rate` is less or equal to 0.
    - Updated existing tests and added new ones to cover the changes in
    global rate limit logic.
    - Adjusted OpenAPI Specification (OAS) related code to utilize the new
    `Disabled` flag for rate limiting.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag
    to GlobalRateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/api_definitions.go
    <li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code>
    struct.<br> <li> This change allows for explicit disabling of global
    rate limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit
    Migration Logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    apidef/migration.go
    <li>Modified condition to disable global rate limit based on new
    <code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set
    <code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or
    <code>Rate</code> is <br>less or equal to 0.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit
    Disabled Flag in RateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/upstream.go
    <li>Updated <code>RateLimit</code> struct methods to use
    <code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate
    limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>migration_test.go</strong><dd><code>Update Tests for
    GlobalRateLimit Migration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/migration_test.go
    <li>Updated tests to reflect new <code>Disabled</code> flag logic in
    global rate limit.<br> <li> Added test cases for various scenarios of
    <code>Per</code> and <code>Rate</code> values.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>oas_test.go</strong><dd><code>Initialize
    GlobalRateLimit Disabled in Tests</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/oas_test.go
    - Initialized `GlobalRateLimit.Disabled` to false in test setup.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    ---------
    
    Co-authored-by: Tit Petric <[email protected]>
    
    (cherry picked from commit 5e0b679)
    buger added a commit that referenced this pull request Mar 6, 2024
    …tions (#6086)
    
    [TT-11413] Fix apidef GlobalRateLimit migrations (#6086)
    
    ## **Type**
    bug_fix, enhancement
    
    
    ___
    
    ## **Description**
    - Added a `Disabled` boolean field to the `GlobalRateLimit` struct to
    explicitly enable or disable global rate limits.
    - Modified migration logic to consider the new `Disabled` flag, setting
    it to true if either `Per` or `Rate` is less or equal to 0.
    - Updated existing tests and added new ones to cover the changes in
    global rate limit logic.
    - Adjusted OpenAPI Specification (OAS) related code to utilize the new
    `Disabled` flag for rate limiting.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag
    to GlobalRateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/api_definitions.go
    <li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code>
    struct.<br> <li> This change allows for explicit disabling of global
    rate limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit
    Migration Logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    apidef/migration.go
    <li>Modified condition to disable global rate limit based on new
    <code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set
    <code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or
    <code>Rate</code> is <br>less or equal to 0.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit
    Disabled Flag in RateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/upstream.go
    <li>Updated <code>RateLimit</code> struct methods to use
    <code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate
    limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>migration_test.go</strong><dd><code>Update Tests for
    GlobalRateLimit Migration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/migration_test.go
    <li>Updated tests to reflect new <code>Disabled</code> flag logic in
    global rate limit.<br> <li> Added test cases for various scenarios of
    <code>Per</code> and <code>Rate</code> values.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>oas_test.go</strong><dd><code>Initialize
    GlobalRateLimit Disabled in Tests</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/oas_test.go
    - Initialized `GlobalRateLimit.Disabled` to false in test setup.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    ---------
    
    Co-authored-by: Tit Petric <[email protected]>
    @tykbot

    tykbot Bot commented Mar 6, 2024

    Copy link
    Copy Markdown

    @lghiur Succesfully merged PR

    @tykbot

    tykbot Bot commented Mar 6, 2024

    Copy link
    Copy Markdown

    Still working...

    tykbot Bot pushed a commit that referenced this pull request Mar 6, 2024
    ## **Type**
    bug_fix, enhancement
    
    
    ___
    
    ## **Description**
    - Added a `Disabled` boolean field to the `GlobalRateLimit` struct to
    explicitly enable or disable global rate limits.
    - Modified migration logic to consider the new `Disabled` flag, setting
    it to true if either `Per` or `Rate` is less or equal to 0.
    - Updated existing tests and added new ones to cover the changes in
    global rate limit logic.
    - Adjusted OpenAPI Specification (OAS) related code to utilize the new
    `Disabled` flag for rate limiting.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag
    to GlobalRateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/api_definitions.go
    <li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code>
    struct.<br> <li> This change allows for explicit disabling of global
    rate limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit
    Migration Logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    apidef/migration.go
    <li>Modified condition to disable global rate limit based on new
    <code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set
    <code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or
    <code>Rate</code> is <br>less or equal to 0.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit
    Disabled Flag in RateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/upstream.go
    <li>Updated <code>RateLimit</code> struct methods to use
    <code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate
    limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>migration_test.go</strong><dd><code>Update Tests for
    GlobalRateLimit Migration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/migration_test.go
    <li>Updated tests to reflect new <code>Disabled</code> flag logic in
    global rate limit.<br> <li> Added test cases for various scenarios of
    <code>Per</code> and <code>Rate</code> values.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>oas_test.go</strong><dd><code>Initialize
    GlobalRateLimit Disabled in Tests</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/oas_test.go
    - Initialized `GlobalRateLimit.Disabled` to false in test setup.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    ---------
    
    Co-authored-by: Tit Petric <[email protected]>
    
    (cherry picked from commit 5e0b679)
    buger added a commit that referenced this pull request Mar 6, 2024
    …ons (#6086)
    
    [TT-11413] Fix apidef GlobalRateLimit migrations (#6086)
    
    ## **Type**
    bug_fix, enhancement
    
    
    ___
    
    ## **Description**
    - Added a `Disabled` boolean field to the `GlobalRateLimit` struct to
    explicitly enable or disable global rate limits.
    - Modified migration logic to consider the new `Disabled` flag, setting
    it to true if either `Per` or `Rate` is less or equal to 0.
    - Updated existing tests and added new ones to cover the changes in
    global rate limit logic.
    - Adjusted OpenAPI Specification (OAS) related code to utilize the new
    `Disabled` flag for rate limiting.
    
    
    ___
    
    
    
    ## **Changes walkthrough**
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definitions.go</strong><dd><code>Add Disabled Flag
    to GlobalRateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/api_definitions.go
    <li>Added <code>Disabled</code> field to <code>GlobalRateLimit</code>
    struct.<br> <li> This change allows for explicit disabling of global
    rate limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-9961ccc89a48d32db5b47ba3006315ef52f6e5007fb4b09f8c5d6d299c669d67">+3/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>migration.go</strong><dd><code>Enhance GlobalRateLimit
    Migration Logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    apidef/migration.go
    <li>Modified condition to disable global rate limit based on new
    <code>Disabled</code> <br>flag.<br> <li> Adjusted logic to set
    <code>GlobalRateLimit.Disabled</code> true if <code>Per</code> or
    <code>Rate</code> is <br>less or equal to 0.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-e1d9b55a26f9d6225d56d6f0161959217308e5ad4d6934e7d7df4595d9c2a130">+4/-4</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>upstream.go</strong><dd><code>Use GlobalRateLimit
    Disabled Flag in RateLimit Struct</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/upstream.go
    <li>Updated <code>RateLimit</code> struct methods to use
    <code>GlobalRateLimit.Disabled</code> for <br>enabling/disabling rate
    limits.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-7b0941c7f37fe5a2a23047e0822a65519ca11c371660f36555b59a60f000e3f4">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>migration_test.go</strong><dd><code>Update Tests for
    GlobalRateLimit Migration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/migration_test.go
    <li>Updated tests to reflect new <code>Disabled</code> flag logic in
    global rate limit.<br> <li> Added test cases for various scenarios of
    <code>Per</code> and <code>Rate</code> values.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-d79d77f814074b9e483554e36687e22fda759045141c3b094b039428744ff94c">+26/-3</a>&nbsp;
    &nbsp; </td>
    </tr>                    
    
    <tr>
      <td>
        <details>
    <summary><strong>oas_test.go</strong><dd><code>Initialize
    GlobalRateLimit Disabled in Tests</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    apidef/oas/oas_test.go
    - Initialized `GlobalRateLimit.Disabled` to false in test setup.
    
    
    </details>
        
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6086/files#diff-74029ee88132d30d6478c96a35f8bb2200e0c8e6f42f2c9b147dc6bb7ce74644">+1/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    </tr>                    
    </table></td></tr></tr></tbody></table>
    
    ___
    
    > ✨ **PR-Agent usage**:
    >Comment `/help` on the PR to get a list of all available PR-Agent tools
    and their descriptions
    
    ---------
    
    Co-authored-by: Tit Petric <[email protected]>
    @tykbot

    tykbot Bot commented Mar 6, 2024

    Copy link
    Copy Markdown

    @lghiur Succesfully merged PR

    @buger

    buger commented Mar 6, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - postgres15-murmur64 env: success
    Branch used: refs/heads/master
    Commit: 5e0b679 TT-11413 Fix apidef GlobalRateLimit migrations (#6086)

    Type

    bug_fix, enhancement


    Description

    • Added a Disabled boolean field to the GlobalRateLimit struct to
      explicitly enable or disable global rate limits.
    • Modified migration logic to consider the new Disabled flag, setting
      it to true if either Per or Rate is less or equal to 0.
    • Updated existing tests and added new ones to cover the changes in
      global rate limit logic.
    • Adjusted OpenAPI Specification (OAS) related code to utilize the new
      Disabled flag for rate limiting.

    Changes walkthrough

    Relevant files
    Enhancement
    api_definitions.go
    Add Disabled Flag to GlobalRateLimit Struct                           

    apidef/api_definitions.go

  • Added Disabled field to GlobalRateLimit struct.
  • This change allows for explicit disabling of global rate limits.
  • +3/-2     
    migration.go
    Enhance GlobalRateLimit Migration Logic                                   

    apidef/migration.go

  • Modified condition to disable global rate limit based on new Disabled
    flag.
  • Adjusted logic to set GlobalRateLimit.Disabled true if Per or Rate is
    less or equal to 0.
  • +4/-4     
    upstream.go
    Use GlobalRateLimit Disabled Flag in RateLimit Struct       

    apidef/oas/upstream.go

  • Updated RateLimit struct methods to use GlobalRateLimit.Disabled for
    enabling/disabling rate limits.
  • +2/-2     
    Tests
    migration_test.go
    Update Tests for GlobalRateLimit Migration                             

    apidef/migration_test.go

  • Updated tests to reflect new Disabled flag logic in global rate limit.
  • Added test cases for various scenarios of Per and Rate values.
  • +26/-3   
    oas_test.go
    Initialize GlobalRateLimit Disabled in Tests                         

    apidef/oas/oas_test.go

    • Initialized GlobalRateLimit.Disabled to false in test setup.
    +1/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@lghiur)
    Execution page

    @buger

    buger commented Mar 6, 2024

    Copy link
    Copy Markdown
    Member

    API tests result - mongo44-murmur64 env: success
    Branch used: refs/heads/master
    Commit: 5e0b679 TT-11413 Fix apidef GlobalRateLimit migrations (#6086)

    Type

    bug_fix, enhancement


    Description

    • Added a Disabled boolean field to the GlobalRateLimit struct to
      explicitly enable or disable global rate limits.
    • Modified migration logic to consider the new Disabled flag, setting
      it to true if either Per or Rate is less or equal to 0.
    • Updated existing tests and added new ones to cover the changes in
      global rate limit logic.
    • Adjusted OpenAPI Specification (OAS) related code to utilize the new
      Disabled flag for rate limiting.

    Changes walkthrough

    Relevant files
    Enhancement
    api_definitions.go
    Add Disabled Flag to GlobalRateLimit Struct                           

    apidef/api_definitions.go

  • Added Disabled field to GlobalRateLimit struct.
  • This change allows for explicit disabling of global rate limits.
  • +3/-2     
    migration.go
    Enhance GlobalRateLimit Migration Logic                                   

    apidef/migration.go

  • Modified condition to disable global rate limit based on new Disabled
    flag.
  • Adjusted logic to set GlobalRateLimit.Disabled true if Per or Rate is
    less or equal to 0.
  • +4/-4     
    upstream.go
    Use GlobalRateLimit Disabled Flag in RateLimit Struct       

    apidef/oas/upstream.go

  • Updated RateLimit struct methods to use GlobalRateLimit.Disabled for
    enabling/disabling rate limits.
  • +2/-2     
    Tests
    migration_test.go
    Update Tests for GlobalRateLimit Migration                             

    apidef/migration_test.go

  • Updated tests to reflect new Disabled flag logic in global rate limit.
  • Added test cases for various scenarios of Per and Rate values.
  • +26/-3   
    oas_test.go
    Initialize GlobalRateLimit Disabled in Tests                         

    apidef/oas/oas_test.go

    • Initialized GlobalRateLimit.Disabled to false in test setup.
    +1/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric [email protected]
    Triggered by: push (@lghiur)
    Execution page

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    4 participants