Clean up completed D&D scene chunking work

This commit is contained in:
2026-07-24 03:14:34 +00:00
parent f5ed30e455
commit 8adcf6840d
5 changed files with 10 additions and 439 deletions

View File

@@ -20,7 +20,7 @@ func TestRunManifestOmitsEmptyOptionalFields(t *testing.T) {
func TestRunManifestChunkPlanIsAdditiveAndOmitsPlanContent(t *testing.T) {
manifest := RunManifest{ChunkPlan: &ChunkPlanManifest{
Mode: "auto", Action: "reused", SourceDigest: "sha256:source", PlanDigest: "sha256:plan",
PlanSchemaVersion: "notarius.chunk-plan.v1", RequestedModule: "chunk/current",
PlanSchemaVersion: "notarius.chunk-plan.v2", RequestedModule: "chunk/current",
ProducerInputModule: "input/original", ProducerModule: "chunk/original",
}}
encoded, err := json.Marshal(manifest)

View File

@@ -402,19 +402,19 @@ func TestRunnerRegeneratesStructurallyInvalidHit(t *testing.T) {
}
}
func TestRunnerReusesCrossDomainAnnotationsAsOptionalData(t *testing.T) {
func TestRunnerReusesAnnotationsFromDifferentChunkerAsOptionalData(t *testing.T) {
prepared, plan := preparedTerminalDebugPipeline(t)
plan.Annotations = source.ChunkAnnotations{"dnd/scenes": json.RawMessage(`{"boundary_caveats":["uncertain"]}`)}
plan.Ranges[0].Annotations = source.ChunkAnnotations{"dnd/scenes": json.RawMessage(`{"title":"Opening"}`)}
plan.Annotations = source.ChunkAnnotations{"test/chunker": json.RawMessage(`{"label":"fixture"}`)}
plan.Ranges[0].Annotations = source.ChunkAnnotations{"test/chunker": json.RawMessage(`{"category":"sample"}`)}
record := chunkPlanRecord(t, prepared, plan)
record.Producer.ChunkModule = "dnd/scenes"
record.Producer.ChunkModule = "chunk/producer"
store := &recordingChunkPlanStore{record: record, decision: ChunkPlanDecision{Status: ChunkPlanHit}}
output, err := New().Run(context.Background(), RunInput{Prepared: prepared, RawInput: []byte("input"), ChunkCacheMode: ChunkCacheAuto, ChunkPlans: store})
if err != nil {
t.Fatal(err)
}
if output.Manifest.ChunkPlan.ProducerModule != "dnd/scenes" || output.Manifest.ChunkPlan.Action != "reused" {
t.Fatalf("cross-domain annotation plan was not reused: %#v", output.Manifest.ChunkPlan)
if output.Manifest.ChunkPlan.ProducerModule != "chunk/producer" || output.Manifest.ChunkPlan.Action != "reused" {
t.Fatalf("different-chunker annotation plan was not reused: %#v", output.Manifest.ChunkPlan)
}
}

View File

@@ -170,14 +170,14 @@ func TestPlanReturnsAnnotationFreeSceneRangesFromStructuredOutput(t *testing.T)
if got.StartUnitID != want.StartUnitID || got.EndUnitID != want.EndUnitID {
t.Fatalf("range[%d] = %#v, want %#v", i, result.Plan.Ranges[i], want)
}
if got.Annotations != nil {
if len(got.Annotations) != 0 {
t.Fatalf("range[%d] annotations = %#v, want absent", i, got.Annotations)
}
}
if result.Plan.Annotations != nil {
if len(result.Plan.Annotations) != 0 {
t.Fatalf("plan annotations = %#v, want absent", result.Plan.Annotations)
}
if result.Warnings != nil {
if len(result.Warnings) != 0 {
t.Fatalf("warnings = %#v, want absent", result.Warnings)
}
}