Skip to content

1954 finalize migration importexport kea prompt mapping full platform team config export#2106

Open
simcariou wants to merge 4 commits into
swiftfrom
1954-finalize-migration-importexport-kea-prompt-mapping-full-platform-team-config-export
Open

1954 finalize migration importexport kea prompt mapping full platform team config export#2106
simcariou wants to merge 4 commits into
swiftfrom
1954-finalize-migration-importexport-kea-prompt-mapping-full-platform-team-config-export

Conversation

@simcariou

Copy link
Copy Markdown
Contributor

Pull Request

Read this before you type anything.

Opening a PR is the last step, not the first. If you designed this alone,
implemented it without sharing the plan, and are now hoping the review will
validate the approach — stop. Close this tab. Go read
docs/swift/platform/DEVELOPER_CONTRACT.md
and come back when the steps below are already done.

This is not process theater. Every question below exists because something
went wrong when it was skipped. Fill them in honestly. A short honest answer
beats a long evasive one every time.


1. What problem does this solve — and where is it tracked?

ID:

Problem in one sentence:

Backlog ref:


2. Before you wrote a single line of code

This section cannot be skipped. If the answer to any question is "no" or
"I didn't", explain why — do not leave it blank.

RFC written?

Plan presented to the team before implementation?

Confirmation received?


3. What you built


4. Proof of quality

Tests added or updated:

Test File What it covers

make code-quality output (paste the last line or "all checks passed"):


Raw basedpyright output (required if a touched package keeps a non-empty baseline file):


make test output (paste the summary line — pass count, 0 failures):


If you touched multiple packages, paste one block per package.


5. Docs updated

Work through this line by line. If an item does not apply, write "n/a" and say why.

What changed File updated
Backlog [ ] item is now done
New behaviour, API field, or contract change
Frozen contract touched (execution.py, agent_app.py, OpenAPI)
UX component implemented or visual status changed
Phase progress row exists for this area
WORKPLAN sprint item finished
Code and a design doc now diverge

6. Close-out statement

## Task close-out
- Code:
- Tests:
- Docs updated:
- Backlog:
- Skipped steps:

7. Risk and rollback

What breaks if this is wrong?

How do we roll back?

…prompts, OpenFGA role transform (#1954)

Validated end-to-end against a real kea dump (2026-07-22):

- bundle.py: default users_schema_version=1 for source_platform != "swift"
  (kea's exporter predates the field); kea bundles were rejected at
  open_bundle() before this.
- importer.py kea path:
  - agents keep their real tuning (role/description/tags/created_by) and
    customized system prompt via tuning.values["prompts.system"] — the key
    the runtime overlays onto the template prompt (MIGR-05.11); v1
    secondary prompts warned; legacy type=leader rows skipped.
  - chat-context resources become prompt rows in personal-{author}
    (front-matter stripped, idempotent by resource_id, name collisions
    suffixed); other kinds warned; kea library tags filtered (MIGR-05.15).
  - OpenFGA tuple restore with role transformation (MIGR-05.04), replacing
    the ops bulk-copy plan: owner→team_admin+team_editor,
    manager→team_editor, member→team_member; drops team:personal,
    resource#parent and non-UUID subjects; replays agent/tag/document/
    organization 1:1; idempotent audited writes via RebacEngine.
  - team table read under its kea file name (teammetadata.jsonl, from
    main's EXPORT_TABLES) on the kea path (MIGR-05.14).
- tests: test_import_export_kea_bundle.py (12 tests, kea-format bundles).
- docs: PLATFORM-IMPORT-RFC §4/§8/§9, KEA-MIGRATION-BACKLOG §0bis,
  KEA_SWIFT_CUTOVER implementation state.
…lm export (#1954)

Kea stores team names only in Keycloak groups and platform roles only as
per-user realm roles — neither lives in Postgres or OpenFGA, so the kea
import path now consumes keycloak/realm.json when the bundle carries it:

- every tuple-referenced team gets a swift teammetadata row: name from the
  realm groups, customization merged from the kea row when present,
  joining_mode defaulted; no realm in the bundle -> named by id + warning
  (SQL on the Keycloak DB documented as ops fallback).
- a FULL realm export (kc export --users) re-provisions platform roles from
  users[].realmRoles: admin->platform_admin, viewer->platform_observer,
  editor dropped with a warning. Partial-exports carry no users -> grants
  stay on the users.json/bootstrap channel.
- tests: 3 new in test_import_export_kea_bundle.py; harness gives the task
  service its own SQLite file (single-writer lock artifact, not a product
  concern).
- docs: PLATFORM-IMPORT-RFC §8, KEA-MIGRATION-BACKLOG MIGR-05.16.
… as MIGR-05.17, mark MIGR-02.02 superseded

async def _make_engine(tmp_path: Path, name: str) -> AsyncEngine:
import control_plane_backend.models.agent_instance_models # noqa: F401
import control_plane_backend.models.prompt_models # noqa: F401
…ompt-mapping-full-platform-team-config-export
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.

Finalize migration import/export: kea prompt mapping + full platform team-config export

2 participants