Keep new worktrees clean when setup changes are uncommitted (#3311)
* fix(worktrees): preserve selected base config New worktrees were overwriting the selected ref's paseo.json with source-checkout bytes, which could create an accidental revert in an otherwise fresh workspace. Keep committed base config authoritative and warn when locally saved setup changes still need to be committed. * fix(worktrees): seed config exclusively * fix(projects): refresh config status on focus
This commit is contained in:
@@ -4219,6 +4219,7 @@ export const ReadProjectConfigResponseMessageSchema = z.object({
|
||||
ok: z.literal(true),
|
||||
config: PaseoConfigRawSchema.nullable(),
|
||||
revision: PaseoConfigRevisionSchema.nullable(),
|
||||
hasUncommittedWorktreeSetupChanges: z.boolean().optional(),
|
||||
}),
|
||||
z.object({
|
||||
requestId: z.string(),
|
||||
@@ -4240,6 +4241,7 @@ export const WriteProjectConfigResponseMessageSchema = z.object({
|
||||
ok: z.literal(true),
|
||||
config: PaseoConfigRawSchema,
|
||||
revision: PaseoConfigRevisionSchema,
|
||||
hasUncommittedWorktreeSetupChanges: z.boolean().optional(),
|
||||
}),
|
||||
z.object({
|
||||
requestId: z.string(),
|
||||
|
||||
@@ -138,6 +138,34 @@ const SourceSchema = z.object({
|
||||
);
|
||||
});
|
||||
|
||||
it("accepts project config responses with and without setup commit status", () => {
|
||||
const payload = {
|
||||
requestId: "project-config-read",
|
||||
repoRoot: "/repo",
|
||||
ok: true,
|
||||
config: null,
|
||||
revision: null,
|
||||
};
|
||||
const envelope = (
|
||||
responsePayload: typeof payload & {
|
||||
hasUncommittedWorktreeSetupChanges?: boolean;
|
||||
},
|
||||
) => ({
|
||||
type: "session",
|
||||
message: {
|
||||
type: "read_project_config_response",
|
||||
payload: responsePayload,
|
||||
},
|
||||
});
|
||||
|
||||
expect(GeneratedWSOutboundMessageSchema.safeParse(envelope(payload)).success).toBe(true);
|
||||
expect(
|
||||
GeneratedWSOutboundMessageSchema.safeParse(
|
||||
envelope({ ...payload, hasUncommittedWorktreeSetupChanges: true }),
|
||||
).success,
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("accepts a compact provider snapshot envelope", () => {
|
||||
const envelope = {
|
||||
type: "session",
|
||||
|
||||
Reference in New Issue
Block a user