# Optional file logging after the first action

This isolated companion starts from the **unchanged source** of `try-answerup/01-first-action/src/index.mjs` inside the selected `@answerup/generic-http-reference@0.2.0-preview.4` archive, then adds a small host-owned writer. The original archive and selected distribution are not changed. The executable still uses actual Actions `0.2.0-preview.8` (with Runtime `0.2.0-preview.5` and Core `1.0.0-rc.1`) against a separate local HTTP business-system fixture.

Save this README, `package.json`, `src/index.mjs`, `src/diagnostics.mjs` and `test/logging.test.mjs` together using the paths shown. From this directory with Node 22 or newer, install the exact selected archives and run the example. Manual checksum verification against the trusted manifest is optional; if you check and find a mismatch, download a fresh copy before use. Replace `/absolute/received-archives` with your own received-archives directory:

```sh
cd /path/to/optional-file-logging
npm install --ignore-scripts --offline --no-save \
  /absolute/received-archives/answerup-core-1.0.0-rc.1.tgz \
  /absolute/received-archives/answerup-runtime-0.2.0-preview.5.tgz \
  /absolute/received-archives/answerup-actions-0.2.0-preview.8.tgz
npm run demo
npm test
```

Optional: from the archive folder, compare files with the trusted manifest. Missing checksum tooling does not prevent running the example. See [checksum guidance](/package-access#checksums) for PowerShell, Linux and macOS.

```sh
cd /absolute/received-archives
sha256sum -c MANIFEST.sha256
```

Protected Portal downloads are enabled for authorized participants after identity, invitation, agreement and active entitlement checks; the files above are public example source, not SDK archives. `evidence/run/execution.jsonl` contains one JSON observation per result boundary. `evidence/run/execution.log` renders the **same observations** as short lines. The initial `UNKNOWN` withholds a customer confirmation. A later verifier-only read yields `COMMITTED` / `PRESENT`; the saved request and returned permission allow a bounded confirmation. The provider POST count for this attempted effect stays at one. The unchanged first-action cases also check same-request replay, changed-input conflict, refusal and claim mismatch.

`src/diagnostics.mjs` selects only result kind, lifecycle state, exact SDK effect-truth and claim enums, whether dispatch occurred, four per-run keyed opaque identity aliases, a host report of whether confirmation was emitted, and a host POST count. The host's existing renderer still makes the claim decision; the logger only observes it. Neither file contains the original request, customer wording, prompts, provider responses, verifier payloads, credentials or whole SDK objects. Identity aliases are stable **within this run only**. Restrict log access and retention like any other operational record. Two file appends are not an atomic transaction or a recovery store.

Your existing log shipper can tail `execution.jsonl` or ingest each parsed line into your current observability system. Preserve the schema and provenance labels, apply your normal access/retention rules, and avoid using a log line as proof of provider effect truth. This example does not call a hosted AnswerUp service or require Trace.

**Trace is optional.** If you want to inspect this execution in Trace Local, separately capture each live result with the selected Trace Local `actionsSnapshot()` helper *during* execution, retain host-reported read/admission/claim evidence, and assemble the documented `answerup-local-trace/1` file. Do not infer those snapshots from later logs or pass an Actions result to `runtime.project()`. This companion intentionally does not export Trace JSON or use the declared but unimplemented Actions `TraceSink.append` option.

Provenance: selected distribution manifest SHA-256 `bcf9b7864818c0e851de9c051d9548f8bf0a0b01a4c310fed68b862f91e6d1ff`; Generic HTTP archive SHA-256 `7a95340d0cb02dc2c45ddb2f3a9a1914022cc65e8940845a723e9620fc015708`.
