mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 19:34:29 +00:00
chore: exempt seam field-name constants from the layout-writer ratchet; drop dead setters (F4)
The seam's SEAM_*_FIELDS lists name fields without writing them, so the ratchet skips them and the raised baseline row is gone (renderer total 569, main 571). setStructuredChatSleptAt and the two launch-directory setters lost their last callers to the batched companion write. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7554926f35
commit
4e1665997f
@@ -45,7 +45,6 @@
|
||||
1 src/renderer/src/runtime/web-session-tabs-sync/inventory/web-runtime-session-snapshot.ts
|
||||
3 src/renderer/src/runtime/web-session-tabs-sync/placement/web-session-client-owned-tab-placement.ts
|
||||
2 src/renderer/src/runtime/web-session-tabs-sync/session-tabs-inventory-absence.ts
|
||||
7 src/renderer/src/store/seam-record-fields.ts # names the transition seam's tracked fields once; no layout write
|
||||
10 src/renderer/src/store/slices/browser/cleanup/browser-close-actions.ts
|
||||
2 src/renderer/src/store/slices/browser/create-browser-slice.ts
|
||||
1 src/renderer/src/store/slices/browser/hydration/browser-hydration-state.ts
|
||||
|
||||
+20
-1
@@ -320,6 +320,24 @@ function isSameNameCopy(property, name) {
|
||||
return ts.isPropertyAccessExpression(value) && value.name.text === name
|
||||
}
|
||||
|
||||
// The transition seam names the fields it tracks in `const SEAM_*_FIELDS = [...] as const` lists; names, not writes.
|
||||
function isSeamFieldNameConstant(literal) {
|
||||
let list = literal.parent
|
||||
if (!ts.isArrayLiteralExpression(list)) {
|
||||
return false
|
||||
}
|
||||
let declaration = list.parent
|
||||
while (ts.isAsExpression(declaration) || ts.isSatisfiesExpression(declaration)) {
|
||||
declaration = declaration.parent
|
||||
}
|
||||
return (
|
||||
ts.isVariableDeclaration(declaration) &&
|
||||
ts.isIdentifier(declaration.name) &&
|
||||
/^SEAM_[A-Z_]+_FIELDS$/.test(declaration.name.text) &&
|
||||
(declaration.parent.flags & ts.NodeFlags.Const) !== 0
|
||||
)
|
||||
}
|
||||
|
||||
/** Layout writes in one file under one ratchet's rules. */
|
||||
export function countLayoutWrites(sourceText, ratchet, fileName = 'file.tsx') {
|
||||
const names = [...ratchet.writerNames, ...ratchet.assignedFields]
|
||||
@@ -392,7 +410,8 @@ export function countLayoutWrites(sourceText, ratchet, fileName = 'file.tsx') {
|
||||
node.parent.expression.expression.text === 'Object' &&
|
||||
node.parent.expression.name.text === 'hasOwn'
|
||||
) &&
|
||||
!ts.isLiteralTypeNode(node.parent)
|
||||
!ts.isLiteralTypeNode(node.parent) &&
|
||||
!isSeamFieldNameConstant(node)
|
||||
) {
|
||||
count += 1
|
||||
}
|
||||
|
||||
+15
-3
@@ -106,11 +106,23 @@ describe.each<ChatStatusConsumer>(['sidebar', 'parent picker', 'palette'])(
|
||||
expect(chatStatusLabels()).toEqual(['inactive'])
|
||||
const tab = useAppStore.getState().unifiedTabsByWorktree[TARGET_WORKTREE_ID][0]
|
||||
const paneKey = structuredAgentSessionPaneKey(tab.id, tab.entityId)
|
||||
act(() => useAppStore.getState().setStructuredChatSleptAt(paneKey, undefined))
|
||||
act(() =>
|
||||
useAppStore
|
||||
.getState()
|
||||
.applyStructuredChatCompanionWrites([{ kind: 'slept-at', paneKey, sleptAt: undefined }])
|
||||
)
|
||||
expect(chatStatusLabels()).toEqual(['active'])
|
||||
act(() => useAppStore.getState().setStructuredChatSleptAt(paneKey, 1))
|
||||
act(() =>
|
||||
useAppStore
|
||||
.getState()
|
||||
.applyStructuredChatCompanionWrites([{ kind: 'slept-at', paneKey, sleptAt: 1 }])
|
||||
)
|
||||
expect(chatStatusLabels()).toEqual(['inactive'])
|
||||
act(() => useAppStore.getState().setStructuredChatSleptAt(paneKey, null))
|
||||
act(() =>
|
||||
useAppStore
|
||||
.getState()
|
||||
.applyStructuredChatCompanionWrites([{ kind: 'slept-at', paneKey, sleptAt: null }])
|
||||
)
|
||||
expect(chatStatusLabels()).toEqual(['active'])
|
||||
const working: AgentStatusEntry = {
|
||||
paneKey,
|
||||
|
||||
@@ -10,7 +10,6 @@ export type StructuredChatSleptAtByPaneKey = Readonly<Record<string, number | nu
|
||||
|
||||
export type StructuredChatSleptAtSlice = {
|
||||
structuredChatSleptAtByPaneKey: StructuredChatSleptAtByPaneKey
|
||||
setStructuredChatSleptAt: (paneKey: string, sleptAt: number | null | undefined) => void
|
||||
}
|
||||
|
||||
const EMPTY_SLEPT_CHATS: StructuredChatSleptAtByPaneKey = Object.freeze({})
|
||||
@@ -71,13 +70,6 @@ export const createStructuredChatSleptAtSlice: StateCreator<
|
||||
[],
|
||||
[],
|
||||
StructuredChatSleptAtSlice
|
||||
> = (set) => ({
|
||||
structuredChatSleptAtByPaneKey: {},
|
||||
setStructuredChatSleptAt: (paneKey, sleptAt) =>
|
||||
set((state) => {
|
||||
const next = withStructuredChatSleptAt(state.structuredChatSleptAtByPaneKey, paneKey, sleptAt)
|
||||
return next === state.structuredChatSleptAtByPaneKey
|
||||
? state
|
||||
: { structuredChatSleptAtByPaneKey: next }
|
||||
})
|
||||
> = () => ({
|
||||
structuredChatSleptAtByPaneKey: {}
|
||||
})
|
||||
|
||||
+2
-43
@@ -10,13 +10,6 @@ export type StructuredSessionLaunchDirectory = {
|
||||
/** Mirror host-pinned chat directories; absent uses workspace resolution except floating chats, which remain unknown until pinned. */
|
||||
export type StructuredSessionLaunchDirectorySlice = {
|
||||
structuredSessionLaunchDirectoryByTabId: Record<string, StructuredSessionLaunchDirectory>
|
||||
setStructuredSessionLaunchDirectory: (
|
||||
tabId: string,
|
||||
sessionId: string,
|
||||
launchDirectory: string | undefined
|
||||
) => void
|
||||
/** Only drops the entry while it still belongs to `sessionId`. */
|
||||
clearStructuredSessionLaunchDirectory: (tabId: string, sessionId: string) => void
|
||||
}
|
||||
|
||||
type LaunchDirectoriesByTabId = Record<string, StructuredSessionLaunchDirectory>
|
||||
@@ -50,45 +43,11 @@ export function withoutStructuredSessionLaunchDirectory(
|
||||
return byTabId[tabId]?.sessionId === sessionId ? withoutTab(byTabId, tabId) : byTabId
|
||||
}
|
||||
|
||||
function launchDirectoriesPatch(
|
||||
state: AppState,
|
||||
next: LaunchDirectoriesByTabId
|
||||
): Partial<AppState> | AppState {
|
||||
return next === state.structuredSessionLaunchDirectoryByTabId
|
||||
? state
|
||||
: { structuredSessionLaunchDirectoryByTabId: next }
|
||||
}
|
||||
|
||||
export const createStructuredSessionLaunchDirectorySlice: StateCreator<
|
||||
AppState,
|
||||
[],
|
||||
[],
|
||||
StructuredSessionLaunchDirectorySlice
|
||||
> = (set) => ({
|
||||
structuredSessionLaunchDirectoryByTabId: {},
|
||||
setStructuredSessionLaunchDirectory: (tabId, sessionId, launchDirectory) => {
|
||||
set((state) =>
|
||||
launchDirectoriesPatch(
|
||||
state,
|
||||
withStructuredSessionLaunchDirectory(
|
||||
state.structuredSessionLaunchDirectoryByTabId,
|
||||
tabId,
|
||||
sessionId,
|
||||
launchDirectory
|
||||
)
|
||||
)
|
||||
)
|
||||
},
|
||||
clearStructuredSessionLaunchDirectory: (tabId, sessionId) => {
|
||||
set((state) =>
|
||||
launchDirectoriesPatch(
|
||||
state,
|
||||
withoutStructuredSessionLaunchDirectory(
|
||||
state.structuredSessionLaunchDirectoryByTabId,
|
||||
tabId,
|
||||
sessionId
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
> = () => ({
|
||||
structuredSessionLaunchDirectoryByTabId: {}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user