[object Object]

← back to Wallco Ai

Q3: read-only top-12 Monterey manifest generator (one-command-away paid batch)

ef20e2053155be7882c8151529ec9b10035f7960 · 2026-06-03 09:59:54 -0700 · Steve

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit ef20e2053155be7882c8151529ec9b10035f7960
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Jun 3 09:59:54 2026 -0700

    Q3: read-only top-12 Monterey manifest generator (one-command-away paid batch)
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 YOLO_BACKLOG.md                    |   4 +-
 data/monterey-top12-manifest.json  | 120 +++++++++++++++++++++++++++++++++++++
 scripts/monterey-top12-manifest.py |  74 +++++++++++++++++++++++
 3 files changed, 196 insertions(+), 2 deletions(-)

diff --git a/YOLO_BACKLOG.md b/YOLO_BACKLOG.md
index e5bd67c..a73cec2 100644
--- a/YOLO_BACKLOG.md
+++ b/YOLO_BACKLOG.md
@@ -127,8 +127,8 @@ $ per mural + the low-res demotion is customer-facing; both await Steve's go.
 
 ## Queue
 - [x] **Q1 · fliepaper-bugs.html** — 2026-06-03 09:26 · added created date+time chip (🕓 fmtDate, full ISO in title=) per standing rule #2. API now carries c.created_at; .when chip + CSS in admin grid. Validated: local API returns created_at 36/36, node -c clean. Local only (deploy gated).
-- [ ] **Q2 · build-mural-master.py --estimate** — zero-spend dry-run cost estimator (ESRGAN tiles + outpaint calls × per-call $) so Steve sees the batch cost before approving
-- [ ] **Q3 · curated top-12 Monterey manifest** — read-only DB select → JSON so the paid batch is one command away on return
+- [x] **Q2 · build-mural-master.py --estimate** — 2026-06-03 09:59 · ALREADY IMPLEMENTED (estimate() at L373, --estimate N wired L457). Validated: `--estimate 12` → 216 calls ~$3.30, NO calls made. No code change needed.
+- [x] **Q3 · curated top-12 Monterey manifest** — 2026-06-03 09:59 · new scripts/monterey-top12-manifest.py (READ-ONLY SELECT, zero spend) → data/monterey-top12-manifest.json. Top-12 published monterey-mural ranked combined_score→elo→newest, with build_command_template + estimate_command. Validated: 12 ids, valid JSON, 0 DB writes.
 - [ ] opportunistic local code-health as found
 
 ## Ledger
diff --git a/data/monterey-top12-manifest.json b/data/monterey-top12-manifest.json
new file mode 100644
index 0000000..d744456
--- /dev/null
+++ b/data/monterey-top12-manifest.json
@@ -0,0 +1,120 @@
+{
+  "note": "READ-ONLY curated top-12 Monterey murals. No spend until Steve runs the build command.",
+  "category": "monterey-mural",
+  "ranking": "combined_score DESC NULLS LAST -> elo DESC -> newest id (published, not user_removed)",
+  "count": 12,
+  "ids": [
+    25052,
+    25059,
+    25051,
+    25046,
+    25045,
+    37893,
+    37769,
+    37715,
+    37709,
+    37613,
+    37417,
+    37412
+  ],
+  "build_command_template": "for id in 25052 25059 25051 25046 25045 37893 37769 37715 37709 37613 37417 37412; do python3 scripts/build-mural-master.py $id; done   # ~$0.28/mural, see --estimate 12",
+  "estimate_command": "python3 scripts/build-mural-master.py --estimate 12",
+  "murals": [
+    {
+      "id": 25052,
+      "ai_title": null,
+      "combined_score": 3.5,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/25052",
+      "rank": 1
+    },
+    {
+      "id": 25059,
+      "ai_title": null,
+      "combined_score": 3.0,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/25059",
+      "rank": 2
+    },
+    {
+      "id": 25051,
+      "ai_title": null,
+      "combined_score": 3.0,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/25051",
+      "rank": 3
+    },
+    {
+      "id": 25046,
+      "ai_title": null,
+      "combined_score": 3.0,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/25046",
+      "rank": 4
+    },
+    {
+      "id": 25045,
+      "ai_title": null,
+      "combined_score": 3.0,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/25045",
+      "rank": 5
+    },
+    {
+      "id": 37893,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37893",
+      "rank": 6
+    },
+    {
+      "id": 37769,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37769",
+      "rank": 7
+    },
+    {
+      "id": 37715,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37715",
+      "rank": 8
+    },
+    {
+      "id": 37709,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37709",
+      "rank": 9
+    },
+    {
+      "id": 37613,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37613",
+      "rank": 10
+    },
+    {
+      "id": 37417,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37417",
+      "rank": 11
+    },
+    {
+      "id": 37412,
+      "ai_title": null,
+      "combined_score": null,
+      "elo": 1200.0,
+      "image_url": "/designs/img/by-id/37412",
+      "rank": 12
+    }
+  ]
+}
\ No newline at end of file
diff --git a/scripts/monterey-top12-manifest.py b/scripts/monterey-top12-manifest.py
new file mode 100644
index 0000000..73aa8c4
--- /dev/null
+++ b/scripts/monterey-top12-manifest.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python3
+"""
+monterey-top12-manifest.py — READ-ONLY curated top-N Monterey manifest.
+
+Selects the top-N published `monterey-mural` designs (deterministic ranking:
+combined_score DESC NULLS LAST → elo DESC → newest id) and writes a manifest
+JSON so the paid mural-master batch is one command away. Makes NO DB writes and
+spends NOTHING (pure SELECT + local file write).
+
+Usage:
+  python3 scripts/monterey-top12-manifest.py            # top 12 → data/monterey-top12-manifest.json
+  python3 scripts/monterey-top12-manifest.py --n 20     # top 20
+  python3 scripts/monterey-top12-manifest.py --out /tmp/x.json
+"""
+import argparse, json, os, subprocess, sys
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+
+
+def psql_json(sql):
+    # Connect the same way the app does on this host (peer auth / DATABASE_URL=dw_unified).
+    env = dict(os.environ)
+    r = subprocess.run(["psql", "dw_unified", "-At", "-c", sql],
+                       capture_output=True, text=True, env=env)
+    if r.returncode != 0:
+        # fall back to dw_admin TCP if peer auth isn't available
+        env["PGPASSWORD"] = env.get("PGPASSWORD", "DW2024SecurePass")
+        r = subprocess.run(["psql", "-h", "127.0.0.1", "-U", "dw_admin", "-d", "dw_unified",
+                            "-At", "-c", sql], capture_output=True, text=True, env=env)
+        if r.returncode != 0:
+            sys.stderr.write(r.stderr)
+            sys.exit(1)
+    return r.stdout.strip()
+
+
+def main():
+    ap = argparse.ArgumentParser()
+    ap.add_argument("--n", type=int, default=12)
+    ap.add_argument("--out", default=str(ROOT / "data" / "monterey-top12-manifest.json"))
+    a = ap.parse_args()
+
+    sql = (
+        "SELECT COALESCE(json_agg(t ORDER BY t.rank), '[]'::json) FROM ("
+        "  SELECT id, ai_title, combined_score, elo, "
+        "         '/designs/img/by-id/' || id AS image_url, "
+        "         row_number() OVER (ORDER BY combined_score DESC NULLS LAST, elo DESC NULLS LAST, id DESC) AS rank "
+        "  FROM all_designs "
+        "  WHERE category='monterey-mural' AND is_published=TRUE AND COALESCE(user_removed,FALSE)=FALSE "
+        "  ORDER BY combined_score DESC NULLS LAST, elo DESC NULLS LAST, id DESC "
+        f"  LIMIT {int(a.n)}"
+        ") t;"
+    )
+    rows = json.loads(psql_json(sql) or "[]")
+
+    manifest = {
+        "note": "READ-ONLY curated top-%d Monterey murals. No spend until Steve runs the build command." % a.n,
+        "category": "monterey-mural",
+        "ranking": "combined_score DESC NULLS LAST -> elo DESC -> newest id (published, not user_removed)",
+        "count": len(rows),
+        "ids": [r["id"] for r in rows],
+        "build_command_template": "for id in %s; do python3 scripts/build-mural-master.py $id; done   # ~$0.28/mural, see --estimate %d" % (
+            " ".join(str(r["id"]) for r in rows), len(rows)),
+        "estimate_command": "python3 scripts/build-mural-master.py --estimate %d" % len(rows),
+        "murals": rows,
+    }
+    out = Path(a.out)
+    out.parent.mkdir(parents=True, exist_ok=True)
+    out.write_text(json.dumps(manifest, indent=2))
+    print("wrote %s — %d murals (ids: %s)" % (out, len(rows), ",".join(str(r["id"]) for r in rows)))
+
+
+if __name__ == "__main__":
+    main()

← 34f8c54 docs: mural-pipeline.md — full room-size scenic-mural archit  ·  back to Wallco Ai  ·  loop tick4: DTD->B, catalog quality clean (0 dup image_url, cfb81ce →