Skip to content

Pin prefab paths and prim names in a test - #18

Merged
dmccoystephenson merged 1 commit into
mainfrom
feat/pin-prefab-paths
Oct 29, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feat/pin-prefab-paths

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) for src/colony/view.cpp, a cycle with no open issues.

  • prefabFor() is part of the save format: src/bridge/bridge.cpp saves each building's kind as its prefab path (toWorld) and recovers the kind by comparing against prefabFor() (kindFromPrefab). Only the Stockpile path was asserted before; the Hut and HutPlan paths and the out-of-range fallback (/Prefabs/Unknown) were never checked. A renamed path would stop existing saves from loading. The check now runs in the USD-free rules jobs, before the Strata build gets involved.
  • primName() gets checks for zero-padding to six digits and for widening, not truncating, ids past six digits.
  • view() gets checks for huts, hut plans, non-tree resources (not drawn) and the tree scale formula.

Test-only change: no production code, schema, fingerprint or strata.ref changes, and no existing CHECK was removed.

No tracking issue: the gap was found during triage.

Test plan

  • CI rules (gcc-13), rules (clang-18), rules (asan-ubsan), rules (msvc) green on the PR head. The local build could not run here because the sandbox does not permit cmake/g++, so the local anchor is UNVERIFIED and CI on the exact head SHA is the anchor.
  • game on Strata (saves soak, headless smoke) green

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

A building's kind is saved as its prefab path (the bridge maps it with
prefabFor() and maps it back by comparing against prefabFor()), so a
changed path would silently stop old saves from loading. Pin every
kind's path, the unknown-kind fallback, primName padding and widening,
and the view of huts, plans and tree scale.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (the Copilot review request did not register: reviewRequests is empty, so this rubric is the review of record):

  • Scope: PASS. One file changed (tests/test_systems.cpp, +25/-0). It holds only the new test section.
  • Tests-new: PASS. No new public functions. The section exercises prefabFor (all three kinds plus the fallback), primName and view.
  • Tests-fix: N/A. This is a characterization-only change, and no production code was modified.
  • Sibling structure: PASS. The new block uses the file's SECTION(...) / { Colony c = tiny(); ... } pattern and CHECK/CHECK_MSG from tests/check.h.
  • Sibling renames: N/A. Nothing was renamed.
  • Docs: PASS. The Phase 7 table was checked: README.md, manifest.h, schema.h vs bridge and content/prefabs.usda (prims Settler, Hut, HutPlan, Stockpile, Tree all present under /Prefabs), stats.h, the mod manifests and LICENSE. A test-only diff changes none of them, and none needed a correction.
  • Issue resolution: N/A. There is no Closes; the gap was found during triage.
  • CI: PASS. On head feat/pin-prefab-paths, all of these passed: rules (gcc-13), rules (clang-18), rules (asan-ubsan), rules (msvc), game on Strata (saves soak, headless smoke), game on Strata (Windows, MSVC) and the web smoke. The gcc-13 log shows 100% tests passed, 0 tests failed out of 5. The local build was UNVERIFIED because the sandbox denied cmake/g++, so CI on the head SHA is the anchor.
  • Privacy: PASS. The diff, title, body and commit name no employer and no private repository, and the RFCs are not mentioned. The only repository linked is the Gardener URL that the dispatch requires. Its visibility could not be re-queried from this sandbox because gh api repos/... was denied.
  • Save integrity: PASS. The diff does not touch components.*, schema.h, src/bridge/ or strata.ref, and no CHECK was removed.
  • Fingerprint: PASS. tests/test_determinism.cpp is unchanged.
  • Schema untouched: PASS. There is no diff to schema.h or strata.ref.
  • Layering: PASS. The test includes only colony/ headers.
  • Docs follow the change: N/A. There is no new control, flag, rule or mod key.

Judgment note: tests/test_systems.cpp:233 compares a float scale exactly against 0.5f + 0.05f * 4.f. That is the same single-precision expression view() computes, and it passes on gcc, clang, ASan and MSVC, so exact equality holds under the project's no-contraction flags.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 3bf2cd0 into main Oct 29, 2026
7 checks passed
@dmccoystephenson
dmccoystephenson deleted the feat/pin-prefab-paths branch October 29, 2026 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant