Skip to content

Commit 806dc51

Browse files
committed
Compose Sidekick ACP attachment with reviewed TestAgent delivery
2 parents 45977fe + d9c4380 commit 806dc51

15 files changed

Lines changed: 691 additions & 500 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,10 @@ jobs:
662662
with:
663663
bun-version: 1.4.0
664664

665+
- uses: denoland/setup-deno@e95548e56dfa95d4e1a28d6f422fafe75c4c26fb # v2.0.3
666+
with:
667+
deno-version: v2.9.5
668+
665669
- run: bun install
666670

667671
- name: Test

‎architecture.md‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7174,20 +7174,22 @@ exactly once.
71747174

71757175
### What one entry retains about the checkout it is standing in
71767176

7177-
The trusted `--observe-worktree` command configuration permits one existing
7178-
linked checkout for the four local Git reads. The selected entry factory
7179-
receives its detached path from the captured profile; document props, Context
7180-
values and retained data do not supply it. Native validation checks the root,
7181-
linked registration, common directory, object format and captured repository
7182-
identity before live targeting work, including before Dir can ensure a missing
7183-
root. Observation registrations remain separate from mutation/publication and
7177+
A retained REPL can inspect its separate existing linked source checkout with
7178+
`--observe-worktree /absolute/linked-checkout`. This admits the four local Git
7179+
reads in that checkout without selecting it for mutations or publication. The
7180+
selected entry factory receives the path from the captured command profile;
7181+
document props, Context values and retained data do not supply it. Native
7182+
validation checks the root, linked registration, common directory, object format
7183+
and captured repository identity before live targeting work, including before
7184+
Dir can ensure a missing root. Observation registrations remain separate from
71847185
retained Files placements.
71857186

71867187
A closed version 1 `observation-worktree` placement uses the existing placement
71877188
record protocol and normalized request fingerprint. Its acknowledged append
7188-
precedes private read membership. Historical reconstruction is passive; a new
7189+
precedes private read membership. The reader preserves existing version 1
7190+
histories without native inspection or ownership during completed replay. A new
71897191
read validates the current grant and identity and takes an entry-owned
7190-
observation hold keyed by common directory and checkout. This nonblocking hold
7192+
observation lock keyed by common directory and checkout. This nonblocking lock
71917193
lives outside either checkout, uses the existing joined advisory-lock owner,
71927194
and takes no mutation lease. Native reads and placement appends use the entry's
71937195
existing Git serializer. No managed checkout is adopted and no sidecar is

‎packages/cli/src/repl/repositories/deno/files.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export interface ReplLocalRecorder {
116116
* a path a later `<Dir>` sibling renders at.
117117
*/
118118
placements(): readonly ReplManagedPlacement[];
119-
guard?(target: string): Operation<void>;
119+
validateObservationTarget(target: string): Operation<void>;
120120
}
121121

122122
/** The middleware that records this entry's authored mutations. */
@@ -204,9 +204,7 @@ function* routed(
204204
}
205205

206206
const target = yield* targetOf(request);
207-
if (recorder.guard !== undefined) {
208-
yield* recorder.guard(target);
209-
}
207+
yield* recorder.validateObservationTarget(target);
210208
const managed = covering(recorder.placements(), target);
211209
if (managed !== undefined) {
212210
// Placement ownership first, and for a read as much as for a write: what it

‎packages/cli/src/repl/repositories/deno/leases.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export function* holdManagedPlacement(acquire: () => Operation<void>): Operation
108108
}
109109
}
110110

111-
export function* useObservationLease(commonDirectory: string, checkout: string): Operation<void> {
111+
export function* useObservationLock(commonDirectory: string, checkout: string): Operation<void> {
112112
const held = yield* useAdvisoryLock(
113113
commonDirectoryLock("observation\0" + commonDirectory + "\0" + checkout),
114114
);

‎packages/cli/src/repl/repositories/deno/observations.ts‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import { realpath } from "node:fs/promises";
4646
import { basename, isAbsolute, relative, resolve } from "node:path";
4747
import { DurableContext } from "@executablemd/durable-streams";
4848
import { lazily, locatorFingerprint, type AmbientRepository } from "@executablemd/git/deno";
49-
import { useObservationLease } from "./leases.ts";
49+
import { useObservationLock } from "./leases.ts";
5050
import { currentCoroutine } from "./local.ts";
5151
import {
5252
parseReplPlacementRecord,
@@ -130,7 +130,7 @@ export interface ReplObservationEntry {
130130
/** The native repository work this entry asks for, credential-free. */
131131
readonly operations: DenoRepositoryOperations;
132132
prepare?(path: string): Operation<void>;
133-
ownObservation?(target: ReplGitCheckout): Operation<void>;
133+
ownObservation(target: ReplGitCheckout): Operation<void>;
134134
/** Hold a managed slot for the entry, single-flight per root and slot. */
135135
holdSlot(root: string, kind: SlotKind, path: string, subject: string): Operation<void>;
136136
/** Run live native Git for one shared Git directory in order within this entry. */
@@ -440,9 +440,6 @@ function* route(
440440
function* own(entry: ReplObservationEntry, target: ReplGitCheckout): Operation<void> {
441441
const registration = target.registration;
442442
if (registration.placement.kind === "observation-worktree") {
443-
if (entry.ownObservation === undefined) {
444-
throw observationPlacementRefusal();
445-
}
446443
yield* entry.ownObservation(target);
447444
return;
448445
}
@@ -586,16 +583,16 @@ const observationCoordinator: LiveDurableOperationCoordinator = {
586583
},
587584
};
588585

589-
/** Entry-private routing for the one host-selected observation checkout. */
590-
export function* useObservationWorktrees(options: {
586+
/** Validate and register one host-selected checkout for Git reads. */
587+
export function* useObservationWorktree(options: {
591588
readonly path: string | undefined;
592589
readonly cwd: string;
593590
readonly operations: DenoRepositoryOperations;
594591
ambient(): Operation<AmbientRepository | undefined>;
595592
serialize<T>(key: string, work: () => Operation<T>): Operation<T>;
596593
}): Operation<{
597594
prepare(path: string): Operation<void>;
598-
guard(path: string): Operation<void>;
595+
validateObservationTarget(path: string): Operation<void>;
599596
own(target: ReplGitCheckout): Operation<void>;
600597
checkouts(): readonly ReplGitCheckout[];
601598
}> {
@@ -615,7 +612,7 @@ export function* useObservationWorktrees(options: {
615612
const key = common + "\0" + checkout;
616613
let acquire = holds.get(key);
617614
if (acquire === undefined) {
618-
acquire = lazily(owner, () => useObservationLease(common, checkout));
615+
acquire = lazily(owner, () => useObservationLock(common, checkout));
619616
holds.set(key, acquire);
620617
}
621618
return acquire();
@@ -785,7 +782,7 @@ export function* useObservationWorktrees(options: {
785782
prepare,
786783
own,
787784
checkouts: () => routes,
788-
*guard(path) {
785+
*validateObservationTarget(path) {
789786
yield* prepare(path);
790787
const target = routes.find(
791788
(route) =>

‎packages/cli/src/repl/repositories/deno/provider.ts‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import { replFileMiddleware } from "./files.ts";
7474
import type { ReplLocalRecorder, ReplManagedPlacement } from "./files.ts";
7575
import { replGitMiddleware } from "./git.ts";
7676
import type { ReplGitCheckout, ReplGitEntry } from "./git.ts";
77-
import { replObservationMiddleware, useObservationWorktrees } from "./observations.ts";
77+
import { replObservationMiddleware, useObservationWorktree } from "./observations.ts";
7878
import type { ReplObservationEntry } from "./observations.ts";
7979
import { GitQuery } from "@executablemd/git/api";
8080
import { replPushAdmission, replPushPolicy } from "./push.ts";
@@ -332,13 +332,9 @@ function* initializeReplRepository(
332332
// coroutine consumes at its own cursor.
333333
const gitCheckouts: ReplGitCheckout[] = [];
334334

335-
let observationGuard: ((path: string) => Operation<void>) | undefined;
335+
let validateObservationTarget: (path: string) => Operation<void> = function* () {};
336336
const recorder: ReplLocalRecorder = {
337-
*guard(path) {
338-
if (observationGuard !== undefined) {
339-
yield* observationGuard(path);
340-
}
341-
},
337+
validateObservationTarget: (path) => validateObservationTarget(path),
342338
*selection(): Operation<ReplAmbientCheckout | undefined> {
343339
const coroutine = yield* currentCoroutine();
344340
const remembered = selected.get(coroutine);
@@ -566,14 +562,14 @@ function* initializeReplRepository(
566562
// entry's registry, its registered checkouts, its slot acquisition and its
567563
// native turn, and take no mutation lease: a read changes nothing, so there
568564
// is nothing for one to protect.
569-
const observations = yield* useObservationWorktrees({
565+
const observations = yield* useObservationWorktree({
570566
path: options.observeWorktree,
571567
cwd: directory,
572568
operations,
573569
ambient: useAmbientRepository,
574570
serialize,
575571
});
576-
observationGuard = observations.guard;
572+
validateObservationTarget = observations.validateObservationTarget;
577573
const observationEntry: ReplObservationEntry = {
578574
prepare: observations.prepare,
579575
ownObservation: observations.own,

0 commit comments

Comments
 (0)