Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 48 additions & 9 deletions docs/experiment-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,48 @@ New local exports retain source manifests/publications and typed mappings under
as an opaque nested evidence file. Nested archives are never executed or used
as native runtime state.

Configure the draft's model credentials, MCP connections and unresolved
dependencies locally, acknowledge configuration, then use normal publication.
Acknowledgement checks owned dataset/Skill/server dependencies without connecting
to external services. Normal publication resolves new local sampling/input
Open the imported experiment's editable draft. Its setup panel reports **Ready to
publish** or **Setup needed**, with links to affected canvas nodes. Select saved
destination provider connections and compatible custom MCP connections there;
multiple compatible connections always require an explicit selection. Missing
credentials can be configured in Profile. Refresh readiness after setup changes.
Normal publication validates the current draft and every factor alternative;
there is no acknowledgement checkbox and no return to the upload screen.
Incomplete drafts remain editable and source evidence remains inspectable.
Readiness checks saved records only; live connection tests are explicit actions.
Normal publication resolves new local sampling/input
snapshots; it does not rewrite the preserved source evidence. Resource names
receive an import-specific suffix to avoid collisions. Canvas node IDs remain
protocol-scoped labels because prompts may address them; new protocol ownership
creates a fresh identity namespace. Only typed resource references, selections
and bound factor alternatives are remapped. Opaque strings, scripts, prompts,
dataset values, observation values and provenance are not searched/replaced.

Imported content receives fresh owned identities, including imported MCP
requirement identities. Runtime bindings may reference authorized destination
system services or explicitly selected owned connections. These bindings are
recorded separately from source-to-local content mappings. New packages record
stable built-in service identities derived from shipped modules; automatic
matching requires a trusted system registration, the same service identity,
all recorded required tools and exactly one compatible destination. The additive
`service_identity` and `required_tool_names` requirement fields are supported in
schema 2; required tools include the union of factor alternatives and implicit
dataset/Script grants. Older requirements without a required-tool subset use
their recorded full tool list conservatively. Display
names and source owner IDs never establish compatibility or authorization.
Older packages without service identities require explicit selection. Destination
commands, URLs, environment and credentials remain untouched. Scalar MCP identity
factor alternatives become complete configurations so each selected identity
retains its matching destination runtime name. Opaque values remain unchanged.

Before downloading a prepared export, the dialog separates included dependencies,
destination connection requirements and missing/unresolved content. Incomplete
packages are labelled explicitly and retain actionable dependency diagnostics
(up to 100 in the summary; the full inventory remains in the package). Connection
requirements alone do not make content incomplete. The selected historical
publication remains authoritative; missing history never uses current content.
Use **Publish & prepare package** to download current draft changes instead.

### API

All routes below require the importing user's authentication:
Expand All @@ -210,9 +241,15 @@ All routes below require the importing user's authentication:
`GET .../{id}/source?path=publication/canvas.json` downloads one original file.
Omitting `path` re-exports the original source archive byte-for-byte.
`GET .../{id}/identities?offset=0&limit=50` pages durable typed provenance.
6. After configuring the editable draft, `POST .../{id}/configuration` with
`{"connections_configured":true,"dependencies_resolved":true}` acknowledges
local configuration. It does not publish or start execution.
6. `GET .../{id}/readiness` returns read-only readiness issues with `node_id`,
compatible authorized MCP candidates, and saved provider selections.
`POST .../{id}/connections` with `{"kind":"mcp","source_id":"source-uuid",
"destination_id":"destination-uuid"}` explicitly selects an existing
connection. Use `"kind":"provider"` and a provider key such as `"openai"`
as `source_id` to select that user's saved provider setting. These actions
never connect, test credentials, or invoke packaged code. Publish using the
normal protocol publication endpoint. The legacy `/configuration` endpoint
remains compatible but its timestamp does not unlock or gate publication.

`GET /api/experiment-package-imports?experiment_id={id}` finds an experiment's
source history; omitting the filter returns the newest 50 owned requests.
Expand Down Expand Up @@ -283,8 +320,10 @@ connection is invoked by inspection or reconstruction.
| Attributable durable output/artifact files | Exact source files with hashes and attempt attribution; re-exportable source evidence |
| Missing/excluded dependencies and unavailable history | Visible diagnostics and preserved inventories; no same-name substitution |

The PostgreSQL tests cover independent owners and both dataset modes, exact CSV
and binary Skill bytes, publication after acknowledgement, source re-export,
The PostgreSQL tests cover isolated source/destination product and resource
schemas, different owners/storage paths/credentials, both dataset modes, exact
CSV/split/binary Skill bytes, publication readiness, built-in compatibility and
ambiguity, explicit custom mapping, factor alternatives, source re-export,
ownership isolation and cross-database crash/retry/cancel boundaries. Archive
tests cover corruption, unsafe members, limits, compatibility and non-execution.
Native Motoro step/resume histories were never exported and cannot be restored.
53 changes: 53 additions & 0 deletions docs/experiment-portability-plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Experiment portability implementation

Branch: `fix/package-export-publication-join`; starting HEAD: `f27437d`.
Preserve existing ancestry and leave PR #56 (base `develop`) unmerged.

1. Add stable built-in service identities and capability-based destination matching.
Preserve destination connection settings; retain owned imported requirement IDs
and record destination runtime bindings separately as provenance.
2. Add explicit authorized destination connection selection for custom MCP and
model providers, including factor alternatives. Never execute packaged code,
import credentials, or run live connection tests during setup validation.
3. Replace acknowledgement with read-only readiness checks in publication;
surface node/resource issues and allow incomplete drafts to remain editable.
4. Show readiness and setup actions in the imported experiment and link completed
imports directly to that draft. Preserve source inspection and existing UI work.
5. Separate export contents, destination requirements, and missing content;
preserve historical fidelity and the publish-before-download option.
6. Add focused cross-installation coverage for connection matching, fresh owned
identities, factor alternatives, exact bytes, evidence, retry and readiness.

Verification: focused Python unit tests/lint and frontend tests/type checking.
Database integration uses only explicitly configured disposable PostgreSQL, never
application databases or application `.env` files. Obtain approval before starting
infrastructure, checks taking minutes, or browser automation.

Identity clarification for #70: imported content always receives fresh owned IDs.
Runtime bindings may reference authorized destination system services. Source IDs
and source-to-local mappings remain immutable provenance; destination commands,
environment and credentials are never replaced by archive data.

Implementation status: all six steps implemented. Readiness and destination
selection are available on the imported canvas; the legacy acknowledgement API
is retained only for compatibility. New schema-2 requirements carry stable
service identities and required-tool subsets. Legacy requirements require
explicit destination selection. Source provenance scopes reselection when
several requirements share one destination connection.

Verification (2026-11-11): disposable PostgreSQL 16.2, isolated source/destination
product/resource schemas and filesystem roots; full backend suite passed
2,137 tests (3 skipped; 14 statistical-validation tests deselected). Full frontend
suite passed 664 tests with two workers; default concurrency exposed an existing
metrics-autosave timing failure, which passed alone. Backend lint and frontend
type checks passed. Full mypy has 695 existing errors versus 697 at the starting
HEAD, with no new diagnostics; the four portability service modules pass focused
typing. The first full backend attempt had a launcher-relative scripts-path
failure, fixed in the disposable launcher before the successful full rerun.
Final focused checks passed 121 backend tests and 19 frontend tests, additionally
covering later provenance/reselection changes. `git diff --check` and local
documentation links passed. Implementation is recorded in the branch commit.

No application databases or application `.env` files were used. Browser
appearance and live provider/MCP behavior were not tested. All original commits
and the two previously unpushed commits remain; no push or merge was performed.
26 changes: 26 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@base-ui/react": "^1.7.0",
"@codemirror/lang-json": "^6.0.2",
"@codemirror/lang-python": "^6.2.1",
"@codemirror/theme-one-dark": "^6.1.3",
"@fontsource-variable/geist": "^5.3.0",
Expand All @@ -20,6 +21,7 @@
"@xyflow/react": "^12.11.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"jsonc-parser": "^3.3.1",
"lucide-react": "^1.30.0",
"react": "^19.2.8",
"react-dom": "^19.2.8",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ export const packageImportsApi = {
command: (id: string, command: 'confirm' | 'cancel' | 'retry') => request<PackageImport>(`${importBase}/${id}/${command}`, { method: 'POST' }),
files: (id: string, offset = 0) => request<{ items: PackageFile[]; next_offset: number | null }>(`${importBase}/${id}/files?offset=${offset}`),
source: (id: string, path?: string) => requestBlob(`${importBase}/${id}/source${path ? `?path=${encodeURIComponent(path)}` : ''}`),
configure: (id: string) => request<PackageImport>(`${importBase}/${id}/configuration`, { method: 'POST', body: { connections_configured: true, dependencies_resolved: true } }),
readiness: (id: string) => request<import('@/types/packageImports').ImportReadiness>(`${importBase}/${id}/readiness`),
selectConnection: (id: string, kind: 'mcp' | 'provider', sourceId: string, destinationId: string) => request<import('@/types/packageImports').ImportReadiness>(`${importBase}/${id}/connections`, { method: 'POST', body: { kind, source_id: sourceId, destination_id: destinationId } }),
}

export const authApi = {
Expand Down
Loading
Loading