You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "Zestful-ss (via GitHub)" <gi...@apache.org> on 2026/09/16 15:14:19 UTC

[PR] fix(plan): keep execution step titles single-line [maka]

Zestful-ss opened a new pull request, #5408:
URL: https://github.com/apache/maka/pull/5408

   ## Summary
   
   A Plan step title can no longer carry a line break, so one step always reads as
   one line — in the execution request the model receives and in the panel.
   
   The title is rendered as `- <id> [<status>] <title>` in the Turn the Host
   prepares for an approved Plan, and as one row per step in the panel, but nothing
   rejected a break inside it: a model could split one step into two lines, and a
   title persisted before this rule still reads that way. The rule now has three
   parts, so an invalid title is caught as early as possible and can never be
   rendered:
   
   1. **`@maka/core/plan` names the rule once.** `planTextHasLineBreak` and
      `singleLinePlanText` cover `\n`, `\r`, NEL (`\u0085`), LINE SEPARATOR
      (`\u2028`) and PARAGRAPH SEPARATOR (`\u2029`) — every character that ends a
      line for a reader or a renderer — and flatten text onto one line by collapsing
      each break together with the whitespace around it.
   2. **The store rejects it.** `requiredSingleLinePlainText` extends the existing
      plain-text validation for step titles, so an invalid title never reaches the
      ledger. The `submit_plan` tool schema refuses it first, with the same wording,
      so the model is corrected before the write rather than after a failed call.
      Descriptions, notes, overviews and reasons stay multi-line: only the title is
      held to one line.
   3. **Rendering flattens what is already persisted.** The ledger decodes by
      envelope, so a row written before this rule stays readable and approvable;
      `renderExecutionRequest` flattens such a title, so one step cannot read as two.
   
   <details>
   <summary>中文概述</summary>
   
   Plan 步骤标题不再允许换行:模型收到的执行请求里,一个步骤始终占一行;面板里也是
   一行一个步骤。
   
   标题会渲染成 `- <id> [<status>] <title>`,但此前没有任何一层拒绝标题里的换行,
   模型可以把一个步骤拆成两行;规则生效前已写入的标题同样如此。现在规则分三层:
   
   1. `@maka/core/plan` 统一定义:`planTextHasLineBreak` / `singleLinePlanText`
      覆盖 `\n`、`\r`、NEL(`\u0085`)、LINE SEPARATOR(`\u2028`)、PARAGRAPH
      SEPARATOR(`\u2029`) —— 所有对读者或渲染器而言会断行的字符 —— 并把断行连同
      两侧空白压成一个空格。
   2. 存储层拒绝:`requiredSingleLinePlainText` 在既有纯文本校验上收紧步骤标题,
      非法标题不会写进 ledger;`submit_plan` 的工具 schema 更早拒绝,措辞一致,
      让模型在写入前就被纠正而不是写入后报错。描述、备注、overview、reason 仍可
      多行 —— 只有标题被限制为单行。
   3. 渲染层兜底:ledger 只按信封解码,规则生效前的历史行仍可读、可批准;
      `renderExecutionRequest` 会把这类标题压平,一个步骤不会读成两个。
   
   </details>
   
   ## Verification
   
   Each layer has a test that fails without it:
   
   - `@maka/core` `plan.test.ts` — every line-ending character is a break, and
     non-breaking whitespace (space, tab, NBSP, ideographic space) is not.
   - `@maka/storage` — the multi-line title case in `rejects Plan data that the
     Runtime Host projection cannot represent`: without the store rule the submit is
     accepted, and the test fails with `Missing expected rejection`.
   - `@maka/runtime` `plan-mode.test.ts` — `submit_plan` refuses a `\n` and a
     `\u2028` title with `must be a single line`, and still accepts a multi-line
     description.
   - `@maka/runtime-host` `plan-execution-request.test.ts` — a step title persisted
     before the rule (written straight into `workflow_plan_events`, because no current
     write path can produce one any more) is approved and rendered; without the
     normalization the request literally reads `- inspect [pending] Inspect` +
     `the caller`.
   
   Affected suites, all green: `@maka/core` `plan` 2/2, `@maka/storage`
   `sqlite-workflow-store` + `operational-state-store` + `operational-state-backup`
   63/64 (one skipped, none failed), `@maka/runtime` `plan-mode` +
   `tool-availability` + `session-manager` 223/223, `@maka/runtime-host`
   `plan-execution-request` + `plan-protocol` + `plan-store-notification` +
   `plan-two-client-uds` 12/12. `npm run lint`, `npm run format:check`,
   `npm run typecheck`, `npm run check:stale` (`dist is fresh.`) and the protocol
   epoch guard all pass locally.
   
   ## Review focus
   
   - The rule is named once in `@maka/core/plan` and consumed by all three layers
     instead of being re-stated per layer.
   - Only the title is single-line; the other Plan texts keep their breaks, and a
     test pins that.
   - The render-layer flattening exists for rows written before the rule — it is not
     a path new input can take, since the store rejects such a title first.
   
   ## AI use
   
   Select exactly one:
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: ChatGPT 6 Pro planned the change and reviewed it against the
   code; DeepSeek Harness (DSH) implemented it, wrote and ran the tests, and
   prepared this description. The human contributor directed the work and reviewed
   the change. The commit carries a `Generated-by: DeepSeek Harness` trailer.
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [x] Lint, format, typecheck and the affected suites pass locally
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(plan): keep execution step titles single-line [maka]

Posted by "Zestful-ss (via GitHub)" <gi...@apache.org>.
Zestful-ss commented on PR #5408:
URL: https://github.com/apache/maka/pull/5408#issuecomment-5700958414

   Addressed in 9ffc173a. You were right on the current head, and I reproduced it at every layer before fixing — thank you.
   
   **Fix.** Both characters joined the break set, and that set is now declared once: `planTextHasLineBreak` and `singleLinePlanText` are built from the same `PLAN_LINE_BREAK_CHARS`, so the detector and the normalizer cannot disagree about what a break is. The write layers still reject and the render layer still flattens, so no other production behaviour changed — the render layer already called `singleLinePlanText`, which is why this stayed a one-list fix.
   
   **Reproduced red at each layer** (helper mutated back to the pre-fix set, everything else unchanged):
   
   - helper — `AssertionError: "\u000b" ends a line`; both new assertions fail, and `singleLinePlanText('Implement\u000cthe fix')` returned the form feed unchanged.
   - store — `AssertionError: Missing expected rejection. expected: /Plan step title must be a single line/`, so the store really did accept `\f`.
   - schema — `AssertionError: "\u000b" in a title is refused`, so `SubmitPlan` really did accept it.
   - execution request — `The input did not match the regular expression /^- patch \[pending\] Land the fix$/m`: the raw form feed came through into the rendered request.
   
   **Green after the fix**: core `plan` 2/2, storage `sqlite-workflow-store` 21/21, runtime `plan-mode` 4/4, runtime-host `plan-execution-request` 3/3. `npm run lint`, `npm run format:check`, `npm run typecheck` and `npm run check:stale` (`dist is fresh.`) pass locally.
   
   Coverage added, per your list: the helper test walks both characters (and keeps `\u000b`/`\u000c` out of the non-breaking whitespace set), `plan-mode.test.ts` asserts the schema refuses a title carrying either one, the store test adds a form-feed title next to the existing `\n` case, and the execution-request test now persists one `\n` title and one form-feed title and asserts both render on one line.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(plan): keep execution step titles single-line [maka]

Posted by "hqhq1025 (via GitHub)" <gi...@apache.org>.
hqhq1025 commented on code in PR #5408:
URL: https://github.com/apache/maka/pull/5408#discussion_r4027781643


##########
packages/core/src/plan.ts:
##########
@@ -37,6 +37,7 @@ export const PLAN_STEP_TITLE_MAX_CHARS = 30;
 
 const PLAN_ENTITY_ID_PATTERN = new RegExp(`^[A-Za-z0-9_-]{1,${PLAN_ENTITY_ID_MAX_CHARS}}$`);
 const PLAN_TEXT_ENCODER = new TextEncoder();
+const PLAN_LINE_BREAK_PATTERN = /[\r\n\u0085\u2028\u2029]/;

Review Comment:
   [P2] Include U+000B and U+000C in the hard line-break set. Unicode classifies LINE TABULATION and FORM FEED as mandatory breaks (`Line_Break=BK`), but this pattern and the normalizer below omit them. On this exact head, both values pass the `SubmitPlan` schema, are accepted by the real Plan store, and survive approval into the model-visible execution request unchanged, so JSON inputs using `\u000b` or `\f` can still split a supposedly single-line title. Please reject and flatten both controls, and cover them in the helper, schema, store, and execution-request tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(plan): keep execution step titles single-line [maka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5408:
URL: https://github.com/apache/maka/pull/5408#issuecomment-6229220628

   <!-- maka-lifecycle:stale-warning -->
   This pull request has had no new commits for 30 days and has been marked stale. It will be closed in 7 days unless a new commit is pushed.
   
   Comments do not reset this timer: only a new commit does. If the pull request is intentionally long-lived, a maintainer can apply the `pinned` label.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(plan): keep execution step titles single-line [maka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #5408:
URL: https://github.com/apache/maka/pull/5408#issuecomment-6379487194

   <!-- maka-lifecycle:stale-close -->
   This pull request has been closed because it received no new commits during the 7-day grace period. This is not a judgement on the merit of the change; it only keeps the review queue aligned with work that is actively in flight.
   
   The branch and review history are preserved. Push a new commit and reopen the pull request whenever the work is ready to continue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [PR] fix(plan): keep execution step titles single-line [maka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #5408: fix(plan): keep execution step titles single-line
URL: https://github.com/apache/maka/pull/5408


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org