# CHMI01: City Hall mesh integrity

Status: isolated candidate, awaiting independent acceptance. No full-city integration, source-file edits, publication, or upload has been performed.

## Scope and result

This patch repairs topology and winding only. It does not redesign the landmark, improve its real-world dimensions, infer a new ground height, move or reattach any object, or validate hidden elevations/interiors.

- `충주시청 | w472321491`: prove the existing five-point OpenStreetMap ring and exactly two height planes, weld nine duplicate vertices by exact coordinate equality, add only three missing bottom triangles, and make the connected surface outward. The source's 19 vertices / 8 faces / 19 boundary edges become 10 vertices / 11 faces / zero boundary or nonmanifold edges. Every original face's positions, corner UV mapping, material index, smooth/hidden/selected state survives. The represented solid volume is 80,833.51976584 m³, not a surveyed measurement.
- 272 source boxes: prove eight Cartesian-product corners, six planar quad faces, a closed consistent inward surface and the expected box volume, then reverse winding. No coordinates or material assignments change. This is 268 `시청 v05 | …` boxes plus four `시청 pale facade pier` objects.
- The 66 roof-detail curves remain exactly unchanged. Their evaluated meshes still have open ends: 51 canopy ribs and 15 transverse seams. This patch does not make the whole assembly a single watertight object.
- Three existing roof panels remain unchanged and evaluate closed/outward under their existing Solidify modifiers. Two existing end towers remain unchanged and closed/outward.

The exact 273 affected object names and pinned baseline geometry/object fingerprints are in `baseline_manifest.json`. The exact per-object archive/replacement mesh names and before/after proofs are in `integrity_manifest.json`. No replacement objects or renamed source objects exist.

## Elevation and source proof

The dependency graph is updated before reading matrices. The main's object Z translation is exactly −12.674699783325195 m. Its world base/top remain exactly 89.53825378417969 / 131.3382568359375 m. The represented height is 41.80000305175781 m, the float32 form of the preexisting 41.8 m assumption. That assumed height is not measured.

`source_record.json` contains only the selected `w472321491` model-data record, with the source JSON checksum. The source ring is checked for simplicity, unique vertices and a one-to-one correspondence to represented XY coordinates. All side faces must correspond exactly to one source edge; the existing roof triangulation must have the expected count/area. After welding, the only boundary must be the exact source bottom ring. The final surface must have one connected component, Euler characteristic 2, consistent manifold edges, positive volume and no zero-area faces, while preserving the complete original face/corner-UV multiset.

The model-data `ground_m` is deliberately not used. Open-mesh tetrahedron sums are reference-dependent and are not reported as valid enclosed volumes. The earlier apparent 12.6747 m drift was a stale matrix-cache reading, not a displacement.

## API and archive contract

Load `patch_cityhall_mesh_integrity.py` with `runpy.run_path`, keeping `baseline_manifest.json` and `source_record.json` beside it.

- `apply_patch()` applies the patch or returns `already_applied` after verifying the saved state.
- `restore()` reinstates the exact original mesh datablocks or returns `not_applied`.
- Neither API saves files.
- Apply to an R5 **copy** first, then call accepted CHID01 `apply_patch()`.
- Restore in the opposite order: CHID01 `restore()`, then CHMI01 `restore()`.
- Trying to apply CHMI01 after CHID01, or restore CHMI01 while CHID01 is active, is rejected.

State is an unlinked fake-user-retained Text datablock named `CHMI01 | mesh-integrity manifest`. New mesh names are `CHMI01 | mesh 000` through `CHMI01 | mesh 272`. Each source object keeps its original name, identity, metadata, transform, material links and collection membership and receives only a corrected mesh pointer. The original mesh keeps its exact original name/data, is not linked to any object, and receives a fake user. Its prior fake-user state is recorded and restored. No archive collection or new object is created.

All source checks precede live assignments; all candidates are prepared privately. Unsupported source changes, shared mesh consumers, existing fake users, modifiers, shape keys, custom normals, or unknown attributes are rejected rather than guessed. On preparation failure, private candidates are removed and exact prior fake-user states are reinstated. Changed archives or unexpected replacement consumers block restoration instead of destroying edits.

Do not export the unlinked old mesh archive or the state Text. Export only scene-linked visible objects using the established exclusion rules. CHID01 additionally maintains its own unlinked source-object archive.

## Verification

`test_integrity_stack.py` and `stack_qa.json` cover 16 tests, including a direct assertion that snapshot inspection does not mutate any source custom properties:

- All 273 corrected meshes are closed, consistently outward, nondegenerate and positive-volume. Volume is independently recomputed with BMesh.
- All source object names, transforms, custom properties, material nodes and collection memberships survive. All 66 curves and all untargeted objects remain exact.
- Save/reopen retains corrected meshes, the exact archived original data, and fake-user state.
- Repeated apply is unchanged, exact restore recovers the original data sets and metadata, and reapply is deterministic.
- The unchanged, independently accepted CHID01 patch applies on top. Both APIs are idempotent in the combined state.
- Reverse combined restore returns source data including per-corner UVs, material nodes, transforms, links and fake-user states exactly. Source `hide_get` state is included in the snapshots and matches even when 72 objects are archived by CHID01.
- Every one of CHID01's 191 generated meshes has exactly the same vertex-coordinate multiset, per-face corner geometry/UV mapping/material/smooth values, transform, material slots and material-node values as the accepted standalone candidate. Face-index/winding order is deliberately not used as geometric identity; source-normal context was corrected first.

`test_guard_failures_and_uv.py` and `guard_and_uv_qa.json` add negative tests for moved source, shared source datablocks, preexisting fake users, failure during the fourth private candidate, multiple source rings, wrong source height, unmatched ring and altered archive content. They also prove exact two-layer seam-discontinuous per-corner UV preservation on disposable box/main copies. The real 273 source meshes have no UV layers.

`culling_before/after_assembly.png` and `culling_before/after_main.png` use matched camera, orthographic scale, resolution, material shading, backface-culling and bounds, recorded in `matched_culling_qa.json`. I inspected all four actual images. The before main loses its inward roof under one-sided rendering; after it is present. Box tops, piers and entrance columns render on their exterior sides after winding correction. These are culling diagnostics, not evidence of dimensional accuracy. No render-only changes are saved into either candidate.

## Review correction

Independent review rejected the first saved candidates because the test serializer accessed lazy material `cycles` settings, creating empty custom-property groups before its own baseline comparison. The geometry API was not responsible. The serializer now skips non-ID pointers before reading them. Both candidates were rebuilt from untouched `cityhall_before.blend`; all tests were rerun. `verify_saved_materials.py` / `saved_material_qa.json` independently compare the six original materials directly between source and saved candidates and confirm exact properties/node values with no added `cycles` groups. The geometric patch is unchanged. Only the newest hashes in `frozen_artifacts.json` are valid for review/integration.

## Frozen inputs and outputs

- Untouched small study SHA256: `95abe6f4c140d74917882d8ae3ebbe34d14f0361398b5128583e03211c23ee62`.
- Immutable full-city R5 SHA256: `0e09d0c02f900061451e2edc8c7786f23e2985b4fa35277964558c3ac77bba5b`. It was never loaded or changed by this task.
- Accepted CHID01 patch SHA256: `15a67536882e602336d02e49a719153dcb0858d090d9f3429ef194afb2a60caf`.
- Accepted CHID01 candidate SHA256: `ef945a8f5cfcd8c06c656e3bf78ec0054325b934a4368616c506353bbff51bc7`.

`cityhall_integrity_after.blend` is integrity-only. `cityhall_integrity_identity_after.blend` stacks the accepted front-facade detail after integrity. `frozen_artifacts.json` lists the exact current hashes of the patch, inputs, candidates and evidence. Scratch/debug/failure files, `.blend1` backups and development logs are not deliverables.
