chore: drop dead code, sync stale comments
- delete api/categorize.py: orphaned module, never imported. The live
pzmm-types→category mapping is _types_to_category in mlos_sort.py.
- delete api/adapters.py:_autopick_ambiguous: 5-line wrapper around
_apply_branch_rules with zero callers in current source.
- delete docs/backlog/polling-path-pz-build.md: described work that
shipped — init/06_sort_jobs_pz_build.sql plus pz_build plumbing in
jobs.create_job, app._route_to_job, and app._build_result_for_job.
- sync MAP_LINE convention comment in api/mlos_sort.py with the worker
copy (Muldraugh, KY is appended at the end, not prepended at the
front — see adapters.build_response:577).
- update init/04_required_wsids.sql header to reflect the authed-API
fetch path (HTML scrape was retired in 3a34b71).
- soften the now-stale '~14 rows' count in app._strip_path_prefix's
docstring.
This commit is contained in:
@@ -552,13 +552,6 @@ def _apply_branch_rules(
|
||||
|
||||
# Backwards-compat shim used by existing call sites that don't yet pass
|
||||
# pz_build/input_modids. Removed once all callers migrate.
|
||||
def _autopick_ambiguous(mods: List[ModInfo]) -> Tuple[Set[str], List[Dict[str, Any]]]:
|
||||
drop_ids, warns, _hints = _apply_branch_rules(
|
||||
mods, pz_build="B42", input_modids={m.id for m in mods},
|
||||
)
|
||||
return (drop_ids, warns)
|
||||
|
||||
|
||||
def build_response(
|
||||
input_ids: List[str],
|
||||
hit_ids: List[str],
|
||||
|
||||
@@ -131,10 +131,10 @@ class ResortRequest(BaseModel):
|
||||
def _strip_path_prefix(deps) -> List[str]:
|
||||
"""Defensively normalize dep names. Strips leading backslashes (B42 path
|
||||
syntax: `\\StarlitLibrary` -> `StarlitLibrary`) and trims whitespace.
|
||||
Worker._split_csv applies this at parse time, but ~14 mod_parsed rows
|
||||
in the live DB were written before that fix landed and will only refresh
|
||||
when their wsid's time_updated advances on Steam. Normalizing here keeps
|
||||
missing-dep matching correct against legacy rows."""
|
||||
Worker._split_csv applies this at parse time, but a handful of legacy
|
||||
mod_parsed rows were written before that fix landed and will only
|
||||
refresh when their wsid's time_updated advances on Steam. Normalizing
|
||||
here keeps missing-dep matching correct against legacy rows."""
|
||||
out: List[str] = []
|
||||
for d in (deps or []):
|
||||
s = (d or "").strip().lstrip("\\")
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
"""Public helper for mapping pzmm content-type tags to sortof CATEGORY_ORDER.
|
||||
|
||||
The same mapping is also inlined in `mlos_sort.py` (both api/ and worker/
|
||||
copies, deliberately — worker uses a separate venv with no FastAPI deps,
|
||||
so it cannot import from api/). This module exposes the helper for
|
||||
non-mlos consumers (e.g. /api/conflicts diagnostics output) without
|
||||
forcing them to drag in the whole sorter module.
|
||||
|
||||
Source: pzmm core/mods.py:detect_mod_types ordering, mapped to sortof's
|
||||
CATEGORY_ORDER buckets per docs/plans/2026-05-04-pzmm-conflict-and-typing.md
|
||||
§3.4.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
# Items / Animations / Lua / Unknown intentionally absent — too generic to
|
||||
# drive a category decision; callers should fall through to other heuristics.
|
||||
_TYPE_TO_CAT: Dict[str, str] = {
|
||||
"Maps": "map",
|
||||
"Vehicles": "vehicle",
|
||||
"Weapons": "weapon",
|
||||
"Clothing": "wearable",
|
||||
"Traits": "code",
|
||||
"Professions": "profession",
|
||||
"Recipes": "crafting",
|
||||
"Tiles": "tile",
|
||||
"Textures": "texture",
|
||||
"Sounds": "sound",
|
||||
"UI": "ui",
|
||||
"Translations": "translation",
|
||||
"Patch": "patch",
|
||||
"Dependency": "tweaks",
|
||||
"Framework": "tweaks",
|
||||
}
|
||||
|
||||
|
||||
def types_to_category(mod_types: List[str], name: str = "") -> Optional[str]:
|
||||
"""First mod_type that maps to a sortof CATEGORY_ORDER bucket wins.
|
||||
|
||||
Returns the bucket name (e.g. "weapon", "vehicle"), or None when:
|
||||
- mod_types is empty (manifest not yet built), or
|
||||
- mod_types contains only skip-types (Items / Animations / Lua / Unknown).
|
||||
|
||||
The `name` arg is used for the vehicle_spawn refinement only — when a
|
||||
Vehicles-tagged mod is named like "spawn zone X", the more specific
|
||||
`vehicle_spawn` bucket wins over the generic `vehicle`.
|
||||
"""
|
||||
if not mod_types:
|
||||
return None
|
||||
for t in mod_types:
|
||||
cat = _TYPE_TO_CAT.get(t)
|
||||
if cat:
|
||||
if cat == "vehicle" and name and "spawn zone" in name.lower():
|
||||
return "vehicle_spawn"
|
||||
return cat
|
||||
return None
|
||||
@@ -722,11 +722,11 @@ def sort_mods(
|
||||
if wid and wid not in workshop_set:
|
||||
workshop_seen.append(wid)
|
||||
workshop_set.add(wid)
|
||||
# MAP_LINE convention: dependencies first (leftmost), dependents last
|
||||
# (rightmost). Vanilla Muldraugh, KY is the ultimate base and is
|
||||
# prepended at the very front by adapters.build_response. `order` is
|
||||
# already topo-sorted by mod-level deps so dependencies appear before
|
||||
# their dependents — walk it forward.
|
||||
# MAP_LINE convention: dependencies first (leftmost), dependents next.
|
||||
# Vanilla Muldraugh, KY is ALWAYS appended at the very end by
|
||||
# adapters.build_response. `order` is already topo-sorted by mod-level
|
||||
# deps (require= / loadAfter= / loadBefore=), so dependencies appear
|
||||
# before their dependents — walk it forward.
|
||||
map_folders: List[str] = []
|
||||
for mod_id in order:
|
||||
for mf in by_id[mod_id].maps:
|
||||
|
||||
Reference in New Issue
Block a user