metube: media/metube optional — the second-drive copy carries the downloads, off-site does not (D44 #25, felhom.eu R-1283; ported from drill 6733764); check-download-binds allows optional for a NAMED ruling only, with decoys
gates / gates (push) Successful in 56s

This commit is contained in:
admin committed 2026-10-26 09:12:22 +01:00
1 parent cd0cf48fab
commit 73c165d60f
4 files changed
+23 -2

No files matched your search

+10 -1
View File
@@ -28,6 +28,12 @@ import sys
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DOWNLOAD_TARGETS = ("/downloads", "/watch")
# R-1283 (operator D44 #25, 2026-10-25; felhom.eu `architecture/15-media-library.md` §7): a download folder the operator
# ruled worth a second-drive copy. It may be `optional` (Tier 2 copies it, off-site does not) — never mandatory and never
# unlisted. Only by a ruling named here; every other download client stays `excluded`.
OPTIONAL_BY_RULING = {
"metube": "a MeTube video may be gone from its source site, so it cannot be fetched again (D44 #25, R-1283)",
}
BIND = re.compile(r"""^\s*-\s*["']?\$\{USERDATA_PATH\}/([^:"'\s]+):([^:"'\s]+)""")
@@ -114,6 +120,8 @@ def main(argv):
for folder in folders:
cls = classes.get(folder)
judged.append("%s:%s=%s" % (app, folder, cls or "UNLISTED"))
if cls == "optional" and app in OPTIONAL_BY_RULING:
continue # the ruling's one allowed class besides excluded (R-1283)
if cls != "excluded":
why = ("UNLISTED in backup.userdata — the controller classes it MANDATORY (every tier, off-site included)"
if cls is None else "declared `%s` — %s" % (cls, "a nightly copy on the second drive" if cls == "optional" else "copied by the backup"))
@@ -126,7 +134,8 @@ def main(argv):
for b in bad:
print(" " + b)
return 1
print("download-binds gate OK — %d download folder(s), every one `excluded`: %s" % (len(judged), ", ".join(judged)))
print("download-binds gate OK — %d download folder(s), every one `excluded` or `optional` by a named ruling (%s): %s"
% (len(judged), ", ".join(sorted(OPTIONAL_BY_RULING)), ", ".join(judged)))
return 0
+4
View File
@@ -923,6 +923,10 @@ def download_binds_cases():
run("FACT: `class: excluded` only in a COMMENT, the field optional", {"dl/docker-compose.yml": compose([dl]), "dl/.felhom.yml": felhom([("media/dl", "optional")], comment=" # - path: media/dl\n # class: excluded\n")}, 1, ("optional",))
run("FACT: a /watch sub-folder optional under an excluded parent", {"dl/docker-compose.yml": compose([dl, "${USERDATA_PATH}/media/dl/watch:/watch"]), "dl/.felhom.yml": felhom([("media/dl", "excluded"), ("media/dl/watch", "optional")])}, 1, ("media/dl/watch",))
run("FACT: a target below /downloads", {"dl/docker-compose.yml": compose(["${USERDATA_PATH}/media/done:/downloads/complete"]), "dl/.felhom.yml": felhom([("media/done", "optional")])}, 1, ("media/done",))
mt = "${USERDATA_PATH}/media/metube:/downloads"
run("GENUINE (R-1283): metube's folder optional by ruling", {"metube/docker-compose.yml": compose([mt]), "metube/.felhom.yml": felhom([("media/metube", "optional")])}, 0, ("every one",))
run("FACT (R-1283): metube's folder mandatory — the ruling allows optional only", {"metube/docker-compose.yml": compose([mt]), "metube/.felhom.yml": felhom([("media/metube", "mandatory")])}, 1, ("templates/metube", "mandatory"))
run("FACT (R-1283): metube's folder UNLISTED", {"metube/docker-compose.yml": compose([mt]), "metube/.felhom.yml": felhom([("media/other", "excluded")])}, 1, ("UNLISTED",))
run("FACT: no download bind anywhere (nothing to judge)", {"dl/docker-compose.yml": compose(["${USERDATA_PATH}/media:/media:ro"]), "dl/.felhom.yml": felhom([("media", "excluded")])}, 3, ("nothing to judge",))
run("FACT: no templates/ at all (nothing to judge)", {}, 3, ("nothing to judge",), no_templates=True)
finally: