Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: partitioned and autoChips should support different paths #55

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Jul 6, 2024

closes #53

Summary by CodeRabbit

  • New Features

    • Introduced a GitHub Actions workflow to automate project building and publishing on push and pull requests.
  • Bug Fixes

    • Improved cookie handling logic to support various paths and signatures.
  • Tests

    • Added new test cases to validate enhanced cookie handling scenarios.
  • Chores

    • Updated ESLint configuration to the latest version.

@fengmk2 fengmk2 added the bug label Jul 6, 2024
@fengmk2 fengmk2 self-assigned this Jul 6, 2024
Copy link

coderabbitai bot commented Jul 6, 2024

Warning

Rate limit exceeded

@fengmk2 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 15 minutes and 58 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 027451b and f8014fe.

Walkthrough

The overall change encompasses updates to the GitHub Actions workflow, enhancements to cookie handling functions in a TypeScript file, and new test cases to verify these changes. Additionally, the ESLint configuration version is incremented in package.json. The primary objective is to refine the cookie manipulation logic, particularly handling cookies' paths and signatures.

Changes

File Change Summary
.github/workflows/pkg.pr.new.yml Introducing a new GitHub Actions workflow for publishing on any commit or pull request.
package.json Updated "eslint-config-egg" version from "13" to "14", likely reflecting configuration changes.
src/cookies.ts Refactored cookie handling logic to improve removal and addition based on paths and signatures.
test/cookies.test.ts Added test cases for verifying cookie handling scenarios with various paths and partitioned settings.

Sequence Diagram(s)

N/A

Assessment against linked issues

Objective Addressed Explanation
removeUnpartitioned 选项打开后会清除同名但不同path的.sig cookie (#53)

Poem

In the land where code does thrive,
Cookies now more finely drive.
Paths and signatures, neat and trim,
In tests and flows, they now brim.
Publish commits with ease, no strife,
Node, ESLint guide the dev's life.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

socket-security bot commented Jul 6, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] Transitive: environment, eval, filesystem, unsafe +153 18.6 MB fengmk2

🚮 Removed packages: npm/[email protected]

View full report↗︎

Copy link

pkg-pr-new bot commented Jul 6, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

commit: f8014fe

@eggjs/cookies

npm i https://pkg.pr.new/eggjs/egg-cookies/@eggjs/cookies@55


templates

Copy link

codecov bot commented Jul 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (12db545) to head (f8014fe).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #55   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          610       632   +22     
  Branches       131       138    +7     
=========================================
+ Hits           610       632   +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d7db6c7 and f567765.

Files selected for processing (4)
  • .github/workflows/pkg.pr.new.yml (1 hunks)
  • package.json (1 hunks)
  • src/cookies.ts (4 hunks)
  • test/cookies.test.ts (2 hunks)
Files skipped from review due to trivial changes (2)
  • .github/workflows/pkg.pr.new.yml
  • package.json
Additional context used
GitHub Check: codecov/patch
src/cookies.ts

[warning] 318-319: src/cookies.ts#L318-L319
Added lines #L318 - L319 were not covered by tests

Additional comments not posted (6)
src/cookies.ts (4)

176-179: Ensure removeUnpartitioned functionality works correctly.

The removeUnpartitioned option now correctly handles cookies with different paths by using ignoreCookiesByNameAndPath. This change ensures that only cookies with the same path are removed.


190-191: Ensure ignoreCookiesByNameAndPath is called correctly.

The function ignoreCookiesByNameAndPath is used to handle the removal of .sig cookies with different paths. This change ensures that only cookies with the same path are removed.


210-211: Ensure ignoreCookiesByNameAndPath is called correctly.

The function ignoreCookiesByNameAndPath is used to handle the removal of _CHIPS- prefix cookies with different paths. This change ensures that only cookies with the same path are removed.


316-319: New function ignoreCookiesByNameAndPath added.

The function ignoreCookiesByNameAndPath correctly handles the removal of cookies with different paths. Ensure that all edge cases are covered in tests.

Tools
GitHub Check: codecov/patch

[warning] 318-319: src/cookies.ts#L318-L319
Added lines #L318 - L319 were not covered by tests

test/cookies.test.ts (2)

898-927: Test case for removeUnpartitioned with different paths added.

The test case correctly validates that the removeUnpartitioned option handles cookies with different paths without removing them.


951-993: Test case for partitioned and unpartitioned with different paths added.

The test case correctly validates that the partitioned and unpartitioned options work correctly with cookies having different paths.

src/cookies.ts Show resolved Hide resolved
Copy link

@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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f567765 and 027451b.

Files selected for processing (1)
  • src/cookies.ts (4 hunks)
Additional context used
Biome
src/cookies.ts

[error] 339-339: expected } but instead the file ends

the file ends here

(parse)

Additional comments not posted (1)
src/cookies.ts (1)

176-179: LGTM! Ensure thorough testing.

The changes to the set method look good. Ensure that the method is thoroughly tested, especially with the removeUnpartitioned option enabled.

Also applies to: 190-191, 210-211

src/cookies.ts Outdated Show resolved Hide resolved
@fengmk2 fengmk2 merged commit 50b1313 into master Jul 6, 2024
12 checks passed
@fengmk2 fengmk2 deleted the support-different-paths branch July 6, 2024 09:16
fengmk2 pushed a commit that referenced this pull request Jul 6, 2024
[skip ci]

## [3.0.1](v3.0.0...v3.0.1) (2024-07-06)

### Bug Fixes

* partitioned and autoChips should support different paths ([#55](#55)) ([50b1313](50b1313))
fengmk2 added a commit that referenced this pull request Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

removeUnpartitioned 选项打开后会清除同名但不同path的.sig cookie
1 participant