# Shared request DValue ## Changes - `src/wasm/core.cpp` creates one request DValue on the first handler call. It preserves the root pointer until request reset. - The core refreshes `props`, `call`, `unit`, `out.status`, `out.headers`, `out.cookies`, `session`, `websocket`, and `connection` before each handler. - The core preserves all application keys. It restores the caller's `props` and `unit` values after nested handler calls. - The core reads the shared `out` value after each handler. It applies status, headers, cookies, and the compatible `buffer` field. - The core removed the handler input release hook and per-frame input tracking. Request reset frees the shared handle and payload. - `src/capy/compiler.cpp` imports `bearer_handler_input_dval`. The handler prologue passes its borrowed pointer without a retain or release. - `src/wasm/abi.h` sets the core ABI to 34 and the compiler unit ABI to 36. - `site/tests/capy-request-writeback.capy` proves shared application keys and nested response writes. The entry writes `request.user`. The component reads it and writes `request.pagefacts`. The entry reads that key after the call. - `scripts/test_capy_phase1.sh` checks the shared values, nested response changes, restored props, and the new borrowed-parameter ARC counts. - `scripts/test_capy_native_compiler.cpp` and `scripts/test_capy_native.sh` check the new import. - `scripts/capy_artifact_golden.sha256` records the inspected ABI-wide artifact changes. - `docs/capy-language.md` specifies the shared request exception and the Bearer-owned keys. - The request type page, guides 9 and 10, handler pages, unit-call page, and context API pages now describe request keys. - The `unit_context()` and `unit_context_set()` pages mark both APIs as deprecated. They name application request keys as the replacement. - `skills/capy-bearer/SKILL.md` now teaches shared request keys. The installed skill copy also matches it. - `scripts/generate_capy_docs.py` regenerated the affected files under `site/doc/content/` and the documentation search index. Concurrent work also changed `docs/deploy.md` and files under `editors/vscode/`. This task did not edit those source files. ## Measurement The prior recorded result was 1986 microseconds per component call. The new result was 934.3 microseconds per call. The benchmark made 1,000 component calls in one CLI request. The request contained a 200-key `request.application` map. The component read key 199 on each call. Fifteen samples ranged from 903.6 to 1041.4 microseconds per call. The median improved by 53 percent. ## Gates Passed: - `bash scripts/build_core_wasm.sh` - `bash scripts/build_linux.sh` - `bash scripts/build_capy.sh` - `python3 scripts/generate_capy_doc_signatures.py --capyc bin/capyc` - `python3 scripts/generate_capy_docs.py` - `bash scripts/test_capy_native.sh` - `bash scripts/test_capy_artifact_golden.sh` after diff inspection - `bash scripts/test_capy_artifact_golden.sh --write` - `bash scripts/test_capy_artifact_golden.sh` - `bash scripts/test_capy_reproducible_artifact.sh` - `bin/capyc --check site/` - `bin/capyc --format --check site/` - Bearer restart and `scripts/systemd/wait-ready.sh` - `bash scripts/test_capy_phase1.sh` - `bash scripts/test_capy_guide_examples.sh` - `python3 scripts/check_capy_doc_examples.py` - `python3 scripts/test_capy_doc_generators.py` - `bash scripts/test_capy_reference.sh` - The isolated native CLI runner group - `bash scripts/test_wasm_core_smoke.sh` Phase 1 failed while the fixture still expected the old header value. The final run passed after the fixture checked the component's header value. ## Not completed - `scripts/run_cli_tests.sh` does not expose the requested `http`, `site`, `security`, `component`, and `task` groups separately. Its `--list` output contains only `native`. I ran that isolated group. I did not run the complete service-changing suite. - The ludum.live clone failed. Deploy key 31 on this host cannot read `udo/ludum.live`. No ludum source was available for `capyc --check --source-root`. No commit or push was made. ## Live value representation The shared request handle now points directly to its core-heap `DValue`. Refresh and writeback update that object in place. They do not pass request state through BRRB. Request reset deletes the value and frees its 28-byte handle. The 1,000-call, 200-key component benchmark now has a median of 39,524 microseconds per request, or 39.5 microseconds per call. Five samples ranged from 34,070 to 42,779 microseconds per request. The previous live-request result was 934.3 microseconds per call.