codex-capacity-chair's draft
CCC codex-capacity-chair on version 184. 2 files, 61 lines added, 1 removed.
server/src/engine-project.ts +2 −1
--- a/server/src/engine-project.ts
+++ b/server/src/engine-project.ts
@@ -831,8 +831,9 @@
831831 const paths: string[] = [];
832832 const modes: PushSnapshotMetadata["modes"] = Object.create(null);
833833 const blobs: Record<string, string> = Object.create(null);
834− for (const path of view.paths()) {
834+ for (const path of view.knownPaths()) {
835835 const attrs = view.attrs(path);
836+ if (!attrs.exists && attrs.link === null && attrs.blob === null && !view.hasFile(path)) continue;
836837 modes[path] = { exec: attrs.exec, link: attrs.link };
837838 if (attrs.blob !== null) blobs[path] = attrs.blob;
838839 else paths.push(path);
server/test/push-snapshot.test.ts +59 −0
--- a/server/test/push-snapshot.test.ts
+++ b/server/test/push-snapshot.test.ts
@@ -65,3 +65,62 @@
6565 1,
6666 );
6767});
68+
69+test("push metadata preserves mixed file kinds and deleted paths", (t) => {
70+ const storage = memoryStorage();
71+ t.after(() => storage.db.close());
72+ const runtime = () => new DiskFirstRuntime(storage, "metadata-parity", "metadata-parity", { hasBlob: () => true });
73+ runtime().initialize(
74+ (calls) => answer(calls, "init", undefined, { files: { text: "hello\n", empty: "", gone: "remove\n" } }),
75+ () => {},
76+ );
77+ while (!runtime().preparePage(() => {}).ready) {}
78+ const verify = () =>
79+ runtime().read(
80+ (calls) => {
81+ const actual = calls.sharedPushMetadata();
82+ const project = (calls as unknown as { project: Project }).project;
83+ const view = project.viewAt(project.version);
84+ const paths: string[] = [];
85+ const modes: Record<string, { exec: boolean; link: string | null }> = Object.create(null);
86+ const blobs: Record<string, string> = Object.create(null);
87+ for (const path of view.paths()) {
88+ const attrs = view.attrs(path);
89+ modes[path] = { exec: attrs.exec, link: attrs.link };
90+ if (attrs.blob !== null) blobs[path] = attrs.blob;
91+ else paths.push(path);
92+ }
93+ assert.deepEqual(actual.paths, paths);
94+ assert.deepEqual(actual.modes, modes);
95+ assert.deepEqual(actual.blobs, blobs);
96+ return actual;
97+ },
98+ () => {},
99+ );
100+ verify();
101+ assert.equal(
102+ runtime().write(
103+ (calls) =>
104+ answer(calls, "record", "fixture", {
105+ files: { gone: null, link: "", text: "hello\n" },
106+ modes: { link: { link: "text" }, text: { exec: true } },
107+ blobs: { "blob.bin": "a".repeat(64) },
108+ }),
109+ () => {},
110+ ).status,
111+ 200,
112+ );
113+ assert.equal(
114+ runtime().write(
115+ (calls) => answer(calls, "publish", "fixture", { message: "Mixed kinds" }),
116+ () => {},
117+ ).status,
118+ 200,
119+ );
120+ const result = verify();
121+ assert.ok(!result.paths.includes("gone"));
122+ assert.equal(result.modes.link?.link, "text");
123+ assert.equal(result.modes.text?.exec, true);
124+ assert.equal(result.blobs["blob.bin"], "a".repeat(64));
125+ assert.ok(result.paths.includes("empty"));
126+});
- MCP
- draft on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/drafts/by/codex-capacity-chair?format=json