Shared rules implementation - #757
Conversation
| async def _fetch_registry(self) -> dict[str, list[str]]: | ||
| if ( | ||
| self._registry_fetched_at | ||
| and (time.monotonic() - self._registry_fetched_at) < REGISTRY_TTL_SECONDS |
There was a problem hiding this comment.
this definitely makes a lot of sense, we don't need to fetch the same file multiple times per minute
I do wonder though if we could just check if the file changed using the respective HTTP header
There was a problem hiding this comment.
do you mean just for the periodic recheck? I didn't consider it since the yaml should be rather small, but if this needs to scale up later, we can definitely add it, good point
45b8cb7 to
3c697da
Compare
8cd28d7 to
c72e6e8
Compare
|
/agentic_review |
c72e6e8 to
38b0488
Compare
|
/agentic_review |
974fa91 to
1b79fbb
Compare
|
/agentic_review |
|
@lbarcziova It seems Qodo doesn't like you. |
Code Review by Qodo
1. shared-rules dependency undocumented
|
Implements a new MCP tool to fetch shared rules from a central registry, allowing common guidelines to be defined once per ecosystem (Python, Perl, etc.) and automatically applied to groups of packages. Core changes: - New SharedRulesTool: Looks up which shared rule sets apply to a package by querying registry.yaml in rules/shared-rules repo - Returns JSON list of ecosystem names; agents fetch actual AGENTS.md content via existing get_maintainer_rules tool - TTL-based caching (1 hour) at tool instance level for registry.yaml - Centralize GITLAB_API_URL and RULES_NAMESPACE constants (currently pointing at ymir-rules-test for testing) - Register tool in MCP gateway alongside existing MaintainerRulesTool - Add PyYAML>=5.1 dependency for registry parsing - Full test coverage (8 test cases) for lookup and caching behavior Design rationale: - Tool returns only the list, not content (keeps it simple) - Agent orchestrates fetching (maintains control over precedence logic) - Per-package rules always take precedence over shared rules - Registry cached to avoid repeated GitLab API calls - Transient errors don't cache; permanent errors do (404, bad YAML) Assisted-by: Claude Opus 4.6
Lets shared rules be disabled without a code change if the registry or a rule set turns out to cause problems in production. Wired into both OpenShift (configmap + mcp-gateway deployment) and local dev (compose.yaml + make start/start-detached) so the flag behaves the same in both environments. Assisted-by: Claude Sonnet 5
Fixes three issues from PR review: state that package-specific rules take precedence over shared rules in the testing analyst prompt (the one integration point that omitted it), fetch shared rule sets concurrently instead of serially to avoid unbounded latency from per-rule 120s tool timeouts, and document the shared-rules registry as a new untrusted-content entry point in THREAT_MODEL.md given its cross-package blast radius. Assisted-by: Claude Sonnet 5
1b79fbb to
2e96dd7
Compare
No description provided.