Session.append() 静默丢弃 ignorable 标记 —— 第三方插件事件可写入,但整条日志在重载时被拒绝 #5769
Replies: 2 comments
|
This is a well-known gap — yours is the 8th independent report of the same mechanism. I can confirm the source exactly, and the fix shape has been stable across several of the best-documented reports. Confirmed at current master (v0.1.3-alpha.1):
Why it's a gap, not a bug to work around: the read side already honors The fix shape that's been agreed across the best reports (starting with #5463 antst's opts: T extends SurfaceEventType ? [opts: SurfaceIntent<T>]
: T extends keyof IgnorableSessionEventMap ? [opts?: { ignorable: true }]
: []Runtime just passes the marker through (decl-merge erases at type level); Two adjacent warts worth addressing in the same pass:
There's a documented design note ( |
|
Just wanted to close the loop and let the community know there's now a plugin that detects this failure mode proactively. I published @argszero/cordis-plugin-session-audit@0.1.2 — a proactive session-log completeness audit that, among other things, scans a stored Two things it gets right about the #5769 failure mode:
It ships as a slash command ( Note: this is a diagnostic for the write-side gap you've identified. The actual fix (append carrying |
Uh oh!
There was an error while loading. Please reload this page.
我理解
SessionEvent.ignorable?: true标记的存在,是为了让插件能把自己的事件类型持久化进 session 日志,并且之后还能重载。然而在当前 dsh-v0.1.3-alpha.1 版本上,没有任何写入路径能打上这个标记:Session.append()会静默丢弃调用方传入的ignorable选项。后果:插件的事件成功写入,但重载时整条日志被拒绝(
SessionFormatUnsupportedError),任何依赖自定义session 事件的插件,其崩溃恢复能力都被破坏。
opts 上的其他键(包括
ignorable)都被静默丢弃:`
append(
type: T,
data: SessionEventMap[T],
...opts: T extends SurfaceEventType ? [opts: SurfaceIntent] : []
): SessionEvent {
const surfaceOpts: SurfaceIntent | undefined = opts[0]
const surfaceMetadata = {
...surfaceOpts?.sourceEventSeqs === undefined ? {} : { sourceEventSeqs: surfaceOpts.sourceEventSeqs },
...surfaceOpts?.surfaceOp === undefined ? {} : { surfaceOp: surfaceOpts.surfaceOp },
}
`
All reactions