Skip to content

renderer: the replay's legacy handlers are uncalled — addHistoryMessage / prependHistoryMessage and the kind: "history" branch #1494

Closed

Description

@argszero

The replay's two legacy handlers are uncalled: addHistoryMessage / prependHistoryMessage and the kind: "history" branch

Filed by cycle cyc20260921-051840 when it closed #1472 (the acceptance of PR #1489 re-measured
on master), so the residual #1489 stated in its body is not lost with that issue.

This is the same class as the "second mapping" rant 2026-09-20T18:58:44 forbids, in its dying
form: the handlers that were the second record→entry mapping are now dead code, kept alive only by
their own declarations and a comment naming their status.

Measured on master bff15afc

grep -rn "addHistoryMessage|prependHistoryMessage" --include=*.ts --include=*.tsx emrg/gui/renderer/src
  transcript.ts:163-169   the doc comment + the two interface members ("已无调用方" / no call site)
  transcript.ts:502       addHistoryMessage: (text, sid, role) => { … entries.push({ kind: "history", … }) }
  transcript.ts:518       prependHistoryMessage: … entries.unshift({ kind: "history", … })

No production call site exists outside transcript.ts itself, and nothing in the test suite calls
either (the Shell path now goes through lib/historyReplay.ts). kind: "history" is written only
from those two implementations (:514, :531).

Why it is not just tidiness

Every remaining member is a second way to put history into the transcript, which is exactly what the
rant's acceptance forbids — and it is reachable: the entry kind is rendered, so a future change that
calls either handler silently produces history that did not come through the same handlers as the
live stream. Dead code that is one call away from being a second mapping is the failure mode the
rant named, so it should not be left as a permanent option.

What would close it

Delete the two interface members, their two implementations, the kind: "history" render branch and
its CSS, and any test that constructs them directly — one change, no behaviour change, with the
renderer suite green afterwards (Agent.md's Node count line needs re-syncing via
scripts/check-node-test-count.py --write if a case is removed with it).

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions