GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — aggregator(actions): cleanText caps can split a surrogate pair — a stored action field ends in a lone surrogate · Issue #7694 · developing-today/code

aggregator(actions): cleanText caps can split a surrogate pair — a stored action field ends in a lone surrogate #7694

New issue
Copy link
New issue
Copy link
Closed
#7698
Closed
aggregator(actions): cleanText caps can split a surrogate pair — a stored action field ends in a lone surrogate#7694
#7698
Copy link
Labels
app/aggregatorPackage/app: aggregator (pm-stack in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator job

Description

@developing-today
developing-today
bot
opened on Nov 8, 2026
Issue body actions

aggregator(actions): cleanText caps can split a surrogate pair — a stored action field ends in a lone surrogate

Evidence (verified this run, main 8a0a1c0cea)

pm-stack/aggregator/src/actions.ts:289-292 — every user-supplied payload field of a dashboard action passes through:

function cleanText(v: unknown, max: number): string | undefined {
  if (typeof v !== "string") return undefined;
  const t = v.trim();
  return t === "" ? undefined : t.slice(0, max);
}

slice(0, max) counts UTF-16 code units. When an astral character (e.g. an emoji, 2 code units) straddles the cap, the stored value ends in a lone high surrogate. Call sites with caps: reason 2,000 (actions.ts:336), text 20,000 (:334), answer values 2,000 (:376), optionId/questionId 200 (:349/:351/:363/:370), status 60, until 64, and others (:321–:450). These values are persisted in the actions store (one JSON file, PM_AGG_ACTIONS_FILE) and consumed/rendered by the orchestration pass.

Probe (laptop ~/git/fleet/probe-actions-surrogate/probe.ts, real actions.ts imported from the laptop primary, validateNewAction with verb dismiss):

  • Input reason = "x" × 1999 + "😀" + "tail" (2,001+ code units) → validated ok: true; stored reason is exactly 2,000 code units and its last code unit is 0xd83d — a lone high surrogate.
  • JSON.stringify of the stored value ends …\ud83d" — the lone surrogate is carried into the persisted JSON.
  • A UTF-8 encode/decode round-trip of the stored value differs from the original and ends in U+FFFD — any consumer that encodes the field to UTF-8 (file writes in other languages, GitHub bodies, Rust consumers, whose serde_json rejects unpaired surrogates) silently corrupts or refuses the field.
  • Control: "x" × 1998 + "😀" (exactly 2,000 code units) is stored intact, length 2,000.

Why it matters

This is the exact defect class fixed for pm-dispatch in #3178 (validate.ts:319-328 keeps the cap but never leaves half a surrogate pair). The actions boundary was not given the same guard, so a dashboard user who pastes long text with an emoji at the cap boundary gets a silently corrupted reason/answer stored and delivered to consumers — and the corruption only surfaces downstream, far from the boundary that created it.

Acceptance criteria

  • cleanText (or an equivalent shared helper) never returns a string ending in a lone high surrogate or beginning-of-cap lone low surrogate: when the cap would split a surrogate pair, the pair is dropped whole (cap becomes max - 1 code units for that value), mirroring the pm-dispatch(validate): titleFromPrompt truncates by UTF-16 code units — an astral character at the cap leaves a lone surrogate in the title #3178 fix in pm-stack/dispatch/src/validate.ts.
  • The cap semantics otherwise stay identical: same maximum code-unit lengths, same trim/empty behaviour, non-straddling values byte-for-byte unchanged.
  • Regression tests in pm-stack/aggregator/test/actions.test.ts (or a sibling suite run by the aggregator test workflow): an astral character straddling at least the reason (2,000) and one small cap (e.g. optionId 200) boundary is stored whole-or-dropped, never halved; the new tests fail on the pre-fix code.
  • Existing aggregator test suite stays green.

Activity

  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    app/aggregatorPackage/app: aggregator (pm-stack in this repo)
    work/self-assignedAn agent grabbed this item directly, outside the queue
    status/in-progressQueue worker lifecycle state
    on Nov 8, 2026
  2. developing-today commented on Nov 8, 2026

    @developing-today
    developing-todayBot
    on Nov 8, 2026 – with developing.today
    ContributorAuthor
    More actions

    🤖 Agent note · state: filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: cron job new-issue-creator-code-a, run 2026-11-08 07:05 CST
    • Found via: filed this run
    • Task: cleanText caps in aggregator actions validation can split a surrogate pair, persisting a lone surrogate in a stored action field (probe: laptop ~/git/fleet/probe-actions-surrogate, real actions.ts @8a0a1c0cea). Self-assigned this run under lifecycle protocol §4 (trivial, clearly scoped, mirrors the pm-dispatch(validate): titleFromPrompt truncates by UTF-16 code units — an astral character at the cap leaves a lone surrogate in the title #3178 fix in pm-dispatch validate.ts): fixing + regression tests in the same run.
    • Expectation: effort xs — done = fix PR merged, new tests fail pre-fix and pass post-fix, aggregator suite green.
    • Links: probe ~/git/fleet/probe-actions-surrogate (laptop)
  3. dezren39
    added a commit that references this issue on Nov 8, 2026

    Merge pull request #7698 from developing-today/creator-a/7694-cleante…

    2f7ded9
  4. dezren39
    closed this as completedin #7698on Nov 8, 2026
  5. dezren39
    removed
    status/in-progressQueue worker lifecycle state
    work/self-assignedAn agent grabbed this item directly, outside the queue
    on Nov 8, 2026
  6. developing-today commented on Nov 8, 2026

    @developing-today
    developing-todayBot
    on Nov 8, 2026 – with developing.today
    ContributorAuthor
    More actions

    🤖 Agent note · state: done

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: cron job new-issue-creator-code-a, run 2026-11-08 07:05 CST
    • Found via: filed this run
    • Task: Fixed — PR fix(aggregator): cleanText caps never split a surrogate pair (#7694) #7698 merged (merge commit 2f7ded9): cleanText now drops a surrogate pair whole when a cap would split it, mirroring pm-dispatch(validate): titleFromPrompt truncates by UTF-16 code units — an astral character at the cap leaves a lone surrogate in the title #3178. Regression test fails pre-fix, passes post-fix; test/actions.test.ts 27/27 on the branch and on merged main. Full aggregator suite shows only run-varying failures in unrelated areas, also present on clean main.
    • Expectation: done — issue closed by the PR's Fixes marker (verified CLOSED).
    • Links: PR fix(aggregator): cleanText caps never split a surrogate pair (#7694) #7698
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/aggregatorPackage/app: aggregator (pm-stack in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator job

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.