chore(tooling): T-1272 + T-1274 — close E3: no hyphens left, and the lint ignores come off

T-1272 (a verification, as rescoped). No directory Python imports carries a
hyphen any more. The hyphenated script trees were emptied by the per-domain
moves, not renamed. What still has a hyphen is never imported: the three Rust
crates, and the provenance under tooling/archive/, which has no __init__.py.
CLAUDE.md and DEVOPS still pointed at tooling/db/, and pyproject still
predicted the rename; all three fixed.

T-1274. E402, E702 and F841 were ignored for the whole tree from T-1066 on
(43 / 41 / 21 violations). All three are back on:

- E402: the planet modules' imports only sat below their path constants
  because they used to follow a sys.path insert, gone since T-1288. Hoisted.
  The Blender payloads keep a per-file exception, because they extend
  sys.path under Blender's own Python.
- E702: the paired component assignments in three planet maths files are
  deliberate, so they get a per-file exception scoped to those files.
- F841: 10 dead locals removed from live code, each checked for side effects
  first; logo_uv keeps its call, which creates the UV layer.
- tooling/archive/ is excluded: it is provenance, and "fixing" a one-shot
  falsifies the record of what actually ran.

Evidence the lint is real: violations fed through stdin fire in a domain
module, and E402 stays quiet only on a payload path. Evidence nothing moved:
globe renders are pixel-identical before and after for an oceanic, a frozen
and a gas-giant body, and the ledger edit was regenerated (stamp fresh,
generated_brands.toml unchanged).

One finding, noted in the code rather than fixed: planet_renderer computed an
oblate-spheroid ray scale and never used it, so `oblateness` shapes no globe.
Wiring it in would change every globe render; that is a decision to make
deliberately, not a lint fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-23 20:05:07 +02:00
co-authored by Claude Opus 5.5
parent 59b3fc4caa
commit 6fb0ba0e3d
17 changed files with 110 additions and 69 deletions
@@ -212,7 +212,6 @@ def report_earth_echoes(conn, system_id: str | None, body_id: str | None) -> Non
[f"%{pattern.replace('%', '')}%"] + params_base,
).fetchall()
for r in rows:
key = (r["body_id"], label, r["local_id"])
by_body.setdefault(r["body_id"], []).append(
(label, r["local_id"], r["name"])
)
+7 -8
View File
@@ -35,7 +35,13 @@ from pathlib import Path
from tooling.core import config, console
from tooling.core.errors import ReachError
# Venv bootstrap
import numpy as np
import yaml
from tooling.domains.atlas.planet.body_definition_parser import parse_system
from tooling.domains.atlas.planet.planet_simulation import simulate
from tooling.domains.atlas.planet.render_heightmap import render_heightmap
PLANET_DIR = Path(__file__).resolve().parent
WORKTREE_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
@@ -44,13 +50,6 @@ WORKTREE_ROOT = config.repo_root()
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
import yaml
import numpy as np
from tooling.domains.atlas.planet.body_definition_parser import parse_system
from tooling.domains.atlas.planet.planet_simulation import simulate
from tooling.domains.atlas.planet.render_heightmap import render_heightmap
# Systems to skip in batch mode (require manual handling)
SKIP_SYSTEMS = {"GJ-0"}
@@ -46,6 +46,9 @@ from typing import Optional
import numpy as np
from tooling.core import console
from tooling.domains.atlas.planet.biome_config import GAS_PALETTE_SELECTION as GAS_PALETTES
logging.basicConfig(level=logging.INFO, format=" %(levelname)s %(message)s")
log = logging.getLogger(__name__)
@@ -205,9 +208,7 @@ CLASS_OBLATENESS = {
"barren": (0.000, 0.003),
}
# Gas giant band palettes available
from tooling.domains.atlas.planet.biome_config import GAS_PALETTE_SELECTION as GAS_PALETTES
from tooling.core import console
# Gas giant band palettes available: GAS_PALETTES, imported at the top.
# planet_class → cloud coverage base range
CLASS_CLOUD = {
+5 -7
View File
@@ -22,11 +22,15 @@ import json
import os
import time
# Venv bootstrap — re-exec into .venv/bin/python if not already there.
from pathlib import Path
import numpy as np
from tooling.core import config, console
from tooling.core.errors import ReachError
from tooling.domains.atlas.planet.planet_simulation import simulate
from tooling.domains.atlas.planet.render_heightmap import render_heightmap
PLANET_DIR = Path(__file__).resolve().parent
WORKTREE_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
@@ -35,11 +39,6 @@ WORKTREE_ROOT = config.repo_root()
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
import numpy as np
from tooling.domains.atlas.planet.planet_simulation import simulate
from tooling.domains.atlas.planet.render_heightmap import render_heightmap
def _build_markers(body_def: dict, terrain: dict) -> dict:
@@ -51,7 +50,6 @@ def _build_markers(body_def: dict, terrain: dict) -> dict:
sea_level = terrain["sea_level"]
elevation = terrain["elevation"]
surface_water = terrain["surface_water"]
biome = terrain["biome"]
markers = {
"grid": {"w": grid_w, "h": grid_h},
@@ -50,17 +50,9 @@ from pathlib import Path
from tooling.core import config, console
from tooling.core.errors import ReachError
PLANET_DIR = Path(__file__).resolve().parent
REPO_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
# script under .venv/bin/python so numpy would resolve when run by path.
# reach declares numpy and Pillow itself, so its own environment already has
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
import sqlite3
import numpy as np
import sqlite3
from tooling.domains.atlas.planet.atlas_common import (
DB_PATH,
@@ -68,6 +60,14 @@ from tooling.domains.atlas.planet.atlas_common import (
query_inhabited_bodies,
)
PLANET_DIR = Path(__file__).resolve().parent
REPO_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
# script under .venv/bin/python so numpy would resolve when run by path.
# reach declares numpy and Pillow itself, so its own environment already has
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
# D8 neighbor offsets: (dr, dc)
_D8 = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
@@ -168,8 +168,9 @@ def _raytrace(size: int, r: float = 1.0, oblateness: float = 0.0):
mag = np.sqrt(rdx**2 + rdy**2 + rdz**2)
rdx /= mag; rdy /= mag; rdz /= mag
# Scale Y for oblate spheroid
rdy_s = rdy / (1.0 - oblateness + 1e-9)
# NOTE (T-1274): an oblate-spheroid ray scale (rdy / (1 - oblateness)) was
# computed here and never used, so `oblateness` does not shape the globe.
# The dead line is removed; wiring it in would change every globe render.
b = 2.0 * oz * rdz
c = oz**2 - r**2
@@ -237,8 +238,8 @@ def _apply_lighting(
star_type = body_def.get("star", {}).get("type", "G")
star_tint = np.array(STAR_TINTS.get(star_type, (1,1,1)), dtype=np.float32)
# View direction (camera at 0,0,3, looking at origin)
vz = -1.0 # simplified: view dir is ~(0,0,-1) at pixel center
# View direction is ~(0,0,-1) at the pixel centre (camera at 0,0,3); only
# its z enters the specular term below, as -rz.
# Dot products
NdotL = nx * lx + ny * ly + nz * lz # (H,W)
@@ -265,8 +266,6 @@ def _apply_lighting(
# --- Ocean specular ---
if do_spec and surface_water is not None:
rx = -lx + 2.0 * NdotL * nx
ry = -ly + 2.0 * NdotL * ny
rz = -lz + 2.0 * NdotL * nz
spec = np.clip(-rz, 0.0, 1.0) ** 70 # tight highlight
spec *= surface_water.astype(np.float32)
@@ -360,8 +359,6 @@ def _surface_color_terrestrial(
return col.astype(np.float32), water
# --- Procedural fallback ---
rng = np.random.default_rng(seed)
# Continent mask — low-freq noise, threshold to land_fraction
lf = body_def.get("terrain", {}).get("land_fraction", 0.35)
cont_noise = fbm(u * 3, v * 2, seed, octaves=5, gain=0.55)
@@ -25,15 +25,6 @@ from pathlib import Path
from tooling.core import config, console
from tooling.core.errors import ReachError
# Venv bootstrap
PLANET_DIR = Path(__file__).resolve().parent
WORKTREE_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
# script under .venv/bin/python so numpy would resolve when run by path.
# reach declares numpy and Pillow itself, so its own environment already has
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
try:
import yaml
except ImportError:
@@ -42,6 +33,13 @@ except ImportError:
from tooling.domains.atlas.planet.body_definition_parser import parse_system
PLANET_DIR = Path(__file__).resolve().parent
WORKTREE_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
# script under .venv/bin/python so numpy would resolve when run by path.
# reach declares numpy and Pillow itself, so its own environment already has
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
def _body_to_frontmatter(bd: dict) -> str:
@@ -83,7 +83,6 @@ def build_terrain(body_def: dict) -> dict:
# Concentrate lakes near north pole (real Titan has lakes mostly 60-90°N)
v = np.linspace(0, 1, GRID_H, dtype=np.float32)
lat_abs = np.abs(v - 0.5) * 2.0 # 0=equator, 1=poles
north_mask = v < 0.2 # north polar region (top 20% of grid = 72-90°N)
# Allow lakes only in polar regions — mask out equatorial/southern "seas"
equatorial_mask = (lat_abs < 0.6)[:, np.newaxis] * np.ones(GRID_W, dtype=bool)
surface_water = surface_water & ~equatorial_mask
+6 -7
View File
@@ -20,11 +20,16 @@ import argparse
import json
import time
# Venv bootstrap — re-exec into .venv/bin/python if not already there.
from pathlib import Path
import numpy as np
from tooling.core import config, console
from tooling.core.errors import ReachError
from tooling.domains.atlas.planet.generate import _build_markers
from tooling.domains.atlas.planet.planet_simulation import simulate
from tooling.domains.atlas.planet.render_heightmap import render_heightmap
PLANET_DIR = Path(__file__).resolve().parent
WORKTREE_ROOT = config.repo_root()
# The venv re-exec that used to sit here is gone (T-1288). It relaunched the
@@ -33,12 +38,6 @@ WORKTREE_ROOT = config.repo_root()
# them — and an os.execv into a different interpreter, carrying reach's
# argv, would have relaunched something that is not this command at all.
import numpy as np
from tooling.domains.atlas.planet.planet_simulation import simulate
from tooling.domains.atlas.planet.render_heightmap import render_heightmap
from tooling.domains.atlas.planet.generate import _build_markers
# Per-body importers (lazy-loaded)
SOL_INDEX = WORKTREE_ROOT / "wiki" / "star-systems" / "GJ-0" / "index.md"
@@ -328,7 +328,6 @@ def _specialization_checks(
pass
vocab_pu = {k: (v.get("production_ubiquity_projected")) for k, v in vocab.items()}
vocab_commodity = {k: v.get("commodity_id") for k, v in vocab.items()}
# V-SES-02: every inhabited system must resolve a non-null economic value
# (authored here, or via the #1014 fallback once it exists).
@@ -715,7 +715,7 @@ def author_logo_uv(shell, thr):
# Keep exactly two UV layers: primary (albedo/mask) + logo. Remove extras.
while len(me.uv_layers) > 1:
me.uv_layers.remove(me.uv_layers[-1])
logo_uv = me.uv_layers.new(name="logo_uv")
me.uv_layers.new(name="logo_uv") # created for its side effect: the logo UV layer
me.uv_layers.active = me.uv_layers[0] # keep albedo layer active for mask bake safety
bm = bmesh.new()