Skip to content

refactor(arch): architectural entropy reduction and CI governance gates - #265

Open
scrimshawlife-ctrl wants to merge 17 commits into
feat/stage2-rules-015-runtimefrom
feat/arch-governance
Open

scrimshawlife-ctrl wants to merge 17 commits into
feat/stage2-rules-015-runtimefrom
feat/arch-governance

Conversation

@scrimshawlife-ctrl

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #264 (feat/stage2-rules-015-runtime @ 76a79da). Reduces architectural entropy across SurveillanceCore, SurveillanceAutopilot, and App/ with zero gameplay, contract, or replay-digest drift (SS-specs pin 91631e59e9afa1d053c5a62775ca4adb35286a22 unchanged).

 SS-runtime/
 ├── Sources/
 │   ├── SurveillanceCore/
 │   │   ├── Arena/
+│   │   │   └── RulesViewport.swift          # authoritative viewport & CameraObjectiveRules
 │   │   ├── Contracts/CombatContent.swift    # single source of truth for EliteCycle + BossSpec + ability delays
 │   │   ├── Determinism/Xoshiro256StarStar.swift # owns cameraPlacementSeed derivation
 │   │   ├── World/
+│   │   │   ├── LethalWarning.swift          # moved out of Presentation/ (zero upward domain->Presentation edges)
+│   │   │   ├── TutorialState.swift          # moved out of Presentation/HUDLayout.swift
 │   │   │   ├── Simulation.swift             # 2,108 LOC -> 372 LOC core step loop (single-pass Jammer exposure)
+│   │   │   ├── Simulation+Combat.swift      # civic pulse, swept damage, ricochet, contact & mine resolution
+│   │   │   ├── Simulation+Encounters.swift  # patrols, waves, fairness, elite/boss court activation
+│   │   │   ├── Simulation+Objectives.swift  # extraction pursuit, exposure emission, terminal sealing
+│   │   │   └── Simulation+ScenarioHooks.swift # test/debug scenario preconditions
+│   └── SurveillanceAutopilot/
+│       └── ProbePilot.swift                 # extracted library module (removes project.yml -> Tests/ reach)
 ├── App/
+│   ├── AppStorage.swift                     # injectable baseDirectory persistence boundary
+│   ├── GameSession.swift                    # extracted framework-free coordinator (zero SpriteKit/UIKit/try!)
 │   ├── GameScene.swift                      # 1,536 LOC -> 1,154 LOC; pause/intro interruption & idle draw fixes
+│   ├── TextureResolver.swift                # canonical linear+mipmapped atlas/bundle texture loader
+│   ├── WorldRenderer+Benchmark.swift        # gated under #if DEBUG || SS_RENDERER_TEST_SUPPORT
 │   └── BenchmarkReviewArt.swift             # gated out of shipping Release builds
 ├── docs/architecture/                       # ARCHITECTURE.md + ADR-001..ADR-006
 └── scripts/
+    └── test_architecture_governance.py      # CI gate enforcing purity, layer DAG, pins, safety, and LOC ceilings

Evidence

  • Before:
    • Sources/SurveillanceCore domain layers (World/, Events/, Determinism/) depended upward on Presentation/HUDLayout.swift and Camera/.
    • project.yml compiled Tests/SurveillanceCoreTests/PacingProbe/ProbePilot.swift directly into the SSRuntime app target.
    • BossSystem, EnemySystem, TelegraphProjection, and LethalWarning duplicated combat-content-010 boss/elite timing and damage literals 4x, and IsolatedKernel.daemonCycle hardcoded stale eliteHP = 300 (vs 450).
    • GameScene.update(_:) stepped idle terminal/upgrade gates at 60 Hz, leaked NotificationCenter observer tokens, and failed to pause if scenePhase went inactive during the D-098 intro.
    • GhostStore, MedalStore, ReceiptStore, and ReleaseEvidenceStore hardcoded process-global Application Support / Documents paths (MedalStore also reported NEW medals when disk persistence failed).
  • After:
    • python3 -B scripts/test_architecture_governance.py -v -> Ran 6 tests in 0.375s — OK (including negative mutation self-tests for Core purity, layer DAG, version parity, Release benchmark gating, try! / observer safety, and <= 2,000 LOC file ceilings).
    • python3 -B scripts/test_runtime_audit_guards.py -> OK (5/5).
    • python3 -B scripts/test_spec_parity_isolation.py -> OK (2/2).
    • Full 5-lane macOS CI (swift, spec-parity, app (Debug), app (Release), device-sitting) verifies zero replay/vector/sitting drift and passes new PersistenceLifecycleTests, InterruptionTests, RunTelemetryTests, CombatContentFailClosedTests, and ReceiptArchiveCompatibilityTests.

Merge Danger

Door: two-way

Pure internal architectural refactoring, bug fixes, and additive CI governance checks stacked cleanly on #264; zero persisted schema changes, zero SS-specs contract mutations, and zero replay digest changes.

Blast Radius: medium

Touches module targets (Package.swift, project.yml), Simulation file layout, CombatContent decoding, GameSession/GameScene lifecycle, and persistence store initializers (all defaulted to baseDirectory: URL? = nil for source compatibility).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T06:36:51.204286Z 9cb8c8a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9cb8c8a7ca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread App/GameScene.swift
Comment on lines +442 to +447
let key = currentIdleDrawKey()
if idleDrawKey != key {
idleDrawKey = key
redraw()
}
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Drain transient presentation effects before skipping redraws

When a run ends or reaches upgrade selection with presentation effects still active, this return stops advancing them indefinitely. VFXRenderer.render() advances the frame counter and expires pooled effects, while cameraPosition() advances the 12-frame shake; both are called only by redraw(). For example, lethal damage starts a shake whose duration exceeds its hit-stop, so the terminal screen retains an offset camera, and static VFX nodes can remain past their declared lifetimes. Keep advancing presentation until these effects settle, or explicitly clear them before entering the render-once idle state.

Useful? React with 👍 / 👎.

Comment on lines +11 to +15
SOURCE = (
RUNTIME_ASSETS / '[email protected]'
if (RUNTIME_ASSETS / '[email protected]').exists()
else RUNTIME_ASSETS / '[email protected]'
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bind registration landmarks to the selected source image

With the checked-in assets, this now selects the 688×656 @4x building, but main() still uses the hand-observed @1x landmarks [145,172], [60,120], and [201,133] with a two-pixel uncertainty. Those coordinates do not mark slab corners in the selected image. Running the script succeeds and attributes the resulting scale and registration errors to the new image's SHA, producing misleading measurement evidence. Supply separately verified landmarks for the selected source, or fail closed when the original landmark source is unavailable.

Useful? React with 👍 / 👎.

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