Skip to content

Commit bc2b6a2

Browse files
ualtinokAlfonso
andcommitted
test: run the defer side of the marker fixture through postprocess
The drain/defer byte-stability fixture previously modeled the defer pass with tagging alone, so a mutator running after reconciliation would only be exercised on the fold side of the comparison. The defer side now runs the production postprocess order on the rebuilt projection. Co-authored-by: Alfonso <alfonso@cortexkit.io>
1 parent 3ea9142 commit bc2b6a2

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

packages/plugin/src/hooks/magic-context/transform-postprocess-phase.test.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,10 +719,26 @@ describe("deferred compaction marker representation", () => {
719719
},
720720
] as unknown as MessageLike[];
721721
tagger.initFromDb(sessionId, db);
722-
// This is the next pass's normal tag stage. OpenCode then groups the
723-
// adjacent assistant messages while building the Anthropic wire.
724-
tagMessages(sessionId, rebuiltMessages, tagger, db);
725-
const deferWire = serializeAnthropicWireWithAdjacentAssistantMerge(rebuiltMessages);
722+
// The next pass rebuilds its input from the database projection (raw
723+
// summary row included), tags it, and runs the SAME postprocess order
724+
// the production defer pass runs, so any mutator that fires after
725+
// reconciliation is exercised on both sides of the comparison.
726+
const deferInput = rebuiltMessages.slice(2);
727+
const taggedDefer = tagMessages(sessionId, deferInput, tagger, db);
728+
await runPostTransformPhase(
729+
basePostTransformArgs(db, sessionId, deferInput, {
730+
tagger,
731+
targets: taggedDefer.targets,
732+
reasoningByMessage: taggedDefer.reasoningByMessage,
733+
messageTagNumbers: taggedDefer.messageTagNumbers,
734+
batch: taggedDefer.batch,
735+
m0M1: {
736+
projectDirectory: dataHome,
737+
injectDocs: false,
738+
},
739+
}),
740+
);
741+
const deferWire = serializeAnthropicWireWithAdjacentAssistantMerge(deferInput);
726742

727743
expect(deferWire).toBe(foldWire);
728744
expect(JSON.parse(foldWire)).toMatchObject([

0 commit comments

Comments
 (0)