Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ebc1e63
fix(kin): land an L0 lead's shadow notes on the default branch once
Surajsm60720 Nov 23, 2026
aa937fa
chore(kin): say what changes for people with the shadow-notes landing
Surajsm60720 Nov 23, 2026
c4d34c1
fix(kin): land only what a shadow held when #155 cut over
Surajsm60720 Nov 25, 2026
96e0a78
test(kin): date pre-cut-over shadow commits without reading process.e…
Surajsm60720 Nov 25, 2026
6662263
fix(kin): land each lead's shadow notes on its own and tell the owner…
Surajsm60720 Nov 25, 2026
b0d1d24
Merge origin/kin into fix/kin-l0-shadow-landing
Surajsm60720 Nov 27, 2026
220745f
fix(kin): land only shadow notes whose origin and base are proven, an…
Surajsm60720 Nov 27, 2026
7d8a3a6
fix(kin): bound chat-cited shadow notes by their message's time, and …
Surajsm60720 Nov 27, 2026
bf06cf4
fix(kin): read a message's stored time as UTC in either form
Surajsm60720 Nov 27, 2026
d85ef15
Merge origin/kin into fix/kin-l0-shadow-landing
Surajsm60720 Nov 28, 2026
17813d5
fix(kin): check a shadow landing's ids as Memory reads them, and reco…
Surajsm60720 Nov 28, 2026
1cd3b67
merge: kin into fix/kin-l0-shadow-landing
Surajsm60720 Nov 28, 2026
15f4d48
fix(kin): record a shadow landing before its push and confirm that ex…
Surajsm60720 Nov 28, 2026
1a5bd36
merge: kin into fix/kin-l0-shadow-landing
Surajsm60720 Nov 28, 2026
a486f69
test(kin): let K241's migration tests run up to whatever migration is…
Surajsm60720 Nov 28, 2026
1e997e8
merge: kin into fix/kin-l0-shadow-landing
Surajsm60720 Nov 28, 2026
d84e3c1
merge: kin into fix/kin-l0-shadow-landing
Surajsm60720 Nov 30, 2026
8e8b6b4
fix(kin): a pull-request landing records its anchor before the local ref
Surajsm60720 Nov 30, 2026
8e1e7a6
test(kin): name the copied-landing-message test for what it checks
Surajsm60720 Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/server/src/kin/lead/WakeupRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,7 @@ describe("WakeupRunner", () => {
deleteDreamBranch: () => Effect.die("unused"),
reconcileSharing: () => Effect.void,
stripQuotes: () => Effect.void,
landShadows: () => Effect.void,
undoChange: () => Effect.die("unused"),
relabel: () => Effect.die("unused"),
retire: () => Effect.die("unused"),
Expand Down Expand Up @@ -1461,6 +1462,7 @@ describe("WakeupRunner", () => {
deleteDreamBranch: () => Effect.die("unused"),
reconcileSharing: () => Effect.void,
stripQuotes: () => Effect.void,
landShadows: () => Effect.void,
undoChange: () => Effect.die("unused"),
relabel: () => Effect.die("unused"),
retire: () => Effect.die("unused"),
Expand Down Expand Up @@ -1730,6 +1732,7 @@ describe("WakeupRunner", () => {
deleteDreamBranch: () => Effect.die("unused"),
reconcileSharing: () => Effect.void,
stripQuotes: () => Effect.void,
landShadows: () => Effect.void,
undoChange: () => Effect.die("unused"),
relabel: () => Effect.die("unused"),
retire: () => Effect.die("unused"),
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/kin/lead/layer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ it.effect("a cleared chat and each memory sync sweep deleted messages' quotes",
const writer = Layer.mock(Writer.MemoryWriter)({
reconcileSharing: () => Effect.void,
stripQuotes: (org) => Deferred.succeed(org === clearedOrg ? cleared : synced, undefined),
landShadows: () => Effect.void,
});
const hub = Layer.mock(ChatHub.KinChatHub)({
subscribeAll: Effect.succeed(
Expand Down
13 changes: 13 additions & 0 deletions apps/server/src/kin/lead/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ const memorySync = Effect.fn("KinMemory.syncDue")(function* (
}),
),
Effect.andThen(stripQuotes(writer.value, orgId)),
Effect.andThen(
writer.value.landShadows(orgId).pipe(
Effect.catchCause((cause) =>
Effect.logWarning(
"Kin could not land shadow memory on the default branch",
{
orgId,
cause: Cause.pretty(cause),
},
),
),
),
),
),
),
),
Expand Down
39 changes: 32 additions & 7 deletions apps/server/src/kin/memory/Memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,35 @@ const decodeHead = Schema.decodeEffect(MemoryItemHead);
export const folders: ReadonlyArray<string> = itemFolders;

export const maxBlobBytes = 256 * 1024;

/** Whether `load` reads a tree entry as a memory item, by its path and mode alone. */
const isItemEntry = (relative: string, mode: string) =>
["100644", "100755"].includes(mode) &&
relative.endsWith(".md") &&
itemFolders.some((folder) => relative.startsWith(`${folder}/`));
const itemFolder = (kind: string) => (kind === "person" ? "people" : `${kind}s`);
/** The id `load` reads `bytes` at `relative` under, by its own rule; none when it skips the file. */
export const admittedId = Effect.fnUntraced(function* (
orgId: KinOrgId,
relative: string,
mode: string,
bytes: Uint8Array,
) {
if (!isItemEntry(relative, mode) || bytes.length > maxBlobBytes) return undefined;
const text = yield* Effect.try({
try: () => new TextDecoder("utf-8", { fatal: true }).decode(bytes),
catch: () => "not UTF-8",
}).pipe(Effect.option);
if (text._tag === "None") return undefined;
const parsed = yield* parseFrontMatter(orgId, relative, text.value, false, true).pipe(
Effect.option,
);
if (parsed._tag === "None") return undefined;
const { frontMatter } = parsed.value;
if (!relative.startsWith(`${itemFolder(frontMatter.kind)}/`)) return undefined;
const head = yield* decodeHead({ ...frontMatter, orgId, path: relative }).pipe(Effect.option);
return head._tag === "Some" ? head.value.id : undefined;
});
// Well under memoryGit's 64 MiB output cap, so a large journal reads in a few `cat-file` runs.
const checkoutBatchBytes = 16 * 1024 * 1024;

Expand Down Expand Up @@ -886,10 +915,8 @@ const make = Effect.gen(function* () {
const entries = verifiedEntries
.filter(
({ relative, mode }) =>
["100644", "100755"].includes(mode) &&
relative.endsWith(".md") &&
(itemFolders.some((folder) => relative.startsWith(`${folder}/`)) ||
["rules.md", "INDEX.md"].includes(relative)),
isItemEntry(relative, mode) ||
(["100644", "100755"].includes(mode) && ["rules.md", "INDEX.md"].includes(relative)),
)
.map((entry) => ({ ...entry, size: sizes.get(entry.sha) ?? Infinity }));
const pending = [
Expand Down Expand Up @@ -971,9 +998,7 @@ const make = Effect.gen(function* () {
}
const parsed = parsedBlobs.get(sha);
if (!parsed) return;
const expectedFolder =
parsed.frontMatter.kind === "person" ? "people" : `${parsed.frontMatter.kind}s`;
if (!relative.startsWith(`${expectedFolder}/`)) {
if (!relative.startsWith(`${itemFolder(parsed.frontMatter.kind)}/`)) {
if (!mismatchWarnings.has(sha)) {
mismatchWarnings.add(sha);
return yield* new MemoryItemError({
Expand Down
Loading
Loading