mirror of
https://github.com/seanbetts/steam-hardware-watch.git
synced 2026-10-06 05:02:52 +02:00
Integrate customs shipments into watch summaries
This commit is contained in:
1 parent
e76b138a46
commit
f6d93ab9d3
4 files changed
+64
No files matched your search
@@ -51,6 +51,7 @@ def build_draft(run_dir: Path):
|
|||||||
tracking_lines = first_n_nonempty(reports / "steamtracking-pairing-focus.txt", 8)
|
tracking_lines = first_n_nonempty(reports / "steamtracking-pairing-focus.txt", 8)
|
||||||
steamvr_lines = first_n_nonempty(reports / "steamvr-depots-key-lines.txt", 8)
|
steamvr_lines = first_n_nonempty(reports / "steamvr-depots-key-lines.txt", 8)
|
||||||
steamos_lines = first_n_nonempty(reports / "steamos-mirror-key-lines.txt", 8)
|
steamos_lines = first_n_nonempty(reports / "steamos-mirror-key-lines.txt", 8)
|
||||||
|
customs_lines = first_n_nonempty(reports / "customs-shipments-key-lines.txt", 8)
|
||||||
discovered_count = count_lines(reports / "discovered-visual-assets.tsv")
|
discovered_count = count_lines(reports / "discovered-visual-assets.tsv")
|
||||||
retrieved_count = count_lines(reports / "retrieved-visual-assets.tsv")
|
retrieved_count = count_lines(reports / "retrieved-visual-assets.tsv")
|
||||||
blocked_count = count_lines(reports / "blocked-visual-assets.tsv")
|
blocked_count = count_lines(reports / "blocked-visual-assets.tsv")
|
||||||
@@ -60,6 +61,7 @@ def build_draft(run_dir: Path):
|
|||||||
steamvr_blocked = has_nonempty(reports / "steamvr-depots-errors.txt")
|
steamvr_blocked = has_nonempty(reports / "steamvr-depots-errors.txt")
|
||||||
steamos_blocked = has_nonempty(reports / "steamos-mirror-errors.txt")
|
steamos_blocked = has_nonempty(reports / "steamos-mirror-errors.txt")
|
||||||
valve_blocked = has_nonempty(reports / "valve-errors.txt")
|
valve_blocked = has_nonempty(reports / "valve-errors.txt")
|
||||||
|
customs_blocked = has_nonempty(reports / "customs-shipments-errors.txt")
|
||||||
|
|
||||||
lines = [
|
lines = [
|
||||||
f"# Status Draft: {run_date}",
|
f"# Status Draft: {run_date}",
|
||||||
@@ -133,6 +135,14 @@ def build_draft(run_dir: Path):
|
|||||||
else:
|
else:
|
||||||
lines.append("- No Valve key-line report found.")
|
lines.append("- No Valve key-line report found.")
|
||||||
|
|
||||||
|
lines.extend(["", "#### Customs / Shipments"])
|
||||||
|
if customs_blocked:
|
||||||
|
lines.append("- Customs shipment fetches failed or were partially blocked in this run. See `customs-shipments-errors.txt`.")
|
||||||
|
if customs_lines:
|
||||||
|
lines.extend([f"- `{line}`" for line in customs_lines])
|
||||||
|
elif not customs_blocked:
|
||||||
|
lines.append("- No relevant customs shipment rows found.")
|
||||||
|
|
||||||
lines.extend(
|
lines.extend(
|
||||||
[
|
[
|
||||||
"",
|
"",
|
||||||
@@ -149,6 +159,7 @@ def build_draft(run_dir: Path):
|
|||||||
f"- Retrieved visual assets: `{reports / 'retrieved-visual-assets.tsv'}`",
|
f"- Retrieved visual assets: `{reports / 'retrieved-visual-assets.tsv'}`",
|
||||||
f"- Blocked visual assets: `{reports / 'blocked-visual-assets.tsv'}`",
|
f"- Blocked visual assets: `{reports / 'blocked-visual-assets.tsv'}`",
|
||||||
f"- Manual retry URLs: `{reports / 'manual-asset-urls.txt'}`",
|
f"- Manual retry URLs: `{reports / 'manual-asset-urls.txt'}`",
|
||||||
|
f"- Customs shipments: `{reports / 'customs-shipments.md'}`",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ printf '%s\n' "Run note: $RUN_NOTE"
|
|||||||
"$SCRIPT_DIR/check_steamvr_depots.sh" "$RUN_DIR"
|
"$SCRIPT_DIR/check_steamvr_depots.sh" "$RUN_DIR"
|
||||||
"$SCRIPT_DIR/check_steamos_mirror.sh" "$RUN_DIR"
|
"$SCRIPT_DIR/check_steamos_mirror.sh" "$RUN_DIR"
|
||||||
"$SCRIPT_DIR/check_valve_endpoints.sh" "$RUN_DIR"
|
"$SCRIPT_DIR/check_valve_endpoints.sh" "$RUN_DIR"
|
||||||
|
"$SCRIPT_DIR/check_customs_shipments.sh" "$RUN_DIR"
|
||||||
python3 "$SCRIPT_DIR/save_visual_assets.py" --run-dir "$RUN_DIR" --base-dir "$BASE_DIR"
|
python3 "$SCRIPT_DIR/save_visual_assets.py" --run-dir "$RUN_DIR" --base-dir "$BASE_DIR"
|
||||||
|
|
||||||
PREVIOUS_DIR=""
|
PREVIOUS_DIR=""
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ def build(run_dir: Path):
|
|||||||
f"- SteamVR depot metadata blocked: `{'yes' if count(reports / 'steamvr-depots-errors.txt') else 'no'}`",
|
f"- SteamVR depot metadata blocked: `{'yes' if count(reports / 'steamvr-depots-errors.txt') else 'no'}`",
|
||||||
f"- SteamOS mirror metadata blocked: `{'yes' if count(reports / 'steamos-mirror-errors.txt') else 'no'}`",
|
f"- SteamOS mirror metadata blocked: `{'yes' if count(reports / 'steamos-mirror-errors.txt') else 'no'}`",
|
||||||
f"- Valve blocked: `{'yes' if count(reports / 'valve-errors.txt') else 'no'}`",
|
f"- Valve blocked: `{'yes' if count(reports / 'valve-errors.txt') else 'no'}`",
|
||||||
|
f"- Customs shipments blocked: `{'yes' if count(reports / 'customs-shipments-errors.txt') else 'no'}`",
|
||||||
f"- Discovered visual assets: `{discovered}`",
|
f"- Discovered visual assets: `{discovered}`",
|
||||||
f"- Retrieved visual assets: `{retrieved}`",
|
f"- Retrieved visual assets: `{retrieved}`",
|
||||||
f"- Blocked visual assets: `{blocked}`",
|
f"- Blocked visual assets: `{blocked}`",
|
||||||
@@ -124,6 +125,7 @@ def build(run_dir: Path):
|
|||||||
f"- Retrieved assets: `{reports / 'retrieved-visual-assets.tsv'}`",
|
f"- Retrieved assets: `{reports / 'retrieved-visual-assets.tsv'}`",
|
||||||
f"- Blocked assets: `{reports / 'blocked-visual-assets.tsv'}`",
|
f"- Blocked assets: `{reports / 'blocked-visual-assets.tsv'}`",
|
||||||
f"- Manual retry URLs: `{reports / 'manual-asset-urls.txt'}`",
|
f"- Manual retry URLs: `{reports / 'manual-asset-urls.txt'}`",
|
||||||
|
f"- Customs shipments: `{reports / 'customs-shipments.md'}`",
|
||||||
]
|
]
|
||||||
|
|
||||||
if compare_file:
|
if compare_file:
|
||||||
@@ -137,6 +139,7 @@ def build(run_dir: Path):
|
|||||||
notable.extend([f"- SteamVR depots: `{line}`" for line in filtered_first(reports / "steamvr-depots-key-lines.txt", 5)])
|
notable.extend([f"- SteamVR depots: `{line}`" for line in filtered_first(reports / "steamvr-depots-key-lines.txt", 5)])
|
||||||
notable.extend([f"- SteamOS mirror: `{line}`" for line in filtered_first(reports / "steamos-mirror-key-lines.txt", 5)])
|
notable.extend([f"- SteamOS mirror: `{line}`" for line in filtered_first(reports / "steamos-mirror-key-lines.txt", 5)])
|
||||||
notable.extend([f"- Valve: `{line}`" for line in filtered_first(reports / "valve-key-lines.txt", 5)])
|
notable.extend([f"- Valve: `{line}`" for line in filtered_first(reports / "valve-key-lines.txt", 5)])
|
||||||
|
notable.extend([f"- Customs shipments: `{line}`" for line in filtered_first(reports / "customs-shipments-key-lines.txt", 8)])
|
||||||
notable.extend([f"- Asset blocked: `{line}`" for line in filtered_first(reports / "blocked-visual-assets.tsv", 5)])
|
notable.extend([f"- Asset blocked: `{line}`" for line in filtered_first(reports / "blocked-visual-assets.tsv", 5)])
|
||||||
|
|
||||||
if notable:
|
if notable:
|
||||||
|
|||||||
@@ -300,5 +300,54 @@ class CheckCustomsShipmentsShellTests(unittest.TestCase):
|
|||||||
self.assertIn("failed to fetch", errors)
|
self.assertIn("failed to fetch", errors)
|
||||||
|
|
||||||
|
|
||||||
|
class CustomsSummaryIntegrationTests(unittest.TestCase):
|
||||||
|
def test_run_summary_and_status_draft_include_customs_lines(self):
|
||||||
|
with TemporaryDirectory() as tmp:
|
||||||
|
run_dir = Path(tmp) / "2026-05-05"
|
||||||
|
reports = run_dir / "reports"
|
||||||
|
reports.mkdir(parents=True)
|
||||||
|
(reports / "customs-shipments-key-lines.txt").write_text(
|
||||||
|
"2026-05-01\tCEVA C/O VALVE CORPORATION\tTECH-FRONT (CHONGQING) COMPUTER CO\tGAME CONSOLE\t42 PKG\t12596 Kgs\tSNHBSHALAX264015\n",
|
||||||
|
encoding="utf-8",
|
||||||
|
)
|
||||||
|
(reports / "customs-shipments-errors.txt").write_text("", encoding="utf-8")
|
||||||
|
|
||||||
|
summary = subprocess.run(
|
||||||
|
[
|
||||||
|
"python3",
|
||||||
|
str(ROOT / "scripts" / "write_run_summary.py"),
|
||||||
|
"--run-dir",
|
||||||
|
str(run_dir),
|
||||||
|
],
|
||||||
|
cwd=ROOT,
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
draft = subprocess.run(
|
||||||
|
[
|
||||||
|
"python3",
|
||||||
|
str(ROOT / "scripts" / "draft_status_update.py"),
|
||||||
|
"--run-dir",
|
||||||
|
str(run_dir),
|
||||||
|
],
|
||||||
|
cwd=ROOT,
|
||||||
|
text=True,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.assertEqual(0, summary.returncode)
|
||||||
|
self.assertEqual(0, draft.returncode)
|
||||||
|
run_summary = (reports / "run-summary.md").read_text(encoding="utf-8")
|
||||||
|
status_draft = (reports / "status-draft.md").read_text(encoding="utf-8")
|
||||||
|
self.assertIn("Customs shipments", run_summary)
|
||||||
|
self.assertIn("SNHBSHALAX264015", run_summary)
|
||||||
|
self.assertIn("Customs / Shipments", status_draft)
|
||||||
|
self.assertIn("GAME CONSOLE", status_draft)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user