rossoctl / rossoctl/rossoctl

Task: Avoid double IdP catalog fetch in policy-conflict check (#154)

Open
#2,476 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
302
Forks
107
Avg merge
1d 16h
Merged PRs (30d)
41

Description

Context

Follow-up from a review nit on rossoctl/cortex#809 (pre-commit policy conflict diagnostic).

check_policy_conflicts (aiac/src/aiac/agent/uc/policy_check/check.py) calls
config.get_services() to derive service_type, and then resolve_focal_entities
(aiac/src/aiac/agent/shared/focal_entities.py) calls config.get_services() again
internally. That is two IdP catalog round-trips per check request where one would do.

Why it wasn't folded into rossoctl/cortex#809

resolve_focal_entities is shared with the live /apply builder path, and its docstring
deliberately forbids deriving service_type from focus.type (the caller routes on the
passed-in type to preserve the /apply contract). So the fix must not move the type lookup
into the resolver.

Proposed fix

Add an optional pre-fetched services parameter to resolve_focal_entities and thread the
already-fetched list through from check_policy_conflicts, keeping the /apply contract
byte-for-byte. (Caching the catalog on Configuration is an alternative, but the explicit
param keeps the seam obvious and testable.)

Acceptance

  • Single get_services() call per POST /policy/check request.
  • Live /apply path and its 422 contract unchanged.
  • A test asserts the catalog call count (none currently does — noted in review).

Assisted-By: Claude (Anthropic AI) noreply@anthropic.com

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with aiac/src/aiac/agent/uc/policy_check/check.py and aiac/src/aiac/agent/shared/focal_entities.py, tracing the policy check and live /apply callers before running the relevant tests. Done means POST /policy/check makes one get_services() call, the catalog call count is covered by a test, and the live /apply path and its 422 contract remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend-api-design
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.