Skip to content

Commit 35ecde7

Browse files
committed
chore(layering): declare the deferred-warning latch owner and ratchet baseline
The R7 session-state gate requires every SessionState field to have a declared writer owner: recoveredSnapshotWarningLatch is owned solely by snapshot-quality-latch.ts (matching the field's 'managed only through' contract), and the R10 pressure baseline grows deliberately to 23 writer-owned fields / 29 owner claims. Also oxfmt-formats the new latch test.
1 parent 62f8be7 commit 35ecde7

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

scripts/layering/daemon-modularity.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const LARGEST_TYPE_CYCLE_ZONE_CEILINGS: Readonly<Record<string, number>> = {
1313

1414
export const DAEMON_MODULARITY_BASELINE = {
1515
sessionState: {
16-
writerOwnedFields: 22,
17-
ownerFileClaims: 28,
16+
writerOwnedFields: 23,
17+
ownerFileClaims: 29,
1818
},
1919
largestTypeCycle: {
2020
zoneMembers: LARGEST_TYPE_CYCLE_ZONE_CEILINGS,

scripts/layering/session-state.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ export const SESSION_STATE_FIELD_OWNERS: Readonly<Record<string, readonly string
4848
snapshotGeneration: ['src/daemon/session-snapshot.ts'],
4949
lastComparisonSafeSnapshot: ['src/daemon/session-snapshot.ts'],
5050
androidSnapshotFreshness: ['src/daemon/android-snapshot-freshness.ts'],
51+
// One-shot deferred-warning latch (#1587 follow-up): the transition function is the only
52+
// writer, so the latch's window semantics live in a single module.
53+
recoveredSnapshotWarningLatch: ['src/daemon/snapshot-quality-latch.ts'],
5154

5255
// #1478 P4a script publication. The tagged aggregate replaced the eight co-resident
5356
// `saveScript*`/`scriptRecordingState`/`repair*` fields; its ONLY writers are the two

src/daemon/__tests__/snapshot-quality-latch.test.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ test('internal observation responses neither consume nor clear the latch', () =>
138138

139139
test('sessionless responses pass through unchanged', () => {
140140
const data = { snapshotQuality: deferredVerdict() };
141-
expect(
142-
applyRecoveredWarningLatch({ session: undefined, data, internalObservation: false }),
143-
).toBe(data);
141+
expect(applyRecoveredWarningLatch({ session: undefined, data, internalObservation: false })).toBe(
142+
data,
143+
);
144144
});
145145

146146
function scenario() {
@@ -184,7 +184,9 @@ function responseWarnings(response: Awaited<ReturnType<typeof dispatchSnapshotVi
184184
return (response.data?.warnings ?? []) as string[];
185185
}
186186

187-
function storedLatch(input: ReturnType<typeof scenario>): SessionState['recoveredSnapshotWarningLatch'] {
187+
function storedLatch(
188+
input: ReturnType<typeof scenario>,
189+
): SessionState['recoveredSnapshotWarningLatch'] {
188190
return input.sessionStore.get(input.sessionName)?.recoveredSnapshotWarningLatch;
189191
}
190192

0 commit comments

Comments
 (0)