fix: address whole-branch review findings for update-swarm
- versions: require entire normalized string to be numeric so dates and hotfix suffixes compare as incomparable instead of eq/gt - hosts: exact host or dot-suffix match rejects lookalikes like notmediafire.com and evilmega.nz; GitHub stays exact-set - census: lazy extractor loop so a later OSError no longer discards an earlier sidecar changelog hit - jobs: watchlist parses only table rows whose vault-note cell is a bare wikilink (skips parenthetical related/complete notes); wanted also matches bold names in Wanted.md tables with Pokemon prefix stripped and casefolded - cli: validate-scouts and judge raise SystemExit when jobs.json has jobs but scouts/ has zero valid files - fetch: download forwards timeout=60 to urlopen and writes to a .part file then os.replace, removing the partial on any failure
This commit is contained in:
1 parent
37ebc97b51
commit
cb294f72a0
16 files changed
+234
-48
No files matched your search
@@ -18,7 +18,7 @@ def deploy_argv(pokemon_repo: str, site_repo: str) -> list[list[str]]:
|
||||
["powershell", "-File", "scripts/deploy-site.ps1"],
|
||||
]
|
||||
|
||||
def _load_scouts(run_dir: str) -> dict:
|
||||
def _load_scouts(run_dir: str, jobs: list[dict] | None = None) -> dict:
|
||||
out = {}
|
||||
for path in glob.glob(os.path.join(run_dir, "scouts", "*.json")):
|
||||
obj = read_json(path)
|
||||
@@ -26,6 +26,8 @@ def _load_scouts(run_dir: str) -> dict:
|
||||
if errs:
|
||||
raise SystemExit(f"{path} missing keys: {errs}")
|
||||
out[obj["stem"]] = obj
|
||||
if jobs and len(jobs) > 0 and not out:
|
||||
raise SystemExit("no valid scout files in scouts/ but jobs.json has jobs")
|
||||
return out
|
||||
|
||||
def _load_census(run_dir: str) -> dict:
|
||||
@@ -61,14 +63,15 @@ def main(argv=None) -> int:
|
||||
if args.cmd == "validate-scouts":
|
||||
if not args.run:
|
||||
raise SystemExit("--run is required")
|
||||
_load_scouts(args.run)
|
||||
jobs = read_json(os.path.join(args.run, "jobs.json")).get("jobs")
|
||||
_load_scouts(args.run, jobs)
|
||||
print("scouts ok")
|
||||
return 0
|
||||
if args.cmd == "judge":
|
||||
if not args.run:
|
||||
raise SystemExit("--run is required")
|
||||
jobs = read_json(os.path.join(args.run, "jobs.json"))["jobs"]
|
||||
verdicts = judge_all(jobs, _load_census(args.run), _load_scouts(args.run))
|
||||
verdicts = judge_all(jobs, _load_census(args.run), _load_scouts(args.run, jobs))
|
||||
write_json(os.path.join(args.run, "verdict.json"), {"verdicts": verdicts})
|
||||
print(f"wrote {len(verdicts)} verdicts")
|
||||
return 0
|
||||
|
||||
Reference in new issue
Block a user