Worked Examples
Apply application handoffs — Workspace
Transfer governed research objects between Library, Research, Lab, and Workspace while preserving source identity, revisions, ownership, permissions, and scientific provenance. Includes GitHub workflows, secure handoff contracts, and reproducible macOS/Linux tests.
Application: Workspace
Cross-application scope: Library, Research, Lab, and Workspace
Article type: Practical workflow and developer verification guide
Verification status: Synthetic local tests passed; deployed integration not verified
Estimated reading time: 18–23 minutes
Example requirements: Python 3.11+, a macOS or Linux terminal; optional Git and GitHub CLI
1. Purpose and outcome
An application handoff links a governed research object in one service to an authorized workflow in another. It must preserve the meaning and identity of the source object—not merely copy a filename, paste a URL, or generate a successful HTTP response. A Library dataset might be referenced by a Workspace project; a Lab computation may inform a Research output; a reviewed Workspace report may be registered as a Library object. Each action has different rights, state, and provenance consequences.
The primary acceptance condition is: the destination can resolve only the approved source revision, with the correct provenance, rights, organization, recipient, and ownership decisions; the handoff does not silently publish data or widen access.
2. What counts as a handoff—and what does not
| Action | Expected handling | Not implied |
|---|---|---|
| Reference a Library dataset from Workspace | Pin the source object ID, revision, digest, usage rights, and source resolver | Transfer of dataset ownership or blanket download rights |
| Pass a Lab result to Research | Retain inputs, method and environment versions, computation provenance, and reviewer context | Scientific endorsement or publication approval |
| Attach a Research object to Workspace | Check appropriate draft/public restrictions and object-level permissions | Permission to publish a private Research object |
| Register a Workspace output with Library | Create an authorized destination registration linked to the immutable source revision | Automatic public accessibility, license change, or rights transfer |
In this guide, the runnable demo creates a reference-only destination projection. It does not move production files, invoke real service connectors, or perform publication.
3. Responsibility and trust boundaries
Assign each responsibility to a service owner before integration. The source application owns canonical object identity and versioned bytes; the destination owns its accepted reference or registration; the authorization layer decides whether the caller and recipient can act; a governance layer interprets license, consent, embargo, retention, and publication restrictions; an evidence/audit layer records the decision and immutable identifiers. Do not let the receiving application infer authority solely from a source ID or a client-supplied role.
Authenticated requester
|
v
Source object + revision --> source rights and checksum
| |
+------ scoped decision-+
|
v
Prepared handoff manifest
|
recipient authorization + revalidation
|
v
Accepted destination reference
|
Audit receipt
Public publication = separate reviewed workflow
Before integration, inspect the actual repositories and deployment configuration to establish whether this path is implemented, staged, disabled, or absent. Do not infer support from a menu label.
4. Identify and freeze the source revision
A handoff needs at least an organization ID, source application, canonical object ID, immutable revision ID, and a checksum of the exact referenced content. For a source object O, revision r, and canonicalized byte representation B(O,r), the demo records:
digest = SHA-256(B(O, r))
A digest detects changes in the referenced bytes; it does not prove who created them, whether the method was sound, or whether publication is authorized. If a new revision appears after preparation, either reject acceptance or follow an explicitly documented supersession protocol. Never silently rebind the handoff to the latest revision.
5. Define a reference-only handoff envelope
The following is an illustrative contract, not a deployed Sustainable Catalyst schema. It intentionally excludes payload bytes, service credentials, private ACLs, and unpublished content.
{
"schema": "sc-handoff-demo/1",
"organization_id": "org-demo",
"source": {
"application": "Library",
"object_id": "library-dataset",
"revision": "rev-02",
"sha256": "<64-character SHA-256 digest>"
},
"destination_application": "Workspace",
"recipient": "bob",
"publication_state": "unchanged",
"provenance": {
"wasDerivedFrom": "urn:sc-demo:org-demo:library-dataset:rev-02"
}
}
The provenance label illustrates the prov:wasDerivedFrom concept in the W3C PROV model. It is not a claim of full PROV-O serialization or RO-Crate conformance. If RO-Crate packaging is adopted, validate its separate metadata requirements and context rather than simply renaming this object.
6. Enforce source rights, ownership, and recipient scope
Authorizing a handoff requires a conjunction of independent checks: the requester may read the specified source; the requester may create a destination reference; the named recipient may receive that reference; the source’s usage rights permit the target application and purpose; any consent, license, embargo, project-scoping, and legal-hold conditions are satisfied; the exact revision remains valid. Recheck access when the recipient accepts, not only when the requester prepares.
The synthetic example uses explicit allowlists in fixtures/seed.json. These are disposable fixtures, not credentials or an authoritative authorization model. A production service must authenticate actor identity at its trust boundary and reject attempts to impersonate actors supplied in request bodies.
7. Separate draft, reviewed, accepted, and published states
An internal handoff is not a public release. A draft object may remain internal after a governed handoff; a reviewed object may still have restricted source materials; and an accepted destination reference does not establish that a scientific claim has been verified. Keep handoff state separate from scientific-review state and publication state. In the demo, handoff state transitions from prepared to accepted, while publication_state remains unchanged.
8. Download and inspect the developer example
Use the companion ZIP associated with this article. Extract it into a disposable directory named sc_workspace_application_handoffs_demo. The ZIP contains handoffs.py, failure_matrix.py, fixtures/seed.json, tests/, CONTRACTS.md, README.md, a GitHub Actions example, and local execution evidence. It requires only Python’s standard library. The examples use synthetic research objects, so no Sustainable Catalyst credentials are needed.
9. macOS Terminal setup
On macOS, open Terminal. Install Python 3.11 or newer from Python.org or via Homebrew if it is not already available. Do not run example commands from an unrelated working directory or reuse the location of a production research dataset.
python3 --version
cd ~/Downloads
unzip SC_KB_Workspace_Application_Handoffs_Developer_Example.zip
cd sc_workspace_application_handoffs_demo
python3 -m unittest discover -s tests -v
python3 failure_matrix.py
If python3 is unavailable, install a supported interpreter before proceeding. The shell commands use portable POSIX syntax and do not depend on macOS-only utilities.
10. Linux Terminal setup
On Ubuntu/Debian, install Python and unzip with the platform’s package manager if needed. Other distributions should use their equivalent package-management commands.
sudo apt-get update
sudo apt-get install -y python3 unzip
python3 --version
cd ~/Downloads
unzip SC_KB_Workspace_Application_Handoffs_Developer_Example.zip
cd sc_workspace_application_handoffs_demo
python3 -m unittest discover -s tests -v
python3 failure_matrix.py
Do not run the example as root. The synthetic SQLite database will be created under the extracted directory’s out/ path.
11. Initialize disposable handoff state
Run the following inside the extracted project directory. The seed defines synthetic objects from Library, Research, Lab, and Workspace plus illustrative organization-scoped permissions. Seeding refuses to overwrite an existing populated database.
mkdir -p out
python3 handoffs.py seed \
--db out/handoffs.sqlite \
--fixture fixtures/seed.json
Inspect fixtures/seed.json before executing. It includes a nontransferable private note and an object belonging to another synthetic organization for negative tests.
12. Prepare a Library-to-Workspace handoff
python3 handoffs.py prepare \
--db out/handoffs.sqlite \
--org org-demo \
--object-id library-dataset \
--revision rev-02 \
--source-app Library \
--dest-app Workspace \
--actor alice \
--recipient bob \
--key example-handoff
A successful response reports state: prepared and a manifest with the pinned source ID, revision and checksum. Verify that no destination projection has been accepted yet. The source remains in Library; no payload bytes or private metadata are copied into the handoff envelope.
13. Accept and verify in a fresh process
The demonstration derives a deterministic handoff ID from the synthetic organization and idempotency key. This is a demo-specific identifier strategy and should not be mistaken for the deployed platform’s IDs.
HANDOFF_ID="$(python3 -c 'import hashlib; print("ho-" + hashlib.sha256(b"org-demo\0example-handoff").hexdigest()[:24])')"
python3 handoffs.py accept \
--db out/handoffs.sqlite \
--org org-demo \
--handoff-id "$HANDOFF_ID" \
--actor bob
python3 handoffs.py verify \
--db out/handoffs.sqlite
The expected result for a fresh demonstration is ok: true, one accepted destination reference, and two audit events (prepare and accept). Each CLI invocation starts a new Python process, demonstrating persisted database state. It does not simulate real SSO sessions or live service authentication.
14. Try alternate Library, Research, Lab, and Workspace routes
The fixture explicitly permits different target applications for different source objects. For example, a Lab output may be prepared for Research:
python3 handoffs.py prepare \
--db out/handoffs.sqlite \
--org org-demo \
--object-id lab-output \
--revision rev-03 \
--source-app Lab \
--dest-app Research \
--actor alice \
--recipient bob \
--key lab-to-research
Experiment with the approved routes documented in README.md. A change of destination is a new governance decision and should not be smuggled into a previously used idempotency key.
15. Verify idempotency and safe retries
Repeat the exact preparation call from Section 12. It should return the same handoff with replayed: true; it should not create an extra destination object or audit event. Reuse the key with another recipient and the example must reject the request with IDEMPOTENCY_CONFLICT. Never automatically retry a transfer or publication side effect merely because a client timed out; first establish whether the original operation committed and whether the endpoint has a documented idempotency contract.
16. Run the negative and failure-injection tests
python3 -m unittest discover -s tests -v
python3 failure_matrix.py
The test suite checks cross-organization access, wrong recipient, missing rights, unsupported applications, stale and withdrawn revisions, tampered source bytes, modified manifests, revoked recipient permission, and duplicate-request conflicts. The failure matrix deliberately exercises 21 rejected operations. Each scenario uses a fresh disposable database so a negative case cannot contaminate another scenario.
17. Recognize failure codes and recover without widening access
| Failure | Likely cause | Safe operator action |
|---|---|---|
NOT_FOUND |
Object or requested revision absent, or intentionally concealed | Check authorized source IDs and organization scope; do not enumerate private objects |
DENIED |
Requester or recipient lacks the required application permission | Check rights with the accountable owner; never bypass the policy gate |
RIGHTS |
Source rights exclude the requested destination | Seek a revised rights decision; do not relabel the destination |
STALE_REVISION |
Source changed after selection or preparation | Re-evaluate the latest object and obtain a new approved handoff request |
IDEMPOTENCY_CONFLICT |
Same key has different request parameters | Review the original receipt; do not overwrite or silently replay |
INTEGRITY |
Content or manifest diverges from pinned identity | Quarantine the handoff, preserve evidence, and compare against authoritative source |
These codes belong to the example. In production, map actual platform errors to documented, sanitized HTTP problem details under RFC 9457.
18. Handle interrupted delivery and distributed failure
The example uses a single local SQLite database so it can demonstrate atomic preparation and acceptance. Real application handoffs commonly cross multiple services and databases; a local transaction cannot atomically commit across them. A production design needs durable delivery, a transactional outbox or equivalent, deduplication at each consumer, bounded retry policies, cancellation, reconciliation, and an operator-visible state machine. An interrupted or timed-out response is not proof of failure or success. Reconcile the last durable request receipt before retrying.
Compensation should revoke or supersede an unaccepted destination reference where policy permits, not erase source audit records or modify the original scientific artifact. A previously accepted published object requires a separate correction or withdrawal workflow.
19. Preserve research provenance and scientific meaning
At minimum, preserve the source object and revision ID, checksum, declared owner, provenance relation, method/software version where relevant, contributor or service responsibility, permitted processing history, and explicit exclusions. Where results depend on several inputs, require the complete, authorized provenance closure before accepting claims of reproducibility. Do not infer that a hash-valid transfer proves that the computation, analysis or research interpretation was scientifically correct.
A substantive Research or Lab handoff should be accompanied by scientific validation records: test design, controlled inputs, computational method and environment, uncertainty, independent review, and traceable acceptance evidence.
20. GitHub development and automated testing
Place the synthetic example in a dedicated reviewed repository or branch; do not push real credentials or private research fixtures. With Git and the optional GitHub CLI installed:
git init
git add .
git commit -m "Add reproducible synthetic app handoff tests"
gh auth status
# Replace OWNER/REPOSITORY with your own repository name:
gh repo create OWNER/REPOSITORY --private --source=. --remote=origin --push
The included .github/workflows/python-tests.yml runs the unit suite and an end-to-end seed, prepare, accept and verify sequence on Ubuntu and macOS, with Python 3.11 and 3.13. This is a supplied workflow, not evidence that GitHub-hosted CI has run. Check the actual GitHub Actions logs, commit SHA and test artifacts before claiming CI validation.
21. Inspect actual platform source before adopting the workflow
Once you have authorized access to the platform repositories, identify the real source owners and application handoff endpoints. From an approved local clone, the following read-only commands help locate likely implementation contracts:
git status --short
git rev-parse HEAD
git grep -n -i -E 'handoff|provenance|library|workspace' -- '*.py' '*.ts' '*.js' '*.json' || true
git ls-files '*openapi*' '*migration*' '*schema*'
Record repository, exact commit, paths, schemas and deployment version. If no implementation or staging evidence is found, retain the proposed-design label rather than treating the demo as a production connector.
22. Acceptance criteria and evidence receipt
A reviewable staging acceptance packet should contain the source revision ID and digest, destination identity and project scope, request and recipient permissions, rights decision, allowlisted manifest, audit correlation ID, idempotency outcome, and final projection state. At least one positive and one negative case are required per meaningful trust boundary. Store the controlled evidence outside public logs where it contains sensitive identifiers.
| Criterion | Positive case | Negative case |
|---|---|---|
| Identity and tenant boundary | Authorized organization and actor can prepare | Wrong organization or actor is denied |
| Rights boundary | Explicitly permitted target receives reference | Restricted object or target is rejected |
| Revision integrity | Pinned digest matches source | Stale or tampered source fails |
| Recipient control | Named recipient accepts | Revoked or alternate recipient cannot accept |
| Idempotency | Identical retry returns prior receipt | Changed request with same key conflicts |
| Publication | Internal projection is created | No draft becomes public without a separate approval |
23. Reproduce and review local test results
The companion package was tested using disposable synthetic identities and storage: 49/49 Python unit tests and 21/21 deliberate failure scenarios passed locally in the preparation environment. The included evidence/unit-tests.log and evidence/failure-matrix.json are local execution records, not independent attestation. Replay both commands on a clean extraction and compare results before quoting them in another environment. No macOS run, GitHub-hosted CI run, production connector, or independent scientific review has been performed for this example.
24. Operational and security cautions
Use disposable data in tutorials. Do not mount production volumes, connect to real organization identity services, or paste access tokens into command lines, examples, issue reports, or GitHub Actions output. A production handoff must account for encryption, credential lifecycle, retention, legal hold, revocation, audit access, data residency, source deletion, and recovery across independently deployed applications. A hash-linked audit table in a local database detects some accidental modification; it is not a cryptographic signature or a tamper-proof journal.
25. Technical references
- W3C. PROV-O: The PROV Ontology. Model of entities, activities, agents and derivation relationships.
- Research Object Crate community. RO-Crate Metadata Specification 1.2. Research packaging and structured metadata interoperability.
- OWASP. API1:2023 Broken Object Level Authorization. Object-by-object authorization and horizontal access risks.
- IETF. RFC 9457: Problem Details for HTTP APIs. Machine-readable error response format.
- SQLite. SQL Transaction. Atomic commit and rollback semantics used by the local demonstration.
- Python Software Foundation. hashlib documentation. SHA-256 hashing interfaces.
- GitHub. Building and testing Python. Official CI workflow guidance.
- GitHub. gh repo create reference. Repository creation from a local working tree.
Developer verification boundary: Before this article can be marked production verified, attach inspected source commits, actual interface contracts, authorization and rights tests, staging job receipts, durable replay/rollback evidence, independent reviewer acceptance, and a controlled release identifier for each relevant application.
