Files
marqdo/public/features/21-persistence.mq.md
T
cflmy 9331af78e2 release(2.8.0): 合入 CHANGELOG/README/发版说明/skills prove 任务;CI 链接指向 doc/releases
- CHANGELOG.md:v2.8.0 条目(中英双语);
- README.md:版本行 2.7.1→2.8.0 + 愿景第 6 条(知识可证明);
- doc/releases/v2.8.0.md:双语发版说明(亮点/用法/已知限制);
- skills/marqdo-dev/index.mq.md:新增 prove 任务(路径/目录模式/
  require_lean/json;参数用 + 行声明升参,check 与 narrative-ratio 通过);
- 设计文档 §12.5 标记已合入;发版链接统一指向 doc/releases/v2.8.0.md。
2026-11-18 10:29:26 +08:00

59 lines
2.7 KiB
Markdown
Executable File

---
markup: occlusion
title: Persist an actual formatting result through native writeback
import:
guide: ../../doc/library-development.mq.md
formatter: ../../examples/foreign-native-report/index.mq.md
writeback: lib/writeback.mq.md
result: lib/result.mq.md
---
The source remains the manual for this file operation. Its callable main computes
native data, crosses a genuine formatting boundary, checks the result and records
only the successful value. Invoke with process.exec,fs.write and --fs-root .;
static View uses the same source and embeds its actual observed output.
## main
| 返回 | 类型 | 说明 |
|---|---|---|
| result | map | Result with the actual string recorded in this source's total slot |
A static View snapshot embeds executed output in HTML. Explicit writeback
instead keeps a selected value in this source file's named slot. A caller should
choose that file effect deliberately: this main needs process.exec and fs.write,
with --fs-root pointing at the repository. Reading the page alone does not write.
The amount is computed by the native programming guide, then the shared example
uses Node Intl only for locale-aware currency formatting. Its persistent kernel
is closed before this page receives the result. No Python process, foreign file
writer or duplicated arithmetic participates. The exact returned string is then
passed to lib/writeback, so the file operation remains a Marqdo capability.
The total slot below is actual recorded output. Repeated execution replaces that
same key rather than appending another slot. An unavailable interpreter or failed
formatting returns before the write; native write-policy or IO faults retain
their diagnostics. Writeback persists this selected ordinary value, not a live
kernel or arbitrary process memory. Review source changes with the repository's
normal diff workflow. For published docs use a static snapshot unless a living
auditable source result is intended, as it explicitly is in this demonstration.
We **amount = [Compute the native amount](guide.计算金额(单价=190, 数量=5))**.
`report` =
| total | average |
|---|---|
| `amount` | `amount` |
We **formatted = [Use only the actual Intl presentation gap](formatter.format_summary(report=`report`))**.
1. not access(`formatted`, "ok")
Return *formatted* before writing a result slot.
We **text = [Select the actual formatter output](access(access(formatted, "value"), "total"))**.
We **written = [Persist this actual output through Marqdo's native writeback](writeback.record(value=`text`, key="total"))**.
<!-- marqdo-out total
CN¥950.00
-->
After the explicit native file operation, return *[The persisted formatted value](result.ok(value=`text`))*.