feat: sync updated codebase from development snapshot#40
Conversation
|
Warning Review limit reached
More reviews will be available in 38 minutes and 6 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (23)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #40 +/- ##
==========================================
- Coverage 88.15% 87.44% -0.71%
==========================================
Files 15 15
Lines 3182 3474 +292
==========================================
+ Hits 2805 3038 +233
- Misses 377 436 +59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
385439f to
12086fd
Compare
There was a problem hiding this comment.
Code Review
This pull request addresses several security, correctness, and usability issues identified in an adversarial review. Key changes include restricting cache validity based on API mode and metadata completeness, securing cache file permissions to 0o600, unescaping path segments to fix round-trip conversion of escaped display names, enforcing strict scoping on cached hierarchies, and updating status commands to respect JSON/YAML formatting. Additionally, the MCP server was updated to enforce server-level scopes and utilize the disk cache. The review feedback highlights a critical issue where the MCP server unconditionally writes to the disk cache for arbitrary scopes, potentially overwriting the user's main global cache. It is recommended to restrict cache writes to None or the configured entrypoint, and update the corresponding test suite accordingly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| write_cache( | ||
| hierarchy, | ||
| scope=scope, | ||
| via_resource_manager=not use_asset_api, | ||
| include_labels=include_labels, | ||
| include_tags=include_tags, | ||
| ) |
There was a problem hiding this comment.
Unconditionally writing the loaded hierarchy to the disk cache for arbitrary scopes will overwrite the user's main global/entrypoint disk cache file (~/.gcpath/cache.json). This causes subsequent CLI commands to suffer from cache scope mismatches, forcing slow live loads. The disk cache should only be written if the scope is None or matches the configured entrypoint. Please ensure read_config is imported at the top of the file rather than inline.
| write_cache( | |
| hierarchy, | |
| scope=scope, | |
| via_resource_manager=not use_asset_api, | |
| include_labels=include_labels, | |
| include_tags=include_tags, | |
| ) | |
| entrypoint = read_config().get("entrypoint") | |
| if scope is None or scope == entrypoint: | |
| write_cache( | |
| hierarchy, | |
| scope=scope, | |
| via_resource_manager=not use_asset_api, | |
| include_labels=include_labels, | |
| include_tags=include_tags, | |
| ) |
References
- Place all imports at the top of the file, after any module docstrings and all declarations, to improve consistency and readability, following PEP 8 guidelines. (link)
| def test_get_hierarchy_refresh_loads_and_writes_disk_cache(): | ||
| import gcpath.mcp_server as mcp_mod | ||
|
|
||
| mcp_mod._HIERARCHY_CACHE.clear() | ||
| loaded = make_test_hierarchy() | ||
| with ( | ||
| patch.object(mcp_mod, "read_cache") as mock_read, | ||
| patch.object(mcp_mod, "write_cache") as mock_write, | ||
| patch.object(Hierarchy, "load", return_value=loaded) as mock_load, | ||
| ): | ||
| result = mcp_mod._get_hierarchy( | ||
| use_asset_api=False, | ||
| scope="folders/1", | ||
| refresh=True, | ||
| include_labels=True, | ||
| include_tags=False, | ||
| ) | ||
|
|
||
| assert result is loaded | ||
| mock_read.assert_not_called() | ||
| mock_load.assert_called_once() | ||
| mock_write.assert_called_once_with( | ||
| loaded, | ||
| scope="folders/1", | ||
| via_resource_manager=True, | ||
| include_labels=True, | ||
| include_tags=False, | ||
| ) | ||
| mcp_mod._HIERARCHY_CACHE.clear() |
There was a problem hiding this comment.
Since we restricted write_cache in _get_hierarchy to only write when the scope is cacheable (i.e., None or the configured entrypoint), we should update this test to use scope=None so that it continues to test the write-cache path without needing to mock the configuration. Please ensure any required imports (like mcp_server) are placed at the top of the file.
def test_get_hierarchy_refresh_loads_and_writes_disk_cache():
mcp_mod._HIERARCHY_CACHE.clear()
loaded = make_test_hierarchy()
with (
patch.object(mcp_mod, "read_cache") as mock_read,
patch.object(mcp_mod, "write_cache") as mock_write,
patch.object(Hierarchy, "load", return_value=loaded) as mock_load,
):
result = mcp_mod._get_hierarchy(
use_asset_api=False,
scope=None,
refresh=True,
include_labels=True,
include_tags=False,
)
assert result is loaded
mock_read.assert_not_called()
mock_load.assert_called_once()
mock_write.assert_called_once_with(
loaded,
scope=None,
via_resource_manager=True,
include_labels=True,
include_tags=False,
)
mcp_mod._HIERARCHY_CACHE.clear()References
- Place all imports at the top of the file, after any module docstrings and all declarations, to improve consistency and readability, following PEP 8 guidelines. (link)
12086fd to
45d12d7
Compare
|



Syncs the latest codebase version from the development snapshot.
Key changes:
All 567 tests pass.