Skip to content

feat(file-sources): map connectors to file-source adapters (PR 2/4)#367

Merged
philmerrell merged 1 commit into
developfrom
feature/connector-adapter-mapping
May 21, 2026
Merged

feat(file-sources): map connectors to file-source adapters (PR 2/4)#367
philmerrell merged 1 commit into
developfrom
feature/connector-adapter-mapping

Conversation

@philmerrell
Copy link
Copy Markdown
Contributor

Summary

Second PR in the file source connectors series. Builds on the adapter framework from #366 to let an admin mark a connector as a file source by mapping it to a registered adapter.

Backend

  • OAuthProvider gains a nullable file_source_adapter_id — dataclass field, DynamoDB to/from_dynamo_item round-trip, OAuthProviderCreate/Update/Response, and provider_repository.apply_metadata_update. Legacy records without the field default to None.
  • Admin create/update routes validate the mapping against the adapter registry: the adapter must exist and its compatible_provider_types must include the connector's type. Validation lives in the app_api route — apis.shared cannot import the app_api registry.
  • New read-only GET /admin/file-source-adapters exposes the registry so the admin form can populate a dropdown.

Frontend

  • The admin connector form gains a "File Source" section: an adapter dropdown filtered by provider-type compatibility, plus a scope-coverage warning when the connector's OAuth scopes don't cover what the adapter requires. Selecting an adapter is the opt-in; clearing it ("") removes the mapping.

Design notes

  • file_source_adapter_id is the opt-in — there's no separate "is file source" boolean. Set = file source; null = not.
  • A connector ≠ a file source: the connector is OAuth; the file-source capability exists only when an adapter is mapped. The admin dropdown only offers adapters compatible with the connector's provider type, so e.g. a Slack connector is never offered Google Drive.

Test plan

  • 88 backend tests pass — model round-trip (incl. legacy records), validation helper (unknown adapter / incompatible type / valid / no-op), GET /admin/file-source-adapters endpoint, plus connectors + oauth + architecture regression suites
  • ruff clean; mypy clean apart from the repo-wide pre-existing import-untyped noise
  • Frontend production build succeeds — connector form component + template type-check cleanly
  • Architecture import-boundary tests pass (registry validation is app_api-only)

Known issue (pre-existing, not introduced here)

connectors.service.spec.ts fails on a clean develop checkout — its TestBed setup chokes on a null HttpClientTestingModule (Angular test-infra version drift). The new fetchFileSourceAdapters test was added in the same style and will pass once that environment issue is fixed. Flagged separately.

🤖 Generated with Claude Code

Lets an admin mark a connector as a file source by mapping it to a
registered file-source adapter. Builds on the PR #366 adapter framework.

Backend:
- OAuthProvider gains a nullable file_source_adapter_id (dataclass +
  DynamoDB round-trip + Create/Update/Response models + repository
  apply_metadata_update).
- Admin create/update routes validate the mapping against the adapter
  registry — the adapter must exist and its compatible_provider_types
  must include the connector's type. Validation lives in the app_api
  route (apis.shared cannot import the registry).
- New read-only GET /admin/file-source-adapters exposes the registry so
  the admin form can populate its dropdown.

Frontend:
- Admin connector form gains a "File Source" section: an adapter
  dropdown filtered by provider-type compatibility, with a scope-
  coverage warning when the connector's scopes don't cover what the
  adapter needs. Selecting an adapter is the opt-in; clearing it removes
  the mapping.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@philmerrell philmerrell merged commit 2239137 into develop May 21, 2026
30 checks passed
@philmerrell philmerrell deleted the feature/connector-adapter-mapping branch May 21, 2026 23:00
colinmxs added a commit that referenced this pull request May 22, 2026
Merges 16 commits from origin/develop into the stack-simplification
branch. Two modify/delete conflicts resolved (mcp-sandbox-stack.ts and
its test — both deleted by us, modified by develop's PRs #352#360).

Ported the dynamic per-resource CSP changes from develop into
constructs/mcp-sandbox/mcp-sandbox-distribution-construct.ts:

  - Removed buildMcpSandboxProxyCsp() (static CSP is gone)
  - Added loadMcpSandboxCspFunctionCode() — loads csp-function.js from
    assets/mcp-sandbox/, substitutes the FRAME_ANCESTORS placeholder
    with the real source list via JSON.stringify (handles quote-escaping
    for 'none' correctly)
  - Added McpSandboxCspFunction (CloudFront Function, JS_2_0 runtime)
    associated at VIEWER_RESPONSE on the default behavior — composes
    per-resource CSP from ?csp= query param
  - Removed contentSecurityPolicy from the ResponseHeadersPolicy (CSP
    is now dynamic via the function; other security headers stay on RHP)
  - Shortened RHP comment to fit 128-char AWS cap

The mcp-sandbox-csp-function.test.ts that came in from develop passes
against our construct (88 tests green).

Also merged: file-sources adapter framework (#366, #367), frontend
test fix (#368), beta.27 release merges (#365, #369), kaizen doc (#370),
backup tool (#361 — already cherry-picked earlier).
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.

1 participant