chore(session): scope history reader exemptions to tests

This commit is contained in:
_Kerman
2026-09-09 12:55:32 +08:00
parent 37abcb74c5
commit 8f986c8da6
170 changed files with 72 additions and 1070 deletions
@@ -41,7 +41,6 @@ async function commandHarness(
// never appends one: the identity folds as continuable, but from the
// inherited prefix rather than this Session's own suffix.
const lineage = childMode === 'seeded-continuable' || childMode === 'seed-only'
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
? ancestor.snapshotEvents()
: undefined
const session = ctx.sessions.create(sessionId, {
@@ -203,7 +203,6 @@ describe('attached updatedAt tracks human prompts', () => {
meta: { cwd: '/proj', createdAt: 500 },
})
ctx.agents.register({ id: resumed.id, session: resumed, status: 'idle', ctx } as Agent)
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
const boundary = resumed.snapshotEvents().at(-1)
expect(boundary?.type).toBe('session/end-seed')
expect(boundary?.time).toBeGreaterThan(worked)
@@ -718,7 +717,6 @@ describe('sessions.prompt synchronous rejection', () => {
defaultModelSelection: () => ({ provider: 'p', model: 'm' }),
cwd: '/tmp',
})
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
const initialEvents = session.snapshotEvents()
const rejectedContent: readonly SessionPromptRequest['content'][] = [
[],
@@ -743,7 +741,6 @@ describe('sessions.prompt synchronous rejection', () => {
}
expect(followup).not.toHaveBeenCalled()
expect(steer).not.toHaveBeenCalled()
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
expect(session.snapshotEvents()).toEqual(initialEvents)
const queued = await remote.prompt(promptRequest({
@@ -95,7 +95,6 @@ describe('sessions.fork', () => {
expect(response.ok ? null : response.error).toBeNull()
if (!response.ok) return
const child = ctx.sessions.get(response.value.sessionId)
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
expect(child?.snapshotEvents().map(event => event.type)).toEqual([
'turn/start', 'user/message', 'turn/end', 'session/end-seed',
])
@@ -215,14 +214,12 @@ describe('sessions.fork', () => {
const omitted = await proxy.fork(request({ sessionId: source.id }))
expect(omitted.ok).toBe(true)
if (omitted.ok) {
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
expect(ctx.sessions.get(omitted.value.sessionId)?.snapshotEvents().map(event => event.type))
.toEqual(expectedTypes)
}
const pastEnd = await proxy.fork(request({ sessionId: source.id, atSeq: 999 }))
expect(pastEnd.ok).toBe(true)
if (pastEnd.ok) {
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
expect(ctx.sessions.get(pastEnd.value.sessionId)?.snapshotEvents().map(event => event.type))
.toEqual(expectedTypes)
}
@@ -246,12 +243,10 @@ describe('sessions.fork', () => {
const source = liveAgent(ctx, 'session-aborted', 1, 'aborted')
// What a stopped message's fork button anchors on: the frozen node sits
// one event before its turn/end, floored client-side to that event's seq.
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
const anchor = (source.snapshotEvents().at(-1)?.seq ?? 0) - 1
const response = await remote(ctx).fork(request({ sessionId: source.id, atSeq: anchor }))
expect(response.ok).toBe(true)
if (!response.ok) return
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
expect(ctx.sessions.get(response.value.sessionId)?.snapshotEvents().map(event => event.type)).toEqual([
'turn/start', 'user/message', 'turn/end',
'turn/start', 'user/message', 'turn/end',
@@ -263,7 +258,6 @@ describe('sessions.fork', () => {
it('rejects an in-log anchor whose turn is still open', async () => {
const ctx = await composed()
const source = liveAgent(ctx, 'session-open', 1, 'open')
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
const anchor = source.snapshotEvents().at(-1)?.seq ?? 0
const response = await remote(ctx).fork(request({ sessionId: source.id, atSeq: anchor }))
expect(response).toMatchObject({
@@ -172,7 +172,6 @@ describe('session.history projections block', () => {
parent.append('turn/end', { turn: 1, reason: { kind: 'completed' } })
const inheritedEventCount = parent.seq
const child = ctx.sessions.create(SessionId('wire-seed-child'), {
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
seed: parent.snapshotEvents(),
inheritedEventCount,
meta: {
@@ -449,7 +448,6 @@ describe('session.history projections block', () => {
expect('test/last-user' in after.projections.values).toBe(false)
expect(after.projections.values.sessionListMetadata).toEqual({
blank: true,
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
lastPromptAt: session.eventAt(SessionSeq(session.seq - 1))?.time,
})
})
@@ -484,7 +482,6 @@ describe('session.list projections column', () => {
expect(row?.projections?.values['test/last-user']).toEqual({ text: 'm0' })
expect(row?.projections?.values.sessionListMetadata).toEqual({
blank: false,
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
lastPromptAt: session.eventAt(SessionSeq(session.seq - 1))?.time,
})
expect(row?.projections?.asOfSeq).toBe(session.seq - 1)
@@ -76,7 +76,6 @@ describe('sessions.rename', () => {
expect(renamed.ok).toBe(true)
if (!renamed.ok) return
expect(renamed.value.title).toBe('new name')
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
const event = source.snapshotEvents().findLast(item => item.type === 'session/title')
expect(event?.seq).toBe(renamed.value.seq)
expect(event?.data).toMatchObject({ title: 'new name', source: { kind: 'user' } })
@@ -230,7 +230,6 @@ describe('SessionHistoryController', () => {
observed.resolve({
source: 'live',
header: attached.header,
// oxlint-disable-next-line typescript/no-deprecated -- Existing Session history read; migration deferred.
events: attached.snapshotEvents(),
cursor: attached.seq - 1,
projections: { asOfSeq: attached.seq - 1, values: {} },