Skip to content

Commit 1e65590

Browse files
committed
fix: repair main after the managed-allocation move landed under stale PRs
`main` has been red since #2308. That PR was authored before #2316 moved managed-device allocation into `@agent-device/managed-allocation`, so the daemon files it added still import pre-move sibling paths that no longer exist: src/daemon/managed-device-allocation/lease-admission.ts(19,8): error TS2307: Cannot find module './record-validation.ts' src/daemon/managed-device-allocation/__tests__/lease-admission.fixtures.ts(10,61): error TS2307: Cannot find module './fixtures.ts' Typecheck, Repo Guards, and the two managed provider-integration suites all fail on it, which makes every open PR red. - `lease-admission.ts` now reaches the record validators through the package's `./record` surface, which re-exports them. The `TS2322` at line 70 was a consequence of the unresolved import, not a separate defect: with the module resolved, `isVerbatimId` narrows `identityIncarnationId` again. - The daemon-side grant fixtures come back under `src/daemon`, stated in contract terms only. Both trees keeping their own test data is the shape #2316 already chose for `managed-device-allocator.fixtures.ts`. - The root now consumes `@agent-device/managed-allocation`, so its `ignoreDependencies` entry — whose comment said "no root consumer yet" — goes. Separately, the eager-closure ratchet was failing on a stale approval row: the merge-base now carries `packages/capture-kit/src/durable-capture/index.ts`, so nothing can read its `APPROVED_OVER_CEILING` row and the table's own staleness rule fails it. Removed, exactly as the rule prescribes.
1 parent 6e22e26 commit 1e65590

5 files changed

Lines changed: 63 additions & 15 deletions

File tree

.fallowrc.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@
5656
// @agent-device/provider-limrun owns the source import, while the published
5757
// root build externalizes @limrun/api and retains runtime imports in packed chunks.
5858
"@limrun/api",
59-
// @agent-device/managed-allocation has no root consumer yet: the managed runtime binding
60-
// (ADR 0021 §3) is its first, and it lands after the package's move out of src/daemon.
61-
"@agent-device/managed-allocation",
6259
// Oxlint resolves the shared config's JS plugins dynamically from their package names.
6360
"@nkzw/eslint-plugin",
6461
"eslint-plugin-no-only-tests",

packages/managed-allocation/src/record.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ export { ALLOCATION_OPERATION_SCHEMA_VERSION };
44
export { newAllocationOperation } from './record-factory.ts';
55
export { decodeAllocationOperationRecord } from './record-codec.ts';
66
export { bindingFenceFor } from './record-fence.ts';
7+
// The daemon's managed lease admission (src/daemon/managed-device-allocation/lease-admission.ts)
8+
// validates a grant against the same record rules the package applies internally, so these leave
9+
// through the record surface rather than being restated at the call site.
10+
export {
11+
freezeLease,
12+
isRequestGeneration,
13+
isValidLease,
14+
isVerbatimId,
15+
} from './record-validation.ts';
716
export type {
817
AllocationAllocatorOutcome,
918
AllocationOperationPhase,

scripts/__tests__/eager-closure-budgets.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,7 @@ export const NEW_ENTRY_CEILINGS: Readonly<Record<EntryCategory, number>> = Objec
128128
*/
129129
export const APPROVED_OVER_CEILING: Readonly<
130130
Record<string, { issue: string; reason: string; owner: string }>
131-
> = Object.freeze({
132-
'packages/capture-kit/src/durable-capture/index.ts': {
133-
issue: '#2317',
134-
reason:
135-
'The entry surface is new; the weight is not. These mechanics moved out of src/daemon ' +
136-
'unchanged, and their two heaviest edges are the ones that make them durable at all: the ' +
137-
'store publishes through host-kit/file, and adoption validates through the envelope codec. ' +
138-
'Only the daemon imports this subpath, and its own closure did not grow.',
139-
owner: '@thymikee',
140-
},
141-
});
131+
> = Object.freeze({});
142132

143133
/** The category is a function of the path, never a hand-written column. */
144134
export function entryCategoryOf(entryFile: string): EntryCategory {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import type {
2+
LeaseRequestInput,
3+
LeaseRequestStatus,
4+
ManagedIdentityRef,
5+
ManagedLease,
6+
ManagedShapeRequest,
7+
} from '@agent-device/contracts/managed-device-allocation';
8+
9+
/**
10+
* The grant shapes the daemon-side managed admission is written against, stated in contract terms
11+
* only. `@agent-device/managed-allocation` keeps its own copy for the package's tests
12+
* (`packages/managed-allocation/src/__tests__/fixtures.ts`), the same way both sides keep their own
13+
* `managed-device-allocator.fixtures.ts`: neither tree reaches past the other's exported surface
14+
* for test data.
15+
*/
16+
const ALLOCATION_SHAPE: ManagedShapeRequest = {
17+
platform: 'ios',
18+
deviceType: 'iPhone 16',
19+
osVersion: '18.2',
20+
};
21+
22+
const ALLOCATION_IDENTITY: ManagedIdentityRef = {
23+
deviceId: 'device-1',
24+
identityIncarnationId: 'incarnation-1',
25+
};
26+
27+
export const ALLOCATION_LEASE: ManagedLease = {
28+
id: 'lease-1',
29+
ttlDeadline: 1_700_000_900_000,
30+
device: { address: ALLOCATION_IDENTITY.deviceId },
31+
environment: { SIMLOCK_IOS_DEVICE_SET: '/managed/set' },
32+
};
33+
34+
export const ALLOCATION_REQUEST: LeaseRequestInput = {
35+
requesterId: 'requester-a',
36+
requestGeneration: 1,
37+
attemptKey: 'attempt-1',
38+
shape: ALLOCATION_SHAPE,
39+
deadlineAtMs: 1_700_000_600_000,
40+
admission: 'fail-fast',
41+
activation: 'direct',
42+
attribution: { tenantId: 'tenant-a' },
43+
};
44+
45+
export const ALLOCATION_GRANTED_STATUS: LeaseRequestStatus = {
46+
requesterId: ALLOCATION_REQUEST.requesterId,
47+
requestGeneration: ALLOCATION_REQUEST.requestGeneration,
48+
attemptKey: ALLOCATION_REQUEST.attemptKey,
49+
identityIncarnationId: ALLOCATION_IDENTITY.identityIncarnationId,
50+
state: 'granted',
51+
lease: ALLOCATION_LEASE,
52+
};

src/daemon/managed-device-allocation/lease-admission.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
isRequestGeneration,
1717
isValidLease,
1818
isVerbatimId,
19-
} from './record-validation.ts';
19+
} from '@agent-device/managed-allocation/record';
2020

2121
export type ManagedCommandHorizon = Readonly<{ deadline: Deadline; teardownTimeoutMs: number }>;
2222
type FenceReason = 'released' | 'replaced' | 'superseded' | 'fenced' | 'authority-unconfirmed';

0 commit comments

Comments
 (0)