Skip to content

fix(audit): resolve P4 build docs and casing issues - #858

Merged
MichaelFisher1997 merged 4 commits into
devfrom
refactor/resolve-p4-audit-849-851-852
Jul 8, 2026
Merged

fix(audit): resolve P4 build docs and casing issues#858
MichaelFisher1997 merged 4 commits into
devfrom
refactor/resolve-p4-audit-849-851-852

Conversation

@MichaelFisher1997

@MichaelFisher1997 MichaelFisher1997 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix AGENTS.md function naming guidance to match ZigCraft camelCase function convention and normalize remaining mixed-style public functions/call sites.
  • Decompose build.zig so pub fn build is orchestration-only, with options, module wiring, build steps, shader validation, and project imports split into focused helpers.
  • Raise public pub fn documentation coverage above 40% without counting test blocks; remove docs from test-only MockRHI helpers and replace generated stubs with function-specific API documentation.
  • Clarify LODManager, LODChunk, Chunk, LOD geometry, RHI, and IRenderSettings docs with concrete behavior, mutation, caller/thread, input/output, and error semantics instead of template wrapper wording.

Verification

  • nix develop --command zig fmt src/ modules/ build.zig
  • nix develop --command zig build test
  • nix develop --command zig build
  • nix develop --command zig build -Doptimize=ReleaseFast
  • pre-push hooks: formatting + full test suite
  • no remaining snake_case pub fn declarations in src/ or modules/
  • no generated doc stub phrases remain in LODManager, LODChunk, Chunk, or LOD geometry
  • no RHI acronym-splitting/tautology phrases remain for TAA, FXAA, MSAA, LOD, frame/pass docs
  • IRenderSettings setters have complete /// coverage
  • no MockRHI test-helper /// docs remain in lod_renderer.zig
  • doc coverage check excluding test blocks: total=2318 documented=947 coverage=40.9%
  • build.zig pub fn build line count: 8

Closes #849
Closes #851
Closes #852

@github-actions github-actions Bot added documentation Improvements or additions to documentation engine build labels Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📋 Summary

This PR closes #849, #851, and #852.

The PR is a mechanical, behavior-preserving cleanup. Both nix develop --command zig build and nix develop --command zig build test pass.

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.

⚠️ High Priority Issues (Should Fix)

None identified.

💡 Medium Priority Issues (Nice to Fix)

[MEDIUM] modules/world-lod/src/lod_renderer.zig:695 - Documentation added to test mock helpers
Confidence: High
Description: The PR adds /// doc comments to MockRHI functions inside test blocks (e.g., lines 695, 745, 892, 996, 1075, etc.). Issue #852 explicitly states: "Do not add /// to test blocks or fn (non-pub) — out of scope." These test mocks are not part of the module's public API.
Impact: Artificially inflates the reported coverage number without adding consumer value; violates the issue's stated scope; creates review noise.
Suggested Fix: Remove all /// comments from MockRHI and other test helper functions inside the test blocks in this file.

[MEDIUM] modules/engine-rhi/src/rhi.zig:127 - Newly added doc comments are repetitive stubs
Confidence: High
Description: The /// comments added across engine-rhi, world-runtime, world-lod, and world-core are all template strings, e.g. /// Forwards \createBuffer` to the active RHI backend. Callers must provide valid handles and preserve backend render-thread sequencing.or/// World facade operation `update` coordinates simulation, streaming, rendering, or telemetry through runtime-owned world state.Issue #852 asked each doc to answer purpose, preconditions, postconditions, errors, and threading, and explicitly warned against stub docs like/// Initializes. **Impact:** The 42.1% coverage target is met, but the documentation does not provide the actionable, consumer-oriented information the issue requested. **Suggested Fix:** Replace the template stubs with specific per-function documentation. For RHI methods, document thread safety, valid handle requirements, and error semantics. For IWorld` facade methods, describe what each operation does and its side effects.

ℹ️ Low Priority Suggestions (Optional)

None identified.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 build.zig helpers are focused; doc additions are per-module.
Open/Closed 7 No new extension points, but build.zig is now much easier to extend.
Liskov Substitution 8 No type hierarchies modified.
Interface Segregation 8 No interface changes.
Dependency Inversion 8 No dependency changes.
Average 7.8

🎯 Final Assessment

Overall Confidence Score: 78%

How to interpret: 61-80% — Minor concerns, mostly ready with some fixes.

Confidence Breakdown:

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing

Verdict:

MERGE WITH FIXES — Build and tests pass and the linked issues are substantially addressed, but the documentation additions include test-block noise and stub comments that should be cleaned up before merging.

{
  "reviewed_sha": "d7766cd31ea26ea3e8980f7007392773c9fde99c",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 2,
  "overall_confidence_score": 78,
  "recommendation": "MERGE WITH FIXES"
}

New%20session%20-%202026-07-08T00%3A34%3A47.835Z
opencode session  |  github run

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📋 Summary

This PR closes #849, #851, and #852.

Verified locally:

  • nix develop --command zig fmt --check src/ modules/ build.zig → pass
  • nix develop --command zig build test → pass
  • nix develop --command zig build → pass
  • nix develop --command zig build -Doptimize=ReleaseFast → pass

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.

⚠️ High Priority Issues (Should Fix)

None identified.

💡 Medium Priority Issues (Nice to Fix)

[FIXED] Previous issue: modules/world-lod/src/lod_renderer.zig:~695 — MockRHI test-helper /// comments have been removed from test blocks.

[FIXED] Previous issue: modules/engine-rhi/src/rhi.zig:127 — the previously repetitive template doc comments on IResourceFactory methods have been replaced with substantive per-function documentation.

[MEDIUM] modules/world-lod/src/lod_manager.zig:105 — Template/stub doc comments on the public LODManager API
Confidence: High
Description: Most public LODManager methods (and many in LODChunk and Chunk) were given boilerplate /// comments such as "Updates LOD manager lifecycle or scheduling state through fn", "Advances LOD work scheduling through fn", "Records LOD manager bookkeeping via fn", or "Manages chunk pin state through fn". These name the internal delegate but do not explain the purpose, preconditions, postconditions, error semantics, or thread-safety requirements of the public API (the requirements listed in #852).
Impact: The reported 42.1% coverage number is inflated by low-value comments that fail the issue's "avoid stub docs" requirement, forcing consumers to read the delegate implementation to understand behavior.
Suggested Fix: Replace each template with a specific description of what the public method does, what state it mutates, which thread must call it, and what errors mean. For pure delegating wrappers, describe the semantics rather than the internal function name. Representative files: modules/world-lod/src/lod_manager.zig:105-573, modules/world-lod/src/lod_chunk.zig:46-641, modules/world-core/src/chunk.zig:243-302.

ℹ️ Low Priority Suggestions (Optional)

[LOW] modules/engine-core/src/interfaces.zig:65 — Incomplete /// coverage on IRenderSettings
Confidence: High
Description: Only 4 of the 15 IRenderSettings setters received new /// docs in this change; the remaining setters (e.g., setBloomIntensity, setTAABlendFactor, setMSAA) are undocumented.
Impact: Patchy public interface documentation after the file was already modified.
Suggested Fix: Add a brief /// comment to each remaining setter describing the setting and its default/expected behavior.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 8 build.zig helpers are focused; doc additions are per-module.
Open/Closed 7 No new extension points, but build.zig is now much easier to extend.
Liskov Substitution 8 No type hierarchies modified.
Interface Segregation 8 No interface changes; role facades unchanged.
Dependency Inversion 8 No dependency changes; same abstractions used.
Average 7.8

🎯 Final Assessment

Overall Confidence Score: 85%

Confidence Breakdown:

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing

Verdict:

MERGE WITH FIXES — Builds and tests pass and the linked issues are substantially addressed, but residual template doc comments in world-lod/world-core public APIs should be replaced with meaningful descriptions before merging.

{
  "reviewed_sha": "4d90fb849ff16b8fb08997aed4041ccf87c3663e",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 1,
  "overall_confidence_score": 85,
  "recommendation": "MERGE WITH FIXES"
}

New%20session%20-%202026-07-08T01%3A03%3A58.263Z
opencode session  |  github run

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📋 Summary

This PR closes #849, #851, and #852.

nix develop --command zig fmt --check src/ modules/ build.zig, nix develop --command zig build test, and a snake_case pub fn sweep all pass on the reviewed commit.

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.

⚠️ High Priority Issues (Should Fix)

None identified.

💡 Medium Priority Issues (Nice to Fix)

[FIXED] Previous issue: modules/world-lod/src/lod_renderer.zig — MockRHI test-helper /// comments have been removed from test blocks.

[FIXED] Previous issue: modules/engine-rhi/src/rhi.zig:127 — Repetitive template doc comments on IResourceFactory methods have been replaced with substantive per-function documentation.

[FIXED] Previous issue: modules/world-lod/src/lod_manager.zig:105, modules/world-lod/src/lod_chunk.zig, and modules/world-core/src/chunk.zig — Template/stub doc comments on the public LODManager, LODChunk, and Chunk APIs have been replaced with concrete behavior, mutation, threading, and error semantics.

[MEDIUM] modules/world-lod/src/lod_geometry.zig:53 — Generated stub doc comments on public LOD geometry helpers
Confidence: High
Description: The newly added /// comments across this file are largely name-to-sentence templates and generic filler phrases. Representative examples include:

  • modules/world-lod/src/lod_geometry.zig:53/// Computes make skirt quad for LOD mesh generation.
  • modules/world-lod/src/lod_geometry.zig:97/// Computes build full detail heightmap mesh from LOD terrain and water samples.
  • modules/world-lod/src/lod_geometry.zig:2775/// Reports whether is l o d water cell for a sampled LOD cell or span.
  • modules/world-lod/src/lod_geometry.zig:2815/// Computes cell color for l o d for LOD material shading.
  • modules/world-lod/src/lod_geometry.zig:3019/// Computes boundary skirt depth for LOD mesh generation.

Many functions also reuse identical filler lines such as /// The function is pure with respect to caller-owned world data unless output buffers are explicit parameters. or /// Returned heights are in world/block units and may be quantized for seam stability. rather than describing the actual geometric operation.
Impact: These comments inflate the reported doc coverage without providing actionable, consumer-oriented information, which is exactly what issue #852 explicitly warned against.
Suggested Fix: Replace the template phrases with specific descriptions of each function's purpose, inputs, outputs, and invariants. For example, makeSkirtQuad should explain what a boundary skirt is, how params maps to vertex positions, and what the returned [4]Vertex represents.

ℹ️ Low Priority Suggestions (Optional)

[FIXED] Previous issue: modules/engine-core/src/interfaces.zig:65 — All 15 IRenderSettings setters now have /// documentation.

[LOW] modules/engine-rhi/src/rhi.zig:1049 — Minor doc polish in RHI public interfaces
Confidence: High
Description: A few newly added /// comments in engine-rhi/src/rhi.zig are tautological or split acronyms with spaces:

  • modules/engine-rhi/src/rhi.zig:1049/// Begins frame for the current frame.
  • modules/engine-rhi/src/rhi.zig:1153/// Provides RHI access for compute t a a.
  • modules/engine-rhi/src/rhi.zig:1175/// Provides RHI access for draw sky.
  • modules/engine-rhi/src/rhi.zig:1428/// Sets m s a a on the active graphics backend.
  • modules/engine-rhi/src/rhi.zig:1433/// Sets f x a a on the active graphics backend.
  • modules/engine-rhi/src/rhi.zig:1478/// Sets t a a blend factor on the active graphics backend.
  • modules/engine-rhi/src/rhi.zig:1483/// Sets t a a velocity rejection on the active graphics backend.
  • modules/engine-rhi/src/rhi.zig:458 and modules/engine-rhi/src/rhi.zig:848/// Sets l o d instance buffer on the active graphics backend.
    Impact: These are readable but look mechanical and inconsistent with the higher-quality IResourceFactory docs; they also reduce the perceived professionalism of the public API docs.
    Suggested Fix: Replace acronyms with their normal casing (TAA, FXAA, MSAA, LOD) and replace tautological descriptions with concrete semantics (e.g., /// Begins the per-frame command recording scope.).

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 9 build.zig is cleanly decomposed into focused helpers; doc additions are per-module.
Open/Closed 7 No new extension points, but build.zig is now much easier to extend.
Liskov Substitution 8 No type hierarchies modified.
Interface Segregation 8 No interface changes; RHI facades unchanged.
Dependency Inversion 8 No dependency changes; same abstractions used.
Average 8.0

🎯 Final Assessment

Overall Confidence Score: 85%

Confidence Breakdown:

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing

Verdict:

MERGE WITH FIXES — Builds and tests pass and the linked issues are substantially addressed, but generated doc stubs in modules/world-lod/src/lod_geometry.zig should be replaced with meaningful descriptions before merging.

{
  "reviewed_sha": "1c8088a96d8438aabbed51a79f06ca69235266b6",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 1,
  "overall_confidence_score": 85,
  "recommendation": "MERGE WITH FIXES"
}

New%20session%20-%202026-07-08T01%3A23%3A33.674Z
opencode session  |  github run

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

📋 Summary

This PR closes #849, #851, and #852.

Verified locally:

  • nix develop --command zig build test → pass
  • nix develop --command zig build → pass
  • nix develop --command zig fmt --check src/ modules/ build.zig → pass

📌 Review Metadata

🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.

⚠️ High Priority Issues (Should Fix)

None identified.

💡 Medium Priority Issues (Nice to Fix)

[FIXED] Previous issue: modules/world-lod/src/lod_geometry.zig — Generated stub doc comments on public LOD geometry helpers have been replaced with concrete, function-specific descriptions.

[FIXED] Previous issue: modules/engine-rhi/src/rhi.zig — Tautological and acronym-split phrases (e.g., "Begins frame for the current frame", "t a a", "m s a a") have been replaced with proper casing and concrete semantics.

None identified.

ℹ️ Low Priority Suggestions (Optional)

[LOW] modules/engine-rhi/src/rhi.zig:1785IRenderQualityOptions and IDeviceQuery docs remain terse and repetitive
Confidence: High
Description: The IRenderQualityOptions setters (e.g., setWireframe, setTexturesEnabled, setVSync) all use the same /// Sets X on the active graphics backend. pattern, and IDeviceQuery getters repeat /// Returns X from the active graphics backend.. These lack the concrete behavior, input/output, and semantics the PR otherwise established for IRenderSettings (e.g., "Enables or disables vertical synchronization for presentation"). Minor inconsistencies include setVSync documenting "v sync" and getDeviceLocalVramBytes using lowercase "vram".
Impact: Public API docs are technically correct but less useful than the IRenderSettings tier that was already polished.
Suggested Fix: Expand the IRenderQualityOptions setter descriptions to match the IRenderSettings style (e.g., "Enables or disables FXAA post-processing"), and capitalize "VSync"/"VRAM" and "UI" where appropriate in IDeviceQuery and VulkanNativeHandles.

📊 SOLID Principles Score

Principle Score Notes
Single Responsibility 9 build.zig is cleanly decomposed; doc additions are per-module.
Open/Closed 7 No new extension points, but build.zig is now much easier to extend.
Liskov Substitution 8 No type hierarchies modified.
Interface Segregation 8 No interface changes; RHI facades remain narrow.
Dependency Inversion 8 No dependency changes; same abstractions used.
Average 8.0

🎯 Final Assessment

Overall Confidence Score: 90%

Confidence Breakdown:

  • Code Quality: 90% — Mechanical renames and build refactor are correct; docs are mostly substantive.
  • Completeness: 90% — All three linked issues are substantially satisfied; coverage target met.
  • Risk Level: 10% — No runtime behavior changes; only docs, naming, and build decomposition.
  • Test Coverage: 95% — Existing tests still pass; no new tests needed for this class of change.

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing

Verdict:

MERGE WITH FIXES — Builds and tests pass and all linked issues are fully addressed; the remaining low-priority doc polish in IRenderQualityOptions/IDeviceQuery should be cleaned up before merging.

{
  "reviewed_sha": "6a64939d9a2025e920f401e4cac2f74380251369",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 0,
  "overall_confidence_score": 90,
  "recommendation": "MERGE WITH FIXES"
}

New%20session%20-%202026-07-08T01%3A36%3A03.266Z
opencode session  |  github run

@MichaelFisher1997
MichaelFisher1997 merged commit f72ee2f into dev Jul 8, 2026
8 of 9 checks passed
@MichaelFisher1997
MichaelFisher1997 deleted the refactor/resolve-p4-audit-849-851-852 branch July 8, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build documentation Improvements or additions to documentation engine

Projects

None yet

1 participant