chore(deadcode): drop unused exact session lookup · openclaw/openclaw@2ef61eb
vincentkoc
·
2026-06-22
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -14,7 +14,6 @@ import {
|
14 | 14 | cleanupSessionLifecycleArtifacts, |
15 | 15 | createSessionEntryWithTranscript, |
16 | 16 | listSessionEntries, |
17 | | -loadExactSessionEntry, |
18 | 17 | loadSessionEntry, |
19 | 18 | loadTranscriptEvents, |
20 | 19 | patchSessionEntry, |
@@ -207,7 +206,7 @@ describe("session accessor file-backed seam", () => {
|
207 | 206 | ); |
208 | 207 | }); |
209 | 208 | |
210 | | -it("keeps exact persisted-key lookup separate from canonical entry reads", async () => { |
| 209 | +it("resolves canonical entry reads without requiring exact key casing", async () => { |
211 | 210 | fs.writeFileSync( |
212 | 211 | storePath, |
213 | 212 | JSON.stringify({ |
@@ -225,15 +224,12 @@ describe("session accessor file-backed seam", () => {
|
225 | 224 | storePath, |
226 | 225 | }; |
227 | 226 | |
228 | | -expect(loadSessionEntry(mixedCaseScope)?.sessionId).toBe("session-1"); |
229 | | -expect(loadExactSessionEntry(mixedCaseScope)).toBeUndefined(); |
230 | | -expect(loadExactSessionEntry({ sessionKey: "agent:main:main", storePath })).toEqual({ |
231 | | -sessionKey: "agent:main:main", |
232 | | -entry: expect.objectContaining({ |
| 227 | +expect(loadSessionEntry(mixedCaseScope)).toEqual( |
| 228 | +expect.objectContaining({ |
233 | 229 | sessionId: "session-1", |
234 | 230 | model: "gpt-5.5", |
235 | 231 | }), |
236 | | -}); |
| 232 | +); |
237 | 233 | }); |
238 | 234 | |
239 | 235 | it("updates existing entries without creating missing sessions", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -166,12 +166,6 @@ export type SessionEntrySummary = {
|
166 | 166 | entry: SessionEntry; |
167 | 167 | }; |
168 | 168 | |
169 | | -/** Session entry read by the exact persisted session key, without alias resolution. */ |
170 | | -export type ExactSessionEntry = { |
171 | | -sessionKey: string; |
172 | | -entry: SessionEntry; |
173 | | -}; |
174 | | - |
175 | 169 | /** Raw transcript record for non-message events; message records use appendTranscriptMessage. */ |
176 | 170 | export type TranscriptEvent = unknown; |
177 | 171 | |
@@ -443,24 +437,6 @@ export function loadSessionEntry(scope: SessionAccessScope): SessionEntry | unde
|
443 | 437 | return getSessionEntry(scope); |
444 | 438 | } |
445 | 439 | |
446 | | -/** |
447 | | - * Returns only the row persisted under the exact key provided. |
448 | | - * Use this for authorization-sensitive routing where alias canonicalization |
449 | | - * could cross an account or agent boundary. |
450 | | - */ |
451 | | -export function loadExactSessionEntry(scope: SessionAccessScope): ExactSessionEntry | undefined { |
452 | | -const sessionKey = scope.sessionKey.trim(); |
453 | | -if (!sessionKey) { |
454 | | -return undefined; |
455 | | -} |
456 | | -const store = loadSessionStore(resolveAccessStorePath(scope), { |
457 | | - ...(scope.clone === false ? { clone: false } : {}), |
458 | | - ...(scope.hydrateSkillPromptRefs === false ? { hydrateSkillPromptRefs: false } : {}), |
459 | | -}); |
460 | | -const entry = Object.hasOwn(store, sessionKey) ? store[sessionKey] : undefined; |
461 | | -return entry ? { sessionKey, entry } : undefined; |
462 | | -} |
463 | | - |
464 | 440 | /** Lists entries from the resolved store, preserving the persisted key for each row. */ |
465 | 441 | export function listSessionEntries( |
466 | 442 | scope: Partial<Omit<SessionAccessScope, "sessionKey">> = {}, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。