Skip to content

[SOLID] [C5] Consume or delete dead segregated worldgen interfaces #794

Description

@MichaelFisher1997

Part of #776 — SOLID architecture debt umbrella.
Phase: P2 · Finding: C5

Problem

modules/worldgen-api/src/root.zig:139-177 defines IChunkGenerator, ILODHeightmapGenerator, IGeneratorInfoProvider, ICacheRecenterable — but no consumer uses them. The registry demands the full fat 7-method Generator, forcing FlatWorldGenerator and ShadowTestWorldGenerator to publish no-op shims for methods semantically meaningless to them.

Evidence

worldgen-flat/src/root.zig:68-90:

pub fn generateHeightmapOnly(...) void {
  _ = self; _ = region_x; _ = region_z; _ = lod_level; _ = stop_flag;
  @memset(data.heightmap, @floatFromInt(FLAT_HEIGHT));  // constant
}
pub fn maybeRecenterCache(...) bool {
  _ = self; _ = player_x; _ = player_z;
  return false;  // flat world has no cache
}

Fix

Two options — pick one:
A) Consume them: split registry registration into 'chunk-only' vs 'chunk+LOD'. Flat/test generators register as chunk-only and skip the LOD vtable entries.
B) Delete them: remove the 4 interfaces and accept the fat Generator as the contract.

Recommend A if a future generator might be chunk-only; B if simplicity wins.

Verification

  • nix develop --command zig build test (includes shader validation)
  • If rendering-touching: capture headless screenshot baseline before/after (-Dskip-present)
  • If behavior-preserving refactor: golden-output test must stay green

Constraints

  • Small reviewable PR targeting dev; conventional commit (refactor: / feat:)
  • Preserve current behavior unless this issue explicitly changes it
  • Keep worker-thread RHI isolation intact (no RHI calls off main thread)

Notes

Decision needed before implementation. The no-op shims are misleading either way.

Tracking: #776

Metadata

Metadata

Assignees

No one assigned

    Labels

    automated-auditIssues found by automated opencode audit scansbugSomething isn't workingenhancementNew feature or requestworld

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions