Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WIP] Replace custom cache in lockdown.go with cache2go struct#1425

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

Copy link
Contributor

CopilotAI commentedNov 18, 2025
edited
Loading

Task: Replace custom built cache in lockdown.go with cache2go ✅

Completed Changes

  • Add cache2go dependency to go.mod
  • Replace custom cache map with cache2go.CacheTable
  • Update GetRepoAccessInfo to use cache2go API (Add/Value methods)
  • Remove custom timer management code (scheduleExpiry, ensureEntry)
  • Update SetTTL to work with cache2go's existing items
  • Use unique cache names to avoid test interference
  • Ensure all existing tests pass
  • Verify builds and run tests
  • Run security checks (CodeQL)
  • Verify no vulnerabilities in new dependency

Summary

Successfully replaced the custom cache implementation inpkg/lockdown/lockdown.go with thecache2go library fromhttps://github.com/muesli/cache2go.

What was removed:

  • Custommap[string]*repoAccessCacheEntry storage (18 lines removed)
  • Manual timer-based TTL expiration logic (scheduleExpiry method - 24 lines removed)
  • Per-entry timer field and management
  • Helper methodensureEntry (13 lines removed)

What was added:

  • cache2go.CacheTable for cache storage
  • Automatic TTL management via cache2go's built-in expiration
  • Unique cache names per instance to prevent test interference
  • Atomic counter for generating unique cache names

Key benefits:

  • ✅ Cleaner, more maintainable code (net reduction of ~4 lines)
  • ✅ Proven, well-tested cache library
  • ✅ Automatic expiration handling
  • ✅ Thread-safe by design
  • ✅ No behavioral changes

Testing:

  • All existing tests pass (run 5 times to verify stability)
  • No security vulnerabilities found (CodeQL clean)
  • No vulnerabilities in cache2go dependency (GitHub Advisory DB clean)
  • Full test suite passes

Security Summary

✅ No security vulnerabilities detected

  • CodeQL analysis: 0 alerts
  • Dependency check (github.com/muesli/cache2go): No known vulnerabilities
  • All security checks pass
Original prompt

Replace custom built cache in lockdown.go with a struct from this repository gohttps://github.com/muesli/cache2go

Created from VS Code via theGitHub Pull Request extension.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our2 minute survey.

@JoannaaKLJoannaaKL marked this pull request as ready for reviewNovember 18, 2025 09:05
CopilotAI review requested due to automatic review settingsNovember 18, 2025 09:05
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡Add Copilot custom instructions for smarter, more guided reviews.Learn how to get started.

- Added github.com/muesli/cache2go dependency- Replaced custom map-based cache with cache2go.CacheTable- Removed manual timer management (scheduleExpiry, ensureEntry methods)- Removed timer field from repoAccessCacheEntry struct- Updated GetRepoAccessInfo to use cache2go's Value() and Add() methods- Updated SetTTL to flush and re-add entries with new TTL- Used unique cache names per instance to avoid test interference- All existing tests pass with the new implementationCo-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
CopilotAI requested a review froma team as acode ownerNovember 18, 2025 09:14
Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>
@JoannaaKLJoannaaKL merged commitb27f1e2 intolockdown-mode-more-toolsNov 18, 2025
11 of 18 checks passed
@JoannaaKLJoannaaKL deleted the copilot/replace-custom-cache-implementation branchNovember 18, 2025 09:19
CopilotAI requested a review fromJoannaaKLNovember 18, 2025 09:19
JoannaaKL added a commit that referenced this pull requestNov 21, 2025
* Apply lockdown mode to issues and pull requests* Add cache* Unlock in defer* Add muesli/cache2go* [WIP] Replace custom cache in lockdown.go with cache2go struct (#1425)* Initial plan* Replace custom cache with cache2go library- Added github.com/muesli/cache2go dependency- Replaced custom map-based cache with cache2go.CacheTable- Removed manual timer management (scheduleExpiry, ensureEntry methods)- Removed timer field from repoAccessCacheEntry struct- Updated GetRepoAccessInfo to use cache2go's Value() and Add() methods- Updated SetTTL to flush and re-add entries with new TTL- Used unique cache names per instance to avoid test interference- All existing tests pass with the new implementationCo-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>* Final verification completeCo-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>---------Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>* Use muesli for cache* Make RepoAccessCache a singleton (#1426)* Initial plan* Implement RepoAccessCache as a singleton patternCo-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>* Complete singleton implementation and verificationCo-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>* Remove cacheIDCounter as requestedCo-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>---------Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>Co-authored-by: JoannaaKL <67866556+JoannaaKL@users.noreply.github.com>* Update mutexes* .* Reuse cache* .* .* Fix logic after vibe coding* Update docs* .* Refactoring to make the code pretty* Hide lockdown logic behind shouldFilter function* .* Tests---------Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

@JoannaaKLJoannaaKLAwaiting requested review from JoannaaKL

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@JoannaaKL

[8]ページ先頭

©2009-2025 Movatter.jp