Some checks are pending
Headless portability / portable-headless (ubuntu-latest) (push) Waiting to run
Headless portability / portable-headless (windows-latest) (push) Waiting to run
Headless portability / linux-graphical (push) Waiting to run
Headless portability / linux-vulkan (push) Waiting to run
Both static sites (LandblockPhysicsPublisher, the headless-only LandblockPhysicsContentBuilder) emitted an authored Setup Sphere as a base-anchored Cylinder of radius r and height 2r. The live path emits a Sphere for the same data, so the same object collided differently by arrival route, and the narrow phase met a flat cap where retail meets a curved surface. Both sites now mirror ShadowShapeBuilder.FromSetup's Sphere block exactly. Combined Opus review: PASS. Its numeric verification of the dispatch test's geometry (head-sphere clearance 0.201 m for the true sphere; the cylinder counterfactual inside by 0.10 m XY with the Z band overlapping) is what makes the discrimination claim more than a sabotage anecdote, and its F8 finding is applied: the test now carries a POSITIVE control — aiming straight through the boulder's centre must block — so a membership/seed regression can no longer masquerade as a curve-hit pass. F4 applied: CylHeight is asserted, not inferred (the C4 lesson). F3 applied: the deleted Quaternion.Inverse base composition is recorded as internally coherent for the old cylinder's world-Z axis — the defect was the shape TYPE, not that rotation math. The review also verified the deleted-cylinder blast radius: the F2 overlay's drawn span is IDENTICAL for both shapes (old [c-r, c+r], new [c-r, c+r]); the flood sphere's centre rises by exactly r, which cannot change outdoor membership (XY rectangle) and lands the indoor half on Session B's dungeon gate alongside S1B; and the sphere-branch flood is now pinned uncapped by a genuine eleventh-shape A/B test. PublishStaticCollision — the headless static path — gains its first test ever. AP-155 is NARROWED, not deleted (review F13): the has-BSP source split (entity.MeshRefs vs setup.Parts + AnimPartChanged) survives and keeps the row active. The shared-primitive-emitter refactor that would make route independence a compile-time property is the filed follow-up (review F20). Population: 3,506 of 5,935 installed Setups, structurally equal to AP-157's third-branch count (byte-identical classifier — three independent routes agree: 3,605 - 99 = 3,506). Clean-room suite at implementation: 11,253 passed / 6 skipped / 0 failed on landed S1B. Post-review-hardening: Publisher tests 25/25, Content tests 2/2, both green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
105 lines
4.3 KiB
C#
105 lines
4.3 KiB
C#
using System.Collections.Generic;
|
|
using AcDream.Core.Physics;
|
|
using DatReaderWriter;
|
|
using DatReaderWriter.DBObjs;
|
|
using DatReaderWriter.Enums;
|
|
using DatReaderWriter.Options;
|
|
|
|
namespace AcDream.Content.Tests;
|
|
|
|
/// <summary>
|
|
/// AP-155 population MEASUREMENT ONLY (contract
|
|
/// <c>docs/research/2026-08-07-s2-static-sphere-contract.md</c>, "Measurement"
|
|
/// section) — not a gate. Counts, over the installed <c>client_portal.dat</c>
|
|
/// Setups (the same <c>dats.GetAllIdsOfType<Setup>()</c> enumeration
|
|
/// <see cref="InstalledSetupCollisionReachabilityTests"/> and
|
|
/// <see cref="InstalledSetupBspPrimitiveDispatchTests"/> already sweep), how
|
|
/// many actually REACH the fixed static-publication Sphere emission — i.e.
|
|
/// <see cref="ShadowShapeBuilder.FromSetup"/>'s production dispatch, at
|
|
/// scale 1, emits ONLY <see cref="ShadowCollisionType.Sphere"/> shapes for
|
|
/// them. That dispatch (not a raw "has Spheres, no CylSpheres" field read) is
|
|
/// the correct population: a Setup can carry authored Spheres and STILL never
|
|
/// reach the sphere branch if a physics-BSP part suppresses it (AP-152) — 99
|
|
/// of the 3,605 "sphere-only, no cylinder" Setups the reachability sweep
|
|
/// already counted fall into exactly that trap.
|
|
/// </summary>
|
|
public sealed class Ap155StaticSpherePopulationMeasurementTests
|
|
{
|
|
[Fact]
|
|
public void InstalledSetups_SphereOnlyStaticPopulation_Measured()
|
|
{
|
|
string? datDir = ContentConformanceDats.ResolveDatDir();
|
|
if (datDir is null)
|
|
{
|
|
Console.WriteLine("SKIP: installed retail DAT directory is unavailable.");
|
|
return;
|
|
}
|
|
|
|
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
|
|
|
// Production physics-BSP predicate — same as
|
|
// InstalledSetupBspPrimitiveDispatchTests / FlatCollisionAssetBuilder.cs:377-380.
|
|
var physicsBspCache = new Dictionary<uint, bool>();
|
|
bool HasPhysicsBsp(uint gfxObjId)
|
|
{
|
|
if (physicsBspCache.TryGetValue(gfxObjId, out bool cached))
|
|
return cached;
|
|
bool result =
|
|
dats.Portal.TryGet<GfxObj>(gfxObjId, out GfxObj? gfx)
|
|
&& gfx is not null
|
|
&& gfx.Flags.HasFlag(GfxObjFlags.HasPhysics)
|
|
&& gfx.PhysicsBSP?.Root is not null
|
|
&& gfx.VertexArray is not null;
|
|
physicsBspCache[gfxObjId] = result;
|
|
return result;
|
|
}
|
|
|
|
int totalSetups = 0;
|
|
int sphereOnlyReachable = 0;
|
|
var samples = new List<uint>();
|
|
|
|
foreach (uint id in dats.GetAllIdsOfType<Setup>())
|
|
{
|
|
if (!dats.Portal.TryGet<Setup>(id, out Setup? setup) || setup is null)
|
|
continue;
|
|
totalSetups++;
|
|
|
|
// The classifier: production FromSetup output, not raw Setup
|
|
// fields — this is what a landblock static entity built from
|
|
// this Setup actually registers.
|
|
var shapes = ShadowShapeBuilder.FromSetup(setup, 1f, HasPhysicsBsp);
|
|
if (shapes.Count == 0)
|
|
continue;
|
|
|
|
bool sphereOnly = true;
|
|
foreach (var shape in shapes)
|
|
{
|
|
if (shape.CollisionType != ShadowCollisionType.Sphere)
|
|
{
|
|
sphereOnly = false;
|
|
break;
|
|
}
|
|
}
|
|
if (!sphereOnly)
|
|
continue;
|
|
|
|
sphereOnlyReachable++;
|
|
if (samples.Count < 3)
|
|
samples.Add(id);
|
|
}
|
|
|
|
Console.WriteLine("===== AP-155 static-sphere population measurement =====");
|
|
Console.WriteLine($"Total installed Setups: {totalSetups}");
|
|
Console.WriteLine($"Reach the static Sphere emission (post-fix, production dispatch): {sphereOnlyReachable}");
|
|
Console.WriteLine("Three example object ids:");
|
|
foreach (uint sample in samples)
|
|
Console.WriteLine($" 0x{sample:X8}");
|
|
Console.WriteLine("=========================================================");
|
|
|
|
// Structural sanity only — this is a measurement, not a gate.
|
|
Assert.True(totalSetups > 0, "Expected the installed DAT to enumerate at least one Setup.");
|
|
Assert.True(
|
|
sphereOnlyReachable > 0,
|
|
"Expected at least one Setup to reach the static Sphere emission in the installed DAT.");
|
|
}
|
|
}
|