Skip to content

fix(xtest): address review findings on KAO URI coverage - #608

Open
dmihalcik-virtru wants to merge 4 commits into
mainfrom
test/kas-uri-from-kao-review-fixes
Open

dmihalcik-virtru wants to merge 4 commits into
mainfrom
test/kas-uri-from-kao-review-fixes

Conversation

@dmihalcik-virtru

Copy link
Copy Markdown
Member

Stacked on #605base is test/kas-uri-from-kao, not main. Merge #605 first, or merge this into it.

These are the mechanical follow-ups from my review of #605. The two design-level findings (the vacuous key-absence assertion and the missing negative control) are inline comments on #605 itself rather than edits here, since they're the author's call.

What's here

I1 — km3 reachability probe. kas_uri_from_kao is force-only, so the feature gate answers "is the override set?", not "does a km3 exist?". Nothing in the fixture path ever contacts :8787kas_registry_create_if_not_present and _get_or_create_key talk only to the policy service on :8080. So with the override set but no km3 running, registry create, key create and encrypt all succeed and decrypt dies with a connection-refused buried in an SDK CLI's stderr. New kas_reachable() in xtest/fixtures/kas.py turns that into a skip that names the port. This also covers the CI case where force-platform-supports is dispatched while multikas/km-check is false: kao-check is gated on both, so km3 never starts, but the pytest gate has no such condition.

I2 — kas-km3 in otdf-local, started by default. Port 8787, mirroring km1/km2. km3 alone gets services.kas.kas_uri_from_kao: true; km1 and km2 keep the default false so they stay usable as the negative-control instances. Cost, accepted deliberately: all_kas_names() drives up/status/env, so every otdf-local up now starts a 7th go run ./service. In exchange otdf-local env emits KAS_KM3_LOG_FILE, the audit fixture picks km3 up automatically, and the new test becomes runnable locally — which matters because CI only runs it on manual dispatch.

I3 + I5 — documentation only, no CI behaviour change. XT_FORCE_PLATFORM_SUPPORTS is empty on pull_request and on the schedule crons, so test_decrypt_uses_kao_kas_registration skips every cell in both the PR gate and the nightlies. Leaving that as-is and making it legible: the tdfs.py comment now names XT_FORCE_PLATFORM_SUPPORTS explicitly (it said only "force-only", and the one prior use of that phrase means the SDK override — and because both parse against the same feature_type Literal, XT_FORCE_SUPPORTS=kas_uri_from_kao is accepted and then silently does nothing), names the services.kas.kas_uri_from_kao service setting and where it's turned on, and states the un-force step. xtest/README.md records the force-only status and the exact dispatch invocation.

I4 — pin comment exit condition. The d16f6d0 pin is safe — gh api .../compare/6dd5f64...d16f6d0 is 138 ahead / 0 behind, so it contains the sibling steps' require_nonce fix. But the comment documented a temporary divergence with no exit condition, so it stayed true forever while the pin quietly persisted. Comment only; the SHA is unchanged.

I6 — assert on the km3 audit log. #605 wires km3 into the audit service list, the env mapping, the workflow env and the failure artifact, but the test never requests audit_logs, so none of that plumbing is exercised. Since the feature is specifically about which KAS URI is authoritative, the rewrap event is the observable worth asserting. Note no key-management test in test_abac.py uses AuditLogAsserter today, so this steps slightly beyond the immediate family — justified by #605 having added km3 audit collection in the first place.

Known follow-ups, left out to keep this reviewable

Misplaced comment at test_abac.py:974; missing attribute_with_alternate_kas_registration docstring; the cross-module private import at test_abac.py:19 (_get_or_create_key / _create_keyed_attribute — a new precedent, not an existing pattern); chained assert at :935; the (kao,) = ... unpack at :970; dead ec-tdf-enabled: true on km3; and the kao-check step's style divergence from its siblings plus its missing decision echo.

Verification

ruff check, ruff format and pyright are clean in both xtest/ and otdf-local/; test_tdfs_units.py passes (29). The local otdf-local up smoke test for km3 has not been run — worth doing before merge.

c-r33d and others added 4 commits September 16, 2026 08:55
Signed-off-by: Chris Reed <creed@virtru.com>
Signed-off-by: Chris Reed <creed@virtru.com>
Follow-ups from the review of #605, stacked on that branch.

- Skip test_decrypt_uses_kao_kas_registration when no km3 is listening,
  instead of failing with connection-refused inside an SDK CLI.
- Add kas-km3 (8787) to otdf-local so the test is runnable locally.
- Document kas_uri_from_kao as force-only via XT_FORCE_PLATFORM_SUPPORTS,
  and that neither the PR gate nor the nightlies exercise it.
- Give the divergent km3 action pin an exit condition.
- Assert the km3 rewrap audit event the PR added collection for.
@dmihalcik-virtru
dmihalcik-virtru requested review from a team as code owners September 17, 2026 14:21
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: db1e2ec3-d757-4cdf-a5de-0b68f89d07ba

📥 Commits

Reviewing files that changed from the base of the PR and between 18f67c6 and 5616e30.

📒 Files selected for processing (11)
  • .github/workflows/xtest.yml
  • otdf-local/AGENTS.md
  • otdf-local/README.md
  • otdf-local/src/otdf_local/cli.py
  • otdf-local/src/otdf_local/config/ports.py
  • otdf-local/src/otdf_local/services/kas.py
  • xtest/README.md
  • xtest/fixtures/audit.py
  • xtest/fixtures/kas.py
  • xtest/tdfs.py
  • xtest/test_abac.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sonarqubecloud

Copy link
Copy Markdown

Base automatically changed from test/kas-uri-from-kao to main September 17, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants