Skip to content

feat(AF-579): assign review plans to API connectors#585

Merged
babltiga merged 1 commit into
mainfrom
feature/AF-579-api-connector-review-plan
Jul 3, 2026
Merged

feat(AF-579): assign review plans to API connectors#585
babltiga merged 1 commit into
mainfrom
feature/AF-579-api-connector-review-plan

Conversation

@babltiga

@babltiga babltiga commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #579

Brings API connectors to parity with SQL/NoSQL datasources for review-plan assignment.

What changed

Frontend

  • Review-plan Select (options from GET /review-plans, allowClear, loading placeholder, and a "no plan → single approval" hint) in the New connector modal (ApiConnectorsListPage) and the settings Config tab (ApiConnectorSettingsPage), mirroring the datasource wizard/settings UX.
  • Clearing the select on settings sends clear_review_plan: true (UpdateApiConnectorInput in src/types/api.ts); review_plan_id: null keeps meaning "unchanged" on update.
  • New i18n keys (apiGov.connectors.reviewPlan*) translated in all 7 locale files.

Backend

  • DefaultApiConnectorAdminService now validates reviewPlanId on create and update via ReviewPlanLookupService: a non-existent or cross-org plan id is rejected with 404 REVIEW_PLAN_NOT_FOUND (cross-org reads as not-found on purpose).
  • New clearReviewPlan flag on UpdateApiConnectorRequest/UpdateApiConnectorCommand (same convention as the datasource update's clearAiConfig) persists review_plan_id = NULL; it wins over a reviewPlanId sent in the same request.

Tests

  • DefaultApiConnectorAdminServiceTest: 9 new cases covering assign/validate/clear/unchanged on create and update.
  • New component tests: ApiConnectorsListPage.test.tsx (selector renders, selected plan rides the create payload) and ApiConnectorSettingsPage.test.tsx (assigned plan shown, submit with/without plan → clear_review_plan mapping).
  • New e2e spec in e2e/tests/api-governance.spec.ts: assign → persist across reload → clear → review_plan_id NULL via API; createApiConnectorViaApi helper gained an optional aiAnalysisEnabled knob.

Docs updated

  • docs/04-api-spec.md — review-plan assignment semantics on the connector endpoints (org validation, clearReviewPlan, 1-approval default).
  • docs/06-frontend.md — review-plan Select on the connector settings page + create modal.
  • website/ — no change needed: website/docs/index.html already documents "Set the review plan" for API connectors; this PR closes that gap in the app.
  • README.md — unaffected (no setup/tech-stack/feature-list change).

Verification

  • mvn verify -Pcoverage: 4646 tests, 0 failures, JaCoCo gate green (incl. ApplicationModulesTest, ApiPackageDependencyTest).
  • Frontend: lint (0 errors) + typecheck + test:coverage (94.2% lines / 83.7% branches) + build green.
  • e2e against the local docker stack: all 3 connector specs (8 tests, incl. the new AF-579 spec) plus the 2 other specs using the shared connector helper (6 tests) pass.

Parity with SQL/NoSQL datasources: admins can pick a review plan when
creating an API connector, change or clear it from connector settings,
and the backend validates the plan belongs to the caller's organization.

- reviewPlanId on create/update is now resolved via ReviewPlanLookupService
  and rejected with 404 REVIEW_PLAN_NOT_FOUND when missing or cross-org
- new clearReviewPlan flag on the update request (datasource clearAiConfig
  convention) persists review_plan_id = NULL; null still means unchanged
- Review-plan Select (allowClear, loading, 1-approval-default hint) in the
  connector create modal and settings ConfigTab; i18n keys in all 7 locales
- component tests for both pages, service tests for validate/clear paths,
  and an e2e spec covering assign -> persist -> clear

Closes #579
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Frontend Test Results

1 144 tests  +5   1 144 ✅ +5   3m 9s ⏱️ +51s
  155 suites +2       0 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 2acc89c. ± Comparison against base commit fcef41c.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for Frontend Coverage (frontend)

Status Category Percentage Covered / Total
🔵 Lines 94.18% (🎯 90%) 1994 / 2117
🔵 Statements 92.12% (🎯 90%) 2222 / 2412
🔵 Functions 91.47% (🎯 90%) 601 / 657
🔵 Branches 83.69% (🎯 80%) 1247 / 1490
File CoverageNo changed files found.
Generated in workflow #735 for commit 2acc89c by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Backend Test Results

4 646 tests   4 646 ✅  13m 53s ⏱️
  616 suites      0 💤
  616 files        0 ❌

Results for commit 2acc89c.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Backend Code Coverage

Overall Project 93.14% 🍏
Files changed 100% 🍏

File Coverage
UpdateApiConnectorRequest.java 100% 🍏
UpdateApiConnectorCommand.java 100% 🍏
DefaultApiConnectorAdminService.java 88.41% 🍏

@babltiga babltiga merged commit adf75e3 into main Jul 3, 2026
28 checks passed
@babltiga babltiga deleted the feature/AF-579-api-connector-review-plan branch July 3, 2026 13:40
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.

Admin: assign Review Plan to API Connectors (parity with SQL/NoSQL datasources)

1 participant