cflmy
1e3f56d8e5
docs(knowledge): document stable theorem claim identity and proof-declaration references
2026-11-18 12:03:48 +08:00
cflmy
f4059f57e4
docs(knowledge): specify stable anchor links and exact proof receipt trust boundaries
2026-11-18 11:59:03 +08:00
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
cflmy
4fae71342d
prove: P3 — --all 目录模式、T4 差分一致性、库语义对齐、2.8.0 收口
...
- main.rs:prove --all/--max-files(递归收集,目录不带 --all 拒绝;
聚合 JSON kind=prove-all,整体状态差者胜);--fault-inject offline-claim
(调试分歧注入,A3 护栏验证入口)
- tests/conformance.rs:T4 差分一致性——5 例纯函数语料(算术/中文标识符/
分支比较/字符串拼接/i64 边界)解释器求值 == Lean example(simp+try rfl);
B4 result.ok 结构字段 access 两侧一致
- MarqdoProof.lean:mqAdd 补文本拼接与 num 混合(与解释器 eval_binary(Add)
对齐——T4 实测抓出的真分歧);mqDisplay 显示串(标量精确,容器一层,
有意简化并记录)
- 文档:design §12 P3 落地 + §12.4 延期理由(foreach/assume-guarantee/T3
→ 2.9)+ §12.5 权限受限待合入清单;roadmap 状态 → 已实施;
教程 §13.8 prove 章节;skills/marqdo/reference.md 定理表;
doc/verification/skill-proof-theory.md(库形式化说明);
doc/roadmap/prove-release-2.8.0.md(双语发版说明 + CHANGELOG/README/
skills/marqdo-dev prove 任务待合入原文)
- Cargo.toml/Cargo.lock:2.7.1 → 2.8.0
实测:全量 516 通过(仅 2 个已记录环境基线失败);prove 23 + prove_lean 10
+ corpus 40 夹具 + conformance 6 例全绿;biz 定理 proved、假定理反例、
--all 聚合与护栏目录模式同样生效。
2026-11-18 10:28:18 +08:00
cflmy
63d60e3ba1
prove: P2 — 离线符号执行(F1–F5)+ 单调性护栏 + 语料库
...
- offline.rs:SymVal 符号执行(Const/Struct/OpResult/Param/Unknown);
If 分支克隆状态并接续后续语句(修复 Return-in-outer 编排丢结果);
可行性检查(前提∩路径条件为空 → 空真关闭,Lean 假设矛盾同构);
F2 轨迹包含/长度、F3 构造器结构求值、F4 自由原子二分、
F5 区间:字面重述关闭 + 区间违反反例(区间端点见证,如 金额 = 10001);
区间蕴含保守 unverified(当前 Lean 脚本无 Val 传递引理,先于 Lean
关闭即触发 divergence——诚实优先)
- 判定编排:离线先行(毫秒级 checked ≠ proved)→ Lean 复核升级 proved;
分歧护栏:checked 但 Lean 关不掉 / 反例被 Lean 证出 ⇒
error[proof.divergence] 退 1 永不落绿;MARQDO_PROOF_INJECT_DIVERGENCE 验证
- emit:try split 按 if 嵌套深度重复(三路分支可达);simp 清单补
mqResultError/mqValueOr/mqAnd/mqOr/mqNot(分歧护栏暴露)
- tests/prove_corpus.rs:8 类 × 5 = 40 夹具语料库,
offline_checked ⊆ lean_proved 强制 + 无 Lean 禁 proved;
f5_interval_closure_scope 单测锁定 F5 诚实范围
- 设计文档 §12 记录 P2 落地、修复与文法限制
实测:biz 3 定理离线 checked→Lean proved;假定理反例 金额 = 10001
指回定理表行;注入分歧 → error/divergence 退 1;全量 516 通过
(仅剩 2 个已记录环境基线失败)。
2026-11-18 10:28:18 +08:00
cflmy
44d2928c06
prove: P1 — Lean 判定接入 CLI(driver + 证书缓存 + CI)
...
- driver.rs:工具链发现(--lean → MARQDO_PROOF_LEAN → PATH;显式坏路径
error[proof.lean_missing] 不回退);MarqdoProof 库内嵌进二进制,按内容
哈希缓存、lean -o 直接构建(运行时零 lake/elan 依赖);lean 调用带超时
(--timeout/--heartbeats);unsolved→unproved、error→error、
sorry→unverified;-- mq: 注释 + 定理头注释 → 证据映射指回源行
- cache.rs:复合键证书(源码⊕plan⊕库sha256⊕lean版本⊕版本),
命中跳判定(lean.cache: hit),--no-cache/MARQDO_PROOF_NO_CACHE 绕过
- mod.rs:per-claim 判定面(status/decided_by/evidence/source_line)、
lean JSON 对象、proof.claim_failed 诊断;文件状态只聚合有定理与被拒函数
- main.rs:--lean/--timeout/--no-cache/--heartbeats 旗标;prove emit
子命令只生成不判定;策略 none → sorry(绝不冒充 proved)
- tests/prove_lean.rs:A1/E1/E4/F2/F3/F4/G1/G2/G2b 矩阵,无工具链 SKIP、
MARQDO_PROOF_REQUIRE_LEAN=1 硬性要求;实测抓出并修复错误行/列解析、
逐定理记录缺失、含点函数名归因三处判定缺陷
- CI proof.yml:装 Lean 4.35.0 → 底座校验 → 判定矩阵(CI 不许静默降级)
- 设计文档 §12 记录 P1 落地与偏差(直接 lean -o,不经 lake)
实测:业务样例 3 定理 proved;假定理 unproved 退 1 指回定理表行;
缓存命中后跳判定(假 lean 计数器验证);全量 Rust 测试 508 通过
(仅剩 2 个已记录环境基线失败)。
2026-11-18 10:28:18 +08:00
cflmy
fa832268b3
prove: fix issues found in Lean verification round
...
- p2_len fixture claim corrected: pure function's trace is always empty,
so '长度(轨迹) = 2' was an authoring mistake -> '长度(轨迹) = 0'
(Nat-path coverage unchanged); all 7 claim-bearing files now prove
- generated Lean headers set linter.unusedVariables/unusedSimpArgs off:
machine-emitted artifacts should not trigger human-authoring lints
(0 warnings now)
- verification driver script + updated results in design doc 12 and
library README
2026-11-18 10:28:18 +08:00
cflmy
9576188a2e
prove: real Lean 4.35.0 verification round
...
- MarqdoProof semantic base (Val + mq* helpers + branch-contradiction
lemmas, no axiom/opaque), lake-built; sources under doc/verification/
- emitter: ASCII-only namespaces (uXXXX encoding), guillemet wrapping
for all non-ASCII identifiers, ':' -> '_' inside op ctor names,
ctor pattern arg binding, ASCII-safe rename forms, placeholder ctor
via op_ctor, flipped run equation (outputs on the left), try-split
for branchless bodies, validated proof script (simp_all + .elim
contradiction + omega)
- business example: 3/3 theorems proved by real Lean; 5/6 claim
fixtures proved, p2_len honestly unproved (false claim)
- design doc section 12: Lean round findings + results
2026-11-18 10:28:18 +08:00
cflmy
528a1f0dbc
prove: fix 4 review defects (honesty + compilability) + business validation
...
Code review after the initial prove commit found and fixed:
1. Calls inside table/list literals were silently dropped — a function
with side-effectful cells lowered to "no ops" and claimed purity in
Lean. lower_expr's fallback now rejects with proof.unsupported
(author must bind the call to a variable first).
2. Same-callee call sites with different arities (optional params)
shared one Op whose ctor declared the first-seen arity, emitting
uncompilable Lean. register_op now suffixes `/N` per arity.
3. proof.name_shadow fired once per walked function (N functions → N
duplicates) and checked params of claim-free functions. Predicate
check runs once per module; param check only for functions that
carry claims.
4. 长度(轨迹) = 2 emitted mqEq (Nat) (Val) — type-mismatched Lean.
Nat-context detection renders trace-length comparisons natively;
untranslatable shapes become comments instead of broken Lean.
Hardening: lean_ident reserves 轨迹₀ / h_前提 (theorem binder
collision); emit_theorems dedups repeated claim ids.
Tests: +4 integration regressions (p2_a..p2_d), 23 prove tests total;
full suite green except the documented env-limited failures (one
host::foreign_session flake passes standalone).
Business validation (doc §12): e-commerce order-approval SKILL with 3
theorems cross-checked against the real interpreter — 5000 → auto
(1-step trace), 20000/60000 → manual ticket T-20000/T-60000
(需人工→创建, exactly 2 steps); corrupted claim tables hit
check --proof codes while staying default-off; double emit
byte-identical.
2026-11-18 10:28:18 +08:00
cflmy
a11b347659
prove: add marqdo prove (P0 emit/audit + P1 claim tables & check --proof)
...
Language layer (ADR 0010):
- claim tables (定理|结论|前提|策略) parsed before first executable
statement, extracted into Function.claims, removed from body
- check --proof (default off): proof.claim_malformed / claim_ambiguous /
claim_misplaced / claim_duplicate / claim_unknown_symbol /
claim_unsupported / name_shadow
Runtime layer (src/prove/):
- ir.rs: Plan IR with stable hand-rolled JSON (schema 1)
- lower.rs: subset acceptance (proof.while / proof.recursion /
proof.dynamic_call), inlining for straight-line pure callees, opaque
ops with effect labels, --allow-opaque whole-function downgrade
- types.rs: literal-driven inference + branch confluence
(proof.type_mismatch, exit 1)
- emit.rs: deterministic Lean emission (Val × List Op, continuation
style, -- mq: line:col anchors, «…» for dotted idents, theorem
scaffolds from claims with unfold/split script)
- mod.rs: prove/emit/audit/clean commands, Verdict taxonomy
(error > unproved > rejected > unverified > checked > proved),
exit codes 0/1/2 per design §3.3
Tests: tests/prove.rs 19 integration cases (no Lean required) + module
unit tests; full suite stays green except the 3 documented
env-limited failures.
Docs: doc/design/prove-cli.md (§12 records deviations: result.ok/error
vs drafted success/failure, Val-based run at P1, op arity, opaque
effect label), doc/roadmap/prove.md, doc/adr/0010.
Env fixes carried in: scratch dirs in test helpers honor
CARGO_TARGET_DIR (needed on this machine's read-only target/debug).
2026-11-18 10:28:18 +08:00
cflmy
d9aef957f7
Release 2.7.0: executable handbooks and native user-site workflows
2026-11-10 17:03:06 +08:00
cflmy
c50c515c4a
Refactor executable library handbooks and improve document reading
2026-11-08 22:19:11 +08:00
cflmy
16c44588d5
Fix replay policy wire commands and register the agent smoke tool
...
Send complete op/steps/value records to the Lean decoder for every operation. Preserve companion exit status and a bounded stderr tail on transport failure. Register the smoke fixture read tool explicitly without weakening the allowlist or changing its output assertion.
Validation: 462 library tests and 312 gold tests passed. The repository regression run passed 946 tests with two existing ignored experiments; the previously passed 1000-document scale test was not repeated.
2026-11-08 21:50:01 +08:00
cflmy
5080136d65
Make Web an executable handbook with recursive Markdown layouts
2026-11-08 21:50:01 +08:00
cflmy
cc5277d2b5
Make Quantum an executable handbook with verified experiments
2026-11-08 21:50:01 +08:00
cflmy and Cursor
bb06dad134
Start web skill=tools migration with in-package layout law.
...
Add root/index and layout skills that force file-partitioned pages and ban
HTML/CSS injection as the default path; wire ext add, docs, and call coverage.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-08 21:50:01 +08:00
cflmy and Cursor
24dcb97354
Document the ext skill=tools development paradigm.
...
Capture the quantum pilot as a checklist-driven guide: layout, root skill
paths, call/session, narration, i18n, install hygiene, and rollout order.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-08 21:50:01 +08:00
cflmy and Cursor
76aa02846a
Clarify quantum agent paths for Bell preparation.
...
Root skills get a choose-a-path table; circuit modules spell the simulate
handoff; call_cli covers ZH bell and stepwise session probabilities.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-08 21:50:01 +08:00
cflmy and Cursor
0e389f34ec
Ship quantum skill=tools tree with call session and ZH package.
...
Split ext/quantum into index + modules, add marqdo call --effects/--session/--toget,
narrative-ratio checks, and a same-package 量子/ tree so agents can follow a
decision path for Bell demos without inventing a second API.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-08 21:50:01 +08:00
cflmy
492790e985
release: v2.5.1 — flowing source annotations and labeled toolbar
2026-11-07 13:08:09 +08:00
cflmy
6195ad1d5d
release: v2.5.0 — document reader redesign
2026-11-07 10:06:58 +08:00
cflmy and Cursor
8f1010f967
Ship oracle journal values, bytecode/frontend hardening, and replay-policy Lean.
...
Host exposes oracle journals as language values with refuse/copy gates; bytecode and foreign session paths get modularized; applications and verification replay-policy sources land with Lake builds ignored.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-06 15:04:27 +08:00
cflmy and Cursor
e3d9021bb6
docs: align foreign Strong correspondence with mechanized Thm. corr
...
Record corr_fresh_functional and host discharge (foreign gold + R1–R3)
for the closed/fresh/functional fragment instead of conformance-only wording.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-01 20:03:44 +08:00
cflmy and Cursor
142ab523d6
release: v2.3.0 Foreign Strong session/handle/replay/arity
...
Opaque session handles, affine close, replay_check vs oracle journal,
table arity refuse, and Ω∈V_safe gate for the Strong foreign narrative.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-01 14:46:08 +08:00
cflmy and Cursor
82c8d78fd3
release: v2.2.2 V_safe JSON integer refuse on foreign bridge
...
Align host json encode/decode with Lean ForeignJSON: refuse OOD integers
instead of silent Node distortion; keep decimal-string BigInt author path.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-11-01 09:43:51 +08:00
cflmy
6b568aff3d
docs: design reliable agent capabilities
2026-10-27 02:10:25 +00:00
cflmy and Cursor
16f26d7d60
fix(knowledge): warm-load IR for preflight/find/reuse queries
...
Stop full recompile on every knowledge preflight by writing ekc/graph/ir.json
and loading it unless --refresh or missing projections, cutting chat预检 wall time.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-27 09:18:27 +08:00
cflmy and Cursor
3cabe53da2
release: v2.1.4 isolated HTTP execute (ADR 0009)
...
Default execute/sse-live/stream to Supervisor worker pool; MR-01 gold;
/_runtime/*; bump CLI/wasm/ext to 2.1.4.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-26 18:33:33 +08:00
cflmy
58e13ee6d3
docs: add isolated web runtime development design
2026-10-26 05:53:02 +00:00
cflmy and Cursor
1b11fe063a
fix(web): fail-fast when invoke lock is busy; document single-interp limit
...
Long sse-live chats held INVOKE_LOCK indefinitely and starved short routes
(UI freeze). Timed try-lock returns interpreter busy → HTTP 503; ADR 0008
records that HTTP is multi-goroutine while Marqdo evaluation stays single-flight.
Also lands plan/delta streaming and soft map guards used by qdagent chat.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-26 13:27:53 +08:00
cflmy and Cursor
c7c329341b
feat(workbench): live selection smoke, F02 agent e2e, DocumentView CLI
...
Hoist llm.ask prompt binding to avoid elevated `p`; prefer reasoning_content
when content is empty; point live/tests at in-tree MARQDO_EXT; add USTC live
gates and mock agent.step selection+resume evidence; view document --out for
read-only browser embed checks. Design stays Partial (not Verified).
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-25 23:05:28 +08:00
cflmy and Cursor
8cf5288481
feat(workbench): F14 coalesce, snapshot manifest, and sse drain evidence
...
Hold analysis locks across compile for concurrent same-snapshot reads,
emit SnapshotManifestV1 for app retention, and add Go drainForward tests.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-25 11:13:53 +08:00
cflmy and Cursor
090b026547
test(workbench): harden F-matrix evidence and demote Verified claim
...
Add dual-endpoint LLM isolation, usage revision replace, cancel/F08/F11
asserts, and mark the design status Partial until remaining F gaps close.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-25 11:01:02 +08:00
cflmy and Cursor
03396afd02
feat(workbench): land M00–M06 runtime contracts and read-only view
...
Add capabilities/selection/usage/DocumentView/locator/RunContext with
honest probes, LLM messages+cancel, sse-live cancel bridge, and CI
workbench_contracts gate; record design evidence for verified slices.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-25 10:55:08 +08:00
cflmy
663a8ba2c0
docs: specify runtime and view workbench support
2026-10-24 16:27:08 +00:00
cflmy
0b80ff8e50
docs: redesign view knowledge reading experience
2026-10-24 02:51:03 +00:00
cflmy and Cursor
ecbdd18303
feat: executable-knowledge S0–S1 gate plus effect and MLSP reuse subset
...
Establish author baseline fixtures and offline tests, make SemanticProject
the sole authority for graph edges, classify named steps, and tighten
local reuse so unknown effects are not pure and MLSP binds by SymbolId.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-23 22:52:06 +08:00
cflmy
bedd53e212
docs: align executable knowledge roadmap with native workflow
2026-10-23 14:25:12 +00:00
cflmy and Cursor
687c168014
feat(parse): use nested YAML import: maps instead of one-liner binds
...
Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target
entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the
old one-liner form, and migrate lib/ext/examples/tests/docs accordingly.
Co-authored-by: Cursor <cursoragent@cursor.com >
2026-10-23 19:33:58 +08:00
cflmy
8bbe017a5e
docs: define executable knowledge step architecture
2026-10-23 15:46:02 +08:00
cflmy
5ad1a07f5c
docs(language): 链接语法与知识分层设计声明 + 示例
...
- []() 零新语法:描述 + 已有类/函数调用,不引入 ref/别名/开关
- # 是类、## 是函数;类.函数 是类调用;跨文档用项目类索引
- 知识分层:原始语料 / 本体 / 单体知识类 / 调用面;出处与还原验证
- 新增 link-syntax、knowledge-layers 设计声明与两组可运行/目标示例
2026-10-23 14:52:23 +08:00
cflmy
9015de26e5
feat(view): M8 遮蔽呈现 — 描述为正文、实现为代码片、桩有徽章;并修复 view 解析模式回归
...
一、先修回归(用户看到"没渲染"的真因)
view 多处直接用 crate::parse::parse_source 重新解析文件,而 per-file markup:
是在 load 层生效的(M7)。于是任何带 markup: occlusion 的文档在结构区报
"parse/load error: expected ')' after link-index collection",退化成源码视图。
→ 新增 load::parse_source_auto(source):先读 frontmatter 的 markup:,用
with_markup 包住解析;view 的 4 处解析点全部改用。
二、遮蔽呈现
浏览视图(document.rs / /file):
<div class="doc-line doc-occl">
<span class="occl-pre">留存 =</span> ← 变量名 灰 等宽
<span class="occl-label">客户留存率,模拟数据</span> ← 描述 正文
<code class="occl-code">0.42</code> ← 实现 代码片
</div>
空载荷换成 <span class="occl-stub">桩</span> 琥珀徽章(title 说明未接通/待补返回值);
前缀的反引号与 ** 都剥掉,与其它行的 mq-anchor 一致。
卡片视图(render.rs / /debug):按 AST 匹配 Expr::Occluded(Assign/Expr/Return),
渲染 card occl-card:徽章「遮蔽」+ 变量名 + 描述 + 代码片/桩。
样式刻意不加虚线下划线(易读成链接):描述即正文,靠代码片边框区分。
验证:
- /file 页面 0 处 parse/load error;7 个遮蔽行全部渲染
(6 代码片 + 1 桩),文本抽取为「留存 = 客户留存率,模拟数据 [0.42]」
- 4 个单测(裸赋值/粗体赋值/空载荷+嵌套/非遮蔽不误判)
- 全量 cargo test --release 613 passed / 0 failed
未能截图:本机无任何浏览器,puppeteer 的 Chromium 下载被网络阻断;
改为 DOM 断言 + /.preview/occlusion.html 方案对照页由作者目视确认。
文档:doc/design/change-m8-view-occlusion.md
2026-10-22 16:16:32 +08:00
cflmy
86e921e959
feat(migrate): 支持多路径;docs: 体量审计修正两条不成立的判断
...
- migrate labels 接受多个 PATH(与 labels 一致);全仓干跑幂等:
lib/ext/cli/examples/public 均为 0,tests 仅剩刻意保留的 classic 样例 1 处
- 审计修正:
* html.rs 皮肤"重复声明基础 CSS" —— 实测 312 vs 128 条规则、选择器零重叠,不成立
* debug_page "复刻 shell" —— 仅 head/favicon 约 10 行相似,它没有 nav/topbar,不成立
* HostFn 五表合一标记为已完成(−404 行)
- 结论:可机械消除的重复已清完;剩余体量全是特性实现
全仓校验:63 个文件 check 零诊断(label.* 全 0);
cargo test --release 609 passed / 0 failed。" && timeout 300 git push origin main 2>&1 | tail -1
2026-10-22 15:52:22 +08:00
cflmy
b196a44685
refactor(host): HostFn 五张表合一 — HOST_FN_TABLE 单一来源(−404 行)
...
202 个宿主函数的元数据原本分散在 from_u16 / from_name / name /
required_params / optional_params 五个手写 match 里,必须同步维护,
审计已记录过 from_name 与 name() 的漂移。
改动:
- 新增 HostFnDef + HOST_FN_TABLE(203 项:id, 变体, 规范名, 必填, 可选)
- from_u16 按 id 查表;name / required_params / optional_params 按判别值查表
- call_host 的 202 个一行臂保持不变(只集中元数据,不动分派逻辑)
- from_name 保留:它是别名注册表(http_get/中文别名…),语义与规范名不同
等价性证明(快照比对):
1. 先在旧实现导出全部 203 项的 (id,name,required,optional) 到 TSV
2. 合并后用同一段代码再导出
3. diff 两份 → 完全一致;快照测试用后即删
长期守护(4 个不变量测试,上一轮已加):
id↔as_u16 往返、name→from_name 往返、规范名唯一、required/optional 不重叠。
验证:cargo build 零警告;cargo test --release 609 passed / 0 failed。
行数:dispatch.rs 2052 → 1648;src 合计 53,040 → 52,668。
文档:doc/design/change-hostfn-table.md
2026-10-22 15:51:26 +08:00
cflmy
c8ed5bffb7
docs: 体量审计更新 — 插件 SDK 完成(净减 674 行),合计 67,786
2026-10-22 15:49:26 +08:00
cflmy
fb135ae2f8
refactor(plugins): 抽出 marqdo-plugin-sdk — ABI 前言从 5 份变 1 份
...
新增工作区成员 crates/marqdo-plugin-sdk:ABI 类型、HOST_* 静态回调、
host_strdup/set_out/set_err/parse_args/reply/host_query_json(_with)/
take_host_string/init_plugin,以及生成四个 #[no_mangle] 导出的
marqdo_plugin! 宏。ABI 常量、符号名、结构体布局一律未变。
5 个插件改为依赖 SDK + 一行宏调用:
agent 1237 → 929 (-308)
quantum 1045 → 835 (-210)
linalg 688 → 524 (-164)
llm 405 → 278 (-127)
demo 170 → 73 (-97)
SDK 新增 232 行 → 净减约 674 行
迁移中发现并修正三次"编译通过但语义已变":
1. 注册项抽取漏 11 项 —— 正则 [a-z_0-9]+ 匹配不到 mcp_server::agent_mcp_serve、
sandbox::* 这类路径限定函数名;改为允许 :: 后重抽。
已用脚本逐项比对 (名称, 参数串, 函数) 三元组:agent 63/63、quantum 41/41、
linalg 31/31、llm 2/2、demo 2/2,全部 0 差异。
2. mcp_client 被误判死模块(删 327 行后才发现 agent_mcp_client 正注册它)→ 恢复。
3. 量子插件两个"未使用"函数删除时连带吃掉 density_from_amps/flat_to_nested
→ 恢复原文件并改为 #[allow(dead_code)]。
验证:cargo build --release(含 5 个插件)零警告;
cargo test --release 609 passed / 0 failed;
量子金样实跑 p00-ok / p11-ok / ping-ok。
文档:doc/design/change-plugin-sdk.md
2026-10-22 15:49:13 +08:00
cflmy
69fcdd6227
docs: 代码体量审计 — 53k 行构成、已清 14.5k 冗余、剩余为特性面
...
把账算清楚,避免行数多=冗余多的误判:
- src 53,072(其中 5,220 是内联测试)+ plugins/crates 15,423
- 最大的 10 个文件逐一标注性质(html.rs 4,451 行里 3,861 是页面皮肤字符串)
- 已清除 14,235 + ~400 行,逐项列提交号
- 顺带修出的 4 个真实缺陷(Access 隐式判别值、escape_js_string 漏 U+2028/2029、
view 双 handler 路由、HOST id 稀疏无测试守护)
- 剩余可精简项:插件 ABI SDK(~550)、html 皮肤(~250)、debug_page(~120)、
HostFn 五表(~450),合计约总量 2%,标注风险
- 结论:继续压体量的正确方向是砍特性,而不是在特性内部找重复(已找完)
2026-10-22 15:44:37 +08:00
cflmy
307c8efa81
feat(labels): 支持多路径扫描;docs: 里程碑全量完成状态与变更文档索引
...
- labels 接受多个 PATH(默认 .),合并去重后扫描
- occlusion-syntax.md §13.1 记录 M0–M10 全部完成,附 11 份变更文档索引
- 全仓校验:98 个文件 check 零诊断(label.* 全为 0,确认无噪音)
- cargo test --release 605 passed / 0 failed;0 编译警告
2026-10-22 15:34:29 +08:00
cflmy
34b0911218
feat(labels): M8 债务棘轮 — --baseline + --fail-on-increase
...
规则:未完成项只许减少,不许增加。
- 台账不存在 → 建立(写入当前计数)并提示,exit 0
- 当前 > 台账 → 失败并提示"未完成项增加了 K",exit 1
- 当前 ≤ 台账 → 通过;若减少则**收紧**台账(N → M)
为什么减少即收紧:否则债务可先降后升,棘轮形同虚设;
收紧后回退到旧数量同样失败(测试第 4 步验证)。
台账格式 {"count":N,"words":[…]},记录词集使"口径变更"可审计。
为什么用棘轮而非硬门禁:硬门禁(必须为 0)会让存量债立刻红一片、逼人关检查;
棘轮做到"老账不追、新账必拦",与防疲劳机制的结论一致。
呈现面复核:expr_display / view 把遮蔽渲染为 [描述](实现)、桩为 [描述](),
实测 view output 页面含 access(;未做桩徽章——桩已是显眼形状,再加装饰是噪音。
测试:四步集成用例(建账 → 增加失败 → 减少收紧 → 回退再次失败);
全量 605 passed / 0 failed(M7 后 604 + 1)。
文档:doc/design/change-m8-ratchet.md
2026-10-22 15:34:07 +08:00
cflmy
4488a3cb70
feat(migrate): M7 迁移与版本门 — per-file markup + migrate labels + 全仓迁移
...
原计划的"翻转默认 + 旧形硬报错"不可行:`[键](集合)` 与 `[描述](实现)` 外形相同,
翻转会让 506 处取元静默变义,硬报错又拿不到证据。改为**按文件声明**。
一、per-file markup
- frontmatter `markup: occlusion`(或 `标记: 遮蔽`)决定该文件模式
- load.rs 先取模式,用 parse::expr::with_markup(线程局部压栈)包住解析
- 同一进程可同时加载两种模式的文件(imports);MARQDO_MARKUP 仍作进程默认
- 好处:迁移逐文件、可增量、可回滚,不存在半迁移的静默错义
二、`marqdo migrate labels [--write|--json]`
改写规则:
[键](集合) → [键](access(集合, "键"))
[`名`](集合) → [名](access(集合, `名`))
- [项](集合) → - [项](遍历 集合 为 项)
安全模型:改写 → 重解析 → 证明等价 → 才写
- 原文件按 classic 解析得 AST-A;改写后按 occlusion 解析得 AST-B
- 反归一化 B(标签与键同名且 payload 为 access 的遮蔽还原成 Index)
- Debug(A) == Debug(反归一化(B))(抹掉行号)才写入,否则原文件一字不动
只改代码行(LineKind::Code);表格行只改 **…** 单元格,散文 markdown 链接不碰;
链式索引由内向外改写,已迁移的有守卫不二次改。
三、access 提升为宿主函数 HostFn::Access(u16 id 212)
与旧取元逐字一致(Map 按键 / List 1-based / 缺键 missing map key);
进 HostFn 是为了两个后端共用同一实现,interp 里的特例已删除。
四、顺带修的两处真实语义缺陷
1. payload 继承外层"文本模式":`f text=[k](access(c,k))` 中 access 不被当调用
→ `()` 内永远允许 callee(args)
2. 遮蔽形状判定过宽:`[问候] ([格式化] "Bo")` 误判为遮蔽
→ 要求 `]` 后紧跟 `(`,否则落回方括号调用
五、全仓迁移结果
migrate labels: 256 index, 23 loop, 80 file written;0 文件被等价性拒绝;
迁移后 cargo test --release → 604 passed / 0 failed;再跑迁移幂等。
等价性检查先后抓出 4 类改写 bug(表格散文链接、payload 文本模式、链式索引、
遮蔽与方括号调用混淆),每类都是先拦下再修工具,未污染文件。
测试:6 个单测 + 3 个集成(干跑不写盘 / 写入后运行输出不变且幂等 /
等价失败文件不动);全量 604 passed / 0 failed(M3 后 595 + 9);双后端一致。
文档:doc/design/change-m7-migration.md
2026-10-22 15:33:31 +08:00