perf(session-controller): exclude the shared image limits from session summaries

`imageLimits` is a boot constant every Session shares: the unit stores no
per-Session state (`stateSchema: z.null()`, `apply: state => state`) and its
view returns `ctx.attachments.imageLimits`. A list row therefore repeated one
host-wide capability fact on every row. It now carries the summary mark like
the three log-derived units, so a summary read skips it while an opened Session
still receives it through `session/follow`, the control baseline, and
`session.projections`.

No other logic changes: the registration, its schema, its constant view, and
the host-side prompt validation keep reading `ctx.attachments` directly.
This commit is contained in:
imccyu committed 2026-10-18 23:04:29 +08:00
1 parent ef446fc85f
commit 8e2dd67de8
13 files changed
+44 -37

No files matched your search

@@ -1,7 +1,7 @@
/**
* Session-list summary payloads: a `session.list` row carries every registered
* wire projection except the three units that declare `summary: false`
* (`turnOutline`, `sessionStats`, `todos`), while an opened Session's
* wire projection except the units that declare `summary: false`
* (`turnOutline`, `sessionStats`, `todos`, `imageLimits`), while an opened Session's
* `session/follow` opening snapshot keeps serving them.
*/
@@ -23,7 +23,7 @@ import {
} from '@deepseek-ai/dsh-tool-todo'
import { createSessionTestRemote } from './test-remote.ts'
const SUMMARY_EXCLUDED_KEYS = ['turnOutline', 'sessionStats', 'todos'] as const
const SUMMARY_EXCLUDED_KEYS = ['turnOutline', 'sessionStats', 'todos', 'imageLimits'] as const
const ownedContexts = new Set<Context>()
afterEach(async () => {
@@ -112,7 +112,7 @@ describe('session.list summary payload', () => {
expect(row?.projections?.values.sessionListMetadata).toMatchObject({ blank: false })
})
it('keeps the three units on an opened Session\'s follow snapshot', async () => {
it('keeps the excluded units on an opened Session\'s follow snapshot', async () => {
const { ctx } = await harness()
const { id } = seedSession(ctx)
const session = ctx.sessions.get(id)
@@ -126,9 +126,10 @@ describe('session.list summary payload', () => {
.toEqual(everyValue[key as keyof typeof everyValue])
}
expect(snapshot.projections.values.todos).toEqual([{ content: 'ship it', status: 'in_progress' }])
expect(snapshot.projections.values.imageLimits).toEqual(ctx.attachments.imageLimits)
})
it('drops the three units from the list while a Session is still attached', async () => {
it('drops the excluded units from the list while a Session is still attached', async () => {
const { ctx } = await harness()
const { id } = seedSession(ctx)
// Two consecutive pulls: a refresh must not reintroduce a dropped unit.
@@ -139,6 +140,7 @@ describe('session.list summary payload', () => {
expect(row?.projections?.values, `attempt ${String(attempt)}`).not.toHaveProperty('turnOutline')
expect(row?.projections?.values, `attempt ${String(attempt)}`).not.toHaveProperty('sessionStats')
expect(row?.projections?.values, `attempt ${String(attempt)}`).not.toHaveProperty('todos')
expect(row?.projections?.values, `attempt ${String(attempt)}`).not.toHaveProperty('imageLimits')
}
})
})