From d216c6b7618f844b95b3cb763771e6cd02aa3dfb Mon Sep 17 00:00:00 2001 From: Kinneyzhang Date: Thu, 20 Aug 2026 09:35:52 +0800 Subject: [PATCH] docs: record native live append gate --- .phrase/docs/CHANGE.md | 3 ++ .../change_post_audit_hardening_20260820.md | 29 ++++++++++++--- ...sue_narrow_live_append_latency_20260729.md | 36 +++++++++++++------ .../task_post_audit_hardening_20260820.md | 9 +++++ 4 files changed, 61 insertions(+), 16 deletions(-) diff --git a/.phrase/docs/CHANGE.md b/.phrase/docs/CHANGE.md index 5c22823..cfbb0f4 100644 --- a/.phrase/docs/CHANGE.md +++ b/.phrase/docs/CHANGE.md @@ -5,6 +5,9 @@ - 2026-08-20 plan and implement post-audit hardening (`task037`–`task042`, `task030` source-fresh evaluator continuation; `issue022`–`issue028`): `.phrase/phases/phase-kp-overhaul-20260726/change_post_audit_hardening_20260820.md` +- 2026-08-20 select and implement native automatic live-append backend + (`task030`; `ekp-auto-justify-native-append`): + `.phrase/phases/phase-kp-overhaul-20260726/adr_native_live_append_backend_20260820.md` - 2026-08-13 close issues awaiting user-visible confirmation (`issue011`– `issue017`, `issue019`, `issue020`; `issue018`/`task030` remain open): `.phrase/phases/phase-kp-overhaul-20260726/change_close_user_confirmation_20260813.md` diff --git a/.phrase/phases/phase-kp-overhaul-20260726/change_post_audit_hardening_20260820.md b/.phrase/phases/phase-kp-overhaul-20260726/change_post_audit_hardening_20260820.md index 17c05eb..fc79de3 100644 --- a/.phrase/phases/phase-kp-overhaul-20260726/change_post_audit_hardening_20260820.md +++ b/.phrase/phases/phase-kp-overhaul-20260726/change_post_audit_hardening_20260820.md @@ -78,16 +78,35 @@ passes the same matrix without argument errors. - **Commit:** `01001b9`. +## 2026-08-20 — Implement user-selected native live-append backend + +- **Modify** `ekp-buffer.el` and `ekp.el` to let prepared automatic live + append use the loaded C 1D DP when `ekp-auto-justify-native-append` is + non-nil, without changing ordinary full-layout dispatch or the 15-field C + ABI. Native-unavailable and option-disabled paths remain Elisp. +- **Add** `adr_native_live_append_backend_20260820.md`, bilingual README + guidance, evaluator backend metadata, and a public buffer regression proving + the setting toggles the bridge. +- **Verification:** native bridge/parity regression 1/1 and source-first ERT + 296/296 pass. In the bounded all-width, 2/4/8/16-row, GC-excluded + source-fresh round, the candidate width-80 C p95/p99 was + 14.190/16.495 ms and the Elisp-configured live path (native append backend) + was 13.484/14.334 ms. Layout parity, zero-work, GC, conflict, and width + non-regression checks passed; the C p99 remains just above the locked + 16 ms target, so `issue018/task030` stays open. +- **Commit:** `3d3dda6`. + ## Verification -- Source-first normal ERT: 295/295. -- Source-first seeded random ERT: 295/295, including all nine GUI verifier +- Source-first normal ERT: 296/296. +- Source-first seeded random ERT: 296/296, including all nine GUI verifier tests previously omitted by the name filter. - Per-test isolated ERT: 294/294 process runs logged `0 unexpected`; the later batch-position test is covered by focused isolated C ERT. - C focused ERT: 15/15; C portable build warning-clean; source fuzz: 300/300 with zero failures; checkdoc, release, dictionary, and shell gates pass. -- Corrected narrowed source evaluator: parity, zero-work, GC, conflicts, and - width non-regression pass, but source candidate p99 remains above 16 ms; - the performance issue is intentionally not closed. +- Corrected source evaluator: parity, zero-work, GC, conflicts, and width + non-regression pass. The bounded all-width/row source round still reports + C p99 16.495 ms at width 80, so the performance issue is intentionally not + closed. diff --git a/.phrase/phases/phase-kp-overhaul-20260726/issue_narrow_live_append_latency_20260729.md b/.phrase/phases/phase-kp-overhaul-20260726/issue_narrow_live_append_latency_20260729.md index 47b5a69..d212789 100644 --- a/.phrase/phases/phase-kp-overhaul-20260726/issue_narrow_live_append_latency_20260729.md +++ b/.phrase/phases/phase-kp-overhaul-20260726/issue_narrow_live_append_latency_20260729.md @@ -2,13 +2,16 @@ ## issue018 [ ] Unique live appends miss the frame budget at very narrow widths -- **Status:** Exact incremental implementation verified; the locked - source-instrumented gate remains open. +- **Status:** Native live-append backend implemented and verified; the locked + source-fresh gate remains open for preparation/assembly latency. - **Summary:** Stable transactions removed per-key whole-hard-line planning, - and task030 now incrementally extends paragraph preparation, Elisp DP - state, and layout lines only at structural row crossings. Byte-compiled - production paths are within the 16 ms frame budget; the deliberately - source-loaded, fully instrumented evaluator still exceeds it. + and task030 incrementally extends paragraph preparation, DP state, and + layout lines only at structural row crossings. The user-selected + `ekp-auto-justify-native-append` backend now uses the loaded C 1D DP for + prepared live appends even when full layout is configured for Elisp. + Byte-compiled production paths are within the 16 ms frame budget; the + source-fresh evaluator still exceeds it in Elisp-owned preparation and plan + assembly. - **Environment:** Emacs 30.2 on macOS, C backend 1.6, benchmark width fixed at 80 px, `gc-cons-threshold` bound to `most-positive-fixnum` so mutator work is measured without GC pauses. @@ -70,14 +73,25 @@ pure-Elisp DP from a safe reachable state, reuses common layout lines, and reconstructs only the live dirty source island. Unsupported contexts take the unchanged full path. C int32 validation now performs one extraction. +- **Native backend update (2026-08-20):** `ekp-auto-justify-native-append` + now routes prepared 1D live append DP through the loaded C module even when + full layout uses Elisp. The option can be disabled for a pure-Elisp live + path, and unavailable modules fall back exactly. In a bounded source-fresh + all-width, 2/4/8/16-row, GC-excluded round, width-80 candidate append-DP + p95/p99 was 2.051/3.127 ms for C and 2.495/3.406 ms for the Elisp-configured + live path. Total p95/p99 was 14.190/16.495 ms and 13.484/14.334 ms, + respectively; preparation and assembly remain the active budget owners and + the C p99 is still just above 16 ms. - **Verification:** Exact baseline/C/Elisp hashes and append-chain equivalence pass across 64/80/96/128/160 px, 2/4/8/16-row fixtures, - default/excluded GC, unsafe fallbacks, and randomized chains. Normal and - random-order ERT pass 199/199; 300 fuzz cases, warning-clean production/C - compilation, 9/9 C tests, release checks, and reviewed temporal GUI - evidence pass. + default/excluded GC, unsafe fallbacks, and randomized chains. Current + source-first normal and random-order ERT pass 296/296; the native bridge + parity regression passes 1/1; 300 fuzz cases, warning-clean production/C + compilation, C contract tests, release/dictionary checks, and reviewed + temporal GUI evidence pass. The bounded source-fresh performance round + remains red only on the C p99 absolute target. - **User Confirmation:** Pending; the formal source-instrumented performance target also remains open. - **Resolved At:** Unresolved. - **Resolved By:** Pending. -- **Commit:** Pending. +- **Commit:** `3d3dda6` (native backend); performance gate remains open. diff --git a/.phrase/phases/phase-kp-overhaul-20260726/task_post_audit_hardening_20260820.md b/.phrase/phases/phase-kp-overhaul-20260726/task_post_audit_hardening_20260820.md index a8993c7..903272b 100644 --- a/.phrase/phases/phase-kp-overhaul-20260726/task_post_audit_hardening_20260820.md +++ b/.phrase/phases/phase-kp-overhaul-20260726/task_post_audit_hardening_20260820.md @@ -63,3 +63,12 @@ is 9.753/5.663 ms for both engines, while Elisp append-DP is 55.970 ms and C append-DP is 1.015 ms. The evaluator wrapper collision was fixed and the same source matrix passes the harness without argument errors. + - User-selected architecture option 2 is implemented as + `ekp-auto-justify-native-append`: loaded C DP is used only for prepared + auto live append, while full/string `ekp-use-c-module=nil` remains pure + Elisp and unavailable native modules fall back exactly. The source + append-DP p95 drops from roughly 56 ms to roughly 2.1 ms in the bounded + all-width/row run; preparation and assembly remain the active budget + owners. Width-80 C candidate p95/p99 is 14.190/16.495 ms, so the locked + 16 ms gate remains open rather than being marked complete on a noisy + single-round result.