Wanderer big step v0.20.0 -> v0.21.2 (bench + box + undo proven): PocketBase internal, inbound federation off, sign-up lock on PUT /api/v1/user, Meilisearch 384M; offered again (D59 ends, operator); Wanderer + Homepage fixtures; box_walk --to-definition (felhom.eu R-1335)
gates / gates (push) Successful in 44s
gates / gates (push) Successful in 44s
This commit is contained in:
1 parent
0829994440
commit
1825247d0f
9 files changed
+248
-57
No files matched your search
+37
-5
@@ -388,12 +388,27 @@ def backup_now(name):
|
||||
say(f" [4] backup press SKIPPED for {name} (R-648: whole-box only; the update's backing-up phase backs up {name} alone)")
|
||||
return None
|
||||
|
||||
def drill_bump(app, frm, to, service_hint=None):
|
||||
"""Serialised across concurrent walks: one git working tree, one lock."""
|
||||
def drill_bump(app, frm, to, service_hint=None, definition=None):
|
||||
"""Serialised across concurrent walks: one git working tree, one lock. `definition` = (dir, TO map): the drill commit
|
||||
takes that whole definition instead of moving image lines (a definition step)."""
|
||||
import fcntl
|
||||
with open(f"{SC}/drill.lock", "w") as lk:
|
||||
fcntl.flock(lk, fcntl.LOCK_EX)
|
||||
sh(["git", "-C", DRILL, "pull", "-q", "--rebase", "origin", "main"], timeout=120)
|
||||
if definition:
|
||||
c, y, why = definition_files(definition[0], definition[1], datetime.now().strftime("%Y-%m-%d"))
|
||||
if why:
|
||||
say(f" [5] {why}")
|
||||
return None
|
||||
open(f"{DRILL}/templates/{app}/docker-compose.yml", "w").write(c)
|
||||
open(f"{DRILL}/templates/{app}/.felhom.yml", "w").write(y)
|
||||
sh(["git", "-C", DRILL, "add", "-A"])
|
||||
sh(["git", "-C", DRILL, "commit", "-q", "-m", f"DRILL {app}: {frm} -> {to} (definition {definition[0]})"])
|
||||
r = sh(["git", "-C", DRILL, "push", "-q", "origin", "main"], timeout=120)
|
||||
h = sh(["git", "-C", DRILL, "rev-parse", "--short=12", "HEAD"]).stdout.strip()
|
||||
say(f" [5] drill commit {h}: {app} -> the definition in {definition[0]} (push rc={r.returncode})")
|
||||
refresh_box_mirror()
|
||||
return h
|
||||
return _drill_bump(app, frm, to, service_hint)
|
||||
|
||||
|
||||
@@ -413,6 +428,19 @@ def move_images(s, froms, tos):
|
||||
return out, None
|
||||
|
||||
|
||||
def definition_files(ddir, to, today):
|
||||
"""A DEFINITION step (more than image lines: an entrypoint, an init flag, a removed field — R-762's shape): the TO
|
||||
compose and .felhom.yml from `ddir`, catalog_since set to `today`. Returns (compose, felhom, None), or (None, None, why)
|
||||
when the definition's images are not the walk's TO. Pinned by test_box_walk_drill_move.py."""
|
||||
c = open(os.path.join(ddir, "docker-compose.yml")).read()
|
||||
y = open(os.path.join(ddir, ".felhom.yml")).read()
|
||||
imgs = images_of(c)
|
||||
if imgs != to:
|
||||
return None, None, f"the definition in {ddir} names {imgs}, the walk's TO is {to}"
|
||||
y = re.sub(r'^catalog_since:.*$', f'catalog_since: "{today}"', y, count=1, flags=re.M)
|
||||
return c, y, None
|
||||
|
||||
|
||||
def _drill_bump(app, frm, to, service_hint=None):
|
||||
"""Commit the edge to the DRILL repo. catalog_since set by hand (the drill repo has no gates).
|
||||
|
||||
@@ -770,7 +798,7 @@ def setup_gate_probe(sub):
|
||||
return out
|
||||
|
||||
|
||||
def security_walk(app, frm, to, evdir, soak_s=SOAK_DEFAULT_S, values=None):
|
||||
def security_walk(app, frm, to, evdir, soak_s=SOAK_DEFAULT_S, values=None, definition=None):
|
||||
"""`box_walk.py --security <app> --from <svc=ref,…> --to <svc=ref,…> --ev <dir> [--soak N] [--value K=V …]` — the BOX venue of a
|
||||
security-fix step (`09` §3 decision 255, D39 = B), on scratch guest 9202 pointed at the DRILL catalog, through the
|
||||
product's own endpoints only:
|
||||
@@ -840,7 +868,9 @@ def security_walk(app, frm, to, evdir, soak_s=SOAK_DEFAULT_S, values=None):
|
||||
rec["seed"] = "read_back"
|
||||
froms = ",".join(frm[s] for s in sorted(frm) if frm[s] != to.get(s))
|
||||
tos = ",".join(to[s] for s in sorted(frm) if frm[s] != to.get(s))
|
||||
rec["drill_commit"] = drill_bump(app, froms, tos)
|
||||
if definition:
|
||||
rec["to_definition"] = definition
|
||||
rec["drill_commit"] = drill_bump(app, froms, tos, definition=(definition, to) if definition else None)
|
||||
if not rec["drill_commit"]:
|
||||
return finish("inconclusive", "the drill could not be moved FROM -> TO")
|
||||
moved = [s for s in sorted(to) if frm.get(s) != to[s]]
|
||||
@@ -918,6 +948,8 @@ def main(argv):
|
||||
ap.add_argument("--to", required=True, help="svc=ref,… the step moves to")
|
||||
ap.add_argument("--ev", required=True, help="evidence directory")
|
||||
ap.add_argument("--soak", type=int, default=SOAK_DEFAULT_S)
|
||||
ap.add_argument("--to-definition", dest="to_definition", default=None, metavar="DIR",
|
||||
help="a definition step: the drill takes DIR's docker-compose.yml + .felhom.yml (images must be TO)")
|
||||
ap.add_argument("--value", action="append", default=[], metavar="KEY=VAL",
|
||||
help="a deploy field the wizard would get from the household (e.g. HDD_PATH=<the drive>)")
|
||||
a = ap.parse_args(argv)
|
||||
@@ -926,7 +958,7 @@ def main(argv):
|
||||
print("box_walk: --from and --to must name the same services")
|
||||
return 2
|
||||
vals = dict(v.split("=", 1) for v in a.value if "=" in v)
|
||||
return security_walk(a.security, frm, to, a.ev, a.soak, vals or None)
|
||||
return security_walk(a.security, frm, to, a.ev, a.soak, vals or None, definition=a.to_definition)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -3364,8 +3364,6 @@
|
||||
"deploy_fields[POCKETBASE_ENCRYPTION_KEY].label": "Adatbázis titkosítási kulcs",
|
||||
"deploy_fields[SUBDOMAIN].description": "Az alkalmazás aldomainje",
|
||||
"deploy_fields[SUBDOMAIN].label": "Aldomain",
|
||||
"deploy_fields[SUBDOMAIN_DB].description": "A PocketBase adatbázis aldomainje - a böngésző KÖZVETLENÜL ezt hívja, ezért saját nevet kap",
|
||||
"deploy_fields[SUBDOMAIN_DB].label": "Adatbázis aldomain",
|
||||
"description": "Túra tervező és nyomkövetéssel"
|
||||
},
|
||||
"wger": {
|
||||
@@ -3587,7 +3585,7 @@
|
||||
"uptime-kuma": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag",
|
||||
"vaultwarden": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag",
|
||||
"vikunja": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag",
|
||||
"wanderer": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag",
|
||||
"wanderer": "2026-10-28 (felhom.eu R-1335): the SUBDOMAIN_DB field is removed with the public PocketBase route (upstream v0.21.1: the db must not be reachable from outside); its two strings go, nothing else moves",
|
||||
"wger": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag",
|
||||
"wishlist": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag",
|
||||
"zipline": "user guide added (app guides 2026-10-15): every label checked against the app at its pinned tag"
|
||||
|
||||
@@ -53,6 +53,22 @@ class DrillMove(unittest.TestCase):
|
||||
self.assertIn("refresh_box_mirror()", body, "security_walk installs FROM without loading the drill into the box")
|
||||
self.assertLess(body.index("refresh_box_mirror()"), body.index("deploy(app, sub, values)"))
|
||||
|
||||
def test_definition_step_takes_the_whole_definition(self):
|
||||
import tempfile
|
||||
d = tempfile.mkdtemp()
|
||||
comp = "services:\n seerr:\n image: ghcr.io/seerr-team/seerr:v3.5.1\n init: true\n"
|
||||
open(os.path.join(d, "docker-compose.yml"), "w").write(comp)
|
||||
open(os.path.join(d, ".felhom.yml"), "w").write('display_name: "Seerr"\ncatalog_since: "2026-01-01"\n')
|
||||
c, y, why = w.definition_files(d, {"seerr": "ghcr.io/seerr-team/seerr:v3.5.1"}, "2026-10-28")
|
||||
self.assertIsNone(why)
|
||||
self.assertEqual(c, comp)
|
||||
self.assertIn('catalog_since: "2026-10-28"', y)
|
||||
c, y, why = w.definition_files(d, {"seerr": "ghcr.io/seerr-team/seerr:v3.4.0"}, "2026-10-28")
|
||||
self.assertIsNotNone(why) # the definition's images must be the walk's TO
|
||||
|
||||
def test_cli_has_to_definition(self):
|
||||
self.assertIn('"--to-definition"', open(w.__file__).read())
|
||||
|
||||
def test_mover_uses_move_images(self):
|
||||
self.assertIn("move_images(s, froms, tos)", open(w.__file__).read(), "_drill_bump no longer calls move_images")
|
||||
|
||||
|
||||
@@ -162,9 +162,9 @@ LOAD_CONCURRENCY = 4
|
||||
# only address it reads — measured in the v0.20.0 and v0.21.0 images), which the bench has no name or certificate for;
|
||||
# on a box traefik answers it. The bench points it at the database's own container instead. Every verdict that used an
|
||||
# override carries it (`bench_overrides`), so the difference from a box is on the record, never silent.
|
||||
BENCH_ENV_OVERRIDES = {
|
||||
"wanderer": {"wanderer": {"PUBLIC_POCKETBASE_URL": "http://wanderer-db:8090"}},
|
||||
}
|
||||
# 2026-10-28 (felhom.eu R-1335): wanderer's TEMPLATE now points PUBLIC_POCKETBASE_URL at its database container (no
|
||||
# public PocketBase), so the bench needs no override for it any more — the bench and the box run the same definition.
|
||||
BENCH_ENV_OVERRIDES = {}
|
||||
|
||||
|
||||
def apply_bench_overrides(app: str, compose_text: str) -> str:
|
||||
|
||||
@@ -1658,6 +1658,128 @@ def _set_cookies(out):
|
||||
pairs = re.findall(r"(?im)^set-cookie:\s*([^=;\s]+=[^;\r\n]*)", out or "")
|
||||
return "; ".join(pairs)
|
||||
|
||||
# =============================================================================================
|
||||
class Homepage:
|
||||
"""Homepage stores no household data through any route (a dashboard rendered from its config files); what it DOES
|
||||
keep is the configuration it writes into its volume at first start. So the „seed" plants nothing: it reads the
|
||||
dashboard's own `/api/services` and `/api/bookmarks` (both routes in v1.13.2 and v2.7.0, read in the sources
|
||||
2026-10-28) at FROM, and the read-back asks for the same group and entry names after the update — the config
|
||||
survived and the new version still renders it. An empty list at FROM is no seed (nothing to compare)."""
|
||||
sub = "home"
|
||||
route = "GET /api/services and /api/bookmarks (the first-start configuration, read through the app)"
|
||||
|
||||
@staticmethod
|
||||
def _names(out):
|
||||
try:
|
||||
d = json.loads((out or "").strip() or "[]")
|
||||
except ValueError:
|
||||
return None
|
||||
names = []
|
||||
for g in d if isinstance(d, list) else []:
|
||||
names.append(str(g.get("name")))
|
||||
for e in g.get("services") or g.get("bookmarks") or []:
|
||||
names.append("%s/%s" % (g.get("name"), e.get("name") if isinstance(e, dict) else e))
|
||||
return sorted(names)
|
||||
|
||||
def _read(self, w, sub):
|
||||
got = {}
|
||||
for path in ("/api/services", "/api/bookmarks"):
|
||||
rc, code, out = w.app_curl(sub, path)
|
||||
got[path] = self._names(out) if code == "200" else None
|
||||
return got
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200",), tries=72):
|
||||
return None
|
||||
got = self._read(w, sub)
|
||||
say(f" homepage: first-start config read: services={got['/api/services']} bookmarks={got['/api/bookmarks']}")
|
||||
if not got["/api/services"] or got["/api/bookmarks"] is None:
|
||||
return None
|
||||
return got
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200",), tries=72):
|
||||
return False
|
||||
got = self._read(w, sub)
|
||||
ok = got == t
|
||||
say(f" homepage: the same services and bookmarks after: {ok} ({got['/api/services']})")
|
||||
return ok
|
||||
|
||||
|
||||
# =============================================================================================
|
||||
class Wanderer:
|
||||
"""Wanderer's OWN web API (the SvelteKit server in front of PocketBase), the routes its UI calls — measured in the
|
||||
v0.20.0 and v0.21.2 sources (2026-10-28): `PUT /api/v1/user` signs up (the household's first-run route; closed by
|
||||
PUBLIC_DISABLE_SIGNUP after the setup), `POST /api/v1/auth/login` answers the record and sets the `pb_auth` cookie,
|
||||
`PUT /api/v1/list` stores a private list whose `author` is the user's `actor` (as `list_store.ts` sends it).
|
||||
Read-back: sign in again, `GET /api/v1/list/<id>` names the list; a wrong password must be refused."""
|
||||
sub = "hike"
|
||||
route = "PUT /api/v1/user, POST /api/v1/auth/login, PUT /api/v1/list, GET /api/v1/list/<id>"
|
||||
|
||||
@staticmethod
|
||||
def _json(out):
|
||||
body = (out or "").split("\r\n\r\n")[-1].split("\n\n")[-1]
|
||||
try:
|
||||
return json.loads(body)
|
||||
except ValueError:
|
||||
return {}
|
||||
|
||||
def _login(self, w, sub, u, pw):
|
||||
rc, code, out = w.app_curl(sub, "/api/v1/auth/login", "-D", "-", "-H", "Content-Type: application/json",
|
||||
"-H", f"Origin: https://{sub}.{w.DOMAIN}",
|
||||
data=json.dumps({"username": u, "password": pw}), method="POST")
|
||||
return code, _set_cookies(out), self._json(out)
|
||||
|
||||
def seed(self, w, sub, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "302", "303"), tries=72):
|
||||
return None
|
||||
u = "drill" + secrets.token_hex(4)
|
||||
pw = "Drill-" + secrets.token_hex(8)
|
||||
rc, code, out = w.app_curl(sub, "/api/v1/user", "-H", "Content-Type: application/json",
|
||||
"-H", f"Origin: https://{sub}.{w.DOMAIN}",
|
||||
data=json.dumps({"username": u, "email": u + "@example.invalid", "password": pw,
|
||||
"passwordConfirm": pw}), method="PUT")
|
||||
# the sign-up also asks PocketBase to mail a verification; with no SMTP that half may fail AFTER the user exists
|
||||
say(f" wanderer: sign-up http={code}")
|
||||
code, ck, rec = self._login(w, sub, u, pw)
|
||||
actor = ((rec or {}).get("record") or {}).get("actor")
|
||||
for h in ("@" + u, u): # the login record carries no actor (v0.20.0); the profile route answers it
|
||||
if actor or code != "200":
|
||||
break
|
||||
rc, pc, out = w.app_curl(sub, "/api/v1/profile/" + h, "-H", f"Cookie: {ck}")
|
||||
actor = (self._json(out).get("actor") or {}).get("id") if pc == "200" else None
|
||||
if code != "200" or not ck or not actor:
|
||||
say(f" wanderer: sign-in after sign-up http={code} cookie={bool(ck)} actor={bool(actor)}")
|
||||
return None
|
||||
name = "Drill-" + secrets.token_hex(5)
|
||||
rc, code, out = w.app_curl(sub, "/api/v1/list", "-H", "Content-Type: application/json", "-H", f"Cookie: {ck}",
|
||||
"-H", f"Origin: https://{sub}.{w.DOMAIN}",
|
||||
data=json.dumps({"name": name, "public": False, "description": "drill",
|
||||
"trails": [], "author": actor}), method="PUT")
|
||||
lid = self._json(out).get("id") if code == "200" else None
|
||||
say(f" wanderer: seeded user {u} and private list {name} http={code} id={bool(lid)}")
|
||||
if not lid:
|
||||
say(f" wanderer: list refused {out[:200]}")
|
||||
return None
|
||||
return {"u": u, "pw": pw, "name": name, "id": lid}
|
||||
|
||||
def verify(self, w, sub, t, say):
|
||||
if not w.wait_app(sub, "/", want=("200", "302", "303"), tries=72):
|
||||
return False
|
||||
bad, _, _ = self._login(w, sub, t["u"], "wrong-" + secrets.token_hex(6))
|
||||
if bad == "200":
|
||||
say(" wanderer: READBACK UNUSABLE — a wrong password signed in")
|
||||
return False
|
||||
code, ck, _ = self._login(w, sub, t["u"], t["pw"])
|
||||
if code != "200" or not ck:
|
||||
say(f" wanderer: sign-in as the seeded user http={code}")
|
||||
return False
|
||||
rc, code, out = w.app_curl(sub, "/api/v1/list/" + t["id"], "-H", f"Cookie: {ck}")
|
||||
ok = code == "200" and self._json(out).get("name") == t["name"]
|
||||
say(f" wanderer: sign-in ok (wrong password refused: http {bad}); the private list read back http={code} ok={ok}")
|
||||
return ok
|
||||
|
||||
|
||||
|
||||
class Sparkyfitness:
|
||||
"""SparkyFitness's OWN better-auth API: `POST /api/auth/sign-up/email` makes the first account (the
|
||||
@@ -3151,6 +3273,8 @@ FIXTURES = {
|
||||
"vikunja": Vikunja(),
|
||||
"opengist": OpenGist(),
|
||||
"papra": Papra(),
|
||||
"wanderer": Wanderer(),
|
||||
"homepage": Homepage(),
|
||||
"mealie": Mealie(),
|
||||
"n8n": N8n(),
|
||||
"zipline": Zipline(),
|
||||
|
||||
Reference in new issue
Block a user