# Arena owned draft requests and history

Implemented with production creation inactive. This is an Arena account workflow,
not a delegated partner write API. It does not mint, publish, sell or move value.
The separate [Core coordinator](../core/arena-drafts-v1/README.md) is privately
deployed with creation disabled. Its [native runtime evidence](../core/arena-drafts-v1/deployment.json)
records the initial inactive deployment. The later [database readiness check](../core/arena-drafts-v1/database-readiness.json)
confirms the existing canonical database binding and four empty recovery tables;
it does not establish personal/studio permission or issuance acceptance. The [Hybrid-ID provider](../hybrid-id/asset-consent-v1/provider-deployment.json) is
also deployed inactive. The [native Identity issuer and personal portal](../hybrid-id/asset-consent-v1/identity-deployment.json) are now deployed with gates disabled. Star Quest acceptance still needs source rollout; scoped configuration and real issuer/studio acceptance remain outstanding. Source contracts and actual activation are reported separately.

## Account API

`GET /api/collectibles/drafts` lists the signed-in owner's requests, newest first,
in pages of 20. `next_cursor` is the original UUID of the last item, or null.
Use `?before=<next_cursor>` for the next page. `?request_id=<original UUID>` reads
one owned request instead. Selectors are exclusive. Reads create no permission,
request, or upstream action. Unknown, foreign and malformed request IDs return 404.
Records survive brief discard, logout/relogin and a creation pause.

`POST /api/collectibles/drafts` requires the current Arena session, exact Origin,
JSON content type and `X-Arena-CSRF`. Maximum body: 512 bytes, exactly:

```json
{"action":"refresh","request_id":"<original UUID v4>"}
```

- `refresh`: ask Core for historical status only. No acceptance or creation.
- `advance`: explicitly create or recover the original exact draft request.
  This may accept permissions or create a canonical draft. New action gate must
  be enabled. The first start also requires an undiscarded owned brief.
- `cancel`: request cancellation before source acceptance/creation may have
  started. Core makes the authoritative decision. A timeout remains unconfirmed;
  refresh or retry cancellation. Explicitly continuing creation afterward is a
  separate owner choice and cannot reverse a cancellation Core already recorded.

A request must already have a private studio attachment to its original approved
review. The browser cannot submit native issuer identifiers, terms, grant IDs,
service origins or new creation UUIDs. Service authentication is app-scoped; Arena
checks current owner/session before transport and again before disclosing results.
Configuration is reread after transport. Five-second per-request throttle and a
90-second durable lease serialize overlapping attempts. Transport is bounded to
45 seconds; Core separately serializes and recovers the original request.

Responses include `configured` (private transport available) and
`creation_enabled` (local action gate), neither of which proves connected-service
acceptance. `requests` or `request` contains title, replay/brief references,
original request ID, attachment/start/observation UTC milliseconds and the last
redacted Core observation. It contains no private native identity, body, license
agreement or credential. `studio_attachment:true` is not rights approval;
`studio_permission_verified:false` deliberately distinguishes the attachment from
the later historical `source_permission_accepted` observation.

Only `creation_confirmed:true`, following canonical readback, exposes the asset
UUID and confirmation time. A draft is not a minted token, public listing, current
ownership attestation or chain finality. Mint, publish, purchase and value flags
remain false. A lost response preserves the original UUID, frozen approved
revision and exact terms. A later consumed review revision does not replace it.
History is encrypted in the existing private Arena database and has no cleanup TTL.

Errors: 400 malformed request, 401 no session, 403 CSRF/origin failure, 404 unknown
owned request or unconfirmed Core record, 409 incompatible/final action or changed
service configuration, 429 throttle/lease, 502 invalid coordinator result, 503
inactive/unavailable service or unknown transport result. Errors do not imply
cancellation, refund, failed creation or permission release.

## Private operator attachment

After the actual studio grant and explicit acceptance permit have been reviewed
and recorded on Star Quest, attach their reference to the exact approved Arena
request. This step records a reference; it neither approves rights nor contacts
Core. All permissions are still checked by the coordinator on the owner's action.
Never load fixture grants or infer issuer profiles from an alias or OIDC subject.

Use the existing private Arena auth environment, a mode-0600 regular JSON file
(maximum 2 KiB), and the packaged script:

```sh
node scripts/collectible-attach.mjs /absolute/private/reviewed-attachment.json
```

The exact fields are `request_id`, `proposal_digest`,
`canonical_request_sha256`, `revision` (approved revision), `grant_id` and
`grant_sha256`. UUIDs are lowercase v4; hashes lowercase SHA-256. Match the source
reviewed record's full-record digest, not a hash of redacted public grant terms.
The original approved review must be current, app-bound and owned by an active
brief when first attached. Exact retry is allowed; changed attachment is refused.
Neither secrets nor actual reviewed agreements belong in Git or public comments.
The script prints only the request ID and false permission/creation flags.

Back up the existing encrypted Arena auth database consistently, including WAL
state, with its existing storage key before rollout. The additive draft table and
owner/history index follow the existing Core SQLite migration pattern. No old
brief or review is rewritten. Discard clears brief content but retains the minimum
encrypted title/replay references, exact request commitments and observed history
needed to recover a previously started draft.

## Private configuration and activation

`ARENA_DRAFT_CONFIG` selects a mode-0600 regular JSON file, maximum 4 KiB, with
exactly `app_id`, `origin`, `secret` and `enabled`. Use Arena's actual registered
app ID, the operated canonical Core loopback origin (`http://127.0.0.1:<port>`),
a distinct 32–256-character coordinator secret, and `enabled:false` initially.
No default port, fallback key, browser token or public endpoint is selected. The
same app binding/key must be configured at the private Core coordinator. Redirects
are refused; requests sign original bytes using its documented HMAC domain.
Do not put this file or any Core configuration in the Sites review environment.

When absent or invalid, local history is still readable and no command is sent.
With transport configured and `enabled:false`, status reads and limited
cancellation can work; advance remains blocked. Before enabling: verify all native
migrations/backups/keys, actual personal issuer approval, exact studio permit,
original-request recovery after interruption, canonical creation/readback, and
real owner browser acceptance. Existing runtime configuration remains unchanged
by this website release. Funding and Stripe remain paused.

## Local service connections verified, creation still disabled

The [latest participant readiness record](../core/arena-drafts-v1/participant-readiness.json)
verifies separate local Arena/Identity credentials, the registered Arena app binding,
and reuse of the existing canonical signer. Signed history requests traverse the
actual services and return404 for an unknown original request; wrong keys and browser
headers are rejected. This establishes transport, not personal/studio permission.
The private runtime also fixes an actual database-owner lifetime error; its native
canary and95 isolated tests passed. Creation, consent and collection-read gates
remain disabled. Star Quest acceptance deployment/key, real personal issuer and
collection acceptance, an explicit studio permit and original-request creation/
readback/recovery acceptance remain. No grant, consent or asset was created; only
transport nonce/clock records were written during these checks. Earlier deployment
and database evidence are historical checkpoints. Funding and value movement stay paused.
