Skip to content

SCITT/SCRAPI: refactor to SCRAPI lifecycle, per-participant registration, storage backend#136

Open
howethomas wants to merge 4 commits intomainfrom
feature/scitt-scrapi-only
Open

SCITT/SCRAPI: refactor to SCRAPI lifecycle, per-participant registration, storage backend#136
howethomas wants to merge 4 commits intomainfrom
feature/scitt-scrapi-only

Conversation

@howethomas
Copy link
Contributor

Summary

Refactors the SCITT link from DataTrails to SCRAPI lifecycle registration, adds per-participant SCITT for portal queryability, fixes test mocks, and adds a SCITT storage backend. SCITT-only changes (no other consolidation stack).

Changes

1. Refactor SCITT link from DataTrails to SCRAPI lifecycle (7cf1acf)

  • Remove DataTrails-specific OIDC auth (client_id, client_secret, auth_url) and OIDC_Auth class.
  • Add direct SCRAPI calls to a SCRAPI-compatible transparency service (e.g. SCITTLEs): register_statement(scrapi_url, signed_statement) with sync (201) and async (303) handling, wait_for_entry_id() polling, get_receipt().
  • Config: scrapi_url, signing_key_path, issuer, key_id, vcon_operation, store_receipt.
  • Register vcon_created/vcon_enhanced lifecycle events per draft-howe-vcon-lifecycle; store COSE receipts as scitt_receipt analysis entries on the vCon.
  • New tests in server/links/scitt/tests/test_scitt.py.

2. Fix SCITT test mocks leaking to live SCITTLEs (d6f2daa)

  • Tests were hitting real SCITTLEs (~80s) because mocks were applied on server.links.scitt.* while the conserver loads links.scitt.*.
  • Fix: Patch submodule attributes on links.scitt.register_signed_statement and links.scitt.create_hashed_signed_statement; patch VconRedis on server.links.scitt.
  • Use non-routable test URL http://scrapi.test.invalid:9999 as safety net.
  • Test suite now runs in ~0.5s.

3. Per-participant SCITT and SCITT storage (06c797d)

  • Per-participant: Each party with a tel gets a separate SCITT entry with subject=tel:+number, enabling portal queries (e.g. WHERE subject = 'tel:+12026661834'). Falls back to vcon://{vcon_uuid} when no parties have tel. Receipts stored as array on vCon.
  • New server/storage/scitt/: Post-chain storage backend that registers per-participant SCITT entries. Options: scrapi_url, signing_key_path, issuer, key_id, operations (e.g. ["vcon_enhanced"]). Does not write receipts back to the vCon (avoids races with parallel storage). Transparency service is authoritative for receipts.
  • Link version bumped to 0.3.0.

Made with Cursor

howethomas and others added 4 commits March 4, 2026 18:16
Replace the DataTrails-specific OIDC authentication and registration
with generic SCRAPI calls to SCITTLEs (self-hosted transparency service).
Register vcon_created and vcon_enhanced lifecycle events per
draft-howe-vcon-lifecycle, storing COSE receipts as scitt_receipt
analysis entries on each vCon.

- Remove OIDC_Auth class and DataTrails-specific endpoints
- Add register_statement() with sync (201) and async (303) SCRAPI handling
- Add wait_for_entry_id() polling and get_receipt() for async flow
- Store receipt metadata (entry_id, vcon_operation, vcon_hash) on vCon
- Add 12 unit tests covering registration, polling, and link runner
- Document SCITT Lifecycle Registration in README

Co-Authored-By: Claude Opus 4.6 <[email protected]>
The conserver's __init__.py uses ``from links.scitt import ...`` which
registers submodules under ``links.scitt.*`` in sys.modules, while
pytest imports create a parallel ``server.links.scitt.*`` entry.
Patching the wrong module object meant time_sleep, requests.get, and
VconRedis mocks had no effect — tests hit real services and took 80s.

Fixes:
- Use ``links.scitt.register_signed_statement`` path for submodule
  attribute mocks (time_sleep, requests.get/post)
- Use ``links.scitt.create_hashed_signed_statement`` for COSE mocks
- Use ``server.links.scitt`` for __init__.py namespace names (VconRedis)
- Replace http://scittles:8000 with non-routable RFC 6761 URL
  (http://scrapi.test.invalid:9999) as safety net
- Test suite now runs in 0.5s instead of 80s

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Each vCon party with a tel field now gets a separate SCITT entry with
subject=tel:{number}, enabling customer data portal queries like
WHERE subject = 'tel:+12026661834'. Falls back to vcon:// subject
when no parties have tel. Link version bumped to 0.3.0.

Changes:
- links/scitt: Loop over parties, register per-participant, store
  receipt array instead of single receipt
- storage/scitt: New per-participant storage backend with same
  party iteration pattern
- Handle both dict and Party object access for tel field

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- mock_vcon fixture: set parties = [{"tel": "+15551234567"}] so
  (vcon.parties or []) is iterable and produces one subject
- test_run_uses_fallback_subject: set mock_vcon.parties = [] so
  fallback subject vcon:// is used
- Add subject to expected receipt body in test_run_registers_and_stores_receipt

Made-with: Cursor
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