Repository navigation
Description
Parent
FILE16-01 #396, under S16 #392.
Model tier
Frontier: byte custody, policy/disclosure lineage, exact effects, restart/recovery and client publication cross protected service boundaries.
Context to read
AGENTS.md, CONTEXT.md, docs/agents/workflow.md, docs/specs/S16-rakazo-experience.md, docs/design/S16-rakazo-experience.md, ADRs 0064/0074/0075/0076, docs/contracts/s16-client-v1.md and docs/contracts/s16-files-v1.md. Prerequisites #393/#394/#395 are implemented in stacked draft PRs #398/#399, not yet merged.
Deliverable
An authenticated owner uses the explicit React /s16 client to attach supported UTF-8 text/Markdown/CSV, request a file-derived brief and preview/download the exact committed immutable result. Preserve the larger document/image scope of #396.
Implementation steps
- Implement protected src/s16/files/{types,store,workflow}.ts with opaque IDs, exact byte/hash/type bounds, pinned resource/source identity and durable cancellation/expiry/restart states.
- Add s16-conversation/v2 rather than extending text v1; input-only acceptance starts no model/work.
- Register actual POLICY reads and s16_files artifact_create actions; stamp distinct private input sources before work-model sends; intersect TEAM read/write and existing owner recipient/policy gates.
- Stage immutable candidates before CHAT commits result/artifact references. Require actual complete selected-input read coverage. Guard every projection/download against current producer/source lineage.
- Implement authored React src/s16/web/ over the shared client: real pick/paste/drop/upload states, recover original sends, escaped previews, fresh verified downloads and mobile/keyboard interactions.
- Reuse the reviewed pinned Rakazo classifier/card at narrow seams; retain licenses, notices, changed-file headers and immutable provenance in source/releases.
- Keep file work out of MEM/later interpretation until precise cross-request ancestry lands; advertise this limit and unsupported PDF/images honestly.
Acceptance criteria
- Desktop/mobile client uploads actual bytes, reads them via an authorized tool, commits a real output and downloads matching SHA-256 after refresh/restart.
- Input-only sends cause no inference/work; duplicates recover original receipts/artifacts; changed bodies and cross-conversation references refuse.
- Type/signature/UTF-8/size/hash/count/capacity failures and cancellation never leave runnable partial bytes.
- Unread inputs and uncommitted candidates cannot certify delivery or download.
- Distinct private-file recipient approvals, current resource/write ceilings and withdrawal fence model/tool/result/download paths.
- Thai/English UI, keyboard/mobile preview focus, escaped active text and server capability/limit binding pass actual browser tests.
- S14/legacy/default/installed owner policies remain unchanged; release includes all source/dependency notices.
Tests and evidence
- tests/s16-file-store.test.ts: streaming, signatures, integrity, cancellation, expiry, exact identities and restart.
- tests/s16-files-composed.test.ts: production composition with scripted models, POLICY read/action, immutable bytes, original-send recovery, withdrawal, candidate withholding and recipient hold.
- tests/s16-files.browser.test.ts: actual React bundle in headless Chromium at 1440/390 widths, pick/send/preview/download/reload/withdrawal, script escaping and keyboard focus.
- Relevant CHAT/MEM/shared-client/i18n/package regressions. No live model/account/host/device proof is inferred.
Requirements
FR-04/07/15/16/17/18/22/31/35/38/42; NFR-02/05/06/07/08/10/11/12/14; partial S16-AC02/03/04.
Blocked by
#393 baseline, #394 authored interaction and #395 shared API. Stack implementation over #398/#399; no ready-for-agent or merged-status claim.
Contracts used/delivered
s16-client-capabilities/v1, s16-conversation/v2, s16-file-upload/v1, s16-file-receipt/v1, s16-file-artifact/v1; existing POLICY/DATA15/TEAM and supported Schway host seams. ADR 0076 records the exact staged-object protocol and deliberate file-memory fence.
Out of scope
PDF/images, cross-request file memory, artifact editing/revisions/global library, live steering/native clients, live host activation or private S14/legacy migration. These remain required under #396 and the S16 roadmap.
Do not
Do not close #396/parent parity from text acceptance; execute parsers in the protected service; import legacy project/topic authority or a second runtime/auth backend; silently widen installed rules; auto-retry effects; omit upstream notices; add model attribution; use implement-parallel; or merge the PR.
Definition of done
bun install --frozen-lockfile, bun run typecheck, relevant deterministic tests, JIT_S16_BROWSER_TESTS=1 bun test tests/s16-files.browser.test.ts --timeout 30000 and git diff --check pass. PR Closes this exact text slice, Refs #396/#392, records tested head/contracts/limitations and stays unmerged.
Implementation evidence
Draft PR #403, head 28401fe76212710a6f42c7767e5bebf78e331545, stacked on #399/#398. Implementation checks above are recorded; merge and owner-host acceptance remain separate.
Frozen install, typecheck and whitespace checks passed. Focused shared-client/file tests passed (33); the final CHAT/MEM/file selection passed (80, including Thai requests, v1 scope preservation, format fencing and withdrawal). Real headless Chromium passed 3 tests (English desktop, Thai mobile, and unavailable WebCrypto), including response loss, late private-snapshot fencing, preview/download/reload/withdrawal and keyboard focus.
The full repository run recorded 4,432 passes, 22 opt-in skips and one stale package-fixture failure at the runtime commit. The fixture omitted the new license/notice source inputs; it was corrected and the entire package suite then passed 154 tests, including original license-byte preservation and release permissions. Follow-up product changes (browser capability guard and the v2-only Thai file grammar) were covered by the final browser and CHAT/MEM checks. No live host/provider/VM/device evidence is claimed. #396/#392 remain open for required remaining work, including #401/#402 and the S16 graph.
Complete backlog publication — 2026-11-05
The two adapted modules, immutable provenance manifest and release notices are existing draft evidence. #405 extends their reusable import/update/release validation; it must not duplicate the implemented attribution. #407/#433 cover artifact revisions and bounded working-computer inputs beyond this slice.
Activity