`;
-// The VMs page drawn by the real vm.js from vm.json's folders (settings a folder leaves out are drawDocker's), the VMs (all shut
-// off, uuid u0, u1, …) and userprefs.cfg's values
+// The VMs page drawn by the real vm.js from vm.json's folders as given, the VMs (all shut off, uuid u0, u1, …) and userprefs.cfg's values
const drawVms = async ({ folders, names, prefs }) => {
const info = Object.fromEntries(names.map((n, i) => [n, { uuid: `u${i}`, state: 'shutoff', autostart: false }]));
- const defs = Object.fromEntries(Object.entries(folders).map(([id, f]) => [id, { icon: '', hidden_preview: [], actions: [], ...f, settings: { ...FOLDER_SETTINGS, ...(f.settings || {}) } }]));
const p = await makePage({ page: 'vm', api: false, answers: {
- 'read.php': () => JSON.stringify(defs), 'read_order.php': () => JSON.stringify(prefs),
+ 'read.php': () => JSON.stringify(folders), 'read_order.php': () => JSON.stringify(prefs),
'read_unraid_order.php': () => JSON.stringify(names), 'read_info.php': () => JSON.stringify(info),
} });
fakeXhr(p.w, () => ({ status: 200, body: '' }));
@@ -370,4 +368,4 @@ const phpServer = (label, { containers = [] } = {}) => {
return { config, server, cleanup: () => fs.rmSync(tmp, { recursive: true, force: true }) };
};
-module.exports = { makePage, drawDocker, drawVms, fakeXhr, scriptHelpers, check, done, flush, read, phpServer };
+module.exports = { makePage, drawDocker, drawVms, fakeXhr, scriptHelpers, check, done, flush, read, phpServer, FOLDER_SETTINGS };
diff --git a/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js b/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js
index 3b7fe0df..19411a79 100644
--- a/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js
+++ b/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js
@@ -1392,9 +1392,10 @@ window.fv3ContainerAction = async (type, id, action) => {
};
// Unraid's answer to a container or VM action in the shape the folder actions read: a refusal's reason is in `success` (Events.php)
-// or `error` (VMajax.php), the same on 7.0 to 7.4
+// or `error` (VMajax.php); an answer that is no object at all is a failure too
window.fv3ActionAnswer = (answer) => {
- if (!answer || typeof answer !== 'object') return answer;
+ if (!answer || typeof answer !== 'object') return { success: false, text: answer ? String(answer) : fv3I18nOr('request-failed', 'Request failed') };
+ if (answer.success === true) return answer;
var reason = typeof answer.success === 'string' && answer.success ? answer.success : answer.error;
return typeof reason === 'string' && reason ? { success: false, text: reason } : answer;
};
From 071f96c1b899bf0e62b834db34c69646e97728fe Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 02:05:49 +0000
Subject: [PATCH 06/72] chore(beta): release changelog
Release-Synced: 43c85d1a8c8e651a70167992a1838043f6b047e9
---
CHANGELOG.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81dbcb40..23e5095e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,12 @@
After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache if the page doesn't display correctly — before submitting a debug .json.
+## Unreleased
+
+- refactor: the folder-file code moves from lib.php to lib.folders.php
+- fix: a success with an error field stays a success, a null answer is a failure; the API-first path and raw VM fixtures are tested
+- fix: a folder action Unraid refuses shows Unraid's reason, not its JSON answer
+
## 2026.11.14.1 (beta)
- Folder saves from two tabs, or made at once, no longer overwrite each other
From 90f2c02b4ea3c99d48a9ba571b508bbf19e650cf Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 10:44:04 +0800
Subject: [PATCH 07/72] ci: the Unraid watch checks what FolderView3 relies on
in every supported Unraid release: contracts, Unraid CSS by release and
theme, CSS variable fallbacks
---
.github/unraid-watch/README.md | 22 ++++--
.github/unraid-watch/css.py | 97 +++++++++++++++++++++++++++
.github/unraid-watch/github.py | 16 +++++
.github/unraid-watch/releases.py | 6 ++
.github/unraid-watch/report.py | 47 +++++++++++++
.github/unraid-watch/scan.py | 15 +++++
.github/unraid-watch/status.py | 11 ++-
.github/unraid-watch/test_commands.py | 49 +++++++++++++-
.github/unraid-watch/test_css.py | 71 ++++++++++++++++++++
.github/unraid-watch/test_github.py | 10 +++
.github/unraid-watch/test_releases.py | 3 +
.github/unraid-watch/test_report.py | 6 ++
.github/unraid-watch/test_status.py | 40 ++++++++---
.github/unraid-watch/upstream.py | 41 +++++++++++
.github/unraid-watch/watch.json | 32 ++++++++-
.github/unraid-watch/watch.py | 29 +++++++-
.github/unraid-watch/world.py | 32 ++++++++-
17 files changed, 503 insertions(+), 24 deletions(-)
create mode 100644 .github/unraid-watch/css.py
create mode 100644 .github/unraid-watch/test_css.py
diff --git a/.github/unraid-watch/README.md b/.github/unraid-watch/README.md
index 7d20aef2..a67b4521 100644
--- a/.github/unraid-watch/README.md
+++ b/.github/unraid-watch/README.md
@@ -7,11 +7,14 @@ plugin stands. Both go to issue #52.
- **check** (every CI run, offline). Reads each GraphQL document out of `scripts/*.js` and `*.page`, and each
webgui PHP file the plugin references. Fails when a document is not a plain string, because nothing
- downstream could see it.
+ downstream could see it. Also fails on a `var(--x)` in the plugin's stylesheets with no fallback when only
+ Unraid defines `--x`, so an Unraid release without it cannot drop the style; a variable the plugin's own
+ stylesheets declare, or its scripts or server code name (the CSS tool's presets), is the plugin's.
- **contract** (pull requests that touch `src/`, this directory or the workflow file, every push to `main` or
`beta`, and daily for both). Validates every operation against the `unraid/api` schema on `main` and at the
- latest release, and confirms every watched path still exists upstream. Red means the plugin sends something
- that is no longer valid, or a file it depends on is gone. The daily run checks each branch with that branch's
+ latest release, confirms every watched path still exists upstream, and checks every contract on each stable
+ OS release from the plugin's declared minimum and on the development branch. Red means the plugin sends
+ something that is no longer valid, a file it depends on is gone, or a release it supports breaks a contract. The daily run checks each branch with that branch's
copy of the tool; a manual run checks the branch it is started on.
- **watch** (daily, on every push to `beta`, and by hand). It always reads the plugin on `beta`, whichever branch
starts it, and does two things:
@@ -39,8 +42,13 @@ Once it is on `main` the daily run starts by itself, and still reads `beta`.
- **Coming with X.Y**: what the newest OS pre-release has that the newest stable does not.
- **Operations by OS release**: how many of the plugin's operations are valid on the API each OS release
bundles, and which fields are missing.
+- **Contracts by OS release**: whether each contract holds on every supported release and the development branch.
+- **Unraid CSS by OS release**: per theme, the layout properties Unraid's stylesheets set on an element the
+ plugin's own CSS styles, that differ between releases, and that the plugin does not set itself: what can
+ look different on an older or newer Unraid. A rule no longer set on the development branch is listed apart,
+ as it has often only moved to a stylesheet not read here.
- **API not used yet**: Docker and VM operations the plugin never calls, and how much of each type it reads.
-- **Still on legacy**: the webgui files the plugin still depends on.
+- **Still on legacy**: the webgui files the plugin still depends on, stylesheets aside.
OS versions and the API each one bundles are read from the release notes. They state it in prose, in several
styles; a release whose notes do not say is listed as not stated rather than guessed. Files are compared by
@@ -63,6 +71,12 @@ with `' + name + '` when `watch.json` has an `expand` rule naming the JS map tha
operation from an unread field.
- `releases`: directory holding the OS release notes. `since` is the oldest OS release to list, and `tags` is
the repository whose tags carry those OS versions.
+- `manifest`: the plugin's `.plg`. Its `min` attribute is the oldest OS release the contracts and stylesheets
+ are checked on; the webgui's stable tags from there up are the releases.
+- `contracts`: what the plugin relies on in a webgui file, as a `path`, a regular expression it must `match`,
+ and `why`. Optional `since`: the oldest release held to it. Add one with each change that relies on Unraid.
+- `styles`: the `themes`, and the stylesheet `files` that make up each one in load order (`{theme}` is
+ replaced). A file a release does not have is skipped, so files from older and newer layouts can both be listed.
## Running it by hand
diff --git a/.github/unraid-watch/css.py b/.github/unraid-watch/css.py
new file mode 100644
index 00000000..c7ca166a
--- /dev/null
+++ b/.github/unraid-watch/css.py
@@ -0,0 +1,97 @@
+"""Stylesheets, FolderView3's and Unraid's: rules as text, the elements FolderView3 styles, and what Unraid sets on them per release."""
+import re
+
+TOKEN = re.compile(r'[#.][A-Za-z_][\w-]*')
+COMMENT = re.compile(r'/\*.*?\*/', re.S)
+# A semicolon inside url(...) or a data URI does not end a declaration
+DECLARATION = re.compile(r';(?![^(]*\))')
+VAR = re.compile(r'var\(\s*(--[\w-]+)\s*([,)])')
+DEFINED = re.compile(r'(?:^|[;{\s])(--[\w-]+)\s*:')
+# What moves or wraps an element. Colours and fonts change with each theme by design, so they are left out
+LAYOUT = frozenset({
+ 'display', 'position', 'white-space', 'overflow', 'overflow-x', 'overflow-y', 'float', 'clear', 'box-sizing', 'flex', 'flex-direction',
+ 'flex-wrap', 'flex-grow', 'flex-shrink', 'flex-basis', 'align-items', 'justify-content', 'gap', 'grid-template-columns', 'width',
+ 'min-width', 'max-width', 'height', 'min-height', 'max-height', 'margin', 'margin-top', 'margin-bottom', 'margin-left', 'margin-right',
+ 'padding', 'padding-top', 'padding-bottom', 'padding-left', 'padding-right', 'line-height', 'font-size', 'vertical-align', 'text-align',
+ 'text-overflow', 'word-break', 'overflow-wrap', 'table-layout', 'border-collapse', 'border-spacing', 'top', 'left', 'right', 'bottom',
+ 'transform', 'z-index', 'visibility', 'content'})
+
+
+def uncommented(text):
+ """The text with each comment blanked out, line breaks kept so positions still give line numbers."""
+ return COMMENT.sub(lambda m: '\n' * m.group(0).count('\n'), text)
+
+
+def rules(text):
+ """[(at-rule conditions, selector, {property: value})], one entry per selector of a rule."""
+ text = uncommented(text)
+ out, heads, start = [], [], 0
+ for i, c in enumerate(text):
+ if c == '{':
+ heads.append(' '.join(text[start:i].split()))
+ start = i + 1
+ elif c == '}' and heads:
+ head, body = heads.pop(), text[start:i]
+ if not head.startswith('@') and '{' not in body:
+ decls = {}
+ for part in DECLARATION.split(body):
+ name, colon, value = part.partition(':')
+ if colon and name.strip():
+ # `4px!important` and `4px !important` are the same value
+ decls[name.strip().lower()] = ' '.join(re.sub(r'\s*!\s*important\b', ' !important', value).split())
+ context = ' '.join(h for h in heads if h.startswith('@'))
+ out += [(context, ' '.join(s.split()), decls) for s in head.split(',') if s.strip()]
+ start = i + 1
+ return out
+
+
+def subject(selector):
+ """The ids and classes of the element a selector styles: its last compound, without what :not(...) and the like name."""
+ last = re.split(r'[\s>+~]+', re.sub(r'\([^()]*\)', '', selector).strip())[-1]
+ return TOKEN.findall(last)
+
+
+def styled(texts):
+ """{id or class: properties FolderView3 sets on elements that carry it} from FolderView3's own stylesheets."""
+ out = {}
+ for text in texts:
+ for _, selector, decls in rules(text):
+ for token in subject(selector):
+ out.setdefault(token, set()).update(decls)
+ return out
+
+
+def merged(texts):
+ """{(at-rule conditions, selector, property): value} for stylesheets in load order: a later one wins."""
+ out = {}
+ for text in texts:
+ for context, selector, decls in rules(text):
+ for name, value in decls.items():
+ out[(context, selector, name)] = value
+ return out
+
+
+def changes(by_ref, refs, ours):
+ """[(at-rule conditions, selector, property, [(ref, value or None)])] for layout properties Unraid sets on an element
+ FolderView3 styles, that differ between refs, and that FolderView3 does not set there itself."""
+ out = []
+ for context, selector, name in sorted(set().union(*(by_ref[r] for r in refs))):
+ tokens = [t for t in subject(selector) if t in ours]
+ if name not in LAYOUT or not tokens or any(name in ours[t] for t in tokens):
+ continue
+ values = [(ref, by_ref[ref].get((context, selector, name))) for ref in refs]
+ if len({v for _, v in values}) > 1:
+ out.append((context, selector, name, values))
+ return out
+
+
+def fallbacks(stylesheets, code):
+ """Problems: var(--x) with no fallback where --x is Unraid's: no FolderView3 stylesheet declares it and its scripts and
+ server code (the CSS tool's presets, the generated theme CSS) never name it."""
+ texts = {f: uncommented(f.read_text(encoding='utf-8')) for f in stylesheets}
+ ours = {name for text in texts.values() for name in DEFINED.findall(text)}
+ named = '\n'.join(f.read_text(encoding='utf-8') for f in code)
+ return [f'{f.name}:{text.count(chr(10), 0, m.start()) + 1}: var({m.group(1)}) has no fallback and only Unraid defines '
+ f'{m.group(1)}; an Unraid release without it would drop the style'
+ for f, text in texts.items() for m in VAR.finditer(text)
+ if m.group(2) == ')' and m.group(1) not in ours and not re.search(r"['\"](?:--)?" + re.escape(m.group(1)[2:]) + r"['\"]", named)]
diff --git a/.github/unraid-watch/github.py b/.github/unraid-watch/github.py
index 64911d7f..4e49da31 100644
--- a/.github/unraid-watch/github.py
+++ b/.github/unraid-watch/github.py
@@ -112,6 +112,22 @@ def read():
return self._call('GET', f'/repos/{repo}/contents/{urllib.parse.quote(path)}', {'ref': ref}, raw=True)
return self._once(('file', repo, ref, path), read)
+ def blob(self, repo, sha):
+ """A file's text by its blob sha: one read per version of a file, however many releases share it."""
+ return self._once(('blob', repo, sha), lambda: self._call('GET', f'/repos/{repo}/git/blobs/{sha}', raw=True))
+
+ def tags(self, repo):
+ """Every tag name of a repository."""
+ def read():
+ names = []
+ for page in range(1, 51):
+ batch = self._call('GET', f'/repos/{repo}/tags', {'page': page, 'per_page': 100})
+ names += [t['name'] for t in batch]
+ if len(batch) < 100:
+ return names
+ raise GitHubError(f'{repo}: more than 5000 tags')
+ return self._once(('tags', repo), read)
+
def exists(self, repo, ref, path):
return bool(self._call('HEAD', f'/repos/{repo}/contents/{urllib.parse.quote(path.rstrip("/"))}',
{'ref': ref}, missing=(404,)))
diff --git a/.github/unraid-watch/releases.py b/.github/unraid-watch/releases.py
index f8a09aa0..05ac29f2 100644
--- a/.github/unraid-watch/releases.py
+++ b/.github/unraid-watch/releases.py
@@ -16,6 +16,12 @@ def stable(version):
return '-' not in version
+def os_tag(name):
+ """A stable Unraid OS release tag such as 7.4.0; the webgui's oldest tags are dates such as 2014.11.10."""
+ found = VERSION.fullmatch(name)
+ return bool(found) and stable(name) and int(found.group(1)) < 1000
+
+
def heading(text):
"""First markdown heading of a release-notes file; '' when it has none."""
for line in text.splitlines():
diff --git a/.github/unraid-watch/report.py b/.github/unraid-watch/report.py
index 41366faa..ef3f375c 100644
--- a/.github/unraid-watch/report.py
+++ b/.github/unraid-watch/report.py
@@ -91,6 +91,52 @@ def _changed(commits):
return f'{len(commits)} commit{"" if len(commits) == 1 else "s"}, newest {code(f"{date} {subject}")}'
+def _runs(values):
+ """`a` in `7.0.0`–`7.3.5`, not set in `7.4.0`–`master`: consecutive refs with the same value as one span."""
+ runs = []
+ for ref, value in values:
+ if runs and runs[-1][0] == value:
+ runs[-1][2] = ref
+ else:
+ runs.append([value, ref, ref])
+ return ', '.join(f'{"not set" if value is None else code(value)} in {code(a)}' + ('' if a == b else f'–{code(b)}')
+ for value, a, b in runs)
+
+
+def _contracts(view):
+ *tags, branch = view['refs']
+ span = ((f'{code(tags[0])} to {code(tags[-1])}' if len(tags) > 1 else code(tags[0])) + ' and ' if tags else '') + code(branch)
+ out = ['', '**Contracts by OS release**', '', f'What FolderView3 relies on in the webgui, checked on {span}.', '']
+ for entry, found in view['contracts']:
+ held = [ref for ref, ok in found.items() if ok is not None]
+ failed = [ref for ref, ok in found.items() if ok is False]
+ state = 'fails on ' + ', '.join(code(r) for r in failed) if failed else f'holds on all {len(held)}'
+ since = f' (from {code(entry["since"])})' if 'since' in entry else ''
+ out.append(f'- {code(entry["path"].rsplit("/", 1)[-1])} {entry["why"]}: {state}{since}')
+ return out
+
+
+def _styles(view):
+ themes, changed, gone = list(view['styles']), {}, {}
+ for theme, rows in view['styles'].items():
+ for context, selector, name, values in rows:
+ # Not set on the development branch any more: often a rule that moved to a stylesheet this does not read
+ (gone if values[-1][1] is None else changed).setdefault((context, selector, name, tuple(values)), []).append(theme)
+
+ def row(key, who):
+ context, selector, name, values = key
+ where = '' if len(who) == len(themes) else f' ({", ".join(who)})'
+ return f'- {code((context + " " if context else "") + selector, 200)} {code(name)}: {_runs(values)}{where}'
+ out = ['', '**Unraid CSS by OS release**', '',
+ 'Layout properties Unraid sets on elements FolderView3 styles, that differ between releases, and that FolderView3 '
+ 'does not set itself.', '']
+ out += capped([row(k, w) for k, w in changed.items()], 60) or ['- none']
+ if gone:
+ out += ['', f'No longer set in the stylesheets read here ({len(gone)}; may have moved elsewhere)', '']
+ out += capped([row(k, w) for k, w in gone.items()], 60) + ['', '']
+ return out
+
+
def render_status(view):
newest, stable, latest = view['releases']
facts = [f'Newest OS release {code(newest[0])} (API {code(newest[1] or "not stated")})'] if newest else []
@@ -117,6 +163,7 @@ def render_status(view):
+ ': ' + '; '.join(members))
if view['unstated']:
out.append('- API version not stated in the notes: ' + ', '.join(code(v) for v in view['unstated']))
+ out += _contracts(view) + _styles(view)
out += ['', f'API not used yet ({len(view["idle"])} operations)', '']
out += [f'- {code(signature, 300)}' for signature in view['idle']]
if view['types']:
diff --git a/.github/unraid-watch/scan.py b/.github/unraid-watch/scan.py
index 15ac1f9b..b00a8247 100644
--- a/.github/unraid-watch/scan.py
+++ b/.github/unraid-watch/scan.py
@@ -65,6 +65,21 @@ def operations(plugin, rules):
return ops, problems
+def stylesheets(plugin):
+ return _files(plugin, ('styles/*.css',))
+
+
+def code(plugin):
+ """The scripts and server code, which name the plugin's own CSS variables (the CSS tool, the generated theme CSS)."""
+ return _files(plugin, ('scripts/*.js', 'server/*.php'))
+
+
+def minimum(manifest):
+ """The oldest Unraid release the plugin declares it runs on: the PLUGIN tag's min attribute; None when it has none."""
+ found = re.search(r']*\bmin="(\d+\.\d+\.\d+)"', manifest.read_text(encoding='utf-8')) if manifest.is_file() else None
+ return found and found.group(1)
+
+
def endpoints(plugin, prefixes):
"""{upstream path: file:line} for every webgui PHP file the plugin references by URL or include."""
found = {}
diff --git a/.github/unraid-watch/status.py b/.github/unraid-watch/status.py
index d6414760..0482ff43 100644
--- a/.github/unraid-watch/status.py
+++ b/.github/unraid-watch/status.py
@@ -20,8 +20,8 @@ def stage(gh, cfg, ops, watched, spans):
return out
-def gather(gh, cfg, ops, watched, heads):
- """Everything the status comment shows, as plain data."""
+def gather(gh, cfg, ops, watched, heads, local):
+ """Everything the status comment shows, as plain data; local is watch.local(): the plugin's floor and styled elements."""
api, docs = upstream.source(cfg, 'schema'), upstream.source(cfg, 'releases')
core, tagged = api['repo'], docs['tags']
branch = next(s['branch'] for s in cfg['sources'] if s['repo'] == tagged)
@@ -59,5 +59,10 @@ def bundled(release):
current = schema.load(gh.file(core, heads[core], api['schema']))
idle, types = schema.coverage(current, api['surface'], schema.check(current, ops)[2], api['namespaces'])
+ held = upstream.source(cfg, 'contracts')
+ refs = upstream.release_refs(gh, held, local['floor'])
return {'releases': (newest, stable, latest), 'stages': stages, 'matrix': matrix, 'unstated': unstated,
- 'idle': idle, 'types': types, 'legacy': sorted(watched[tagged].items())}
+ 'idle': idle, 'types': types, 'refs': refs, 'contracts': upstream.contracts(gh, held, refs),
+ 'styles': upstream.stylesheets(gh, held, refs, local['styled']),
+ # Stylesheets are not pages to move off: they are what the plugin's own CSS sits on
+ 'legacy': [(path, why) for path, why in sorted(watched[tagged].items()) if not path.endswith('.css')]}
diff --git a/.github/unraid-watch/test_commands.py b/.github/unraid-watch/test_commands.py
index afc99793..20ff35a6 100644
--- a/.github/unraid-watch/test_commands.py
+++ b/.github/unraid-watch/test_commands.py
@@ -5,7 +5,7 @@
import watch
from github import GitHubError
-from world import API, CFG, DOCS, ME, NEW, RELEASE, SCRIPT, SDL, USERPREFS, WEB, WITHOUT_STOP, Case, World, sha, url
+from world import API, CFG, DOCS, EVENTS, ME, NEW, RELEASE, SCRIPT, SDL, STYLES, USERPREFS, WEB, WITHOUT_STOP, Case, World, sha, url
class ContractTest(Case):
@@ -77,10 +77,43 @@ def test_scan_problem_fails_the_contract(self):
self.assertEqual(code, 1)
self.assertIn('::error::a.js:6:', out)
+ def test_contracts_are_checked_on_master_and_listed(self):
+ code, out = self.contract()
+ self.assertEqual(code, 0)
+ self.assertIn(f'- contract {EVENTS}: holds on 1 of 1 refs', out)
+
+ def test_a_contract_a_supported_release_breaks_fails_and_names_the_release(self):
+ self.w.release_line()
+ self.w.tree(WEB, '9.0.3', {EVENTS: 'ev0'})
+ self.w.blob(WEB, 'ev0', "$arrResponse = ['ok' => $DockerClient->startContainer($container)];\n")
+ code, out = self.contract()
+ self.assertEqual(code, 1)
+ self.assertIn(f"::error::unraid/webgui: {EVENTS} does not match \"'success' => \" on 9.0.3: answers in `success`", out)
+ self.assertIn(f'- contract {EVENTS}: holds on 1 of 2 refs', out)
+
+ def test_a_release_before_a_contracts_since_is_not_held_to_it(self):
+ self.w.release_line()
+ self.w.tree(WEB, '9.0.3', {})
+ cfg = {**CFG, 'sources': [{**s, 'contracts': [{**s['contracts'][0], 'since': '9.1.0'}]} if 'contracts' in s else s
+ for s in CFG['sources']]}
+ code, out = self.captured(watch.cmd_contract, cfg, self.w.client(), self.w.root, None)
+ self.assertEqual(code, 0)
+ self.assertIn(f'- contract {EVENTS}: holds on 1 of 1 refs', out)
+
+ def test_only_stable_releases_from_the_plugins_minimum_are_read(self):
+ self.w.release_line()
+ self.contract()
+ read = {c[1].split('/git/trees/')[1].split('?')[0] for c in self.w.fake.calls if f'/repos/{WEB}/git/trees/' in c[1]}
+ self.assertEqual(read, {'9.0.3', 'master'})
+
+ def test_a_manifest_without_a_minimum_stops_the_contract(self):
+ with self.assertRaisesRegex(watch.Problem, 'no min="x.y.z"'):
+ self.contract(world=World(self, manifest='\n'))
+
class CheckTest(Case):
- def check(self, script):
- world = World(self, script)
+ def check(self, script, **world):
+ world = World(self, script, **world)
code, out = self.captured(watch.cmd_check, CFG, world.root)
self.assertEqual(world.fake.calls, [])
return code, out
@@ -107,6 +140,16 @@ def test_plugin_that_references_no_endpoint_fails(self):
self.assertEqual(code, 1)
self.assertIn('::error::unraid/webgui: the plugin references none of its endpoints', out)
+ def test_an_unraid_css_variable_without_a_fallback_fails(self):
+ code, out = self.check(SCRIPT, styles=STYLES + '.tip { margin: var(--gap); }\n')
+ self.assertEqual(code, 1)
+ self.assertIn('::error::a.css:3: var(--gap) has no fallback and only Unraid defines --gap', out)
+
+ def test_a_manifest_without_a_minimum_fails(self):
+ code, out = self.check(SCRIPT, manifest='\n')
+ self.assertEqual(code, 1)
+ self.assertIn('::error::plugin.plg: no min="x.y.z" on its PLUGIN tag', out)
+
class MainTest(Case):
def main(self, *argv):
diff --git a/.github/unraid-watch/test_css.py b/.github/unraid-watch/test_css.py
new file mode 100644
index 00000000..7e1109cf
--- /dev/null
+++ b/.github/unraid-watch/test_css.py
@@ -0,0 +1,71 @@
+import tempfile
+import unittest
+from pathlib import Path
+
+import css
+
+
+class RulesTest(unittest.TestCase):
+ def test_each_selector_gets_the_declarations_and_its_at_rule(self):
+ text = '/* a\ncomment */ @media (max-width: 9px) { .a, #b > .c { white-space: pre-line; margin-top:4px!important } }\n.d{display:none}'
+ self.assertEqual(css.rules(text), [
+ ('@media (max-width: 9px)', '.a', {'white-space': 'pre-line', 'margin-top': '4px !important'}),
+ ('@media (max-width: 9px)', '#b > .c', {'white-space': 'pre-line', 'margin-top': '4px !important'}),
+ ('', '.d', {'display': 'none'})])
+
+ def test_a_semicolon_inside_a_url_does_not_end_the_declaration(self):
+ self.assertEqual(css.rules('.a { background: url(data:image/png;base64,xy); top: 0 }'),
+ [('', '.a', {'background': 'url(data:image/png;base64,xy)', 'top': '0'})])
+
+ def test_the_styled_element_is_the_last_compound_without_what_not_names(self):
+ self.assertEqual(css.subject('#docker_containers > tr.sortable:not(.folder)'), ['.sortable'])
+ self.assertEqual(css.subject('div.title:first-of-type'), ['.title'])
+ self.assertEqual(css.subject('label + .content'), ['.content'])
+
+
+class ChangesTest(unittest.TestCase):
+ OURS = {'.tip': {'color'}, '.row': {'white-space'}}
+
+ def by_ref(self, old, new):
+ return {'7.0.0': css.merged([old]), 'master': css.merged([new])}
+
+ def test_a_layout_property_unraid_changed_on_an_element_the_plugin_styles_is_listed(self):
+ rows = css.changes(self.by_ref('.tip { display: block }', '.tip { white-space: pre-line }'), ['7.0.0', 'master'], self.OURS)
+ self.assertEqual(rows, [('', '.tip', 'display', [('7.0.0', 'block'), ('master', None)]),
+ ('', '.tip', 'white-space', [('7.0.0', None), ('master', 'pre-line')])])
+
+ def test_what_the_plugin_sets_itself_colours_and_elements_it_does_not_style_are_left_out(self):
+ # .row's colour: an element the plugin styles, a property it does not set, but a colour, not layout
+ old = '.row { white-space: nowrap; color: red } .tip { color: red } .other { display: block }'
+ new = '.row { white-space: normal; color: blue } .tip { color: blue } .other { display: flex }'
+ self.assertEqual(css.changes(self.by_ref(old, new), ['7.0.0', 'master'], self.OURS), [])
+
+ def test_a_later_stylesheet_wins_as_the_page_loads_them(self):
+ self.assertEqual(css.merged(['.tip { top: 1px }', '.tip { top: 2px }']), {('', '.tip', 'top'): '2px'})
+
+
+class FallbacksTest(unittest.TestCase):
+ def check(self, sheet, code=''):
+ tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(tmp.cleanup)
+ a, js = Path(tmp.name, 'a.css'), Path(tmp.name, 'a.js')
+ a.write_text(sheet, encoding='utf-8')
+ js.write_text(code, encoding='utf-8')
+ return css.fallbacks([a], [js])
+
+ def test_an_unraid_variable_without_a_fallback_is_named_with_its_line(self):
+ (problem,) = self.check('/* two\nlines */\n.a { color: var(--text); }\n')
+ self.assertTrue(problem.startswith('a.css:3: var(--text) has no fallback and only Unraid defines --text'), problem)
+
+ def test_a_fallback_or_a_variable_the_plugin_owns_passes(self):
+ self.assertEqual(self.check('.a { color: var(--text, #fff); }'), [])
+ self.assertEqual(self.check(':root { --gap: 5px; } .a { gap: var(--gap); }'), [])
+ self.assertEqual(self.check('.a { color: var(--fv3-name-color); }', "const vars = { 'fv3-name-color': '#fff' };"), [])
+
+ def test_a_variable_nested_in_a_fallback_needs_its_own(self):
+ (problem,) = self.check('.a { color: var(--fv3-x, var(--text)); }', "'fv3-x'")
+ self.assertIn('var(--text) has no fallback', problem)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/.github/unraid-watch/test_github.py b/.github/unraid-watch/test_github.py
index dbe3043c..bdcf981c 100644
--- a/.github/unraid-watch/test_github.py
+++ b/.github/unraid-watch/test_github.py
@@ -15,6 +15,16 @@ def compare(self, page, status, total, numbers):
self.fake.routes['GET', url(f'/repos/o/r/compare/{sha(1)}...{sha(2)}', page=page, per_page=100)] = {
'status': status, 'total_commits': total, 'commits': [commit(n) for n in numbers]}
+ def test_tags_follow_every_page(self):
+ self.fake.routes['GET', url('/repos/o/r/tags', page=1, per_page=100)] = [{'name': f't{n}'} for n in range(100)]
+ self.fake.routes['GET', url('/repos/o/r/tags', page=2, per_page=100)] = [{'name': 't100'}]
+ self.assertEqual(self.gh.tags('o/r'), [f't{n}' for n in range(101)])
+
+ def test_a_blob_is_read_once_however_many_releases_share_it(self):
+ self.fake.routes['GET', '/repos/o/r/git/blobs/abc'] = '.tip { top: 0 }'
+ self.assertEqual([self.gh.blob('o/r', 'abc') for _ in range(3)], ['.tip { top: 0 }'] * 3)
+ self.assertEqual(len(self.fake.sent('GET')), 1)
+
def test_between_follows_every_page(self):
self.compare(1, 'ahead', 105, range(100, 200))
self.compare(2, 'ahead', 105, range(200, 205))
diff --git a/.github/unraid-watch/test_releases.py b/.github/unraid-watch/test_releases.py
index d24901b5..2e512aa2 100644
--- a/.github/unraid-watch/test_releases.py
+++ b/.github/unraid-watch/test_releases.py
@@ -10,6 +10,9 @@ def test_versions_sort_beta_before_rc_before_final(self):
['9.0.9', '9.0.10', '9.1.0-beta.2', '9.1.0-beta.2.1', '9.1.0-beta.10', '9.1.0-rc.1', '9.1.0',
'10.0.0-beta.1'])
+ def test_an_os_release_tag_is_a_stable_version_not_a_date(self):
+ self.assertEqual([t for t in ('7.4.0', '7.4.0-rc.1', '2014.11.10', 'v7.4.0', '7.4') if releases.os_tag(t)], ['7.4.0'])
+
def test_stable_means_no_prerelease_suffix(self):
self.assertTrue(releases.stable('9.1.0'))
self.assertFalse(releases.stable('9.1.0-rc.1'))
diff --git a/.github/unraid-watch/test_report.py b/.github/unraid-watch/test_report.py
index 4b01e673..cd8a4363 100644
--- a/.github/unraid-watch/test_report.py
+++ b/.github/unraid-watch/test_report.py
@@ -181,5 +181,11 @@ def test_unexpected_comment_link_is_refused(self):
report.announce(data, link)
+class RunsTest(unittest.TestCase):
+ def test_releases_with_the_same_value_read_as_one_span(self):
+ values = [('7.0.0', None), ('7.1.0', None), ('7.2.0', '4px'), ('7.3.0', None), ('master', None)]
+ self.assertEqual(report._runs(values), 'not set in `7.0.0`–`7.1.0`, `4px` in `7.2.0`, not set in `7.3.0`–`master`')
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/.github/unraid-watch/test_status.py b/.github/unraid-watch/test_status.py
index 8c97d6e3..8c197449 100644
--- a/.github/unraid-watch/test_status.py
+++ b/.github/unraid-watch/test_status.py
@@ -42,7 +42,7 @@ def view(self):
self.w.release_line()
return status.gather(self.w.client(), CFG, OPS, {API: {'api/switch.ts': 'page switch'},
WEB: {'emhttp/page/': 'markup', USERPREFS: 'called from a.js:5'},
- DOCS: {}}, NEW)
+ DOCS: {}}, NEW, self.local())
def test_stages_cover_merged_released_and_the_prerelease(self):
titles = [title for title, _ in self.view()['stages']]
@@ -81,9 +81,28 @@ def test_status_reads_as_expected(self):
'- 3 of 3: `main` (not released); `v4.2.0` (latest API release); `v4.1.0` (Unraid 9.1.0-beta.2)',
'- 2 of 3, missing `DockerMutations.stop`: `v4.0.0` (Unraid 9.0.3)',
'- API version not stated in the notes: `9.0.2`, `9.0.1`',
+ '',
+ '**Contracts by OS release**',
+ '',
+ 'What FolderView3 relies on in the webgui, checked on `9.0.3` and `master`.',
+ '',
+ '- `Events.php` answers in `success`: holds on all 2',
+ '',
+ '**Unraid CSS by OS release**',
+ '',
+ 'Layout properties Unraid sets on elements FolderView3 styles, that differ between releases, and that FolderView3 '
+ 'does not set itself.',
+ '',
+ '- `.tip` `white-space`: not set in `9.0.3`, `pre-line` in `master`',
]))
self.assertEqual(body.split('\n\n', 1)[1], '\n'.join([
- 'API not used yet (1 operations)',
+ 'No longer set in the stylesheets read here (1; may have moved elsewhere)',
+ '',
+ '- `.tip` `display`: `block` in `9.0.3`, not set in `master` (azure)',
+ '',
+ '',
+ '',
+ 'API not used yet (1 operations)',
'',
'- `DockerMutations.restart(id: ID!): Boolean!`',
'',
@@ -108,7 +127,7 @@ def test_each_schema_is_fetched_once_however_many_stages_use_it(self):
url(f'/repos/{API}/contents/api/schema.graphql', ref=ref) for ref in (RELEASE, BETA_API, LATEST_API, NEW[API])))
def test_with_no_release_notes_the_stages_that_need_them_say_so(self):
- body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW))
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn('Latest API release `v4.0.0`.', body)
self.assertIn('**Coming: merged, in no release**\n\n- unraid/api `v4.0.0`...`main`: nothing\n'
'- unraid/webgui `not stated`...`master`: not available\n', body)
@@ -121,7 +140,7 @@ def test_with_no_release_notes_the_stages_that_need_them_say_so(self):
def test_release_whose_notes_do_not_state_the_api_says_so(self):
self.w.release_line()
self.w.notes(NEW[DOCS], {'9.1.0.md': '# Version 9.1.0-beta.2 2030-01-02\n\nNothing about the API.\n'})
- body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW))
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn('Newest OS release `9.1.0-beta.2` (API `not stated`), latest API release `v4.2.0`.', body)
self.assertIn('**Coming: released API, not in an OS build**\n\n- unraid/api `not stated`...`v4.2.0`: not available\n', body)
self.assertIn('- API version not stated in the notes: `9.1.0-beta.2`', body)
@@ -129,11 +148,16 @@ def test_release_whose_notes_do_not_state_the_api_says_so(self):
def test_release_documented_before_its_tag_exists_is_shown_as_not_available(self):
self.w.release_line()
del self.w.fake.routes['GET', f'/repos/{WEB}/commits/9.1.0-beta.2']
- body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW))
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn('- unraid/webgui `9.1.0-beta.2`...`master`: not available\n', body)
self.assertIn('- unraid/webgui `9.0.3`...`9.1.0-beta.2`: not available\n', body)
self.assertIn('- unraid/api `v4.0.0`...`v4.1.0`:\n - removed', body)
+ def test_watched_stylesheets_are_not_listed_as_legacy_pages(self):
+ view = status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {'css/azure.css': 'theme', USERPREFS: 'prefs'}, DOCS: {}},
+ NEW, self.local())
+ self.assertEqual(view['legacy'], [(USERPREFS, 'prefs')])
+
def test_file_that_differs_with_no_commit_to_show_just_says_differs(self):
view = self.view()
view['stages'] = [('Coming: merged, in no release', [(API, 'v4.2.0', 'main', [], [('api/switch.ts', 'w', [])])])]
@@ -143,7 +167,7 @@ def test_when_the_newest_release_is_stable_there_is_no_prerelease_stage(self):
self.w.release_line()
self.w.notes(NEW[DOCS], {'9.0.3.md': '# Version 9.0.3 2030-01-01\n\n* The Unraid API version remains 4.0.0.\n'})
self.w.tree(WEB, STABLE_WEB, {'emhttp/page': 't1', USERPREFS: 'u0'})
- body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW))
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn('Newest OS release `9.0.3` (API `4.0.0`), latest API release `v4.2.0`.', body)
self.assertNotIn('Coming with', body)
self.assertIn('- unraid/webgui `9.0.3`...`master`: nothing', body)
@@ -152,7 +176,7 @@ def test_when_the_newest_release_is_stable_there_is_no_prerelease_stage(self):
def test_latest_release_that_an_os_build_already_ships_is_one_row(self):
self.w.release_line()
self.w.fake.routes['GET', f'/repos/{API}/releases/latest'] = {'tag_name': 'v4.1.0'}
- body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW))
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn('`v4.1.0` (latest API release, Unraid 9.1.0-beta.2)', body)
self.assertIn('- unraid/api `v4.1.0`...`v4.1.0`: nothing', body)
@@ -161,7 +185,7 @@ def test_upstream_text_in_the_status_stays_inert(self):
self.w.between(API, [50, 51], span=(LATEST_API, NEW[API]))
self.w.fake.routes['GET', url(f'/repos/{API}/commits', page=1, path='api/switch.ts', per_page=100, sha=NEW[API])] = [
commit(51, 'x `y` @someone '), commit(50, 'older')]
- body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {'api/switch.ts': 'w'}, WEB: {}, DOCS: {}}, NEW))
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {'api/switch.ts': 'w'}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn("`api/switch.ts`: 2 commits, newest `2026-10-01 x 'y' @someone `", body)
self.assertTrue(body.endswith('\n\n' + report.STATUS))
diff --git a/.github/unraid-watch/upstream.py b/.github/unraid-watch/upstream.py
index f482815f..4deaa655 100644
--- a/.github/unraid-watch/upstream.py
+++ b/.github/unraid-watch/upstream.py
@@ -1,6 +1,7 @@
"""What upstream looks like, read through the GitHub client: schema changes, release notes, file differences."""
import re
+import css
import releases
import schema
@@ -67,6 +68,46 @@ def validity(gh, src, ops, refs):
return out
+def release_refs(gh, src, floor):
+ """Stable release tags at or after floor (the plugin's declared minimum), oldest first, then the development branch."""
+ tags = [t for t in gh.tags(src['repo']) if releases.os_tag(t)]
+ return sorted((t for t in tags if releases.order(t) >= releases.order(floor)), key=releases.order) + [src['branch']]
+
+
+def text_at(gh, repo, ref, path):
+ """A file's text at a ref; None when the file is not there."""
+ blob = gh.tree(repo, ref).get(path)
+ return None if blob is None else gh.blob(repo, blob)
+
+
+def applies(entry, ref):
+ """A contract with `since` holds only from that release on; the development branch is always held to it."""
+ return 'since' not in entry or not releases.VERSION.fullmatch(ref) or releases.order(ref) >= releases.order(entry['since'])
+
+
+def contracts(gh, src, refs):
+ """[(contract, {ref: True if it holds, False if not, None where it does not apply})]."""
+ out = []
+ for entry in src.get('contracts', []):
+ found = {ref: bool(re.search(entry['match'], text_at(gh, src['repo'], ref, entry['path']) or ''))
+ if applies(entry, ref) else None for ref in refs}
+ out.append((entry, found))
+ return out
+
+
+def stylesheets(gh, src, refs, ours):
+ """{theme: css.changes} for Unraid's stylesheets per release; a file a release does not have is skipped."""
+ styles = src['styles']
+ out = {}
+ for theme in styles['themes']:
+ by_ref = {}
+ for ref in refs:
+ texts = (text_at(gh, src['repo'], ref, pattern.format(theme=theme)) for pattern in styles['files'])
+ by_ref[ref] = css.merged(t for t in texts if t is not None)
+ out[theme] = css.changes(by_ref, refs, ours)
+ return out
+
+
def differences(gh, repo, paths, start, head):
"""[(path, why, commits)] for watched paths that differ between two commits; commits is None when start is no ancestor."""
a, b = gh.tree(repo, start), gh.tree(repo, head)
diff --git a/.github/unraid-watch/watch.json b/.github/unraid-watch/watch.json
index 6c15eb26..0f863386 100644
--- a/.github/unraid-watch/watch.json
+++ b/.github/unraid-watch/watch.json
@@ -1,6 +1,7 @@
{
"issue": 52,
"plugin": "src/folder.view3/usr/local/emhttp/plugins/folder.view3",
+ "manifest": "folder.view3.plg",
"expand": [
{"match": "docker { ${gqlAction}", "map": "fv3DockerActionMap"},
{"match": "vm { ${gqlAction}", "map": "fv3VmActionMap"}
@@ -48,7 +49,36 @@
"emhttp/plugins/dynamix/include/DefaultPageLayout/BodyInlineJS.php": "task tray openDocker runs through from 7.4",
"emhttp/plugins/dynamix/include/TaskCommand.php": "task tray endpoint behind openDocker from 7.4",
"emhttp/plugins/dynamix/styles/default-dynamix.css": "tooltipster rules the advanced preview popup is drawn inside (7.4 added white-space: pre-line)",
- "emhttp/plugins/dynamix/styles/default-base.css": "sweet-alert, table and menu rules the plugin's dialogs and rows sit in"
+ "emhttp/plugins/dynamix/styles/default-base.css": "sweet-alert, table and menu rules the plugin's dialogs and rows sit in",
+ "emhttp/plugins/dynamix/styles/default-color-palette.css": "colour variables the plugin's own colours fall back from",
+ "emhttp/plugins/dynamix/styles/themes/azure.css": "azure theme rules under the folder rows and dialogs",
+ "emhttp/plugins/dynamix/styles/themes/black.css": "black theme rules under the folder rows and dialogs",
+ "emhttp/plugins/dynamix/styles/themes/gray.css": "gray theme rules under the folder rows and dialogs",
+ "emhttp/plugins/dynamix/styles/themes/white.css": "white theme rules under the folder rows and dialogs",
+ "emhttp/plugins/dynamix.docker.manager/sheets/DockerContainers.css": "Docker tab rows the folders sit among",
+ "emhttp/plugins/dynamix.vm.manager/sheets/VMMachines.css": "VMs tab rows the folders sit among",
+ "emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css": "VM list rules the VM folders inherit",
+ "emhttp/plugins/dynamix/sheets/DashStats.css": "Dashboard tiles the folder tiles are drawn in",
+ "emhttp/plugins/dynamix.docker.manager/include/Events.php": "answers a container action: true, or the reason Unraid refused it (shared.js fv3ActionAnswer)"
+ },
+ "contracts": [
+ {"path": "emhttp/plugins/dynamix.docker.manager/include/Events.php", "match": "'success' => \\$DockerClient->startContainer\\(",
+ "why": "answers a container start in `success`: true, or the reason it was refused (shared.js fv3ActionAnswer)"},
+ {"path": "emhttp/plugins/dynamix.vm.manager/include/VMajax.php", "match": "\\['error' => ",
+ "why": "answers a refused VM action in `error` (shared.js fv3ActionAnswer)"},
+ {"path": "emhttp/plugins/dynamix.docker.manager/include/UserPrefs.php", "match": "\\$save\\[\\] = \\$index\\[\\$i\\+\\+\\]\\.\"=\\\\\"\"\\.\\$name\\.\"\\\\\"\"",
+ "why": "saves the Docker order as N=\"name\" lines, the format the plugin reads and inserts into (lib.php fv3_parse_user_prefs)"}
+ ],
+ "styles": {
+ "themes": ["azure", "black", "gray", "white"],
+ "files": [
+ "emhttp/plugins/dynamix/styles/default-{theme}.css", "emhttp/plugins/dynamix/styles/dynamix-{theme}.css",
+ "emhttp/plugins/dynamix/styles/default-color-palette.css", "emhttp/plugins/dynamix/styles/default-base.css",
+ "emhttp/plugins/dynamix/styles/themes/{theme}.css", "emhttp/plugins/dynamix/styles/default-dynamix.css",
+ "emhttp/plugins/dynamix/styles/jquery.sweetalert.css", "emhttp/plugins/dynamix/styles/default-popup.css",
+ "emhttp/plugins/dynamix.docker.manager/sheets/DockerContainers.css", "emhttp/plugins/dynamix.vm.manager/styles/dynamix.vm.manager.css",
+ "emhttp/plugins/dynamix.vm.manager/sheets/VMMachines.css", "emhttp/plugins/dynamix/sheets/DashStats.css"
+ ]
}
},
{
diff --git a/.github/unraid-watch/watch.py b/.github/unraid-watch/watch.py
index 4598e11c..75e4c042 100644
--- a/.github/unraid-watch/watch.py
+++ b/.github/unraid-watch/watch.py
@@ -6,12 +6,13 @@
import sys
from pathlib import Path
+import css
import scan
import schema
import status
from github import GitHub, GitHubError
from report import announce, code, read_state, render, render_status, restamp, status_comment
-from upstream import api_changes, release_notes, source, validity
+from upstream import api_changes, contracts, release_notes, release_refs, source, validity
HERE = Path(__file__).resolve().parent
@@ -41,6 +42,15 @@ def derive(cfg, root):
return ops, watched, problems
+def local(cfg, root):
+ """What the checks per release need from the plugin: the oldest Unraid it supports, and what its stylesheets style."""
+ floor = scan.minimum(Path(root, cfg['manifest']))
+ if not floor:
+ raise Problem(f'{cfg["manifest"]}: no min="x.y.z" on its PLUGIN tag, so the oldest Unraid it supports is unknown')
+ sheets = scan.stylesheets(Path(root, cfg['plugin']))
+ return {'floor': floor, 'styled': css.styled(f.read_text(encoding='utf-8') for f in sheets)}
+
+
def readable(cfg, root):
"""(operations, watched paths), or a Problem when the plugin source cannot be read reliably."""
ops, watched, problems = derive(cfg, root)
@@ -71,6 +81,12 @@ def show(text):
def cmd_check(cfg, root):
ops, watched, problems = derive(cfg, root)
+ plugin = Path(root, cfg['plugin'])
+ problems += css.fallbacks(scan.stylesheets(plugin), scan.code(plugin))
+ try:
+ local(cfg, root)
+ except Problem as e:
+ problems.append(str(e))
for query, where in ops:
print(f'{where[0]:22s} {query}')
for repo, paths in watched.items():
@@ -97,6 +113,13 @@ def cmd_contract(cfg, gh, root, refs):
gone = [p for p in paths if not gh.exists(repo, head, p)]
errors += [f'{repo}: {p} no longer exists on {src["branch"]}; fix the call or watch.json' for p in gone]
lines.append(f'- {len(paths) - len(gone)} of {len(paths)} watched paths present in {repo}')
+ held = source(cfg, 'contracts')
+ for entry, found in contracts(gh, held, release_refs(gh, held, local(cfg, root)['floor'])):
+ failed = [ref for ref, ok in found.items() if ok is False]
+ if failed:
+ errors.append(f'{held["repo"]}: {entry["path"]} does not match {entry["match"]!r} on {", ".join(failed)}: {entry["why"]}')
+ lines.append(f'- contract {entry["path"]}: holds on {sum(ok is True for ok in found.values())} of '
+ f'{sum(ok is not None for ok in found.values())} refs')
for error in errors:
annotate('error', error)
print('\n'.join(lines))
@@ -107,7 +130,7 @@ def cmd_contract(cfg, gh, root, refs):
def cmd_status(cfg, gh, root):
ops, watched = readable(cfg, root)
heads = {src['repo']: gh.sha(src['repo'], src['branch']) for src in cfg['sources']}
- show(render_status(status.gather(gh, cfg, ops, watched, heads)))
+ show(render_status(status.gather(gh, cfg, ops, watched, heads, local(cfg, root))))
return 0
@@ -151,7 +174,7 @@ def cmd_watch(cfg, gh, root, me, base, dry_run):
for ref, bad, _ in validity(gh, api, ops, [api['branch'], gh.latest_release(api['repo'])])) + '.'
body = render(report, heads)
show(body)
- view = render_status(status.gather(gh, cfg, ops, watched, heads))
+ view = render_status(status.gather(gh, cfg, ops, watched, heads, local(cfg, root)))
show(view)
if dry_run:
return 0
diff --git a/.github/unraid-watch/world.py b/.github/unraid-watch/world.py
index 535c113c..11c94c77 100644
--- a/.github/unraid-watch/world.py
+++ b/.github/unraid-watch/world.py
@@ -19,6 +19,9 @@
BOT = {'login': 'github-actions[bot]'}
API, WEB, DOCS = 'unraid/api', 'unraid/webgui', 'unraid/docs'
USERPREFS = 'emhttp/plugins/dynamix.docker.manager/include/UserPrefs.php'
+EVENTS = 'emhttp/plugins/dynamix.docker.manager/include/Events.php'
+# The plugin colours .tip and sets .row's white-space itself
+STYLES = '.tip { color: var(--c, red); }\n.row { white-space: nowrap; }\n'
SDL = '''
type Query { docker: Docker! }
type Mutation { docker: DockerMutations! }
@@ -36,12 +39,15 @@
CFG = {
'issue': 52,
'plugin': 'plugin',
+ 'manifest': 'plugin.plg',
'expand': [{'match': 'docker { ${act}', 'map': 'dockerMap'}],
'sources': [
{'repo': API, 'branch': 'main', 'schema': 'api/schema.graphql', 'surface': '(?i)docker',
'namespaces': ['Docker', 'DockerMutations'], 'paths': {'api/switch.ts': 'page switch'}},
{'repo': WEB, 'branch': 'master', 'paths': {'emhttp/page/': 'markup'},
- 'endpoints': {'/plugins/dynamix.docker.manager/': 'emhttp/plugins/dynamix.docker.manager/'}},
+ 'endpoints': {'/plugins/dynamix.docker.manager/': 'emhttp/plugins/dynamix.docker.manager/'},
+ 'contracts': [{'path': EVENTS, 'match': "'success' => ", 'why': 'answers in `success`'}],
+ 'styles': {'themes': ['azure', 'black'], 'files': ['css/old-{theme}.css', 'css/{theme}.css']}},
{'repo': DOCS, 'branch': 'main', 'releases': 'notes/', 'since': '9.0.0', 'tags': WEB},
],
}
@@ -94,13 +100,16 @@ def sent(self, method):
class World:
"""A plugin, its issue, and three upstream repos that moved from OLD to NEW without touching anything watched."""
- def __init__(self, case, script=SCRIPT):
+ def __init__(self, case, script=SCRIPT, styles=STYLES, manifest='\n'):
tmp = tempfile.TemporaryDirectory()
case.addCleanup(tmp.cleanup)
self.root = tmp.name
scripts = Path(tmp.name, 'plugin/scripts')
scripts.mkdir(parents=True)
(scripts / 'a.js').write_text(script, encoding='utf-8')
+ Path(tmp.name, 'plugin/styles').mkdir()
+ Path(tmp.name, 'plugin/styles/a.css').write_text(styles, encoding='utf-8')
+ Path(tmp.name, 'plugin.plg').write_text(manifest, encoding='utf-8')
self.fake, self.comments = Fake(), []
routes = self.fake.routes
routes['GET', url(f'/repos/{ME}/issues/52/comments', page=1, per_page=100)] = self.comments
@@ -120,6 +129,17 @@ def __init__(self, case, script=SCRIPT):
self.tree(API, ref, {'api/schema.graphql': 's1', 'api/switch.ts': 'w1'})
self.notes(OLD[DOCS], {})
self.notes(NEW[DOCS], {})
+ # The webgui with no release tag yet: contracts and stylesheets are read on master alone
+ self.tags(WEB, [])
+ self.tree(WEB, 'master', {EVENTS: 'ev1', 'css/azure.css': 'st1', 'css/black.css': 'st1'})
+ self.blob(WEB, 'ev1', "$arrResponse = ['success' => $DockerClient->startContainer($container)];\n")
+ self.blob(WEB, 'st1', '.tip { white-space: pre-line; color: red; }\n.row { white-space: normal; }\n')
+
+ def tags(self, repo, names):
+ self.fake.routes['GET', url(f'/repos/{repo}/tags', page=1, per_page=100)] = [{'name': n} for n in names]
+
+ def blob(self, repo, sha, text):
+ self.fake.routes['GET', f'/repos/{repo}/git/blobs/{sha}'] = text
def between(self, repo, numbers, status='ahead', span=None):
start, head = span or (OLD[repo], NEW[repo])
@@ -162,6 +182,11 @@ def release_line(self):
self.tree(WEB, NEW[WEB], {'emhttp/page': 't1', USERPREFS: 'u0'})
self.between(API, [50], span=(LATEST_API, NEW[API]))
self.between(WEB, [60, 61], status='diverged', span=(STABLE_WEB, BETA_WEB))
+ # Only 9.0.3 is a stable OS release at or after the plugin's floor (9.0.0); 9.0.3's azure theme sets .tip's display,
+ # master's does not but sets its white-space
+ self.tags(WEB, ['9.1.0-beta.2', '9.0.3', '8.9.0', '2014.11.10'])
+ self.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1'})
+ self.blob(WEB, 'old1', '.tip { display: block; color: blue; }\n')
self.fake.routes['GET', url(f'/repos/{API}/commits', page=1, path='api/switch.ts', per_page=100,
sha=NEW[API])] = [commit(50, 'feat: enable the new page', '2030-01-03T00:00:00Z')]
@@ -228,6 +253,9 @@ def setUp(self):
def saved(self, body):
return report.read_state([bot(body)])[0]
+ def local(self):
+ return watch.local(CFG, self.w.root)
+
def outputs(self):
"""Point the job outputs at a file and return its path."""
path = Path(self.w.root, 'out')
From 11686276d52195cc065b24c14d1e47c7796da4b5 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 11:01:31 +0800
Subject: [PATCH 08/72] fix: the Unraid watch reads nested CSS, fails closed on
empty input, reads master at its pinned sha, and a failed release read no
longer stops the news
---
.github/unraid-watch/README.md | 7 +-
.github/unraid-watch/css.py | 140 +++++++++++++++++++-------
.github/unraid-watch/report.py | 24 +++--
.github/unraid-watch/scan.py | 2 +-
.github/unraid-watch/status.py | 13 ++-
.github/unraid-watch/test_commands.py | 40 +++++++-
.github/unraid-watch/test_css.py | 48 +++++++--
.github/unraid-watch/test_releases.py | 2 +-
.github/unraid-watch/test_report.py | 4 +-
.github/unraid-watch/test_status.py | 60 +++++++----
.github/unraid-watch/upstream.py | 35 ++++---
.github/unraid-watch/watch.py | 27 ++++-
.github/unraid-watch/world.py | 11 +-
.github/workflows/unraid-watch.yml | 2 +
14 files changed, 310 insertions(+), 105 deletions(-)
diff --git a/.github/unraid-watch/README.md b/.github/unraid-watch/README.md
index a67b4521..5b2eab3f 100644
--- a/.github/unraid-watch/README.md
+++ b/.github/unraid-watch/README.md
@@ -13,7 +13,7 @@ plugin stands. Both go to issue #52.
- **contract** (pull requests that touch `src/`, this directory or the workflow file, every push to `main` or
`beta`, and daily for both). Validates every operation against the `unraid/api` schema on `main` and at the
latest release, confirms every watched path still exists upstream, and checks every contract on each stable
- OS release from the plugin's declared minimum and on the development branch. Red means the plugin sends
+ webgui release tag from the plugin's declared minimum and on the development branch. Red means the plugin sends
something that is no longer valid, a file it depends on is gone, or a release it supports breaks a contract. The daily run checks each branch with that branch's
copy of the tool; a manual run checks the branch it is started on.
- **watch** (daily, on every push to `beta`, and by hand). It always reads the plugin on `beta`, whichever branch
@@ -42,7 +42,8 @@ Once it is on `main` the daily run starts by itself, and still reads `beta`.
- **Coming with X.Y**: what the newest OS pre-release has that the newest stable does not.
- **Operations by OS release**: how many of the plugin's operations are valid on the API each OS release
bundles, and which fields are missing.
-- **Contracts by OS release**: whether each contract holds on every supported release and the development branch.
+- **Contracts by OS release**: whether each contract holds on every webgui release tag from the plugin's minimum
+ and on the development branch. An OS release the webgui has no tag for (some patch releases) is not read.
- **Unraid CSS by OS release**: per theme, the layout properties Unraid's stylesheets set on an element the
plugin's own CSS styles, that differ between releases, and that the plugin does not set itself: what can
look different on an older or newer Unraid. A rule no longer set on the development branch is listed apart,
@@ -72,7 +73,7 @@ with `' + name + '` when `watch.json` has an `expand` rule naming the JS map tha
- `releases`: directory holding the OS release notes. `since` is the oldest OS release to list, and `tags` is
the repository whose tags carry those OS versions.
- `manifest`: the plugin's `.plg`. Its `min` attribute is the oldest OS release the contracts and stylesheets
- are checked on; the webgui's stable tags from there up are the releases.
+ are checked on; the webgui's stable tags from there up are the releases, and finding none is an error.
- `contracts`: what the plugin relies on in a webgui file, as a `path`, a regular expression it must `match`,
and `why`. Optional `since`: the oldest release held to it. Add one with each change that relies on Unraid.
- `styles`: the `themes`, and the stylesheet `files` that make up each one in load order (`{theme}` is
diff --git a/.github/unraid-watch/css.py b/.github/unraid-watch/css.py
index c7ca166a..4f4c689f 100644
--- a/.github/unraid-watch/css.py
+++ b/.github/unraid-watch/css.py
@@ -3,10 +3,10 @@
TOKEN = re.compile(r'[#.][A-Za-z_][\w-]*')
COMMENT = re.compile(r'/\*.*?\*/', re.S)
-# A semicolon inside url(...) or a data URI does not end a declaration
-DECLARATION = re.compile(r';(?![^(]*\))')
VAR = re.compile(r'var\(\s*(--[\w-]+)\s*([,)])')
DEFINED = re.compile(r'(?:^|[;{\s])(--[\w-]+)\s*:')
+# At-rules whose block holds rules for elements; @keyframes, @font-face and @page hold none
+GROUPS = ('@media', '@supports', '@container', '@layer', '@scope')
# What moves or wraps an element. Colours and fonts change with each theme by design, so they are left out
LAYOUT = frozenset({
'display', 'position', 'white-space', 'overflow', 'overflow-x', 'overflow-y', 'float', 'clear', 'box-sizing', 'flex', 'flex-direction',
@@ -22,33 +22,100 @@ def uncommented(text):
return COMMENT.sub(lambda m: '\n' * m.group(0).count('\n'), text)
-def rules(text):
- """[(at-rule conditions, selector, {property: value})], one entry per selector of a rule."""
- text = uncommented(text)
- out, heads, start = [], [], 0
+def _plain(text):
+ """[(index, char)] for characters outside quoted strings, so a "}" or ";" in a content value is just text."""
+ out, quote = [], None
for i, c in enumerate(text):
- if c == '{':
- heads.append(' '.join(text[start:i].split()))
- start = i + 1
- elif c == '}' and heads:
- head, body = heads.pop(), text[start:i]
- if not head.startswith('@') and '{' not in body:
- decls = {}
- for part in DECLARATION.split(body):
- name, colon, value = part.partition(':')
- if colon and name.strip():
- # `4px!important` and `4px !important` are the same value
- decls[name.strip().lower()] = ' '.join(re.sub(r'\s*!\s*important\b', ' !important', value).split())
- context = ' '.join(h for h in heads if h.startswith('@'))
- out += [(context, ' '.join(s.split()), decls) for s in head.split(',') if s.strip()]
+ if quote:
+ quote = None if c == quote and text[i - 1] != '\\' else quote
+ elif c in '"\'':
+ quote = c
+ else:
+ out.append((i, c))
+ return out
+
+
+def _split(text, at):
+ """text cut at each `at` character outside parentheses and strings (a url() or :not() list keeps its ; and ,)."""
+ parts, depth, start = [], 0, 0
+ for i, c in _plain(text):
+ depth += (c == '(') - (c == ')')
+ if c == at and depth <= 0:
+ parts.append(text[start:i])
start = i + 1
+ return parts + [text[start:]]
+
+
+def _selector(text):
+ """One spelling per selector: spacing around combinators and quotes around attribute values do not make a rule new."""
+ text = re.sub(r'\s*([>+~])\s*', r' \1 ', text)
+ text = re.sub(r'\[\s*([\w-]+)\s*([~|^$*]?=)\s*["\']?([^"\'\]]*?)["\']?\s*\]', r'[\1\2\3]', text)
+ return ' '.join(text.split())
+
+
+def _condition(text):
+ """One spelling per at-rule condition, `@media (max-width: 767px)`, however the stylesheet spaced it."""
+ text = re.sub(r'\s*([():,])\s*', r'\1', text)
+ text = re.sub(r'(?<=[\w)])\(', ' (', text).replace(':', ': ').replace(',', ', ')
+ return ' '.join(text.split())
+
+
+def _parts(body):
+ """(declarations, [(head, block)]) of a body: its own declarations, and the rules and at-rules nested in it."""
+ own, nested, depth, paren, start, item = [], [], 0, 0, 0, 0
+ for i, c in _plain(body):
+ paren += (c == '(') - (c == ')') if depth == 0 else 0
+ if c == '{':
+ if depth == 0:
+ own.append(body[start:item])
+ head, opened = ' '.join(body[item:i].split()), i + 1
+ depth += 1
+ elif c == '}' and depth:
+ depth -= 1
+ if depth == 0:
+ nested.append((head, body[opened:i]))
+ start = item = i + 1
+ elif c == ';' and depth == 0 and paren <= 0:
+ item = i + 1
+ return ''.join(own) + body[start:], nested
+
+
+def _declarations(text):
+ decls = {}
+ for part in _split(text, ';'):
+ name, colon, value = part.partition(':')
+ if colon and name.strip() and not name.strip().startswith('@'):
+ # `4px!important` and `4px !important` are the same value
+ decls[name.strip().lower()] = ' '.join(re.sub(r'\s*!\s*important\b', ' !important', value).split())
+ return decls
+
+
+def _walk(body, conditions, parents, out):
+ own, nested = _parts(body)
+ decls = _declarations(own) if parents else {}
+ out += [(conditions, parent, decls) for parent in parents if decls]
+ for head, block in nested:
+ if head.startswith('@'):
+ if head.split(None, 1)[0].lower() in GROUPS:
+ _walk(block, ' '.join(filter(None, (conditions, _condition(head)))), parents, out)
+ continue
+ selectors = [_selector(s) for s in _split(head, ',') if s.strip()]
+ # Nesting: & is the parent rule; a nested selector without one is a descendant of it
+ resolved = [s.replace('&', p) if '&' in s else f'{p} {s}' for p in parents for s in selectors] if parents else selectors
+ _walk(block, conditions, resolved, out)
+
+
+def rules(text):
+ """[(at-rule conditions, selector, {property: value})] in document order, nested rules resolved."""
+ out = []
+ _walk(uncommented(text), '', [], out)
return out
def subject(selector):
- """The ids and classes of the element a selector styles: its last compound, without what :not(...) and the like name."""
- last = re.split(r'[\s>+~]+', re.sub(r'\([^()]*\)', '', selector).strip())[-1]
- return TOKEN.findall(last)
+ """The ids and classes of the element a selector styles; none for a ::before box, nothing an attribute value or :not() names."""
+ last = re.split(r'[\s>+~]+', re.sub(r'\([^()]*\)|\[[^\]]*\]', '', selector).strip())[-1]
+ return [] if '::' in last else TOKEN.findall(last)
def styled(texts):
@@ -65,33 +132,36 @@ def merged(texts):
"""{(at-rule conditions, selector, property): value} for stylesheets in load order: a later one wins."""
out = {}
for text in texts:
- for context, selector, decls in rules(text):
+ for conditions, selector, decls in rules(text):
for name, value in decls.items():
- out[(context, selector, name)] = value
+ out[(conditions, selector, name)] = value
return out
def changes(by_ref, refs, ours):
- """[(at-rule conditions, selector, property, [(ref, value or None)])] for layout properties Unraid sets on an element
- FolderView3 styles, that differ between refs, and that FolderView3 does not set there itself."""
+ """[(conditions, selector, property, [(ref, value)])]: layout Unraid changed on elements FolderView3 styles but does not set."""
out = []
- for context, selector, name in sorted(set().union(*(by_ref[r] for r in refs))):
+ for conditions, selector, name in sorted(set().union(*(by_ref[r] for r in refs))):
tokens = [t for t in subject(selector) if t in ours]
if name not in LAYOUT or not tokens or any(name in ours[t] for t in tokens):
continue
- values = [(ref, by_ref[ref].get((context, selector, name))) for ref in refs]
+ values = [(ref, by_ref[ref].get((conditions, selector, name))) for ref in refs]
if len({v for _, v in values}) > 1:
- out.append((context, selector, name, values))
+ out.append((conditions, selector, name, values))
return out
def fallbacks(stylesheets, code):
- """Problems: var(--x) with no fallback where --x is Unraid's: no FolderView3 stylesheet declares it and its scripts and
- server code (the CSS tool's presets, the generated theme CSS) never name it."""
+ """Problems: var(--x) with no fallback where --x is Unraid's, not declared or keyed by FolderView3's own CSS or code."""
texts = {f: uncommented(f.read_text(encoding='utf-8')) for f in stylesheets}
ours = {name for text in texts.values() for name in DEFINED.findall(text)}
named = '\n'.join(f.read_text(encoding='utf-8') for f in code)
- return [f'{f.name}:{text.count(chr(10), 0, m.start()) + 1}: var({m.group(1)}) has no fallback and only Unraid defines '
- f'{m.group(1)}; an Unraid release without it would drop the style'
+
+ def keyed(name):
+ # The CSS tool's presets ('fv3-x': '#fff') and the generated theme CSS ('x' => '#fff') key the plugin's own variables
+ bare = re.escape(name[2:])
+ return re.search(r"['\"]--" + bare + r"['\"]|['\"]" + bare + r"['\"]\s*(?::|=>)", named)
+ return [f'{f.name}:{text.count(chr(10), 0, m.start()) + 1}: var({m.group(1)}) has no fallback and FolderView3 does not '
+ f'define {m.group(1)}, so the style needs every Unraid release to; give it a fallback'
for f, text in texts.items() for m in VAR.finditer(text)
- if m.group(2) == ')' and m.group(1) not in ours and not re.search(r"['\"](?:--)?" + re.escape(m.group(1)[2:]) + r"['\"]", named)]
+ if m.group(2) == ')' and m.group(1) not in ours and not keyed(m.group(1))]
diff --git a/.github/unraid-watch/report.py b/.github/unraid-watch/report.py
index ef3f375c..f6af135a 100644
--- a/.github/unraid-watch/report.py
+++ b/.github/unraid-watch/report.py
@@ -104,19 +104,24 @@ def _runs(values):
def _contracts(view):
+ if 'unread' in view:
+ return ['', f'**Contracts and Unraid CSS by OS release**: could not be read ({code(view["unread"], 300)}).']
*tags, branch = view['refs']
- span = ((f'{code(tags[0])} to {code(tags[-1])}' if len(tags) > 1 else code(tags[0])) + ' and ' if tags else '') + code(branch)
- out = ['', '**Contracts by OS release**', '', f'What FolderView3 relies on in the webgui, checked on {span}.', '']
+ span = f'{code(tags[0])} to {code(tags[-1])}' if len(tags) > 1 else code(tags[0])
+ out = ['', '**Contracts by OS release**', '',
+ f'What FolderView3 relies on in the webgui, checked on its release tags {span} and on {code(branch)}.', '']
for entry, found in view['contracts']:
held = [ref for ref, ok in found.items() if ok is not None]
- failed = [ref for ref, ok in found.items() if ok is False]
- state = 'fails on ' + ', '.join(code(r) for r in failed) if failed else f'holds on all {len(held)}'
+ broken = [f'{"missing" if ok == "missing" else "fails"} on {code(ref)}' for ref, ok in found.items() if ok not in (True, None)]
since = f' (from {code(entry["since"])})' if 'since' in entry else ''
- out.append(f'- {code(entry["path"].rsplit("/", 1)[-1])} {entry["why"]}: {state}{since}')
+ out.append(f'- {code(entry["path"].rsplit("/", 1)[-1])} {entry["why"]}: '
+ + (', '.join(broken) if broken else f'holds on all {len(held)}') + since)
return out
def _styles(view):
+ if 'unread' in view:
+ return []
themes, changed, gone = list(view['styles']), {}, {}
for theme, rows in view['styles'].items():
for context, selector, name, values in rows:
@@ -130,10 +135,12 @@ def row(key, who):
out = ['', '**Unraid CSS by OS release**', '',
'Layout properties Unraid sets on elements FolderView3 styles, that differ between releases, and that FolderView3 '
'does not set itself.', '']
- out += capped([row(k, w) for k, w in changed.items()], 60) or ['- none']
+ out += capped([row(k, w) for k, w in changed.items()], 40) or ['- none']
+ if view['unmatched']:
+ out += ['', 'Listed in watch.json but on no release: ' + ', '.join(code(p, 200) for p in view['unmatched']) + '.']
if gone:
out += ['', f'No longer set in the stylesheets read here ({len(gone)}; may have moved elsewhere)', '']
- out += capped([row(k, w) for k, w in gone.items()], 60) + ['', '']
+ out += capped([row(k, w) for k, w in gone.items()], 40) + ['', '']
return out
@@ -163,7 +170,6 @@ def render_status(view):
+ ': ' + '; '.join(members))
if view['unstated']:
out.append('- API version not stated in the notes: ' + ', '.join(code(v) for v in view['unstated']))
- out += _contracts(view) + _styles(view)
out += ['', f'API not used yet ({len(view["idle"])} operations)', '']
out += [f'- {code(signature, 300)}' for signature in view['idle']]
if view['types']:
@@ -171,6 +177,8 @@ def render_status(view):
+ ', '.join(f'{code(name)} {read}/{total}' for name, read, total in view['types']) + '.']
out += ['', '', '', f'Still on legacy ({len(view["legacy"])} webgui files)', '']
out += [f'- {code(path, 200)}: {why}' for path, why in view['legacy']] + ['', '']
+ # Last: the longest sections, so a body cut for length loses these before anything above
+ out += _contracts(view) + _styles(view)
return fit('\n'.join(out)) + '\n\n' + STATUS
diff --git a/.github/unraid-watch/scan.py b/.github/unraid-watch/scan.py
index b00a8247..0abd44a0 100644
--- a/.github/unraid-watch/scan.py
+++ b/.github/unraid-watch/scan.py
@@ -76,7 +76,7 @@ def code(plugin):
def minimum(manifest):
"""The oldest Unraid release the plugin declares it runs on: the PLUGIN tag's min attribute; None when it has none."""
- found = re.search(r']*\bmin="(\d+\.\d+\.\d+)"', manifest.read_text(encoding='utf-8')) if manifest.is_file() else None
+ found = re.search(r']*\bmin="(\d+\.\d+\.\d+)"', manifest.read_text(encoding='utf-8'))
return found and found.group(1)
diff --git a/.github/unraid-watch/status.py b/.github/unraid-watch/status.py
index 0482ff43..d40d6e90 100644
--- a/.github/unraid-watch/status.py
+++ b/.github/unraid-watch/status.py
@@ -2,6 +2,7 @@
import releases
import schema
import upstream
+from github import GitHubError
def stage(gh, cfg, ops, watched, spans):
@@ -60,9 +61,15 @@ def bundled(release):
current = schema.load(gh.file(core, heads[core], api['schema']))
idle, types = schema.coverage(current, api['surface'], schema.check(current, ops)[2], api['namespaces'])
held = upstream.source(cfg, 'contracts')
- refs = upstream.release_refs(gh, held, local['floor'])
+ pinned = {held['branch']: heads[held['repo']]}
+ try:
+ refs = upstream.release_refs(gh, held, local['floor'])
+ styles, unmatched = upstream.stylesheets(gh, held, refs, local['styled'], pinned)
+ compat = {'refs': refs, 'contracts': upstream.contracts(gh, held, refs, pinned), 'styles': styles, 'unmatched': unmatched}
+ except GitHubError as e:
+ # These sections only report: a failed read leaves them out and says so, and the news still goes out
+ compat = {'refs': [], 'contracts': [], 'styles': {}, 'unread': str(e)}
return {'releases': (newest, stable, latest), 'stages': stages, 'matrix': matrix, 'unstated': unstated,
- 'idle': idle, 'types': types, 'refs': refs, 'contracts': upstream.contracts(gh, held, refs),
- 'styles': upstream.stylesheets(gh, held, refs, local['styled']),
+ 'idle': idle, 'types': types, **compat,
# Stylesheets are not pages to move off: they are what the plugin's own CSS sits on
'legacy': [(path, why) for path, why in sorted(watched[tagged].items()) if not path.endswith('.css')]}
diff --git a/.github/unraid-watch/test_commands.py b/.github/unraid-watch/test_commands.py
index 20ff35a6..47221664 100644
--- a/.github/unraid-watch/test_commands.py
+++ b/.github/unraid-watch/test_commands.py
@@ -80,7 +80,7 @@ def test_scan_problem_fails_the_contract(self):
def test_contracts_are_checked_on_master_and_listed(self):
code, out = self.contract()
self.assertEqual(code, 0)
- self.assertIn(f'- contract {EVENTS}: holds on 1 of 1 refs', out)
+ self.assertIn(f'- contract {EVENTS}: holds on 2 of 2 refs', out)
def test_a_contract_a_supported_release_breaks_fails_and_names_the_release(self):
self.w.release_line()
@@ -91,6 +91,14 @@ def test_a_contract_a_supported_release_breaks_fails_and_names_the_release(self)
self.assertIn(f"::error::unraid/webgui: {EVENTS} does not match \"'success' => \" on 9.0.3: answers in `success`", out)
self.assertIn(f'- contract {EVENTS}: holds on 1 of 2 refs', out)
+ def test_a_contract_file_a_release_does_not_have_is_named_missing_not_mismatched(self):
+ self.w.release_line()
+ self.w.tree(WEB, '9.0.3', {})
+ code, out = self.contract()
+ self.assertEqual(code, 1)
+ self.assertIn(f'::error::unraid/webgui: {EVENTS} is missing on 9.0.3: answers in `success`', out)
+ self.assertNotIn('does not match', out)
+
def test_a_release_before_a_contracts_since_is_not_held_to_it(self):
self.w.release_line()
self.w.tree(WEB, '9.0.3', {})
@@ -104,11 +112,19 @@ def test_only_stable_releases_from_the_plugins_minimum_are_read(self):
self.w.release_line()
self.contract()
read = {c[1].split('/git/trees/')[1].split('?')[0] for c in self.w.fake.calls if f'/repos/{WEB}/git/trees/' in c[1]}
- self.assertEqual(read, {'9.0.3', 'master'})
+ # master is read at the sha the run pinned it to, not by its moving name
+ self.assertEqual(read, {'9.0.3', NEW[WEB]})
- def test_a_manifest_without_a_minimum_stops_the_contract(self):
+ def test_a_manifest_without_a_minimum_stops_the_contract_before_any_request(self):
+ world = World(self, manifest='\n')
with self.assertRaisesRegex(watch.Problem, 'no min="x.y.z"'):
- self.contract(world=World(self, manifest='\n'))
+ self.contract(world=world)
+ self.assertEqual(world.fake.calls, [])
+
+ def test_no_supported_release_tag_is_an_error_not_a_pass_on_master_alone(self):
+ self.w.tags(WEB, ['8.9.0', '9.1.0-beta.2', '2030.11.10'])
+ with self.assertRaisesRegex(GitHubError, 'no stable release tag at or after 9.0.0'):
+ self.contract()
class CheckTest(Case):
@@ -143,13 +159,27 @@ def test_plugin_that_references_no_endpoint_fails(self):
def test_an_unraid_css_variable_without_a_fallback_fails(self):
code, out = self.check(SCRIPT, styles=STYLES + '.tip { margin: var(--gap); }\n')
self.assertEqual(code, 1)
- self.assertIn('::error::a.css:3: var(--gap) has no fallback and only Unraid defines --gap', out)
+ self.assertIn('::error::a.css:3: var(--gap) has no fallback and FolderView3 does not define --gap', out)
def test_a_manifest_without_a_minimum_fails(self):
code, out = self.check(SCRIPT, manifest='\n')
self.assertEqual(code, 1)
self.assertIn('::error::plugin.plg: no min="x.y.z" on its PLUGIN tag', out)
+ def test_a_missing_manifest_says_it_is_missing(self):
+ world = World(self)
+ Path(world.root, 'plugin.plg').unlink()
+ code, out = self.captured(watch.cmd_check, CFG, world.root)
+ self.assertEqual(code, 1)
+ self.assertIn('::error::plugin.plg is missing', out)
+
+ def test_a_plugin_with_no_stylesheets_fails_instead_of_reading_as_nothing_styled(self):
+ world = World(self)
+ Path(world.root, 'plugin/styles/a.css').unlink()
+ code, out = self.captured(watch.cmd_check, CFG, world.root)
+ self.assertEqual(code, 1)
+ self.assertIn('::error::plugin/styles has no stylesheets', out)
+
class MainTest(Case):
def main(self, *argv):
diff --git a/.github/unraid-watch/test_css.py b/.github/unraid-watch/test_css.py
index 7e1109cf..5a52565c 100644
--- a/.github/unraid-watch/test_css.py
+++ b/.github/unraid-watch/test_css.py
@@ -13,6 +13,37 @@ def test_each_selector_gets_the_declarations_and_its_at_rule(self):
('@media (max-width: 9px)', '#b > .c', {'white-space': 'pre-line', 'margin-top': '4px !important'}),
('', '.d', {'display': 'none'})])
+ def test_nested_rules_resolve_against_their_parent_and_keep_its_own_declarations(self):
+ text = '.title { display: flex; &:first-of-type { margin-top: 0 } .x, &.y { top: 1px } @media (min-width: 1px) { clear: both } }'
+ self.assertEqual(css.rules(text), [
+ ('', '.title', {'display': 'flex'}),
+ ('', '.title:first-of-type', {'margin-top': '0'}),
+ ('', '.title .x', {'top': '1px'}),
+ ('', '.title.y', {'top': '1px'}),
+ ('@media (min-width: 1px)', '.title', {'clear': 'both'})])
+
+ def test_a_statement_at_rule_does_not_swallow_the_next_rule_and_keyframes_are_no_elements(self):
+ text = '@charset "UTF-8";\n@import url(a.css);\n.tip { display: block }\n@keyframes k { from { top: 0 } }'
+ self.assertEqual(css.rules(text), [('', '.tip', {'display': 'block'})])
+
+ def test_a_brace_inside_a_string_is_just_text(self):
+ self.assertEqual(css.rules('.q::after { content: "}"; } .row { top: 0 }'),
+ [('', '.q::after', {'content': '"}"'}), ('', '.row', {'top': '0'})])
+
+ def test_spacing_and_attribute_quotes_do_not_make_a_rule_new(self):
+ a = css.merged(['label+.content{top:0} [type="radio"]~.x{top:0} @media (max-width:9px){.y{top:0}}'])
+ b = css.merged(['label + .content { top: 0 } [type=radio] ~ .x { top: 0 } @media ( max-width: 9px ) { .y { top: 0 } }'])
+ self.assertEqual(a, b)
+ self.assertIn(('@media (max-width: 9px)', '.y', 'top'), a)
+
+ def test_a_generated_box_or_an_attribute_value_is_not_the_element(self):
+ self.assertEqual(css.subject('.tip::before'), [])
+ self.assertEqual(css.subject('a[href$=".png"]'), [])
+
+ def test_a_comma_inside_not_stays_in_its_selector(self):
+ self.assertEqual(css.rules('.x:not(.p, .q), .z { display: none }'),
+ [('', '.x:not(.p, .q)', {'display': 'none'}), ('', '.z', {'display': 'none'})])
+
def test_a_semicolon_inside_a_url_does_not_end_the_declaration(self):
self.assertEqual(css.rules('.a { background: url(data:image/png;base64,xy); top: 0 }'),
[('', '.a', {'background': 'url(data:image/png;base64,xy)', 'top': '0'})])
@@ -27,18 +58,18 @@ class ChangesTest(unittest.TestCase):
OURS = {'.tip': {'color'}, '.row': {'white-space'}}
def by_ref(self, old, new):
- return {'7.0.0': css.merged([old]), 'master': css.merged([new])}
+ return {'9.0.0': css.merged([old]), 'master': css.merged([new])}
def test_a_layout_property_unraid_changed_on_an_element_the_plugin_styles_is_listed(self):
- rows = css.changes(self.by_ref('.tip { display: block }', '.tip { white-space: pre-line }'), ['7.0.0', 'master'], self.OURS)
- self.assertEqual(rows, [('', '.tip', 'display', [('7.0.0', 'block'), ('master', None)]),
- ('', '.tip', 'white-space', [('7.0.0', None), ('master', 'pre-line')])])
+ rows = css.changes(self.by_ref('.tip { display: block }', '.tip { white-space: pre-line }'), ['9.0.0', 'master'], self.OURS)
+ self.assertEqual(rows, [('', '.tip', 'display', [('9.0.0', 'block'), ('master', None)]),
+ ('', '.tip', 'white-space', [('9.0.0', None), ('master', 'pre-line')])])
def test_what_the_plugin_sets_itself_colours_and_elements_it_does_not_style_are_left_out(self):
# .row's colour: an element the plugin styles, a property it does not set, but a colour, not layout
old = '.row { white-space: nowrap; color: red } .tip { color: red } .other { display: block }'
new = '.row { white-space: normal; color: blue } .tip { color: blue } .other { display: flex }'
- self.assertEqual(css.changes(self.by_ref(old, new), ['7.0.0', 'master'], self.OURS), [])
+ self.assertEqual(css.changes(self.by_ref(old, new), ['9.0.0', 'master'], self.OURS), [])
def test_a_later_stylesheet_wins_as_the_page_loads_them(self):
self.assertEqual(css.merged(['.tip { top: 1px }', '.tip { top: 2px }']), {('', '.tip', 'top'): '2px'})
@@ -55,12 +86,17 @@ def check(self, sheet, code=''):
def test_an_unraid_variable_without_a_fallback_is_named_with_its_line(self):
(problem,) = self.check('/* two\nlines */\n.a { color: var(--text); }\n')
- self.assertTrue(problem.startswith('a.css:3: var(--text) has no fallback and only Unraid defines --text'), problem)
+ self.assertTrue(problem.startswith('a.css:3: var(--text) has no fallback and FolderView3 does not define --text'), problem)
def test_a_fallback_or_a_variable_the_plugin_owns_passes(self):
self.assertEqual(self.check('.a { color: var(--text, #fff); }'), [])
self.assertEqual(self.check(':root { --gap: 5px; } .a { gap: var(--gap); }'), [])
self.assertEqual(self.check('.a { color: var(--fv3-name-color); }', "const vars = { 'fv3-name-color': '#fff' };"), [])
+ self.assertEqual(self.check('.a { color: var(--graph-cpu); }', "$vars = ['graph-cpu' => '#2b8da3'];"), [])
+
+ def test_a_word_the_code_merely_uses_does_not_make_an_unraid_variable_the_plugins(self):
+ (problem,) = self.check('.a { color: var(--text); }', "fields.push({ type: 'text', label: 'Name' });")
+ self.assertIn('var(--text) has no fallback', problem)
def test_a_variable_nested_in_a_fallback_needs_its_own(self):
(problem,) = self.check('.a { color: var(--fv3-x, var(--text)); }', "'fv3-x'")
diff --git a/.github/unraid-watch/test_releases.py b/.github/unraid-watch/test_releases.py
index 2e512aa2..8146c8b4 100644
--- a/.github/unraid-watch/test_releases.py
+++ b/.github/unraid-watch/test_releases.py
@@ -11,7 +11,7 @@ def test_versions_sort_beta_before_rc_before_final(self):
'10.0.0-beta.1'])
def test_an_os_release_tag_is_a_stable_version_not_a_date(self):
- self.assertEqual([t for t in ('7.4.0', '7.4.0-rc.1', '2014.11.10', 'v7.4.0', '7.4') if releases.os_tag(t)], ['7.4.0'])
+ self.assertEqual([t for t in ('9.4.0', '9.4.0-rc.1', '2030.11.10', 'v9.4.0', '9.4') if releases.os_tag(t)], ['9.4.0'])
def test_stable_means_no_prerelease_suffix(self):
self.assertTrue(releases.stable('9.1.0'))
diff --git a/.github/unraid-watch/test_report.py b/.github/unraid-watch/test_report.py
index cd8a4363..a3c627de 100644
--- a/.github/unraid-watch/test_report.py
+++ b/.github/unraid-watch/test_report.py
@@ -183,8 +183,8 @@ def test_unexpected_comment_link_is_refused(self):
class RunsTest(unittest.TestCase):
def test_releases_with_the_same_value_read_as_one_span(self):
- values = [('7.0.0', None), ('7.1.0', None), ('7.2.0', '4px'), ('7.3.0', None), ('master', None)]
- self.assertEqual(report._runs(values), 'not set in `7.0.0`–`7.1.0`, `4px` in `7.2.0`, not set in `7.3.0`–`master`')
+ values = [('9.0.0', None), ('9.1.0', None), ('9.2.0', '4px'), ('9.3.0', None), ('master', None)]
+ self.assertEqual(report._runs(values), 'not set in `9.0.0`–`9.1.0`, `4px` in `9.2.0`, not set in `9.3.0`–`master`')
if __name__ == '__main__':
diff --git a/.github/unraid-watch/test_status.py b/.github/unraid-watch/test_status.py
index 8c197449..8fbe0cbf 100644
--- a/.github/unraid-watch/test_status.py
+++ b/.github/unraid-watch/test_status.py
@@ -81,39 +81,39 @@ def test_status_reads_as_expected(self):
'- 3 of 3: `main` (not released); `v4.2.0` (latest API release); `v4.1.0` (Unraid 9.1.0-beta.2)',
'- 2 of 3, missing `DockerMutations.stop`: `v4.0.0` (Unraid 9.0.3)',
'- API version not stated in the notes: `9.0.2`, `9.0.1`',
+ ]))
+ self.assertEqual(body.split('\n\n', 1)[1], '\n'.join([
+ 'API not used yet (1 operations)',
'',
- '**Contracts by OS release**',
+ '- `DockerMutations.restart(id: ID!): Boolean!`',
'',
- 'What FolderView3 relies on in the webgui, checked on `9.0.3` and `master`.',
+ 'Fields read of those available: `Item` 1/2.',
'',
- '- `Events.php` answers in `success`: holds on all 2',
+ '',
'',
- '**Unraid CSS by OS release**',
+ 'Still on legacy (2 webgui files)',
'',
- 'Layout properties Unraid sets on elements FolderView3 styles, that differ between releases, and that FolderView3 '
- 'does not set itself.',
+ '- `emhttp/page/`: markup',
+ f'- `{USERPREFS}`: called from a.js:5',
'',
- '- `.tip` `white-space`: not set in `9.0.3`, `pre-line` in `master`',
- ]))
- self.assertEqual(body.split('\n\n', 1)[1], '\n'.join([
- 'No longer set in the stylesheets read here (1; may have moved elsewhere)',
+ '',
'',
- '- `.tip` `display`: `block` in `9.0.3`, not set in `master` (azure)',
+ '**Contracts by OS release**',
'',
- '',
+ 'What FolderView3 relies on in the webgui, checked on its release tags `9.0.3` and on `master`.',
'',
- 'API not used yet (1 operations)',
+ '- `Events.php` answers in `success`: holds on all 2',
'',
- '- `DockerMutations.restart(id: ID!): Boolean!`',
+ '**Unraid CSS by OS release**',
'',
- 'Fields read of those available: `Item` 1/2.',
+ 'Layout properties Unraid sets on elements FolderView3 styles, that differ between releases, and that FolderView3 '
+ 'does not set itself.',
'',
- '',
+ '- `.tip` `white-space`: not set in `9.0.3`, `pre-line` in `master`',
'',
- 'Still on legacy (2 webgui files)',
+ 'No longer set in the stylesheets read here (1; may have moved elsewhere)',
'',
- '- `emhttp/page/`: markup',
- f'- `{USERPREFS}`: called from a.js:5',
+ '- `.tip` `display`: `block` in `9.0.3`, not set in `master` (azure)',
'',
'',
'',
@@ -153,6 +153,20 @@ def test_release_documented_before_its_tag_exists_is_shown_as_not_available(self
self.assertIn('- unraid/webgui `9.0.3`...`9.1.0-beta.2`: not available\n', body)
self.assertIn('- unraid/api `v4.0.0`...`v4.1.0`:\n - removed', body)
+ def test_a_failed_read_leaves_the_release_checks_out_and_says_so(self):
+ self.w.fake.routes['GET', url(f'/repos/{WEB}/tags', page=1, per_page=100)] = (500, 'boom')
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
+ self.assertIn('**Operations by OS release**', body)
+ self.assertIn('**Contracts and Unraid CSS by OS release**: could not be read (`GET /repos/unraid/webgui/tags: HTTP 500', body)
+ self.assertNotIn('**Unraid CSS by OS release**', body)
+
+ def test_a_listed_stylesheet_no_release_has_is_named(self):
+ cfg = {**CFG, 'sources': [{**s, 'styles': {**s['styles'], 'files': s['styles']['files'] + ['css/typo-{theme}.css']}}
+ if 'styles' in s else s for s in CFG['sources']]}
+ self.w.release_line()
+ body = report.render_status(status.gather(self.w.client(), cfg, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
+ self.assertIn('Listed in watch.json but on no release: `css/typo-{theme}.css`.', body)
+
def test_watched_stylesheets_are_not_listed_as_legacy_pages(self):
view = status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {'css/azure.css': 'theme', USERPREFS: 'prefs'}, DOCS: {}},
NEW, self.local())
@@ -237,6 +251,14 @@ def test_refreshed_even_when_news_was_posted(self):
self.w.run()
self.assertEqual((len(self.w.posted), len(self.w.status)), (1, 1))
+ def test_news_still_goes_out_when_the_release_checks_cannot_be_read(self):
+ self.w.state()
+ self.w.hit()
+ self.w.fake.routes['GET', f'/repos/{WEB}/git/blobs/ev1'] = (500, 'boom')
+ code, _ = self.w.run()
+ self.assertEqual((code, len(self.w.posted), len(self.w.status)), (0, 1, 1))
+ self.assertIn('could not be read', self.w.status[0][1])
+
def test_status_command_prints_and_writes_nothing(self):
code, out = self.captured(watch.cmd_status, CFG, self.w.client(), self.w.root)
self.assertEqual(code, 0)
diff --git a/.github/unraid-watch/upstream.py b/.github/unraid-watch/upstream.py
index 4deaa655..259904dc 100644
--- a/.github/unraid-watch/upstream.py
+++ b/.github/unraid-watch/upstream.py
@@ -4,6 +4,7 @@
import css
import releases
import schema
+from github import GitHubError
NOTES = re.compile(r'[\w.-]+\.md\Z')
@@ -70,8 +71,11 @@ def validity(gh, src, ops, refs):
def release_refs(gh, src, floor):
"""Stable release tags at or after floor (the plugin's declared minimum), oldest first, then the development branch."""
- tags = [t for t in gh.tags(src['repo']) if releases.os_tag(t)]
- return sorted((t for t in tags if releases.order(t) >= releases.order(floor)), key=releases.order) + [src['branch']]
+ tags = [t for t in gh.tags(src['repo']) if releases.os_tag(t) and releases.order(t) >= releases.order(floor)]
+ # None would leave only the development branch checked, read as every release passing
+ if not tags:
+ raise GitHubError(f'{src["repo"]}: no stable release tag at or after {floor}')
+ return sorted(tags, key=releases.order) + [src['branch']]
def text_at(gh, repo, ref, path):
@@ -85,27 +89,34 @@ def applies(entry, ref):
return 'since' not in entry or not releases.VERSION.fullmatch(ref) or releases.order(ref) >= releases.order(entry['since'])
-def contracts(gh, src, refs):
- """[(contract, {ref: True if it holds, False if not, None where it does not apply})]."""
+def contracts(gh, src, refs, pinned):
+ """[(contract, {ref: True, False, 'missing' (no such file), or None where it does not apply})]; pinned maps a branch to its sha."""
out = []
for entry in src.get('contracts', []):
- found = {ref: bool(re.search(entry['match'], text_at(gh, src['repo'], ref, entry['path']) or ''))
- if applies(entry, ref) else None for ref in refs}
+ found = {}
+ for ref in refs:
+ text = text_at(gh, src['repo'], pinned.get(ref, ref), entry['path']) if applies(entry, ref) else None
+ found[ref] = None if not applies(entry, ref) else 'missing' if text is None else bool(re.search(entry['match'], text))
out.append((entry, found))
return out
-def stylesheets(gh, src, refs, ours):
- """{theme: css.changes} for Unraid's stylesheets per release; a file a release does not have is skipped."""
+def stylesheets(gh, src, refs, ours, pinned):
+ """({theme: css.changes}, [listed file no release has]) for Unraid's stylesheets; a file one release lacks is skipped."""
styles = src['styles']
- out = {}
+ out, seen = {}, set()
for theme in styles['themes']:
by_ref = {}
for ref in refs:
- texts = (text_at(gh, src['repo'], ref, pattern.format(theme=theme)) for pattern in styles['files'])
- by_ref[ref] = css.merged(t for t in texts if t is not None)
+ texts = []
+ for pattern in styles['files']:
+ text = text_at(gh, src['repo'], pinned.get(ref, ref), pattern.format(theme=theme))
+ if text is not None:
+ texts.append(text)
+ seen.add(pattern)
+ by_ref[ref] = css.merged(texts)
out[theme] = css.changes(by_ref, refs, ours)
- return out
+ return out, [p for p in styles['files'] if p not in seen]
def differences(gh, repo, paths, start, head):
diff --git a/.github/unraid-watch/watch.py b/.github/unraid-watch/watch.py
index 75e4c042..59023aff 100644
--- a/.github/unraid-watch/watch.py
+++ b/.github/unraid-watch/watch.py
@@ -42,13 +42,24 @@ def derive(cfg, root):
return ops, watched, problems
+def floor(cfg, root):
+ """The oldest Unraid release the plugin supports, from its manifest; a Problem when it states none."""
+ manifest = Path(root, cfg['manifest'])
+ if not manifest.is_file():
+ raise Problem(f'{cfg["manifest"]} is missing, so the oldest Unraid the plugin supports is unknown')
+ found = scan.minimum(manifest)
+ if not found:
+ raise Problem(f'{cfg["manifest"]}: no min="x.y.z" on its PLUGIN tag, so the oldest Unraid it supports is unknown')
+ return found
+
+
def local(cfg, root):
"""What the checks per release need from the plugin: the oldest Unraid it supports, and what its stylesheets style."""
- floor = scan.minimum(Path(root, cfg['manifest']))
- if not floor:
- raise Problem(f'{cfg["manifest"]}: no min="x.y.z" on its PLUGIN tag, so the oldest Unraid it supports is unknown')
sheets = scan.stylesheets(Path(root, cfg['plugin']))
- return {'floor': floor, 'styled': css.styled(f.read_text(encoding='utf-8') for f in sheets)}
+ # No stylesheets would read as "Unraid changed nothing the plugin styles"
+ if not sheets:
+ raise Problem(f'{cfg["plugin"]}/styles has no stylesheets, so what the plugin styles is unknown')
+ return {'floor': floor(cfg, root), 'styled': css.styled(f.read_text(encoding='utf-8') for f in sheets)}
def readable(cfg, root):
@@ -100,6 +111,8 @@ def cmd_check(cfg, root):
def cmd_contract(cfg, gh, root, refs):
ops, watched, errors = derive(cfg, root)
+ # Read before the first request: a manifest that states no minimum stops the run before anything is fetched
+ oldest = floor(cfg, root)
api = source(cfg, 'schema')
lines = []
for ref, bad, deprecated in validity(gh, api, ops, refs or [api['branch'], gh.latest_release(api['repo'])]):
@@ -114,8 +127,12 @@ def cmd_contract(cfg, gh, root, refs):
errors += [f'{repo}: {p} no longer exists on {src["branch"]}; fix the call or watch.json' for p in gone]
lines.append(f'- {len(paths) - len(gone)} of {len(paths)} watched paths present in {repo}')
held = source(cfg, 'contracts')
- for entry, found in contracts(gh, held, release_refs(gh, held, local(cfg, root)['floor'])):
+ pinned = {held['branch']: gh.sha(held['repo'], held['branch'])}
+ for entry, found in contracts(gh, held, release_refs(gh, held, oldest), pinned):
+ missing = [ref for ref, ok in found.items() if ok == 'missing']
failed = [ref for ref, ok in found.items() if ok is False]
+ if missing:
+ errors.append(f'{held["repo"]}: {entry["path"]} is missing on {", ".join(missing)}: {entry["why"]}')
if failed:
errors.append(f'{held["repo"]}: {entry["path"]} does not match {entry["match"]!r} on {", ".join(failed)}: {entry["why"]}')
lines.append(f'- contract {entry["path"]}: holds on {sum(ok is True for ok in found.values())} of '
diff --git a/.github/unraid-watch/world.py b/.github/unraid-watch/world.py
index 11c94c77..efe56d4d 100644
--- a/.github/unraid-watch/world.py
+++ b/.github/unraid-watch/world.py
@@ -129,9 +129,10 @@ def __init__(self, case, script=SCRIPT, styles=STYLES, manifest=' $DockerClient->startContainer($container)];\n")
self.blob(WEB, 'st1', '.tip { white-space: pre-line; color: red; }\n.row { white-space: normal; }\n')
@@ -179,12 +180,12 @@ def release_line(self):
self.tree(API, NEW[API], {'api/schema.graphql': 's2', 'api/switch.ts': 'w1'})
self.tree(WEB, STABLE_WEB, {'emhttp/page': 't0', USERPREFS: 'u0'})
self.tree(WEB, BETA_WEB, {'emhttp/page': 't1', USERPREFS: 'u0'})
- self.tree(WEB, NEW[WEB], {'emhttp/page': 't1', USERPREFS: 'u0'})
+ self.tree(WEB, NEW[WEB], {'emhttp/page': 't1', USERPREFS: 'u0', EVENTS: 'ev1', 'css/azure.css': 'st1', 'css/black.css': 'st1'})
self.between(API, [50], span=(LATEST_API, NEW[API]))
self.between(WEB, [60, 61], status='diverged', span=(STABLE_WEB, BETA_WEB))
# Only 9.0.3 is a stable OS release at or after the plugin's floor (9.0.0); 9.0.3's azure theme sets .tip's display,
# master's does not but sets its white-space
- self.tags(WEB, ['9.1.0-beta.2', '9.0.3', '8.9.0', '2014.11.10'])
+ self.tags(WEB, ['9.1.0-beta.2', '9.0.3', '8.9.0', '2030.11.10'])
self.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1'})
self.blob(WEB, 'old1', '.tip { display: block; color: blue; }\n')
self.fake.routes['GET', url(f'/repos/{API}/commits', page=1, path='api/switch.ts', per_page=100,
diff --git a/.github/workflows/unraid-watch.yml b/.github/workflows/unraid-watch.yml
index 090167d6..a69cea42 100644
--- a/.github/workflows/unraid-watch.yml
+++ b/.github/workflows/unraid-watch.yml
@@ -19,6 +19,8 @@ on:
pull_request:
paths:
- 'src/**'
+ # its min attribute is the oldest Unraid release the contracts are checked on
+ - 'folder.view3.plg'
- '.github/unraid-watch/**'
- '.github/workflows/unraid-watch.yml'
push:
From d5102adda07eb3631e40cbf2fc9e9f9946a0db16 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 11:02:41 +0800
Subject: [PATCH 09/72] docs: the palette's watched reason says the plugin
reads its variables with fallbacks
---
.github/unraid-watch/watch.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/unraid-watch/watch.json b/.github/unraid-watch/watch.json
index 0f863386..fb35d8c5 100644
--- a/.github/unraid-watch/watch.json
+++ b/.github/unraid-watch/watch.json
@@ -50,7 +50,7 @@
"emhttp/plugins/dynamix/include/TaskCommand.php": "task tray endpoint behind openDocker from 7.4",
"emhttp/plugins/dynamix/styles/default-dynamix.css": "tooltipster rules the advanced preview popup is drawn inside (7.4 added white-space: pre-line)",
"emhttp/plugins/dynamix/styles/default-base.css": "sweet-alert, table and menu rules the plugin's dialogs and rows sit in",
- "emhttp/plugins/dynamix/styles/default-color-palette.css": "colour variables the plugin's own colours fall back from",
+ "emhttp/plugins/dynamix/styles/default-color-palette.css": "colour variables the plugin's CSS reads, each with its own fallback",
"emhttp/plugins/dynamix/styles/themes/azure.css": "azure theme rules under the folder rows and dialogs",
"emhttp/plugins/dynamix/styles/themes/black.css": "black theme rules under the folder rows and dialogs",
"emhttp/plugins/dynamix/styles/themes/gray.css": "gray theme rules under the folder rows and dialogs",
From 8e04e04b572fa83491b867604f834a8f3c203f0e Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 11:17:45 +0800
Subject: [PATCH 10/72] fix: a declaration after a nested rule keeps its place,
each theme's stylesheet counts as its own input, and stylesheets that style
nothing are refused
---
.github/unraid-watch/css.py | 20 +++++++++++---------
.github/unraid-watch/test_commands.py | 7 ++++++-
.github/unraid-watch/test_css.py | 3 +++
.github/unraid-watch/test_status.py | 10 ++++++++--
.github/unraid-watch/upstream.py | 10 ++++++----
.github/unraid-watch/watch.py | 9 +++++----
.github/unraid-watch/world.py | 3 ++-
7 files changed, 41 insertions(+), 21 deletions(-)
diff --git a/.github/unraid-watch/css.py b/.github/unraid-watch/css.py
index 4f4c689f..e2de36bb 100644
--- a/.github/unraid-watch/css.py
+++ b/.github/unraid-watch/css.py
@@ -61,23 +61,23 @@ def _condition(text):
def _parts(body):
- """(declarations, [(head, block)]) of a body: its own declarations, and the rules and at-rules nested in it."""
- own, nested, depth, paren, start, item = [], [], 0, 0, 0, 0
+ """[(None, declarations) or (head, block)] of a body in source order: its own declarations and the rules nested in it."""
+ items, depth, paren, start, item = [], 0, 0, 0, 0
for i, c in _plain(body):
paren += (c == '(') - (c == ')') if depth == 0 else 0
if c == '{':
if depth == 0:
- own.append(body[start:item])
+ items.append((None, body[start:item]))
head, opened = ' '.join(body[item:i].split()), i + 1
depth += 1
elif c == '}' and depth:
depth -= 1
if depth == 0:
- nested.append((head, body[opened:i]))
+ items.append((head, body[opened:i]))
start = item = i + 1
elif c == ';' and depth == 0 and paren <= 0:
item = i + 1
- return ''.join(own) + body[start:], nested
+ return items + [(None, body[start:])]
def _declarations(text):
@@ -91,10 +91,12 @@ def _declarations(text):
def _walk(body, conditions, parents, out):
- own, nested = _parts(body)
- decls = _declarations(own) if parents else {}
- out += [(conditions, parent, decls) for parent in parents if decls]
- for head, block in nested:
+ # In source order: a declaration after a nested rule comes after it, as the browser applies them
+ for head, block in _parts(body):
+ if head is None:
+ decls = _declarations(block) if parents else {}
+ out += [(conditions, parent, decls) for parent in parents if decls]
+ continue
if head.startswith('@'):
if head.split(None, 1)[0].lower() in GROUPS:
_walk(block, ' '.join(filter(None, (conditions, _condition(head)))), parents, out)
diff --git a/.github/unraid-watch/test_commands.py b/.github/unraid-watch/test_commands.py
index 47221664..71d4aee7 100644
--- a/.github/unraid-watch/test_commands.py
+++ b/.github/unraid-watch/test_commands.py
@@ -178,7 +178,12 @@ def test_a_plugin_with_no_stylesheets_fails_instead_of_reading_as_nothing_styled
Path(world.root, 'plugin/styles/a.css').unlink()
code, out = self.captured(watch.cmd_check, CFG, world.root)
self.assertEqual(code, 1)
- self.assertIn('::error::plugin/styles has no stylesheets', out)
+ self.assertIn('::error::plugin/styles has no stylesheets that style an element', out)
+
+ def test_an_empty_stylesheet_fails_the_same_way(self):
+ code, out = self.check(SCRIPT, styles='')
+ self.assertEqual(code, 1)
+ self.assertIn('::error::plugin/styles has no stylesheets that style an element', out)
class MainTest(Case):
diff --git a/.github/unraid-watch/test_css.py b/.github/unraid-watch/test_css.py
index 5a52565c..3f2742b2 100644
--- a/.github/unraid-watch/test_css.py
+++ b/.github/unraid-watch/test_css.py
@@ -22,6 +22,9 @@ def test_nested_rules_resolve_against_their_parent_and_keep_its_own_declarations
('', '.title.y', {'top': '1px'}),
('@media (min-width: 1px)', '.title', {'clear': 'both'})])
+ def test_a_declaration_after_a_nested_rule_wins_as_it_does_in_the_browser(self):
+ self.assertEqual(css.merged(['.tip { & { top: 1px; } top: 2px; }']), {('', '.tip', 'top'): '2px'})
+
def test_a_statement_at_rule_does_not_swallow_the_next_rule_and_keyframes_are_no_elements(self):
text = '@charset "UTF-8";\n@import url(a.css);\n.tip { display: block }\n@keyframes k { from { top: 0 } }'
self.assertEqual(css.rules(text), [('', '.tip', {'display': 'block'})])
diff --git a/.github/unraid-watch/test_status.py b/.github/unraid-watch/test_status.py
index 8fbe0cbf..ffc6a86e 100644
--- a/.github/unraid-watch/test_status.py
+++ b/.github/unraid-watch/test_status.py
@@ -4,7 +4,7 @@
import status
import upstream
import watch
-from world import (API, BETA_API, BETA_WEB, CFG, DOCS, LATEST_API, ME, NEW, RELEASE, SCRIPT, STABLE_WEB, USERPREFS, WEB,
+from world import (API, BETA_API, BETA_WEB, CFG, DOCS, EVENTS, LATEST_API, ME, NEW, RELEASE, SCRIPT, STABLE_WEB, USERPREFS, WEB,
Case, World, commit, sha, url)
OPS = [('{ docker { statuses { name } } }', ['a.js:3']),
@@ -165,7 +165,13 @@ def test_a_listed_stylesheet_no_release_has_is_named(self):
if 'styles' in s else s for s in CFG['sources']]}
self.w.release_line()
body = report.render_status(status.gather(self.w.client(), cfg, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
- self.assertIn('Listed in watch.json but on no release: `css/typo-{theme}.css`.', body)
+ self.assertIn('Listed in watch.json but on no release: `css/typo-azure.css`, `css/typo-black.css`.', body)
+
+ def test_one_themes_file_missing_on_every_release_is_named_though_another_theme_has_it(self):
+ self.w.release_line()
+ self.w.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1'})
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
+ self.assertIn('Listed in watch.json but on no release: `css/old-black.css`.', body)
def test_watched_stylesheets_are_not_listed_as_legacy_pages(self):
view = status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {'css/azure.css': 'theme', USERPREFS: 'prefs'}, DOCS: {}},
diff --git a/.github/unraid-watch/upstream.py b/.github/unraid-watch/upstream.py
index 259904dc..660b62ac 100644
--- a/.github/unraid-watch/upstream.py
+++ b/.github/unraid-watch/upstream.py
@@ -105,18 +105,20 @@ def stylesheets(gh, src, refs, ours, pinned):
"""({theme: css.changes}, [listed file no release has]) for Unraid's stylesheets; a file one release lacks is skipped."""
styles = src['styles']
out, seen = {}, set()
+ # Each theme's own file is its own input: one theme's themes/{theme}.css does not stand in for another's
+ listed = list(dict.fromkeys(p.format(theme=t) for t in styles['themes'] for p in styles['files']))
for theme in styles['themes']:
by_ref = {}
for ref in refs:
texts = []
- for pattern in styles['files']:
- text = text_at(gh, src['repo'], pinned.get(ref, ref), pattern.format(theme=theme))
+ for path in (p.format(theme=theme) for p in styles['files']):
+ text = text_at(gh, src['repo'], pinned.get(ref, ref), path)
if text is not None:
texts.append(text)
- seen.add(pattern)
+ seen.add(path)
by_ref[ref] = css.merged(texts)
out[theme] = css.changes(by_ref, refs, ours)
- return out, [p for p in styles['files'] if p not in seen]
+ return out, [p for p in listed if p not in seen]
def differences(gh, repo, paths, start, head):
diff --git a/.github/unraid-watch/watch.py b/.github/unraid-watch/watch.py
index 59023aff..3755fa3e 100644
--- a/.github/unraid-watch/watch.py
+++ b/.github/unraid-watch/watch.py
@@ -56,10 +56,11 @@ def floor(cfg, root):
def local(cfg, root):
"""What the checks per release need from the plugin: the oldest Unraid it supports, and what its stylesheets style."""
sheets = scan.stylesheets(Path(root, cfg['plugin']))
- # No stylesheets would read as "Unraid changed nothing the plugin styles"
- if not sheets:
- raise Problem(f'{cfg["plugin"]}/styles has no stylesheets, so what the plugin styles is unknown')
- return {'floor': floor(cfg, root), 'styled': css.styled(f.read_text(encoding='utf-8') for f in sheets)}
+ styled = css.styled(f.read_text(encoding='utf-8') for f in sheets)
+ # No stylesheets, or none that styles an element by id or class, would read as "Unraid changed nothing the plugin styles"
+ if not styled:
+ raise Problem(f'{cfg["plugin"]}/styles has no stylesheets that style an element by id or class, so what the plugin styles is unknown')
+ return {'floor': floor(cfg, root), 'styled': styled}
def readable(cfg, root):
diff --git a/.github/unraid-watch/world.py b/.github/unraid-watch/world.py
index efe56d4d..9a56d979 100644
--- a/.github/unraid-watch/world.py
+++ b/.github/unraid-watch/world.py
@@ -186,8 +186,9 @@ def release_line(self):
# Only 9.0.3 is a stable OS release at or after the plugin's floor (9.0.0); 9.0.3's azure theme sets .tip's display,
# master's does not but sets its white-space
self.tags(WEB, ['9.1.0-beta.2', '9.0.3', '8.9.0', '2030.11.10'])
- self.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1'})
+ self.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1', 'css/old-black.css': 'old0'})
self.blob(WEB, 'old1', '.tip { display: block; color: blue; }\n')
+ self.blob(WEB, 'old0', '')
self.fake.routes['GET', url(f'/repos/{API}/commits', page=1, path='api/switch.ts', per_page=100,
sha=NEW[API])] = [commit(50, 'feat: enable the new page', '2030-01-03T00:00:00Z')]
From ebb7db4adabe9ccdea5d0748530f9eb0723410bd Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 11:19:19 +0800
Subject: [PATCH 11/72] fix: a watch.json with no contracts, themes or files,
or a contract without a path, match or valid regex, fails check instead of
reading as every release passing
---
.github/unraid-watch/test_commands.py | 10 ++++++++++
.github/unraid-watch/watch.py | 19 +++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/.github/unraid-watch/test_commands.py b/.github/unraid-watch/test_commands.py
index 71d4aee7..fab44c34 100644
--- a/.github/unraid-watch/test_commands.py
+++ b/.github/unraid-watch/test_commands.py
@@ -180,6 +180,16 @@ def test_a_plugin_with_no_stylesheets_fails_instead_of_reading_as_nothing_styled
self.assertEqual(code, 1)
self.assertIn('::error::plugin/styles has no stylesheets that style an element', out)
+ def test_release_checks_with_nothing_to_check_fail_instead_of_passing(self):
+ web = next(s for s in CFG['sources'] if 'contracts' in s)
+ for broken in ({**web, 'contracts': []}, {**web, 'styles': {**web['styles'], 'themes': []}},
+ {**web, 'contracts': [{'path': EVENTS, 'match': '(', 'why': 'w'}]}, {**web, 'contracts': [{'path': EVENTS}]}):
+ with self.subTest(broken=broken.get('contracts')):
+ cfg = {**CFG, 'sources': [broken if s is web else s for s in CFG['sources']]}
+ code, out = self.captured(watch.cmd_check, cfg, World(self).root)
+ self.assertEqual(code, 1)
+ self.assertIn('::error::watch.json: ', out)
+
def test_an_empty_stylesheet_fails_the_same_way(self):
code, out = self.check(SCRIPT, styles='')
self.assertEqual(code, 1)
diff --git a/.github/unraid-watch/watch.py b/.github/unraid-watch/watch.py
index 3755fa3e..728944cc 100644
--- a/.github/unraid-watch/watch.py
+++ b/.github/unraid-watch/watch.py
@@ -3,6 +3,7 @@
import argparse
import json
import os
+import re
import sys
from pathlib import Path
@@ -39,9 +40,27 @@ def derive(cfg, root):
for path, where in found.items():
paths.setdefault(path, f'called from {where}')
watched[src['repo']] = paths
+ problems += release_checks_config(cfg)
return ops, watched, problems
+def release_checks_config(cfg):
+ """Problems with the contracts and styles in watch.json: an empty list would read as every release passing."""
+ held = next((s for s in cfg['sources'] if 'contracts' in s), {})
+ styles = held.get('styles', {})
+ problems = [] if held.get('contracts') and styles.get('themes') and styles.get('files') else \
+ ['watch.json: the webgui source needs contracts and styles with themes and files, or the release checks read as passing']
+ for entry in held.get('contracts', []):
+ if not all(isinstance(entry.get(key), str) and entry[key] for key in ('path', 'match', 'why')):
+ problems.append(f'watch.json: a contract needs a path, a match and a why: {entry}')
+ continue
+ try:
+ re.compile(entry['match'])
+ except re.error as e:
+ problems.append(f'watch.json: the contract on {entry["path"]} has a match that is not a regular expression ({e})')
+ return problems
+
+
def floor(cfg, root):
"""The oldest Unraid release the plugin supports, from its manifest; a Problem when it states none."""
manifest = Path(root, cfg['manifest'])
From 14faa0582798f0d15a61fe90f5f39d70a40572bf Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 12:21:48 +0800
Subject: [PATCH 12/72] fix: the CSS comparison keeps !important over a later
plain declaration, scopes the plugin's own rules to their media condition,
and treats an empty stylesheet as missing
---
.github/unraid-watch/css.py | 25 ++++++++++++++++++-------
.github/unraid-watch/test_css.py | 15 ++++++++++++++-
.github/unraid-watch/test_status.py | 6 ++++++
.github/unraid-watch/upstream.py | 3 ++-
.github/unraid-watch/world.py | 2 +-
5 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/.github/unraid-watch/css.py b/.github/unraid-watch/css.py
index e2de36bb..b97ef283 100644
--- a/.github/unraid-watch/css.py
+++ b/.github/unraid-watch/css.py
@@ -80,13 +80,19 @@ def _parts(body):
return items + [(None, body[start:])]
+def _set(decls, name, value):
+ """A later declaration wins, except over an !important one that it is not itself."""
+ if not (decls.get(name, '').endswith('!important') and not value.endswith('!important')):
+ decls[name] = value
+
+
def _declarations(text):
decls = {}
for part in _split(text, ';'):
name, colon, value = part.partition(':')
if colon and name.strip() and not name.strip().startswith('@'):
# `4px!important` and `4px !important` are the same value
- decls[name.strip().lower()] = ' '.join(re.sub(r'\s*!\s*important\b', ' !important', value).split())
+ _set(decls, name.strip().lower(), ' '.join(re.sub(r'\s*!\s*important\b', ' !important', value).split()))
return decls
@@ -121,31 +127,36 @@ def subject(selector):
def styled(texts):
- """{id or class: properties FolderView3 sets on elements that carry it} from FolderView3's own stylesheets."""
+ """{id or class: {(at-rule conditions, property)} FolderView3 sets on elements that carry it} from its own stylesheets."""
out = {}
for text in texts:
- for _, selector, decls in rules(text):
+ for conditions, selector, decls in rules(text):
for token in subject(selector):
- out.setdefault(token, set()).update(decls)
+ out.setdefault(token, set()).update((conditions, name) for name in decls)
return out
def merged(texts):
- """{(at-rule conditions, selector, property): value} for stylesheets in load order: a later one wins."""
+ """{(at-rule conditions, selector, property): value} for stylesheets in load order: a later one wins, !important aside."""
out = {}
for text in texts:
for conditions, selector, decls in rules(text):
for name, value in decls.items():
- out[(conditions, selector, name)] = value
+ _set(out, (conditions, selector, name), value)
return out
+def _covers(ours, token, conditions, name):
+ # The plugin's own rule for this property covers Unraid's when it holds everywhere, or under the same condition
+ return ('', name) in ours[token] or (conditions, name) in ours[token]
+
+
def changes(by_ref, refs, ours):
"""[(conditions, selector, property, [(ref, value)])]: layout Unraid changed on elements FolderView3 styles but does not set."""
out = []
for conditions, selector, name in sorted(set().union(*(by_ref[r] for r in refs))):
tokens = [t for t in subject(selector) if t in ours]
- if name not in LAYOUT or not tokens or any(name in ours[t] for t in tokens):
+ if name not in LAYOUT or not tokens or any(_covers(ours, t, conditions, name) for t in tokens):
continue
values = [(ref, by_ref[ref].get((conditions, selector, name))) for ref in refs]
if len({v for _, v in values}) > 1:
diff --git a/.github/unraid-watch/test_css.py b/.github/unraid-watch/test_css.py
index 3f2742b2..4cc17d0e 100644
--- a/.github/unraid-watch/test_css.py
+++ b/.github/unraid-watch/test_css.py
@@ -58,7 +58,7 @@ def test_the_styled_element_is_the_last_compound_without_what_not_names(self):
class ChangesTest(unittest.TestCase):
- OURS = {'.tip': {'color'}, '.row': {'white-space'}}
+ OURS = {'.tip': {('', 'color')}, '.row': {('', 'white-space')}}
def by_ref(self, old, new):
return {'9.0.0': css.merged([old]), 'master': css.merged([new])}
@@ -77,6 +77,19 @@ def test_what_the_plugin_sets_itself_colours_and_elements_it_does_not_style_are_
def test_a_later_stylesheet_wins_as_the_page_loads_them(self):
self.assertEqual(css.merged(['.tip { top: 1px }', '.tip { top: 2px }']), {('', '.tip', 'top'): '2px'})
+ def test_an_important_declaration_is_not_overwritten_by_a_plain_one(self):
+ self.assertEqual(css.merged(['.tip { top: 1px !important }', '.tip { top: 2px }']), {('', '.tip', 'top'): '1px !important'})
+ self.assertEqual(css.rules('.tip { top: 1px !important; top: 2px }'), [('', '.tip', {'top': '1px !important'})])
+ self.assertEqual(css.merged(['.tip { top: 1px !important }', '.tip { top: 3px !important }']), {('', '.tip', 'top'): '3px !important'})
+
+ def test_the_plugin_setting_a_property_under_a_condition_covers_only_that_condition(self):
+ ours = css.styled(['@media (max-width: 600px) { .tip { white-space: normal } }'])
+ by_ref = {'9.0.0': css.merged(['.tip { white-space: nowrap }']), 'master': css.merged(['.tip { white-space: pre-line }'])}
+ self.assertEqual([r[2] for r in css.changes(by_ref, ['9.0.0', 'master'], ours)], ['white-space'])
+ same = {'9.0.0': css.merged(['@media (max-width: 600px) { .tip { white-space: nowrap } }']),
+ 'master': css.merged(['@media (max-width: 600px) { .tip { white-space: pre-line } }'])}
+ self.assertEqual(css.changes(same, ['9.0.0', 'master'], ours), [])
+
class FallbacksTest(unittest.TestCase):
def check(self, sheet, code=''):
diff --git a/.github/unraid-watch/test_status.py b/.github/unraid-watch/test_status.py
index ffc6a86e..d4ef3ff2 100644
--- a/.github/unraid-watch/test_status.py
+++ b/.github/unraid-watch/test_status.py
@@ -167,6 +167,12 @@ def test_a_listed_stylesheet_no_release_has_is_named(self):
body = report.render_status(status.gather(self.w.client(), cfg, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
self.assertIn('Listed in watch.json but on no release: `css/typo-azure.css`, `css/typo-black.css`.', body)
+ def test_an_empty_stylesheet_counts_as_missing_not_as_no_change(self):
+ self.w.release_line()
+ self.w.blob(WEB, 'old0', ' \n')
+ body = report.render_status(status.gather(self.w.client(), CFG, OPS, {API: {}, WEB: {}, DOCS: {}}, NEW, self.local()))
+ self.assertIn('Listed in watch.json but on no release: `css/old-black.css`.', body)
+
def test_one_themes_file_missing_on_every_release_is_named_though_another_theme_has_it(self):
self.w.release_line()
self.w.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1'})
diff --git a/.github/unraid-watch/upstream.py b/.github/unraid-watch/upstream.py
index 660b62ac..bca34aa6 100644
--- a/.github/unraid-watch/upstream.py
+++ b/.github/unraid-watch/upstream.py
@@ -113,7 +113,8 @@ def stylesheets(gh, src, refs, ours, pinned):
texts = []
for path in (p.format(theme=theme) for p in styles['files']):
text = text_at(gh, src['repo'], pinned.get(ref, ref), path)
- if text is not None:
+ # An empty file is no input either: a theme of empty files must not read as "no change"
+ if text and text.strip():
texts.append(text)
seen.add(path)
by_ref[ref] = css.merged(texts)
diff --git a/.github/unraid-watch/world.py b/.github/unraid-watch/world.py
index 9a56d979..35ba1b1e 100644
--- a/.github/unraid-watch/world.py
+++ b/.github/unraid-watch/world.py
@@ -188,7 +188,7 @@ def release_line(self):
self.tags(WEB, ['9.1.0-beta.2', '9.0.3', '8.9.0', '2030.11.10'])
self.tree(WEB, '9.0.3', {EVENTS: 'ev1', 'css/old-azure.css': 'old1', 'css/old-black.css': 'old0'})
self.blob(WEB, 'old1', '.tip { display: block; color: blue; }\n')
- self.blob(WEB, 'old0', '')
+ self.blob(WEB, 'old0', '.other { top: 0; }\n')
self.fake.routes['GET', url(f'/repos/{API}/commits', page=1, path='api/switch.ts', per_page=100,
sha=NEW[API])] = [commit(50, 'feat: enable the new page', '2030-01-03T00:00:00Z')]
From ae7ff678e4161d491be83a67c0ce862abe7fcc6f Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 12:33:11 +0800
Subject: [PATCH 13/72] fix: the element a selector styles is found past guards
nested in :where(:not(...)), as Unraid 7.4 writes them
---
.github/unraid-watch/css.py | 6 +++++-
.github/unraid-watch/test_css.py | 4 ++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/.github/unraid-watch/css.py b/.github/unraid-watch/css.py
index b97ef283..6a78a3eb 100644
--- a/.github/unraid-watch/css.py
+++ b/.github/unraid-watch/css.py
@@ -122,7 +122,11 @@ def rules(text):
def subject(selector):
"""The ids and classes of the element a selector styles; none for a ::before box, nothing an attribute value or :not() names."""
- last = re.split(r'[\s>+~]+', re.sub(r'\([^()]*\)|\[[^\]]*\]', '', selector).strip())[-1]
+ # Innermost first, until none is left: 7.4 wraps its guards as :where(:not(.unapi *))
+ bare, previous = re.sub(r'\[[^\]]*\]', '', selector), None
+ while bare != previous:
+ bare, previous = re.sub(r'\([^()]*\)', '', bare), bare
+ last = re.split(r'[\s>+~]+', bare.strip())[-1]
return [] if '::' in last else TOKEN.findall(last)
diff --git a/.github/unraid-watch/test_css.py b/.github/unraid-watch/test_css.py
index 4cc17d0e..bf8574a8 100644
--- a/.github/unraid-watch/test_css.py
+++ b/.github/unraid-watch/test_css.py
@@ -39,6 +39,10 @@ def test_spacing_and_attribute_quotes_do_not_make_a_rule_new(self):
self.assertEqual(a, b)
self.assertIn(('@media (max-width: 9px)', '.y', 'top'), a)
+ def test_a_guard_nested_in_where_and_not_leaves_the_element_it_styles(self):
+ self.assertEqual(css.subject('a.button:where(:not(.ext *))'), ['.button'])
+ self.assertEqual(css.subject('.box:where(:not(:is(.a .b) .c))'), ['.box'])
+
def test_a_generated_box_or_an_attribute_value_is_not_the_element(self):
self.assertEqual(css.subject('.tip::before'), [])
self.assertEqual(css.subject('a[href$=".png"]'), [])
From 69ca571d523455b54b73f3a967fe75cf3a597e4d Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 13:23:19 +0800
Subject: [PATCH 14/72] fix: a group rule written @media(...) with no space is
read, and code that only reads a CSS variable no longer counts as defining it
---
.github/unraid-watch/css.py | 9 +++++----
.github/unraid-watch/test_css.py | 8 ++++++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/.github/unraid-watch/css.py b/.github/unraid-watch/css.py
index 6a78a3eb..a0e08f48 100644
--- a/.github/unraid-watch/css.py
+++ b/.github/unraid-watch/css.py
@@ -104,7 +104,8 @@ def _walk(body, conditions, parents, out):
out += [(conditions, parent, decls) for parent in parents if decls]
continue
if head.startswith('@'):
- if head.split(None, 1)[0].lower() in GROUPS:
+ # `@media(max-width:600px)` needs no space after the keyword
+ if re.match(r'@[\w-]+', head).group(0).lower() in GROUPS:
_walk(block, ' '.join(filter(None, (conditions, _condition(head)))), parents, out)
continue
selectors = [_selector(s) for s in _split(head, ',') if s.strip()]
@@ -175,9 +176,9 @@ def fallbacks(stylesheets, code):
named = '\n'.join(f.read_text(encoding='utf-8') for f in code)
def keyed(name):
- # The CSS tool's presets ('fv3-x': '#fff') and the generated theme CSS ('x' => '#fff') key the plugin's own variables
- bare = re.escape(name[2:])
- return re.search(r"['\"]--" + bare + r"['\"]|['\"]" + bare + r"['\"]\s*(?::|=>)", named)
+ # The CSS tool's presets ('fv3-x': '#fff') and the generated theme CSS ('x' => '#fff') key the plugin's own variables;
+ # a name that is only read (getPropertyValue('--x')) is not defined by that
+ return re.search(r"['\"](?:--)?" + re.escape(name[2:]) + r"['\"]\s*(?::|=>)", named)
return [f'{f.name}:{text.count(chr(10), 0, m.start()) + 1}: var({m.group(1)}) has no fallback and FolderView3 does not '
f'define {m.group(1)}, so the style needs every Unraid release to; give it a fallback'
for f, text in texts.items() for m in VAR.finditer(text)
diff --git a/.github/unraid-watch/test_css.py b/.github/unraid-watch/test_css.py
index bf8574a8..b1455670 100644
--- a/.github/unraid-watch/test_css.py
+++ b/.github/unraid-watch/test_css.py
@@ -47,6 +47,10 @@ def test_a_generated_box_or_an_attribute_value_is_not_the_element(self):
self.assertEqual(css.subject('.tip::before'), [])
self.assertEqual(css.subject('a[href$=".png"]'), [])
+ def test_a_group_rule_with_no_space_after_its_keyword_is_still_read(self):
+ self.assertEqual(css.rules('@media(max-width:600px){.tip{white-space:pre-line}} @supports(display:grid){.row{top:0}}'),
+ [('@media (max-width: 600px)', '.tip', {'white-space': 'pre-line'}), ('@supports (display: grid)', '.row', {'top': '0'})])
+
def test_a_comma_inside_not_stays_in_its_selector(self):
self.assertEqual(css.rules('.x:not(.p, .q), .z { display: none }'),
[('', '.x:not(.p, .q)', {'display': 'none'}), ('', '.z', {'display': 'none'})])
@@ -118,6 +122,10 @@ def test_a_word_the_code_merely_uses_does_not_make_an_unraid_variable_the_plugin
(problem,) = self.check('.a { color: var(--text); }', "fields.push({ type: 'text', label: 'Name' });")
self.assertIn('var(--text) has no fallback', problem)
+ def test_code_that_only_reads_a_variable_does_not_define_it(self):
+ (problem,) = self.check('.a { color: var(--text); }', "getComputedStyle(document.body).getPropertyValue('--text');")
+ self.assertIn('var(--text) has no fallback', problem)
+
def test_a_variable_nested_in_a_fallback_needs_its_own(self):
(problem,) = self.check('.a { color: var(--fv3-x, var(--text)); }', "'fv3-x'")
self.assertIn('var(--text) has no fallback', problem)
From d12e46202cdd0a84675f887615b93a3e8ad8623c Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 14:35:20 +0800
Subject: [PATCH 15/72] docs: beta release notes
Release-Synced: 43c85d1a8c8e651a70167992a1838043f6b047e9
---
CHANGELOG.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 23e5095e..39d8a323 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,9 +4,7 @@ After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache
## Unreleased
-- refactor: the folder-file code moves from lib.php to lib.folders.php
-- fix: a success with an error field stays a success, a null answer is a failure; the API-first path and raw VM fixtures are tested
-- fix: a folder action Unraid refuses shows Unraid's reason, not its JSON answer
+- Folder actions that Unraid refuses now show its reason instead of raw JSON
## 2026.11.14.1 (beta)
From eb1784887edda88c0cca6f4f2cedb18af780619b Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 14:38:39 +0800
Subject: [PATCH 16/72] chore(release): v2026.11.14.2 [skip ci]
---
CHANGELOG.md | 2 +-
folder.view3.plg | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 39d8a323..986a6f98 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache if the page doesn't display correctly — before submitting a debug .json.
-## Unreleased
+## 2026.11.14.2 (beta)
- Folder actions that Unraid refuses now show its reason instead of raw JSON
diff --git a/folder.view3.plg b/folder.view3.plg
index 9229f27d..572bfdcf 100644
--- a/folder.view3.plg
+++ b/folder.view3.plg
@@ -6,8 +6,8 @@
-
-
+
+
]>
@@ -16,6 +16,9 @@
After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache if the page doesn't display correctly — before submitting a debug .json.
+###2026.11.14.2
+- Folder actions that Unraid refuses now show its reason instead of raw JSON
+
###2026.11.14.1
- Folder saves from two tabs, or made at once, no longer overwrite each other
- Apply Defaults accepts only valid values for each setting
From 16806a0b9c69c374677efdc8b2632d8f829a9a6d Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 16:27:48 +0800
Subject: [PATCH 17/72] fix: a failed update no longer deletes the package
archive the installed version boots from
---
folder.view3.plg | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/folder.view3.plg b/folder.view3.plg
index 572bfdcf..b907aafb 100644
--- a/folder.view3.plg
+++ b/folder.view3.plg
@@ -857,12 +857,6 @@ After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache
- Initial Release
-
-
- rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null | grep -v '&pkgname;')
-
-
-
https://github.com/&github;/releases/download/v&version;/&pkgname;.txz
@@ -872,6 +866,8 @@ After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache
+ # Only once the new package is in: a failed download or upgradepkg keeps the archive the next boot installs from
+ rm -f $(ls /boot/config/plugins/&name;/&name;*.txz 2>/dev/null | grep -v '&pkgname;')
for p in /var/log/packages/&name;-*; do
[ -e "$p" ] || continue
case "$(basename "$p")" in &pkgname;) continue;; esac
From ce2b14939f33dc5ecf17a680989eca338465df68 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 16:27:48 +0800
Subject: [PATCH 18/72] ci: FolderView3 goes through each supported Unraid's
own plugin installer, its PHP tests run on PHP 8.3 to 8.5, and every
!important needs its reason
---
.coderabbit.yaml | 14 ++
.github/scripts/important_check.py | 81 +++++++++++
.github/scripts/important_check_test.py | 60 ++++++++
.github/unraid-compat/Dockerfile | 4 +
.github/unraid-compat/install_test.sh | 130 ++++++++++++++++++
.github/unraid-compat/php_tests.sh | 27 ++++
.github/workflows/ci.yml | 125 +++++++++++++----
renovate.json | 31 +++++
.../plugins/folder.view3/scripts/shared.js | 1 +
9 files changed, 448 insertions(+), 25 deletions(-)
create mode 100644 .github/scripts/important_check.py
create mode 100644 .github/scripts/important_check_test.py
create mode 100644 .github/unraid-compat/Dockerfile
create mode 100755 .github/unraid-compat/install_test.sh
create mode 100755 .github/unraid-compat/php_tests.sh
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 24006ece..63c9df1f 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -206,6 +206,20 @@ reviews:
GraphQL checks in schema.py; flag a second copy of either.
- TESTS use synthetic versions, shas and handles only; a value captured
from a live system in a fixture is a finding.
+ - path: ".github/unraid-compat/**"
+ instructions: |
+ The Unraid compatibility matrix; CI only, nothing here ships.
+ - install_test.sh puts the .plg through each Unraid version's own
+ plugin installer in a throwaway container with no network. Only
+ Slackware's upgradepkg and removepkg are stubbed: flag any other
+ stand-in for Unraid's code. It must refuse to run on a real server.
+ - Each step asserts what the user is left with (live files, the
+ registered manifest, saved folders, Unraid's orders) right after it,
+ against values written by hand. A failed step fails the job.
+ - php_tests.sh is the one list of PHP checks for Lint + build and the
+ PHP matrix: php -l on every .php and .page file, then every
+ .github/scripts/*_test.php; a deprecation fails like an error.
+ - Fixtures hold synthetic names and ids only.
- path: ".github/scripts/**"
instructions: |
CI tests and helpers; nothing here ships in the plugin.
diff --git a/.github/scripts/important_check.py b/.github/scripts/important_check.py
new file mode 100644
index 00000000..0b1ca939
--- /dev/null
+++ b/.github/scripts/important_check.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python3
+"""Each !important in the plugin's own CSS, JS, PHP and .page files needs a `!important: ` comment: on its line,
+on the line above it, or (CSS) directly above its rule. Bundled libraries listed in vendor.json are skipped."""
+import json
+import pathlib
+import re
+import sys
+
+REASON = re.compile(r'!important:\s*\w')
+KINDS = {'.css': 'css', '.js': 'script', '.php': 'script', '.page': 'script'}
+
+
+def scan(text, kind):
+ """(code, comments): the text with comments and strings blanked, and [(start, end, comment text)]."""
+ code, comments, i, n = list(text), [], 0, len(text)
+ while i < n:
+ c, two = text[i], text[i:i + 2]
+ if two == '/*' or (two == '//' and kind == 'script'):
+ end = text.find('*/', i + 2) + 2 if two == '/*' else text.find('\n', i)
+ end = n if end < 2 or end == -1 else end
+ comments.append((i, end, text[i:end]))
+ code[i:end] = [ch if ch == '\n' else ' ' for ch in text[i:end]]
+ i = end
+ elif c in '"\'' or (c == '`' and kind == 'script'):
+ j = i + 1
+ while j < n and text[j] != c and text[j] != '\n':
+ j += 2 if text[j] == '\\' else 1
+ # A script's string is where inline styles live: keep it as code; a CSS string (content: "...") is text
+ if kind == 'css':
+ code[i:j + 1] = [ch if ch == '\n' else ' ' for ch in text[i:j + 1]]
+ i = j + 1
+ else:
+ i += 1
+ return ''.join(code), comments
+
+
+def _line(text, at):
+ return text.count('\n', 0, at)
+
+
+def _reason_ends_on(comments, text, line):
+ return any(REASON.search(body) and _line(text, end - 1) == line for start, end, body in comments)
+
+
+def _rule_start(code, at):
+ """Where the selector of the rule holding the declaration at `at` begins."""
+ opened = code.rfind('{', 0, at)
+ before = max(code.rfind(ch, 0, opened) for ch in '{};')
+ return before + 1 + (len(code[before + 1:opened]) - len(code[before + 1:opened].lstrip()))
+
+
+def problems_in(path, text, kind):
+ code, comments = scan(text, kind)
+ out = []
+ for m in re.finditer(r'!\s*important\b', code):
+ line = _line(text, m.start())
+ ok = _reason_ends_on(comments, text, line) or _reason_ends_on(comments, text, line - 1)
+ if not ok and kind == 'css':
+ start = _rule_start(code, m.start())
+ ok = _reason_ends_on(comments, text, _line(text, start) - 1) or _reason_ends_on(comments, text, _line(text, start))
+ if not ok:
+ out.append(f'{path}:{line + 1}: !important without a "!important: " comment on its line, the line above, or above its rule')
+ return out
+
+
+def problems(repo):
+ manifest = json.loads((repo / 'vendor.json').read_text(encoding='utf-8'))
+ root = repo / manifest['root']
+ bundled = {(root / dest).resolve() for lib in manifest['libraries'] for dest in lib['files'].values()}
+ out = []
+ for path in sorted(root.rglob('*')):
+ kind = KINDS.get(path.suffix)
+ if kind and path.is_file() and path.resolve() not in bundled:
+ out += problems_in(path.relative_to(repo), path.read_text(encoding='utf-8'), kind)
+ return out
+
+
+if __name__ == '__main__':
+ found = problems(pathlib.Path(__file__).resolve().parents[2])
+ print('\n'.join(found) or 'Every !important has its reason')
+ sys.exit(1 if found else 0)
diff --git a/.github/scripts/important_check_test.py b/.github/scripts/important_check_test.py
new file mode 100644
index 00000000..9f9b195f
--- /dev/null
+++ b/.github/scripts/important_check_test.py
@@ -0,0 +1,60 @@
+import json
+import pathlib
+import tempfile
+import unittest
+
+import important_check
+
+ROOT = 'src/plugin'
+
+
+class ImportantCheckTest(unittest.TestCase):
+ def check(self, files, bundled=()):
+ tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(tmp.cleanup)
+ repo = pathlib.Path(tmp.name)
+ (repo / 'vendor.json').write_text(json.dumps({'root': ROOT, 'libraries': [{'files': {f'x/{b}': b for b in bundled}}]}), encoding='utf-8')
+ for name, text in files.items():
+ (repo / ROOT / name).parent.mkdir(parents=True, exist_ok=True)
+ (repo / ROOT / name).write_text(text, encoding='utf-8')
+ return important_check.problems(repo)
+
+ def test_a_reason_above_the_rule_or_on_the_line_passes(self):
+ sheet = ('.a { top: 0 }\n\n/* !important: Unraid inlines this padding */\n#t .x,\n#t .y {\n padding-left: 20px !important;\n}\n'
+ '.b { margin: 0 !important; /* !important: a theme sets it inline */ }\n')
+ self.assertEqual(self.check({'styles/a.css': sheet}), [])
+
+ def test_an_important_without_its_reason_is_named_with_its_line(self):
+ sheet = '/* spacing */\n.a {\n top: 0;\n left: 1px!important;\n}\n'
+ self.assertEqual(self.check({'styles/a.css': sheet}),
+ [f'{ROOT}/styles/a.css:4: !important without a "!important: " comment on its line, the line above, or above its rule'])
+
+ def test_a_reason_belongs_to_the_rule_under_it_only(self):
+ sheet = '/* !important: first */\n.a { top: 0 !important }\n.b { top: 0 !important }\n'
+ (problem,) = self.check({'styles/a.css': sheet})
+ self.assertIn('a.css:3:', problem)
+
+ def test_a_reason_comment_must_give_a_reason(self):
+ self.assertEqual(len(self.check({'styles/a.css': '/* !important: */\n.a { top: 0 !important }\n'})), 1)
+
+ def test_a_comment_or_a_content_string_that_mentions_it_is_not_a_use(self):
+ sheet = '/* never use !important here */\n.a::after { content: "!important"; }\n'
+ self.assertEqual(self.check({'styles/a.css': sheet}), [])
+
+ def test_a_script_needs_the_reason_on_its_line_or_the_line_above(self):
+ good = "// beats swal's !important rules\n// !important: no stylesheet may show a row while it is measured\nrow.style.cssText += ';visibility:hidden !important;';\n"
+ bad = "// hide the row\nrow.style.cssText += ';visibility:hidden !important;';\n"
+ self.assertEqual(self.check({'scripts/a.js': good}), [])
+ (problem,) = self.check({'scripts/b.js': bad})
+ self.assertIn('scripts/b.js:2:', problem)
+
+ def test_page_and_php_files_are_checked_too(self):
+ found = self.check({'Folder.page': 'Menu="x"\n---\n\n', 'server/a.php': "
+set -u
+# This replaces plugin files and system tools, so it must never touch a real server.
+if [ -e /etc/unraid-version ] || [ -d /boot/config ]; then echo 'Refusing to run on an Unraid system' >&2; exit 2; fi
+web=$(cd "$1" && pwd); version=$2; stable=$(cd "$3" && pwd); repo=$(pwd)
+fail() { echo "FAILED [Unraid $version]: $*"; exit 1; }
+awk --version 2>/dev/null | grep -q 'GNU Awk' || fail 'awk is not gawk, as it is on Unraid: the remove script needs RT'
+
+name=folder.view3
+docroot=/usr/local/emhttp
+flash=/boot/config/plugins/$name
+live=$docroot/plugins/$name
+manifest=/boot/config/plugins/$name.plg
+mkdir -p "$docroot/plugins" /boot/config/plugins-error /var/log/plugins /var/log/packages /var/local/emhttp
+cp -R "$web/emhttp/plugins/dynamix" "$web/emhttp/plugins/dynamix.plugin.manager" "$docroot/plugins/"
+ln -sfn "$docroot/plugins/dynamix" "$docroot/webGui"
+printf 'csrf_token="compat-test-token"\n' > /var/local/emhttp/var.ini
+# The hooks check every installed plugin through Unraid's php at /usr/bin/php; this container has only this one
+rm -rf "$docroot/plugins/dynamix.plugin.manager/pre-hooks" "$docroot/plugins/dynamix.plugin.manager/post-hooks"
+ln -sf "$(command -v php)" /usr/bin/php
+plugin() { php "$docroot/plugins/dynamix.plugin.manager/scripts/plugin" "$@"; }
+
+# Slackware's package tools; everything else is Unraid's own code
+cat > /sbin/upgradepkg <<'STUB'
+#!/bin/bash
+for pkg; do :; done
+tar -xJf "$pkg" -C / || exit 1
+touch "/var/log/packages/$(basename "$pkg" .txz)"
+STUB
+cat > /sbin/removepkg <<'STUB'
+#!/bin/bash
+rm -rf /usr/local/emhttp/plugins/folder.view3
+rm -f "/var/log/packages/$1"
+STUB
+chmod +x /sbin/upgradepkg /sbin/removepkg
+
+work=$(mktemp -d)
+build() { # build : the .plg and package as the release workflow makes them
+ local dir="$work/$2"; mkdir -p "$dir"; cp -R "$1/src" "$1/$name.plg" "$1/pkg_build.sh" "$dir/"
+ (cd "$dir" && bash pkg_build.sh --version "$2" --branch "$3" --out "$dir/dist" >/dev/null) || fail "package build of $2"
+}
+old=2026.01.01; new=2099.01.01
+build "$stable" $old main; build "$repo" $new beta
+min=$(grep -o ']*min="[^"]*"' "$work/$new/$name.plg" | sed 's/.*min="//; s/"$//')
+[ -n "$min" ] || fail 'the .plg names no min version'
+
+set_version() { printf 'version="%s"\n' "$1" > /etc/unraid-version; }
+reset() {
+ rm -rf "$flash" "$live" "$manifest" /var/log/plugins/$name.plg /var/log/packages/$name-* /boot/config/plugins/dockerMan /boot/config/plugins/dynamix.vm.manager
+ mkdir -p "$flash"
+}
+install() { # install : the .plg with its package already on the flash, as a boot or a cached download has it
+ cp "$work/$1/dist/$name-$1-x86_64-1.txz" "$flash/"
+ plugin install "$work/$1/$name.plg" > "$work/$2.log" 2>&1 || { cat "$work/$2.log"; fail "$2: install of $1 refused"; }
+}
+installed() { # installed : its files are live, its package is recorded and its manifest registered
+ local pkg=$name-$1-x86_64-1 x=$work/unpacked
+ rm -rf "$x" && mkdir "$x" && tar -xJf "$work/$1/dist/$pkg.txz" -C "$x" || fail "$2: unpack $1"
+ local differ; differ=$(cd "$x" && find . -type f | while read -r f; do cmp -s "$f" "/$f" || echo "${f#.}"; done)
+ [ -z "$differ" ] || fail "$2: files not as $1 ships them: $(echo $differ | head -c 300)"
+ [ -e "/var/log/packages/$pkg" ] || fail "$2: no package record for $1"
+ [ -L /var/log/plugins/$name.plg ] && grep -q "ENTITY version \"$1\"" "$manifest" || fail "$2: $1 is not the registered manifest"
+}
+saved_config() { # what a user has saved: folders, settings, a theme, and Unraid's own orders holding folder entries
+ mkdir -p "$flash/styles" "$flash/scripts" /boot/config/plugins/dockerMan /boot/config/plugins/dynamix.vm.manager
+ printf '{"AbCdEfGhIjKlMnOpQrSt":{"name":"Media","icon":"","regex":"","containers":["alpha"],"settings":{"preview":1},"actions":[]}}' > "$flash/docker.json"
+ printf '{"ZyXwVuTsRqPoNmLkJiHg":{"name":"Lab","icon":"","regex":"","containers":["Debian 12"],"settings":{"preview":1},"actions":[]}}' > "$flash/vm.json"
+ printf '{"docker":{"preview":1}}' > "$flash/settings.json"
+ printf '.folder-appname { color: #abc; }\n' > "$flash/styles/custom.css"
+ # folder-sync and folder-nightlybackups are containers: too short, or no capital as a folder id has
+ printf '0="folder-AbCdEfGhIjKlMnOpQrSt"\n1="alpha"\n2="folder-sync"\n3="folder-nightlybackups"\n4="beta"\n' > /boot/config/plugins/dockerMan/userprefs.cfg
+ printf '0="folder-ZyXwVuTsRqPoNmLkJiHg"\r\n1="Debian 12"\r\n2="Windows"' > /boot/config/plugins/dynamix.vm.manager/userprefs.cfg
+}
+config_sums() { (cd /boot/config/plugins && find $name dockerMan dynamix.vm.manager -type f ! -name "$name-*.txz" ! -path "$name/version" -print0 | sort -z | xargs -0 md5sum); }
+set_version "$version"
+
+# A fresh install
+reset; install $new fresh; installed $new fresh
+[ "$(cat "$flash/version")" = $new ] || fail 'fresh: version file not written'
+[ -d "$flash/styles" ] && [ -d "$flash/scripts" ] || fail 'fresh: styles and scripts folders not made'
+
+# An upgrade over the last stable keeps what the user saved, byte for byte, and drops the previous package
+reset; install $old stable; installed $old stable; saved_config; before=$(config_sums)
+install $new upgrade; installed $new upgrade
+[ "$(config_sums)" = "$before" ] || fail 'upgrade: saved folders, settings, theme or Unraid orders changed'
+[ ! -e "$flash/$name-$old-x86_64-1.txz" ] || fail 'upgrade: previous archive left on the flash'
+[ ! -e "/var/log/packages/$name-$old-x86_64-1" ] || fail 'upgrade: previous package record left'
+
+# What a reboot does: the registered manifest installs again from the archive on the flash
+rm -f /var/log/plugins/$name.plg
+plugin install "$manifest" > "$work/boot.log" 2>&1 || { cat "$work/boot.log"; fail 'boot: reinstall refused'; }
+installed $new boot
+
+# Removal leaves nothing, and takes only FolderView3's own entries out of Unraid's orders, line endings kept
+plugin remove $name.plg > "$work/remove.log" 2>&1 || { cat "$work/remove.log"; fail 'remove: refused'; }
+[ ! -e "$live" ] && [ ! -e "$flash" ] && [ ! -e /var/log/plugins/$name.plg ] && [ ! -e "$manifest" ] || fail 'remove: files left behind'
+ls /var/log/packages/$name-* >/dev/null 2>&1 && fail 'remove: package record left'
+cmp -s /boot/config/plugins/dockerMan/userprefs.cfg <(printf '0="alpha"\n1="folder-sync"\n2="folder-nightlybackups"\n3="beta"\n') \
+ || fail "remove: Docker order not as expected: $(od -c /boot/config/plugins/dockerMan/userprefs.cfg | head -5)"
+cmp -s /boot/config/plugins/dynamix.vm.manager/userprefs.cfg <(printf '0="Debian 12"\r\n1="Windows"') \
+ || fail "remove: VM order not as expected: $(od -c /boot/config/plugins/dynamix.vm.manager/userprefs.cfg | head -5)"
+
+# A download that fails (no network here) leaves the running install and what the user saved
+reset; install $old stable2; saved_config; before=$(config_sums)
+plugin install "$work/$new/$name.plg" > "$work/download.log" 2>&1 && fail 'download: install reported success without its package'
+installed $old download
+[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'download: deleted the archive the next boot installs from'
+[ "$(config_sums)" = "$before" ] || fail 'download: saved files changed'
+
+# A failed upgradepkg does the same
+reset; install $old stable3; saved_config; before=$(config_sums)
+cp "$work/$new/dist/$name-$new-x86_64-1.txz" "$flash/"
+mv /sbin/upgradepkg "$work/upgradepkg"; printf '#!/bin/bash\nexit 1\n' > /sbin/upgradepkg; chmod +x /sbin/upgradepkg
+plugin install "$work/$new/$name.plg" > "$work/upgradepkg.log" 2>&1; status=$?
+mv "$work/upgradepkg" /sbin/upgradepkg
+[ $status -ne 0 ] || fail 'upgradepkg: install reported success though upgradepkg failed'
+installed $old upgradepkg
+[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'upgradepkg: deleted the archive the next boot installs from'
+[ "$(config_sums)" = "$before" ] || fail 'upgradepkg: saved files changed'
+
+# The installer itself refuses an Unraid below the .plg's min, and says why
+reset; set_version 6.12.15; cp "$work/$new/dist/$name-$new-x86_64-1.txz" "$flash/"
+plugin install "$work/$new/$name.plg" > "$work/min.log" 2>&1 && fail "min: installed on 6.12.15 though min is $min"
+grep -q "installed Unraid version is too low, require at least version $min" "$work/min.log" || { cat "$work/min.log"; fail 'min: no reason given'; }
+[ ! -e "$live" ] || fail 'min: files installed below min'
+set_version "$version"
+
+echo "Unraid $version: install, upgrade, boot, remove, failed download, failed upgradepkg and min passed"
diff --git a/.github/unraid-compat/php_tests.sh b/.github/unraid-compat/php_tests.sh
new file mode 100755
index 00000000..5ea8f42a
--- /dev/null
+++ b/.github/unraid-compat/php_tests.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# php -l over every plugin .php and .page file, then every .github/scripts/*_test.php, with every error level on.
+# A deprecation fails like an error, so a PHP that Unraid has not shipped yet shows what FolderView3 must change.
+set -u
+cd "$(dirname "$0")/../.." || exit 2
+status=0
+errors=$(mktemp)
+trap 'rm -f "$errors"' EXIT
+php -v | head -1
+
+while IFS= read -r -d '' f; do
+ if ! out=$(php -d error_reporting=-1 -l "$f" 2>&1) || grep -q 'Deprecated:' <<<"$out"; then
+ echo "$out"
+ status=1
+ fi
+done < <(find src \( -name '*.php' -o -name '*.page' \) -print0)
+
+for t in .github/scripts/*_test.php; do
+ echo "== $t"
+ php -d error_reporting=-1 -d display_errors=stderr -d log_errors=0 "$t" 2>"$errors" || status=1
+ cat "$errors" >&2
+ if grep -q 'Deprecated:' "$errors"; then
+ echo "FAILED: $t ran into a deprecation"
+ status=1
+ fi
+done
+exit $status
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0d682578..7688915c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,33 +31,18 @@ jobs:
- name: Install tools
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libxml2-utils
- - name: PHP syntax check
- run: |
- status=0
- while IFS= read -r f; do
- php -l "$f" || status=1
- done < <(find src -name '*.php')
- exit $status
-
- - name: Update status test
- run: php .github/scripts/update_status_test.php
-
- - name: FolderView Plus import tests
- run: php .github/scripts/foreign_import_test.php
+ # php -l on every .php and .page file, then every .github/scripts/*_test.php; a deprecation fails too
+ - name: PHP syntax check and PHP tests
+ run: bash .github/unraid-compat/php_tests.sh
- - name: Autostart order tests
- run: php .github/scripts/page_order_test.php
-
- - name: POST endpoint answer tests
- run: php .github/scripts/post_answers_test.php
-
- - name: Folder file lock tests
- run: php .github/scripts/folder_lock_test.php
+ - name: Every !important has its reason
+ working-directory: .github/scripts
+ run: |
+ python3 -B -m unittest important_check_test
+ python3 -B important_check.py
- name: Variables tab tests
- run: |
- php .github/scripts/variables_tab_test.php
- node .github/scripts/variables_tab_test.js
+ run: node .github/scripts/variables_tab_test.js
- name: Autostart tab tests
run: node .github/scripts/autostart_api_test.js
@@ -146,6 +131,96 @@ jobs:
python -m unittest discover -s .github/unraid-watch -p 'test_*.py'
python .github/unraid-watch/watch.py check
+ php:
+ name: PHP ${{ matrix.php }}
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ # Unraid ships 8.3 up to 7.2.7 and in 7.3.0, 8.4 from 7.2.8, 7.3.1 and 7.4; 8.5 is ahead of every release
+ php: ['8.3', '8.4', '8.5']
+ steps:
+ - name: Checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+
+ - name: PHP syntax check and PHP tests
+ env:
+ PHP_VERSION: ${{ matrix.php }}
+ run: docker run --rm -v "$PWD:/repo" -w /repo "php:${PHP_VERSION}-cli" bash .github/unraid-compat/php_tests.sh
+
+ unraid:
+ name: Unraid ${{ matrix.unraid }}${{ matrix.row && format(' ({0})', matrix.row) || '' }}
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ # The newest release of each minor from the .plg's min, on the PHP that release ships
+ include:
+ - {unraid: '7.0.1', php: '8.3'}
+ - {unraid: '7.1.4', php: '8.3'}
+ - {unraid: '7.2.7', php: '8.3'}
+ - {unraid: '7.3.5', php: '8.4'}
+ # renovate: newest Unraid
+ - {unraid: '7.4.0', php: '8.4'}
+ # renovate: newest Unraid tag, betas included; a beta on a newer PHP needs its php raised by hand
+ - {unraid: '7.4.0', php: '8.4', row: 'newest tag'}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+
+ - name: Checkout the last stable release
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+ ref: main
+ path: .stable
+
+ - name: Checkout the Unraid webGUI at this version
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
+ with:
+ persist-credentials: false
+ repository: unraid/webgui
+ ref: ${{ matrix.unraid }}
+ path: .webgui
+ sparse-checkout: |
+ emhttp/plugins/dynamix
+ emhttp/plugins/dynamix.plugin.manager
+
+ - name: Install, upgrade, remove and failures through Unraid's own plugin installer
+ env:
+ PHP_VERSION: ${{ matrix.php }}
+ UNRAID_VERSION: ${{ matrix.unraid }}
+ run: |
+ docker build -q -t fv3-unraid --build-arg PHP="$PHP_VERSION" .github/unraid-compat
+ docker run --rm --network none -v "$PWD:/repo" -w /repo fv3-unraid bash .github/unraid-compat/install_test.sh .webgui "$UNRAID_VERSION" .stable
+
+ # One check per matrix for beta's branch protection: the version rows rename themselves as Renovate moves them
+ php-compat:
+ name: PHP compatibility
+ needs: php
+ if: always()
+ runs-on: ubuntu-latest
+ steps:
+ - name: Every PHP version passed
+ env:
+ RESULT: ${{ needs.php.result }}
+ run: '[ "$RESULT" = success ]'
+
+ unraid-compat:
+ name: Unraid compatibility
+ needs: unraid
+ if: always()
+ runs-on: ubuntu-latest
+ steps:
+ - name: Every Unraid version passed
+ env:
+ RESULT: ${{ needs.unraid.result }}
+ run: '[ "$RESULT" = success ]'
+
# A dispatched run's checks never reach the PR, so vendor-sync's run reports Lint + build there as a commit status.
report:
needs: validate
@@ -168,7 +243,7 @@ jobs:
gh api "repos/$REPO/statuses/$SHA" -f state="$state" -f context='Lint + build' -f target_url="$RUN_URL" -f description="CI dispatched for this PR: $RESULT" >/dev/null
notify-failure:
- needs: validate
+ needs: [validate, php, unraid]
if: failure() && github.event_name != 'pull_request' && !inputs.base
permissions: {}
uses: chodeus/chodeus-ops/.github/workflows/notify-discord.yml@65484add1113c1bbc00827af7237ebe7a1837bbb # main
diff --git a/renovate.json b/renovate.json
index 42aeef79..c365eefe 100644
--- a/renovate.json
+++ b/renovate.json
@@ -4,6 +4,26 @@
"forkProcessing": "enabled",
"baseBranchPatterns": ["beta"],
"customManagers": [
+ {
+ "customType": "regex",
+ "description": "The newest stable Unraid the CI matrix installs FolderView3 on, so a new release is tested before users reach it.",
+ "managerFilePatterns": ["/^\\.github/workflows/ci\\.yml$/"],
+ "matchStrings": ["# renovate: newest Unraid\\s+- \\{unraid: '(?[^']+)'"],
+ "datasourceTemplate": "github-tags",
+ "depNameTemplate": "unraid/webgui",
+ "depTypeTemplate": "unraid-stable",
+ "versioningTemplate": "semver"
+ },
+ {
+ "customType": "regex",
+ "description": "The newest Unraid tag of any kind, betas and release candidates included, for the matrix's 'newest tag' row.",
+ "managerFilePatterns": ["/^\\.github/workflows/ci\\.yml$/"],
+ "matchStrings": ["# renovate: newest Unraid tag[^\\n]*\\s+- \\{unraid: '(?[^']+)'"],
+ "datasourceTemplate": "github-tags",
+ "depNameTemplate": "unraid/webgui",
+ "depTypeTemplate": "unraid-newest-tag",
+ "versioningTemplate": "semver"
+ },
{
"customType": "regex",
"description": "actionlint's release tag and tarball SHA-256 in validate-workflows.yml; Renovate takes the same asset's hash from the new release.",
@@ -37,6 +57,17 @@
}
],
"packageRules": [
+ {
+ "description": "Unraid releases only: webgui also carries 2014.x date tags, which sort above every 7.x.",
+ "matchDepTypes": ["unraid-stable"],
+ "allowedVersions": "/^\\d{1,2}\\.\\d+\\.\\d+$/"
+ },
+ {
+ "description": "Unraid releases and their betas and release candidates, still without the date tags.",
+ "matchDepTypes": ["unraid-newest-tag"],
+ "allowedVersions": "/^\\d{1,2}\\.\\d+\\.\\d+(-[0-9A-Za-z.]+)?$/",
+ "ignoreUnstable": false
+ },
{
"description": "Bundled libraries ship to users, so their updates are fix(deps).",
"matchDepTypes": ["bundled"],
diff --git a/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js b/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js
index 19411a79..241972b6 100644
--- a/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js
+++ b/src/folder.view3/usr/local/emhttp/plugins/folder.view3/scripts/shared.js
@@ -1912,6 +1912,7 @@ window.fv3InstallDockerTableWidthFix = () => {
if (!storage || !storage.children.length) return;
const children = Array.from(storage.children);
const origStyles = children.map(c => c.getAttribute('style') || '');
+ // !important: an inline !important outranks every stylesheet, so no theme or custom CSS shows a row while it is measured
children.forEach(c => c.style.cssText += ';visibility:hidden !important;');
children.forEach(c => folder.parentNode.insertBefore(c, folder.nextSibling));
void tbl.offsetHeight;
From 4903b3f08798c4291e45862d54d0166b070ce374 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 16:30:27 +0800
Subject: [PATCH 19/72] ci: a dispatched run posts the PHP and Unraid checks on
the PR too, and the PHP runner sits with the tests it runs
---
.coderabbit.yaml | 6 ++---
.../{unraid-compat => scripts}/php_tests.sh | 0
.github/workflows/ci.yml | 25 ++++++++++++-------
3 files changed, 19 insertions(+), 12 deletions(-)
rename .github/{unraid-compat => scripts}/php_tests.sh (100%)
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 63c9df1f..0739a0d5 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -216,9 +216,6 @@ reviews:
- Each step asserts what the user is left with (live files, the
registered manifest, saved folders, Unraid's orders) right after it,
against values written by hand. A failed step fails the job.
- - php_tests.sh is the one list of PHP checks for Lint + build and the
- PHP matrix: php -l on every .php and .page file, then every
- .github/scripts/*_test.php; a deprecation fails like an error.
- Fixtures hold synthetic names and ids only.
- path: ".github/scripts/**"
instructions: |
@@ -238,6 +235,9 @@ reviews:
failed read or download as "nothing to report".
- package.json here is test-only (jquery, jsdom), pinned to exact
versions.
+ - php_tests.sh is the one list of PHP checks for Lint + build and the
+ PHP matrix: php -l on every .php and .page file, then every
+ *_test.php here; a deprecation fails like an error.
- path: "**"
instructions: |-
Applies to every file, whatever the language:
diff --git a/.github/unraid-compat/php_tests.sh b/.github/scripts/php_tests.sh
similarity index 100%
rename from .github/unraid-compat/php_tests.sh
rename to .github/scripts/php_tests.sh
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7688915c..955dd96a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,7 +33,7 @@ jobs:
# php -l on every .php and .page file, then every .github/scripts/*_test.php; a deprecation fails too
- name: PHP syntax check and PHP tests
- run: bash .github/unraid-compat/php_tests.sh
+ run: bash .github/scripts/php_tests.sh
- name: Every !important has its reason
working-directory: .github/scripts
@@ -148,7 +148,7 @@ jobs:
- name: PHP syntax check and PHP tests
env:
PHP_VERSION: ${{ matrix.php }}
- run: docker run --rm -v "$PWD:/repo" -w /repo "php:${PHP_VERSION}-cli" bash .github/unraid-compat/php_tests.sh
+ run: docker run --rm -v "$PWD:/repo" -w /repo "php:${PHP_VERSION}-cli" bash .github/scripts/php_tests.sh
unraid:
name: Unraid ${{ matrix.unraid }}${{ matrix.row && format(' ({0})', matrix.row) || '' }}
@@ -221,26 +221,33 @@ jobs:
RESULT: ${{ needs.unraid.result }}
run: '[ "$RESULT" = success ]'
- # A dispatched run's checks never reach the PR, so vendor-sync's run reports Lint + build there as a commit status.
+ # A dispatched run's checks never reach the PR, so vendor-sync's run reports each gate there as a commit status.
report:
- needs: validate
+ needs: [validate, php-compat, unraid-compat]
if: always() && github.event_name == 'workflow_dispatch' && inputs.base != ''
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- - name: Post the result on the PR's commit
+ - name: Post the results on the PR's commit
env:
- RESULT: ${{ needs.validate.result }}
+ LINT: ${{ needs.validate.result }}
+ PHP: ${{ needs.php-compat.result }}
+ UNRAID: ${{ needs.unraid-compat.result }}
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
SHA: ${{ github.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
- state=failure
- [ "$RESULT" = success ] && state=success
- gh api "repos/$REPO/statuses/$SHA" -f state="$state" -f context='Lint + build' -f target_url="$RUN_URL" -f description="CI dispatched for this PR: $RESULT" >/dev/null
+ post() {
+ local state=failure
+ [ "$2" = success ] && state=success
+ gh api "repos/$REPO/statuses/$SHA" -f state="$state" -f context="$1" -f target_url="$RUN_URL" -f description="CI dispatched for this PR: $2" >/dev/null
+ }
+ post 'Lint + build' "$LINT"
+ post 'PHP compatibility' "$PHP"
+ post 'Unraid compatibility' "$UNRAID"
notify-failure:
needs: [validate, php, unraid]
From 7d54ebb537ccee4cec58c3cfcb04896375d30c20 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Sat, 14 Nov 2026 08:31:11 +0000
Subject: [PATCH 20/72] chore(deps): update dependency jsdom to v31.0.1 (#187)
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
.github/scripts/package-lock.json | 8 ++++----
.github/scripts/package.json | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/scripts/package-lock.json b/.github/scripts/package-lock.json
index dc7d31db..92812c63 100644
--- a/.github/scripts/package-lock.json
+++ b/.github/scripts/package-lock.json
@@ -7,7 +7,7 @@
"name": "folder-view3-ci-tests",
"devDependencies": {
"jquery": "3.7.1",
- "jsdom": "31.0.0"
+ "jsdom": "31.0.1"
}
},
"node_modules/@exodus/bytes": {
@@ -154,9 +154,9 @@
"license": "MIT"
},
"node_modules/jsdom": {
- "version": "31.0.0",
- "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-31.0.0.tgz",
- "integrity": "sha512-xAkhD9z1eyFC5+QUi9K24CaZJgdCQ2GOGLW1GdVDoQvkp/AxEH9TQ0pAplPOlIiV92hfcgnFOADZypbjgbBT6Q==",
+ "version": "31.0.1",
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-31.0.1.tgz",
+ "integrity": "sha512-CbhJL8ZQg3eKswxSZth4QO9tW0jPIhmR0vtSXQSbKSfWbwIT6hoRc17wdHIVTQ43KI0mdV5iTJr3281IDgVZ5g==",
"dev": true,
"license": "MIT",
"dependencies": {
diff --git a/.github/scripts/package.json b/.github/scripts/package.json
index cab4cf12..3548b360 100644
--- a/.github/scripts/package.json
+++ b/.github/scripts/package.json
@@ -4,6 +4,6 @@
"description": "Test-only dependencies for the scripts in this folder; nothing here ships in the plugin",
"devDependencies": {
"jquery": "3.7.1",
- "jsdom": "31.0.0"
+ "jsdom": "31.0.1"
}
}
From 41a4ca4797346cd2efbd86a718074f6471774884 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 17:19:30 +0800
Subject: [PATCH 21/72] ci: deprecations in endpoint child processes fail, a
boot starts from an empty RAM root, each failure step proves its cause, one
Unraid row per minor kept by Renovate and matrix_check, and the !important
check reads case, URLs, nesting and regexes
---
.coderabbit.yaml | 9 +-
.github/scripts/important_check.py | 107 +++++++++++++++------
.github/scripts/important_check_test.py | 29 +++++-
.github/scripts/php_tests.sh | 38 +++++---
.github/scripts/vendor.py | 21 +++-
.github/unraid-compat/Dockerfile | 5 +-
.github/unraid-compat/install_test.sh | 49 ++++++----
.github/unraid-compat/matrix_check.py | 48 +++++++++
.github/unraid-compat/matrix_check_test.py | 35 +++++++
.github/workflows/ci.yml | 26 ++++-
renovate.json | 26 +++--
11 files changed, 308 insertions(+), 85 deletions(-)
create mode 100644 .github/unraid-compat/matrix_check.py
create mode 100644 .github/unraid-compat/matrix_check_test.py
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 0739a0d5..65ac2287 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -210,9 +210,12 @@ reviews:
instructions: |
The Unraid compatibility matrix; CI only, nothing here ships.
- install_test.sh puts the .plg through each Unraid version's own
- plugin installer in a throwaway container with no network. Only
- Slackware's upgradepkg and removepkg are stubbed: flag any other
- stand-in for Unraid's code. It must refuse to run on a real server.
+ plugin installer, hooks included, in a fresh Docker container with
+ no network; it must refuse to run anywhere else. Only Slackware's
+ upgradepkg and removepkg are stubbed, keeping their file-list
+ records: flag any other stand-in for Unraid's code.
+ - matrix_check.py keeps ci.yml's Unraid rows at one per minor from the
+ .plg's min to the newest release; Renovate only moves rows.
- Each step asserts what the user is left with (live files, the
registered manifest, saved folders, Unraid's orders) right after it,
against values written by hand. A failed step fails the job.
diff --git a/.github/scripts/important_check.py b/.github/scripts/important_check.py
index 0b1ca939..12e4e01d 100644
--- a/.github/scripts/important_check.py
+++ b/.github/scripts/important_check.py
@@ -1,33 +1,65 @@
#!/usr/bin/env python3
-"""Each !important in the plugin's own CSS, JS, PHP and .page files needs a `!important: ` comment: on its line,
-on the line above it, or (CSS) directly above its rule. Bundled libraries listed in vendor.json are skipped."""
-import json
+"""Each !important in the plugin's own CSS, JS, PHP and .page files needs a `!important: ` comment."""
import pathlib
import re
import sys
-REASON = re.compile(r'!important:\s*\w')
-KINDS = {'.css': 'css', '.js': 'script', '.php': 'script', '.page': 'script'}
+import vendor
+
+REASON = re.compile(r'!important:\s*\w', re.I)
+KINDS = {'.css': 'css', '.js': 'js', '.php': 'php', '.page': 'page'}
+# A `/` after one of these, or first on its line, opens a JS regex literal rather than dividing; not `<`, as `` has it
+REGEX_AFTER = set('(,=:[!&|?{};+-*%>~^')
+
+
+def _blank(code, text, i, j):
+ code[i:j] = [ch if ch == '\n' else ' ' for ch in text[i:j]]
+
+
+def _regex_end(text, i):
+ """End of the JS regex literal opening at `i`, or None when the `/` divides."""
+ before = text[:i].rstrip(' \t')
+ if before and not before.endswith('\n') and before[-1] not in REGEX_AFTER and not re.search(r'\b(return|typeof)$', before):
+ return None
+ j, in_class = i + 1, False
+ while j < len(text) and text[j] != '\n':
+ if text[j] == '\\':
+ j += 1
+ elif text[j] == '[':
+ in_class = True
+ elif text[j] == ']':
+ in_class = False
+ elif text[j] == '/' and not in_class:
+ return j + 1
+ j += 1
+ return None
def scan(text, kind):
- """(code, comments): the text with comments and strings blanked, and [(start, end, comment text)]."""
+ """(code, comments): the text with comments, CSS strings and JS regexes blanked, and [(start, end, comment text)]."""
code, comments, i, n = list(text), [], 0, len(text)
+ script = kind != 'css'
while i < n:
c, two = text[i], text[i:i + 2]
- if two == '/*' or (two == '//' and kind == 'script'):
- end = text.find('*/', i + 2) + 2 if two == '/*' else text.find('\n', i)
- end = n if end < 2 or end == -1 else end
+ html = kind == 'page' and text.startswith('' if html else '\n'
+ found = text.find(close, i + 2)
+ end = n if found == -1 else found + (0 if close == '\n' else len(close))
comments.append((i, end, text[i:end]))
- code[i:end] = [ch if ch == '\n' else ' ' for ch in text[i:end]]
+ _blank(code, text, i, end)
i = end
- elif c in '"\'' or (c == '`' and kind == 'script'):
+ elif c == '/' and kind in ('js', 'page') and (end := _regex_end(text, i)):
+ _blank(code, text, i, end)
+ i = end
+ elif c in '"\'' or (c == '`' and script):
j = i + 1
while j < n and text[j] != c and text[j] != '\n':
j += 2 if text[j] == '\\' else 1
# A script's string is where inline styles live: keep it as code; a CSS string (content: "...") is text
if kind == 'css':
- code[i:j + 1] = [ch if ch == '\n' else ' ' for ch in text[i:j + 1]]
+ _blank(code, text, i, j + 1)
i = j + 1
else:
i += 1
@@ -38,41 +70,52 @@ def _line(text, at):
return text.count('\n', 0, at)
-def _reason_ends_on(comments, text, line):
- return any(REASON.search(body) and _line(text, end - 1) == line for start, end, body in comments)
+def _own_line(text, start):
+ return text[text.rfind('\n', 0, start) + 1:start].strip() == ''
+
+
+def _reason(comments, text, line, alone):
+ """A reason comment ending on `line`; with `alone`, only one with no code before it on its line."""
+ return any(REASON.search(body) and _line(text, end - 1) == line and (not alone or _own_line(text, start))
+ for start, end, body in comments)
def _rule_start(code, at):
- """Where the selector of the rule holding the declaration at `at` begins."""
- opened = code.rfind('{', 0, at)
- before = max(code.rfind(ch, 0, opened) for ch in '{};')
- return before + 1 + (len(code[before + 1:opened]) - len(code[before + 1:opened].lstrip()))
+ """Where the selector of the rule holding the declaration at `at` begins, past any nested rules; None outside a rule."""
+ depth, opened = 0, at - 1
+ while opened >= 0 and not (code[opened] == '{' and depth == 0):
+ depth += (code[opened] == '}') - (code[opened] == '{')
+ opened -= 1
+ if opened < 0:
+ return None
+ start = max(code.rfind(ch, 0, opened) for ch in '{};') + 1
+ while start < opened and code[start].isspace():
+ start += 1
+ return start
def problems_in(path, text, kind):
code, comments = scan(text, kind)
out = []
- for m in re.finditer(r'!\s*important\b', code):
+ for m in re.finditer(r'!\s*important\b', code, re.I):
line = _line(text, m.start())
- ok = _reason_ends_on(comments, text, line) or _reason_ends_on(comments, text, line - 1)
- if not ok and kind == 'css':
- start = _rule_start(code, m.start())
- ok = _reason_ends_on(comments, text, _line(text, start) - 1) or _reason_ends_on(comments, text, _line(text, start))
+ ok = _reason(comments, text, line, alone=False) or _reason(comments, text, line - 1, alone=True)
+ start = _rule_start(code, m.start()) if kind == 'css' else None
+ if not ok and start is not None:
+ ok = _reason(comments, text, _line(text, start) - 1, alone=True) or _reason(comments, text, _line(text, start), alone=True)
if not ok:
out.append(f'{path}:{line + 1}: !important without a "!important: " comment on its line, the line above, or above its rule')
return out
def problems(repo):
- manifest = json.loads((repo / 'vendor.json').read_text(encoding='utf-8'))
- root = repo / manifest['root']
- bundled = {(root / dest).resolve() for lib in manifest['libraries'] for dest in lib['files'].values()}
- out = []
- for path in sorted(root.rglob('*')):
- kind = KINDS.get(path.suffix)
- if kind and path.is_file() and path.resolve() not in bundled:
- out += problems_in(path.relative_to(repo), path.read_text(encoding='utf-8'), kind)
- return out
+ repo = repo.resolve()
+ manifest, root = vendor.plugin_root(repo)
+ bundled = {vendor.destination(manifest, root, dest) for lib in manifest['libraries'] for dest in lib['files'].values()}
+ files = [p for p in sorted(root.rglob('*')) if p.suffix in KINDS and p.is_file() and p.resolve() not in bundled]
+ if not files:
+ return [f'{manifest["root"]}: no CSS, JS, PHP or .page files to check']
+ return [problem for p in files for problem in problems_in(p.relative_to(repo), p.read_text(encoding='utf-8'), KINDS[p.suffix])]
if __name__ == '__main__':
diff --git a/.github/scripts/important_check_test.py b/.github/scripts/important_check_test.py
index 9f9b195f..5bbcc125 100644
--- a/.github/scripts/important_check_test.py
+++ b/.github/scripts/important_check_test.py
@@ -34,6 +34,32 @@ def test_a_reason_belongs_to_the_rule_under_it_only(self):
(problem,) = self.check({'styles/a.css': sheet})
self.assertIn('a.css:3:', problem)
+ def test_a_reason_at_the_end_of_a_line_covers_that_line_only(self):
+ rules = '.a { top: 0 !important } /* !important: r */\n.b { top: 0 !important }\n'
+ decls = '.c {\n top: 0 !important; /* !important: r */\n left: 0 !important;\n}\n'
+ self.assertEqual([p.split(': !')[0] for p in self.check({'styles/a.css': rules, 'styles/b.css': decls})],
+ [f'{ROOT}/styles/a.css:2', f'{ROOT}/styles/b.css:3'])
+
+ def test_a_nested_rule_does_not_move_a_declaration_to_its_selector(self):
+ outer = '/* !important: r */\n.a {\n .b { color: red }\n top: 0 !important;\n}\n'
+ inner = '.a {\n /* !important: r */\n .b { color: red }\n top: 0 !important;\n}\n'
+ self.assertEqual(self.check({'styles/a.css': outer}), [])
+ (problem,) = self.check({'styles/b.css': inner})
+ self.assertIn('b.css:4:', problem)
+
+ def test_a_quote_in_a_regex_literal_or_a_php_hash_comment_is_read_as_code_does(self):
+ js = "s = s.replace(/'/g, ''); el.style.cssText = 'x:1 !important'; // !important: r\n"
+ php = "See https://example.test\n\n\n'})
+ self.assertEqual([p.split(': !')[0] for p in found], [f'{ROOT}/Folder.page:1', f'{ROOT}/styles/a.css:1'])
+
+ def test_no_files_to_check_fails_closed(self):
+ self.assertEqual(self.check({'README.md': 'x'}), [f'{ROOT}: no CSS, JS, PHP or .page files to check'])
+
def test_a_reason_comment_must_give_a_reason(self):
self.assertEqual(len(self.check({'styles/a.css': '/* !important: */\n.a { top: 0 !important }\n'})), 1)
@@ -53,7 +79,8 @@ def test_page_and_php_files_are_checked_too(self):
self.assertEqual([p.split(':')[0] for p in found], [f'{ROOT}/Folder.page', f'{ROOT}/server/a.php'])
def test_a_bundled_library_is_skipped(self):
- self.assertEqual(self.check({'styles/include/lib.css': '.a { top: 0 !important }\n'}, bundled=['styles/include/lib.css']), [])
+ self.assertEqual(self.check({'styles/include/lib.css': '.a { top: 0 !important }\n', 'styles/own.css': '.b { top: 0 }\n'},
+ bundled=['styles/include/lib.css']), [])
if __name__ == '__main__':
diff --git a/.github/scripts/php_tests.sh b/.github/scripts/php_tests.sh
index 5ea8f42a..53457d56 100755
--- a/.github/scripts/php_tests.sh
+++ b/.github/scripts/php_tests.sh
@@ -1,27 +1,37 @@
#!/bin/bash
# php -l over every plugin .php and .page file, then every .github/scripts/*_test.php, with every error level on.
-# A deprecation fails like an error, so a PHP that Unraid has not shipped yet shows what FolderView3 must change.
+# Every PHP process logs to one file, the endpoints the tests start included; a deprecation there fails like an error.
set -u
cd "$(dirname "$0")/../.." || exit 2
status=0
-errors=$(mktemp)
-trap 'rm -f "$errors"' EXIT
+ini=$(mktemp -d)
+trap 'rm -rf "$ini"' EXIT
+log=$ini/errors.log
+: > "$log"
+printf 'error_reporting=-1\nlog_errors=1\nerror_log=%s\n' "$log" > "$ini/zz-fv3-tests.ini"
+# An empty entry keeps PHP's own scan folder; this file loads after it, in every child process too
+export PHP_INI_SCAN_DIR="${PHP_INI_SCAN_DIR:-}:$ini"
php -v | head -1
+php -r 'exit((error_reporting() & E_ALL) === E_ALL && ini_get("log_errors") ? 0 : 1);' || { echo 'FAILED: the error-log settings did not load'; exit 1; }
+
+deprecated() { # deprecated : fails the run when logged a deprecation
+ local seen; seen=$(grep -c 'Deprecated:' "$log")
+ if [ "$seen" -gt "${logged:-0}" ]; then
+ echo "FAILED: $1 ran into a deprecation:"
+ grep 'Deprecated:' "$log" | tail -n "$((seen - ${logged:-0}))"
+ status=1
+ fi
+ logged=$seen
+}
while IFS= read -r -d '' f; do
- if ! out=$(php -d error_reporting=-1 -l "$f" 2>&1) || grep -q 'Deprecated:' <<<"$out"; then
- echo "$out"
- status=1
- fi
+ php -l "$f" >/dev/null 2>&1 || { php -l "$f"; status=1; }
done < <(find src \( -name '*.php' -o -name '*.page' \) -print0)
+deprecated 'php -l'
for t in .github/scripts/*_test.php; do
- echo "== $t"
- php -d error_reporting=-1 -d display_errors=stderr -d log_errors=0 "$t" 2>"$errors" || status=1
- cat "$errors" >&2
- if grep -q 'Deprecated:' "$errors"; then
- echo "FAILED: $t ran into a deprecation"
- status=1
- fi
+ echo "== $t"
+ php -d display_errors=stderr "$t" || status=1
+ deprecated "$t"
done
exit $status
diff --git a/.github/scripts/vendor.py b/.github/scripts/vendor.py
index ef2e1f91..0437defb 100755
--- a/.github/scripts/vendor.py
+++ b/.github/scripts/vendor.py
@@ -95,12 +95,25 @@ def lf(data):
return data if b'\0' in data[:8000] else data.replace(b'\r\n', b'\n')
+def plugin_root(repo=ROOT):
+ """(vendor.json, the plugin folder its root names)."""
+ manifest = json.loads((repo / 'vendor.json').read_text())
+ return manifest, (repo / manifest['root']).resolve()
+
+
+def destination(manifest, root, rel):
+ """Where a bundled file lands; vendor.json may not point outside the plugin folder."""
+ dest = (root / rel).resolve()
+ if not dest.is_relative_to(root):
+ raise SystemExit(f'vendor.json: {rel} is outside {manifest["root"]}')
+ return dest
+
+
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('mode', choices=('check', 'sync'))
mode = parser.parse_args().mode
- manifest = json.loads((ROOT / 'vendor.json').read_text())
- root = (ROOT / manifest['root']).resolve()
+ manifest, root = plugin_root()
stale = []
for lib in manifest['libraries']:
if 'npm' in lib:
@@ -110,9 +123,7 @@ def main():
else:
raise SystemExit(f'vendor.json: a library needs an npm or github source: {lib}')
for src, data in files.items():
- dest = (root / lib['files'][src]).resolve()
- if not dest.is_relative_to(root):
- raise SystemExit(f'vendor.json: {lib["files"][src]} is outside {manifest["root"]}')
+ dest = destination(manifest, root, lib['files'][src])
data = lf(data)
if dest.is_file() and dest.read_bytes() == data:
continue
diff --git a/.github/unraid-compat/Dockerfile b/.github/unraid-compat/Dockerfile
index 232bc533..2f8f421f 100644
--- a/.github/unraid-compat/Dockerfile
+++ b/.github/unraid-compat/Dockerfile
@@ -1,4 +1,5 @@
-# The PHP an Unraid version ships, plus what Unraid has and this image lacks: gawk (the .plg's remove script uses RT) and xz.
+# The PHP an Unraid version ships, plus what Unraid has and this image lacks: gawk (the .plg's remove script uses RT), xz
+# (the package format) and wget (the installer's downloader, so a download fails on the network, not a missing tool).
ARG PHP
FROM php:${PHP}-cli
-RUN apt-get update && apt-get install -y --no-install-recommends gawk xz-utils && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y --no-install-recommends gawk wget xz-utils && rm -rf /var/lib/apt/lists/*
diff --git a/.github/unraid-compat/install_test.sh b/.github/unraid-compat/install_test.sh
index 7ec80ef5..103a2c3a 100755
--- a/.github/unraid-compat/install_test.sh
+++ b/.github/unraid-compat/install_test.sh
@@ -2,10 +2,12 @@
# FolderView3 through a real Unraid webGUI's plugin installer: install, upgrade over the last stable, remove, failures, min.
# Disposable container only, as root, with no network. Usage: install_test.sh
set -u
-# This replaces plugin files and system tools, so it must never touch a real server.
-if [ -e /etc/unraid-version ] || [ -d /boot/config ]; then echo 'Refusing to run on an Unraid system' >&2; exit 2; fi
-web=$(cd "$1" && pwd); version=$2; stable=$(cd "$3" && pwd); repo=$(pwd)
+# This replaces /usr/bin/php, package tools and plugin files, so it runs only in a fresh Docker container, never on a host.
+if [ ! -f /.dockerenv ] || [ -e /etc/unraid-version ] || [ -d /boot/config ]; then echo 'Refusing to run outside a fresh Docker container' >&2; exit 2; fi
+version=$2; repo=$(pwd)
fail() { echo "FAILED [Unraid $version]: $*"; exit 1; }
+web=$(cd "$1" 2>/dev/null && pwd) && [ -f "$web/emhttp/plugins/dynamix.plugin.manager/scripts/plugin" ] || fail "no Unraid plugin installer under $1"
+stable=$(cd "$3" 2>/dev/null && pwd) && [ -f "$stable/pkg_build.sh" ] || fail "no last-stable checkout with pkg_build.sh at $3"
awk --version 2>/dev/null | grep -q 'GNU Awk' || fail 'awk is not gawk, as it is on Unraid: the remove script needs RT'
name=folder.view3
@@ -17,22 +19,26 @@ mkdir -p "$docroot/plugins" /boot/config/plugins-error /var/log/plugins /var/log
cp -R "$web/emhttp/plugins/dynamix" "$web/emhttp/plugins/dynamix.plugin.manager" "$docroot/plugins/"
ln -sfn "$docroot/plugins/dynamix" "$docroot/webGui"
printf 'csrf_token="compat-test-token"\n' > /var/local/emhttp/var.ini
-# The hooks check every installed plugin through Unraid's php at /usr/bin/php; this container has only this one
-rm -rf "$docroot/plugins/dynamix.plugin.manager/pre-hooks" "$docroot/plugins/dynamix.plugin.manager/post-hooks"
+# Unraid's pre- and post-install hooks run as #!/usr/bin/php and keep their state under /tmp/plugins
+mkdir -p /tmp/plugins
ln -sf "$(command -v php)" /usr/bin/php
plugin() { php "$docroot/plugins/dynamix.plugin.manager/scripts/plugin" "$@"; }
-# Slackware's package tools; everything else is Unraid's own code
+# Slackware's package tools, as they work: the record lists the package's files, and removepkg takes those and the folders
+# they leave empty. Everything else is Unraid's own code.
cat > /sbin/upgradepkg <<'STUB'
#!/bin/bash
for pkg; do :; done
tar -xJf "$pkg" -C / || exit 1
-touch "/var/log/packages/$(basename "$pkg" .txz)"
+tar -tJf "$pkg" > "/var/log/packages/$(basename "$pkg" .txz)"
STUB
cat > /sbin/removepkg <<'STUB'
#!/bin/bash
-rm -rf /usr/local/emhttp/plugins/folder.view3
-rm -f "/var/log/packages/$1"
+record=/var/log/packages/$1
+[ -f "$record" ] || exit 1
+grep -v '/$' "$record" | while IFS= read -r f; do rm -f "/$f"; done
+grep '/$' "$record" | sort -r | while IFS= read -r d; do rmdir "/$d" 2>/dev/null; done
+rm -f "$record"
STUB
chmod +x /sbin/upgradepkg /sbin/removepkg
@@ -74,6 +80,10 @@ saved_config() { # what a user has saved: folders, settings, a theme, and Unraid
printf '0="folder-ZyXwVuTsRqPoNmLkJiHg"\r\n1="Debian 12"\r\n2="Windows"' > /boot/config/plugins/dynamix.vm.manager/userprefs.cfg
}
config_sums() { (cd /boot/config/plugins && find $name dockerMan dynamix.vm.manager -type f ! -name "$name-*.txz" ! -path "$name/version" -print0 | sort -z | xargs -0 md5sum); }
+boot() { # boot : what a reboot does: RAM starts empty, and the registered manifest installs again from the flash alone
+ rm -rf "$live" /var/log/packages/$name-* /var/log/plugins/$name.plg
+ plugin install "$manifest" > "$work/$1.log" 2>&1 || { cat "$work/$1.log"; fail "$1: reinstall at boot refused"; }
+}
set_version "$version"
# A fresh install
@@ -88,12 +98,13 @@ install $new upgrade; installed $new upgrade
[ ! -e "$flash/$name-$old-x86_64-1.txz" ] || fail 'upgrade: previous archive left on the flash'
[ ! -e "/var/log/packages/$name-$old-x86_64-1" ] || fail 'upgrade: previous package record left'
-# What a reboot does: the registered manifest installs again from the archive on the flash
-rm -f /var/log/plugins/$name.plg
-plugin install "$manifest" > "$work/boot.log" 2>&1 || { cat "$work/boot.log"; fail 'boot: reinstall refused'; }
-installed $new boot
+# A reboot after the upgrade brings back the new version from its archive
+boot boot; installed $new boot
+[ "$(config_sums)" = "$before" ] || fail 'boot: saved files changed'
-# Removal leaves nothing, and takes only FolderView3's own entries out of Unraid's orders, line endings kept
+# Removal leaves nothing, a file the package did not ship included, and takes only FolderView3's entries out of Unraid's
+# orders, line endings kept
+printf 'x' > "$live/not-from-the-package"
plugin remove $name.plg > "$work/remove.log" 2>&1 || { cat "$work/remove.log"; fail 'remove: refused'; }
[ ! -e "$live" ] && [ ! -e "$flash" ] && [ ! -e /var/log/plugins/$name.plg ] && [ ! -e "$manifest" ] || fail 'remove: files left behind'
ls /var/log/packages/$name-* >/dev/null 2>&1 && fail 'remove: package record left'
@@ -102,12 +113,14 @@ cmp -s /boot/config/plugins/dockerMan/userprefs.cfg <(printf '0="alpha"\n1="fold
cmp -s /boot/config/plugins/dynamix.vm.manager/userprefs.cfg <(printf '0="Debian 12"\r\n1="Windows"') \
|| fail "remove: VM order not as expected: $(od -c /boot/config/plugins/dynamix.vm.manager/userprefs.cfg | head -5)"
-# A download that fails (no network here) leaves the running install and what the user saved
+# A download that fails (no network here) leaves the running install, what the user saved, and a next boot that brings it back
reset; install $old stable2; saved_config; before=$(config_sums)
plugin install "$work/$new/$name.plg" > "$work/download.log" 2>&1 && fail 'download: install reported success without its package'
+grep -q 'download failure' "$work/download.log" || { cat "$work/download.log"; fail 'download: refused for a reason other than the download'; }
installed $old download
-[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'download: deleted the archive the next boot installs from'
[ "$(config_sums)" = "$before" ] || fail 'download: saved files changed'
+[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'download: deleted the archive the next boot installs from'
+boot download-boot; installed $old download-boot
# A failed upgradepkg does the same
reset; install $old stable3; saved_config; before=$(config_sums)
@@ -116,9 +129,11 @@ mv /sbin/upgradepkg "$work/upgradepkg"; printf '#!/bin/bash\nexit 1\n' > /sbin/u
plugin install "$work/$new/$name.plg" > "$work/upgradepkg.log" 2>&1; status=$?
mv "$work/upgradepkg" /sbin/upgradepkg
[ $status -ne 0 ] || fail 'upgradepkg: install reported success though upgradepkg failed'
+grep -q "run failed: 'upgradepkg" "$work/upgradepkg.log" || { cat "$work/upgradepkg.log"; fail 'upgradepkg: refused before upgradepkg ran'; }
installed $old upgradepkg
-[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'upgradepkg: deleted the archive the next boot installs from'
[ "$(config_sums)" = "$before" ] || fail 'upgradepkg: saved files changed'
+[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'upgradepkg: deleted the archive the next boot installs from'
+boot upgradepkg-boot; installed $old upgradepkg-boot
# The installer itself refuses an Unraid below the .plg's min, and says why
reset; set_version 6.12.15; cp "$work/$new/dist/$name-$new-x86_64-1.txz" "$flash/"
diff --git a/.github/unraid-compat/matrix_check.py b/.github/unraid-compat/matrix_check.py
new file mode 100644
index 00000000..c67c5604
--- /dev/null
+++ b/.github/unraid-compat/matrix_check.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+"""ci.yml's Unraid matrix has one release row per minor from the .plg's min to the newest, and one for any newer release."""
+import pathlib
+import re
+import sys
+
+ROW = re.compile(r"- \{unraid: '([^']+)', php: '([^']+)'(?:, row: '([^']+)')?\}")
+RELEASE = re.compile(r'(\d+)\.(\d+)\.\d+')
+
+
+def problems(ci, plg):
+ floor = re.search(r']*\bmin="(\d+)\.(\d+)\.\d+"', plg)
+ if not floor:
+ return ['folder.view3.plg names no min="x.y.z"']
+ floor = (int(floor[1]), int(floor[2]))
+ rows = ROW.findall(ci)
+ releases = [version for version, _, row in rows if not row]
+ tags = [version for version, _, row in rows if row == 'newest tag']
+ out = [] if len(tags) == 1 else [f"ci.yml needs exactly one 'newest tag' row, not {len(tags)}"]
+ minors = {}
+ for version in releases:
+ m = RELEASE.fullmatch(version)
+ if not m:
+ out.append(f'release row {version} is not a release version x.y.z')
+ else:
+ minors.setdefault((int(m[1]), int(m[2])), []).append(version)
+ if not minors:
+ return out + ['ci.yml has no Unraid release rows']
+ for (major, minor), versions in sorted(minors.items()):
+ if len(versions) > 1:
+ out.append(f'Unraid {major}.{minor} has {len(versions)} release rows: {", ".join(versions)}')
+ if (major, minor) < floor:
+ out.append(f'release row {versions[0]} is below the .plg\'s min {floor[0]}.{floor[1]}')
+ for major in sorted({major for major, _ in minors if major >= floor[0]}):
+ first = floor[1] if major == floor[0] else 0
+ missing = [f'{major}.{n}' for n in range(first, max(n for m, n in minors if m == major)) if (major, n) not in minors]
+ out += [f'no release row for Unraid {v}, between the .plg\'s min and the newest row' for v in missing]
+ # The 'newest tag' row runs only betas; a release it reaches needs a row of its own and the PHP that release ships
+ out += [f'Unraid {tag} is out: give it a release row with the PHP its release notes name' for tag in tags
+ if RELEASE.fullmatch(tag) and tag not in releases]
+ return out
+
+
+if __name__ == '__main__':
+ repo = pathlib.Path(__file__).resolve().parents[2]
+ found = problems((repo / '.github/workflows/ci.yml').read_text(encoding='utf-8'), (repo / 'folder.view3.plg').read_text(encoding='utf-8'))
+ print('\n'.join(found) or 'The Unraid matrix covers every minor from min to the newest release')
+ sys.exit(1 if found else 0)
diff --git a/.github/unraid-compat/matrix_check_test.py b/.github/unraid-compat/matrix_check_test.py
new file mode 100644
index 00000000..cdd6f6b1
--- /dev/null
+++ b/.github/unraid-compat/matrix_check_test.py
@@ -0,0 +1,35 @@
+import unittest
+
+import matrix_check
+
+PLG = ''
+
+
+def ci(*rows, tag="'7.4.0', php: '8.4'"):
+ lines = [f" - {{unraid: '{v}', php: '8.4'}}" for v in rows]
+ return '\n'.join(lines + [f" - {{unraid: {tag}, row: 'newest tag'}}"])
+
+
+class MatrixCheckTest(unittest.TestCase):
+ def test_one_row_per_minor_up_to_the_newest_passes_with_a_beta_or_that_release_as_newest_tag(self):
+ self.assertEqual(matrix_check.problems(ci('7.0.1', '7.1.4', '7.2.7', '7.3.5', '7.4.0'), PLG), [])
+ self.assertEqual(matrix_check.problems(ci('7.0.1', '7.1.4', '7.2.7', '7.3.5', '7.4.0', tag="'7.5.0-beta.1', php: '8.4'"), PLG), [])
+
+ def test_a_release_the_newest_tag_reached_needs_its_own_row(self):
+ self.assertEqual(matrix_check.problems(ci('7.0.1', '7.1.4', '7.2.7', '7.3.5', '7.4.0', tag="'7.5.0', php: '8.4'"), PLG),
+ ['Unraid 7.5.0 is out: give it a release row with the PHP its release notes name'])
+
+ def test_a_skipped_minor_a_second_row_for_one_and_a_row_below_min_are_named(self):
+ self.assertEqual(matrix_check.problems(ci('6.12.15', '7.0.1', '7.0.0', '7.2.7', '7.3.5', '7.4.0'), PLG), [
+ 'release row 6.12.15 is below the .plg\'s min 7.0',
+ 'Unraid 7.0 has 2 release rows: 7.0.1, 7.0.0',
+ 'no release row for Unraid 7.1, between the .plg\'s min and the newest row'])
+
+ def test_a_missing_min_newest_tag_or_release_row_fails_closed(self):
+ self.assertEqual(matrix_check.problems(ci('7.0.1'), ''), ['folder.view3.plg names no min="x.y.z"'])
+ self.assertEqual(matrix_check.problems("- {unraid: '7.0.1', php: '8.3'}", PLG), ["ci.yml needs exactly one 'newest tag' row, not 0"])
+ self.assertEqual(matrix_check.problems(ci(), PLG), ['ci.yml has no Unraid release rows'])
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 955dd96a..1199e8eb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -41,6 +41,12 @@ jobs:
python3 -B -m unittest important_check_test
python3 -B important_check.py
+ - name: The Unraid matrix has a row for every minor up to the newest release
+ working-directory: .github/unraid-compat
+ run: |
+ python3 -B -m unittest matrix_check_test
+ python3 -B matrix_check.py
+
- name: Variables tab tests
run: node .github/scripts/variables_tab_test.js
@@ -156,23 +162,33 @@ jobs:
strategy:
fail-fast: false
matrix:
- # The newest release of each minor from the .plg's min, on the PHP that release ships
+ # One release row per minor from the .plg's min, on the PHP its release notes name; Renovate moves each to its newest
+ # patch, and the 'newest tag' row to any newer tag. matrix_check.py fails when a release has no row of its own.
include:
- {unraid: '7.0.1', php: '8.3'}
- {unraid: '7.1.4', php: '8.3'}
- - {unraid: '7.2.7', php: '8.3'}
+ - {unraid: '7.2.9', php: '8.4'}
- {unraid: '7.3.5', php: '8.4'}
- # renovate: newest Unraid
- {unraid: '7.4.0', php: '8.4'}
- # renovate: newest Unraid tag, betas included; a beta on a newer PHP needs its php raised by hand
+ # Runs only while it names a beta or release candidate; one on a newer PHP needs its php raised by hand
- {unraid: '7.4.0', php: '8.4', row: 'newest tag'}
+ env:
+ RUNS: ${{ !matrix.row || contains(matrix.unraid, '-') }}
steps:
+ - name: Nothing newer than the release rows
+ if: env.RUNS != 'true'
+ env:
+ UNRAID_VERSION: ${{ matrix.unraid }}
+ run: echo "::notice::Unraid $UNRAID_VERSION is a release, so its own release row tests it"
+
- name: Checkout
+ if: env.RUNS == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Checkout the last stable release
+ if: env.RUNS == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
@@ -180,6 +196,7 @@ jobs:
path: .stable
- name: Checkout the Unraid webGUI at this version
+ if: env.RUNS == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
@@ -191,6 +208,7 @@ jobs:
emhttp/plugins/dynamix.plugin.manager
- name: Install, upgrade, remove and failures through Unraid's own plugin installer
+ if: env.RUNS == 'true'
env:
PHP_VERSION: ${{ matrix.php }}
UNRAID_VERSION: ${{ matrix.unraid }}
diff --git a/renovate.json b/renovate.json
index c365eefe..ab655f85 100644
--- a/renovate.json
+++ b/renovate.json
@@ -6,19 +6,19 @@
"customManagers": [
{
"customType": "regex",
- "description": "The newest stable Unraid the CI matrix installs FolderView3 on, so a new release is tested before users reach it.",
+ "description": "Each release row of the CI matrix's Unraid list, moved to the newest patch of its minor.",
"managerFilePatterns": ["/^\\.github/workflows/ci\\.yml$/"],
- "matchStrings": ["# renovate: newest Unraid\\s+- \\{unraid: '(?[^']+)'"],
+ "matchStrings": ["- \\{unraid: '(?[^']+)', php: '[^']+'\\}"],
"datasourceTemplate": "github-tags",
"depNameTemplate": "unraid/webgui",
- "depTypeTemplate": "unraid-stable",
+ "depTypeTemplate": "unraid-release",
"versioningTemplate": "semver"
},
{
"customType": "regex",
- "description": "The newest Unraid tag of any kind, betas and release candidates included, for the matrix's 'newest tag' row.",
+ "description": "The matrix's 'newest tag' row: the newest Unraid tag of any kind, betas and release candidates included.",
"managerFilePatterns": ["/^\\.github/workflows/ci\\.yml$/"],
- "matchStrings": ["# renovate: newest Unraid tag[^\\n]*\\s+- \\{unraid: '(?[^']+)'"],
+ "matchStrings": ["- \\{unraid: '(?[^']+)', php: '[^']+', row: 'newest tag'\\}"],
"datasourceTemplate": "github-tags",
"depNameTemplate": "unraid/webgui",
"depTypeTemplate": "unraid-newest-tag",
@@ -58,16 +58,28 @@
],
"packageRules": [
{
- "description": "Unraid releases only: webgui also carries 2014.x date tags, which sort above every 7.x.",
- "matchDepTypes": ["unraid-stable"],
+ "description": "Release rows take Unraid releases only (webgui also carries 2014.x date tags, which sort above every 7.x), within their minor.",
+ "matchDepTypes": ["unraid-release"],
"allowedVersions": "/^\\d{1,2}\\.\\d+\\.\\d+$/"
},
+ {
+ "description": "A new minor gets a row of its own by hand, so a release row never leaves its minor.",
+ "matchDepTypes": ["unraid-release"],
+ "matchUpdateTypes": ["major", "minor"],
+ "enabled": false
+ },
{
"description": "Unraid releases and their betas and release candidates, still without the date tags.",
"matchDepTypes": ["unraid-newest-tag"],
"allowedVersions": "/^\\d{1,2}\\.\\d+\\.\\d+(-[0-9A-Za-z.]+)?$/",
"ignoreUnstable": false
},
+ {
+ "description": "One Unraid PR, merged by hand: a patch can change the PHP a release ships (7.2.8 did), so each row's php is checked against the release notes.",
+ "matchDepNames": ["unraid/webgui"],
+ "groupName": "Unraid versions",
+ "automerge": false
+ },
{
"description": "Bundled libraries ship to users, so their updates are fix(deps).",
"matchDepTypes": ["bundled"],
From 967b87f9f5f9c928ab9684635249a911b353beb8 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 17:31:55 +0800
Subject: [PATCH 22/72] ci: a .page's CSS is no JS regex, recovery boots check
saved files, and the matrix check skips commented-out rows and needs the
min's own major
---
.github/scripts/important_check.py | 8 +++++++-
.github/scripts/important_check_test.py | 6 ++++++
.github/unraid-compat/install_test.sh | 2 ++
.github/unraid-compat/matrix_check.py | 9 ++++++---
.github/unraid-compat/matrix_check_test.py | 8 ++++++++
5 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/.github/scripts/important_check.py b/.github/scripts/important_check.py
index 12e4e01d..b5bcb9f9 100644
--- a/.github/scripts/important_check.py
+++ b/.github/scripts/important_check.py
@@ -35,10 +35,16 @@ def _regex_end(text, i):
return None
+def _in_script(spans, i):
+ return any(start <= i < end for start, end in spans)
+
+
def scan(text, kind):
"""(code, comments): the text with comments, CSS strings and JS regexes blanked, and [(start, end, comment text)]."""
code, comments, i, n = list(text), [], 0, len(text)
script = kind != 'css'
+ # A .page holds CSS and HTML too: only its ', text, re.I | re.S)] if kind == 'page' else []
while i < n:
c, two = text[i], text[i:i + 2]
html = kind == 'page' and text.startswith('\n\n'})
self.assertEqual([p.split(': !')[0] for p in found], [f'{ROOT}/Folder.page:1', f'{ROOT}/styles/a.css:1'])
+ def test_a_url_in_page_css_is_no_regex_but_one_in_its_script_is(self):
+ page = ('\n'
+ "\n")
+ (problem,) = self.check({'Folder.page': page})
+ self.assertIn('Folder.page:1:', problem)
+
def test_no_files_to_check_fails_closed(self):
self.assertEqual(self.check({'README.md': 'x'}), [f'{ROOT}: no CSS, JS, PHP or .page files to check'])
diff --git a/.github/unraid-compat/install_test.sh b/.github/unraid-compat/install_test.sh
index 103a2c3a..2612bb54 100755
--- a/.github/unraid-compat/install_test.sh
+++ b/.github/unraid-compat/install_test.sh
@@ -121,6 +121,7 @@ installed $old download
[ "$(config_sums)" = "$before" ] || fail 'download: saved files changed'
[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'download: deleted the archive the next boot installs from'
boot download-boot; installed $old download-boot
+[ "$(config_sums)" = "$before" ] || fail 'download-boot: saved files changed'
# A failed upgradepkg does the same
reset; install $old stable3; saved_config; before=$(config_sums)
@@ -134,6 +135,7 @@ installed $old upgradepkg
[ "$(config_sums)" = "$before" ] || fail 'upgradepkg: saved files changed'
[ -f "$flash/$name-$old-x86_64-1.txz" ] || fail 'upgradepkg: deleted the archive the next boot installs from'
boot upgradepkg-boot; installed $old upgradepkg-boot
+[ "$(config_sums)" = "$before" ] || fail 'upgradepkg-boot: saved files changed'
# The installer itself refuses an Unraid below the .plg's min, and says why
reset; set_version 6.12.15; cp "$work/$new/dist/$name-$new-x86_64-1.txz" "$flash/"
diff --git a/.github/unraid-compat/matrix_check.py b/.github/unraid-compat/matrix_check.py
index c67c5604..23c1b1e0 100644
--- a/.github/unraid-compat/matrix_check.py
+++ b/.github/unraid-compat/matrix_check.py
@@ -4,7 +4,8 @@
import re
import sys
-ROW = re.compile(r"- \{unraid: '([^']+)', php: '([^']+)'(?:, row: '([^']+)')?\}")
+# Only a row that YAML reads: first on its line, so a commented-out row is not counted as tested
+ROW = re.compile(r"^[ \t]*- \{unraid: '([^']+)', php: '([^']+)'(?:, row: '([^']+)')?\}", re.M)
RELEASE = re.compile(r'(\d+)\.(\d+)\.\d+')
@@ -31,9 +32,11 @@ def problems(ci, plg):
out.append(f'Unraid {major}.{minor} has {len(versions)} release rows: {", ".join(versions)}')
if (major, minor) < floor:
out.append(f'release row {versions[0]} is below the .plg\'s min {floor[0]}.{floor[1]}')
- for major in sorted({major for major, _ in minors if major >= floor[0]}):
+ # From the min's own minor: a major with no rows at all still needs its first minor
+ for major in range(floor[0], max(minors)[0] + 1):
first = floor[1] if major == floor[0] else 0
- missing = [f'{major}.{n}' for n in range(first, max(n for m, n in minors if m == major)) if (major, n) not in minors]
+ present = [n for m, n in minors if m == major]
+ missing = [f'{major}.{n}' for n in range(first, max(present, default=first + 1)) if n not in present]
out += [f'no release row for Unraid {v}, between the .plg\'s min and the newest row' for v in missing]
# The 'newest tag' row runs only betas; a release it reaches needs a row of its own and the PHP that release ships
out += [f'Unraid {tag} is out: give it a release row with the PHP its release notes name' for tag in tags
diff --git a/.github/unraid-compat/matrix_check_test.py b/.github/unraid-compat/matrix_check_test.py
index cdd6f6b1..5f63c9f6 100644
--- a/.github/unraid-compat/matrix_check_test.py
+++ b/.github/unraid-compat/matrix_check_test.py
@@ -25,6 +25,14 @@ def test_a_skipped_minor_a_second_row_for_one_and_a_row_below_min_are_named(self
'Unraid 7.0 has 2 release rows: 7.0.1, 7.0.0',
'no release row for Unraid 7.1, between the .plg\'s min and the newest row'])
+ def test_a_commented_out_row_is_not_tested_so_not_counted(self):
+ text = ci('7.0.1', '7.1.4', '7.3.5', '7.4.0').replace(" - {unraid: '7.3.5'", " # - {unraid: '7.2.9', php: '8.4'}\n - {unraid: '7.3.5'")
+ self.assertEqual(matrix_check.problems(text, PLG), ["no release row for Unraid 7.2, between the .plg's min and the newest row"])
+
+ def test_the_mins_own_major_needs_rows_when_only_a_later_major_has_them(self):
+ self.assertEqual(matrix_check.problems(ci('8.0.0', tag="'8.0.0', php: '8.4'"), PLG),
+ ["no release row for Unraid 7.0, between the .plg's min and the newest row"])
+
def test_a_missing_min_newest_tag_or_release_row_fails_closed(self):
self.assertEqual(matrix_check.problems(ci('7.0.1'), ''), ['folder.view3.plg names no min="x.y.z"'])
self.assertEqual(matrix_check.problems("- {unraid: '7.0.1', php: '8.3'}", PLG), ["ci.yml needs exactly one 'newest tag' row, not 0"])
From 2522f0a3a4766c794514061c95fbd3f9be8b05e0 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 17:33:04 +0800
Subject: [PATCH 23/72] ci: in a .page, // starts a comment only in its script
and PHP blocks, so url(//cdn) in CSS hides nothing
---
.github/scripts/important_check.py | 6 ++++--
.github/scripts/important_check_test.py | 5 +++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/.github/scripts/important_check.py b/.github/scripts/important_check.py
index b5bcb9f9..489c0fd1 100644
--- a/.github/scripts/important_check.py
+++ b/.github/scripts/important_check.py
@@ -43,13 +43,15 @@ def scan(text, kind):
"""(code, comments): the text with comments, CSS strings and JS regexes blanked, and [(start, end, comment text)]."""
code, comments, i, n = list(text), [], 0, len(text)
script = kind != 'css'
- # A .page holds CSS and HTML too: only its ', text, re.I | re.S)] if kind == 'page' else []
+ slashes = [(0, n)] if kind in ('js', 'php') else js + [m.span(1) for m in re.finditer(r'<\?(.*?)(?:\?>|\Z)', text, re.S)] if kind == 'page' else []
while i < n:
c, two = text[i], text[i:i + 2]
html = kind == 'page' and text.startswith('' if html else '\n'
found = text.find(close, i + 2)
end = n if found == -1 else found + (0 if close == '\n' else len(close))
diff --git a/.github/scripts/important_check_test.py b/.github/scripts/important_check_test.py
index 7c876c17..ad451f49 100644
--- a/.github/scripts/important_check_test.py
+++ b/.github/scripts/important_check_test.py
@@ -63,6 +63,11 @@ def test_a_url_in_page_css_is_no_regex_but_one_in_its_script_is(self):
(problem,) = self.check({'Folder.page': page})
self.assertIn('Folder.page:1:', problem)
+ def test_a_protocol_relative_url_in_page_css_is_no_comment_but_one_in_its_php_is(self):
+ page = '\n"; ?>\n'
+ (problem,) = self.check({'Folder.page': page})
+ self.assertIn('Folder.page:1:', problem)
+
def test_no_files_to_check_fails_closed(self):
self.assertEqual(self.check({'README.md': 'x'}), [f'{ROOT}: no CSS, JS, PHP or .page files to check'])
From b16d60a2dc0628852c2028a6462fb7506ba43cd4 Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 10:48:59 +0000
Subject: [PATCH 24/72] chore(beta): release changelog
Release-Synced: 4a8472bd0b08a831c1d086b3caf5879885f40807
---
CHANGELOG.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 986a6f98..4f64ad3a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache if the page doesn't display correctly — before submitting a debug .json.
+## Unreleased
+
+- fix: a failed update no longer deletes the package archive the installed version boots from
+
## 2026.11.14.2 (beta)
- Folder actions that Unraid refuses now show its reason instead of raw JSON
From eaf0fad0825d785d5e2ff738837503d4713fec8e Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 18:50:52 +0800
Subject: [PATCH 25/72] docs: beta release notes
Release-Synced: 4a8472bd0b08a831c1d086b3caf5879885f40807
---
CHANGELOG.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4f64ad3a..208b8260 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,7 @@ After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache
## Unreleased
-- fix: a failed update no longer deletes the package archive the installed version boots from
+- A failed update no longer deletes the package the installed version reinstalls from at boot
## 2026.11.14.2 (beta)
From 6129a29cf91183c08bf2597d144581c70d7fc11f Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 18:54:26 +0800
Subject: [PATCH 26/72] chore(release): v2026.11.14.3 [skip ci]
---
CHANGELOG.md | 2 +-
folder.view3.plg | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 208b8260..e02dacbb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,7 +2,7 @@
After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache if the page doesn't display correctly — before submitting a debug .json.
-## Unreleased
+## 2026.11.14.3 (beta)
- A failed update no longer deletes the package the installed version reinstalls from at boot
diff --git a/folder.view3.plg b/folder.view3.plg
index b907aafb..9e9dddcb 100644
--- a/folder.view3.plg
+++ b/folder.view3.plg
@@ -6,8 +6,8 @@
-
-
+
+
]>
@@ -16,6 +16,9 @@
After updating, hard-refresh your browser (Ctrl/Cmd+Shift+R) and clear its cache if the page doesn't display correctly — before submitting a debug .json.
+###2026.11.14.3
+- A failed update no longer deletes the package the installed version reinstalls from at boot
+
###2026.11.14.2
- Folder actions that Unraid refuses now show its reason instead of raw JSON
From 57eb7f39da0617c0daee17f74f40e6081ca859da Mon Sep 17 00:00:00 2001
From: chodeus <190988615+chodeus@users.noreply.github.com>
Date: Sat, 14 Nov 2026 19:39:03 +0800
Subject: [PATCH 27/72] ci: FV3's endpoints and pages through each Unraid
version's real webGUI
fake_unraid.sh serves one webGUI tag with php -S, Docker and libvirt faked at
the system boundary from fixtures; pages_test.php checks Unraid's lists, FV3's
reads and writes behind Unraid's CSRF check, and FV3's pages in 4 themes with
every file they link. lib.sh holds what install_test.sh and fake_unraid.sh
share.
---
.coderabbit.yaml | 13 +-
.github/unraid-compat/Dockerfile | 6 +-
.github/unraid-compat/fake/docker.php | 92 ++++++++++
.github/unraid-compat/fake/libvirt.php | 128 ++++++++++++++
.github/unraid-compat/fake/prepend.php | 5 +
.github/unraid-compat/fake/router.php | 19 +++
.github/unraid-compat/fake_unraid.sh | 81 +++++++++
.github/unraid-compat/fixtures/docker.json | 25 +++
.github/unraid-compat/fixtures/vms.json | 28 +++
.github/unraid-compat/install_test.sh | 22 +--
.github/unraid-compat/lib.sh | 22 +++
.github/unraid-compat/pages_test.php | 187 +++++++++++++++++++++
.github/unraid-compat/pages_test.sh | 6 +
.github/workflows/ci.yml | 10 +-
14 files changed, 619 insertions(+), 25 deletions(-)
create mode 100644 .github/unraid-compat/fake/docker.php
create mode 100644 .github/unraid-compat/fake/libvirt.php
create mode 100644 .github/unraid-compat/fake/prepend.php
create mode 100644 .github/unraid-compat/fake/router.php
create mode 100644 .github/unraid-compat/fake_unraid.sh
create mode 100644 .github/unraid-compat/fixtures/docker.json
create mode 100644 .github/unraid-compat/fixtures/vms.json
create mode 100644 .github/unraid-compat/lib.sh
create mode 100644 .github/unraid-compat/pages_test.php
create mode 100644 .github/unraid-compat/pages_test.sh
diff --git a/.coderabbit.yaml b/.coderabbit.yaml
index 65ac2287..aedcd2e8 100644
--- a/.coderabbit.yaml
+++ b/.coderabbit.yaml
@@ -211,9 +211,16 @@ reviews:
The Unraid compatibility matrix; CI only, nothing here ships.
- install_test.sh puts the .plg through each Unraid version's own
plugin installer, hooks included, in a fresh Docker container with
- no network; it must refuse to run anywhere else. Only Slackware's
- upgradepkg and removepkg are stubbed, keeping their file-list
- records: flag any other stand-in for Unraid's code.
+ no network; it must refuse to run anywhere else (lib.sh's guard).
+ Only Slackware's upgradepkg and removepkg are stubbed, keeping their
+ file-list records: flag any other stand-in for Unraid's code.
+ - fake_unraid.sh serves one Unraid version's real webGUI with php -S
+ and pages_test.php drives FV3 through it. Stand-ins are the system
+ boundary only: fake/docker.php (dockerd's socket and the docker CLI),
+ fake/libvirt.php (the php-libvirt extension) and the Connect plugin's
+ ServerState, which the webGUI repo lacks. A call they do not answer
+ is logged as UNKNOWN and fails the run: flag an answer that hides
+ one, and any other stand-in for Unraid's code.
- matrix_check.py keeps ci.yml's Unraid rows at one per minor from the
.plg's min to the newest release; Renovate only moves rows.
- Each step asserts what the user is left with (live files, the
diff --git a/.github/unraid-compat/Dockerfile b/.github/unraid-compat/Dockerfile
index 2f8f421f..935ad012 100644
--- a/.github/unraid-compat/Dockerfile
+++ b/.github/unraid-compat/Dockerfile
@@ -1,5 +1,7 @@
# The PHP an Unraid version ships, plus what Unraid has and this image lacks: gawk (the .plg's remove script uses RT), xz
-# (the package format) and wget (the installer's downloader, so a download fails on the network, not a missing tool).
+# (the package format), procps (Unraid's pages test for running services with pgrep) and wget (the installer's downloader,
+# so a download fails on the network, not a missing tool). Unraid's /bin/sh is bash: its exec() strings use &>.
ARG PHP
FROM php:${PHP}-cli
-RUN apt-get update && apt-get install -y --no-install-recommends gawk wget xz-utils && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y --no-install-recommends gawk procps wget xz-utils && rm -rf /var/lib/apt/lists/* \
+ && ln -sf bash /bin/sh
diff --git a/.github/unraid-compat/fake/docker.php b/.github/unraid-compat/fake/docker.php
new file mode 100644
index 00000000..6804d30a
--- /dev/null
+++ b/.github/unraid-compat/fake/docker.php
@@ -0,0 +1,92 @@
+` stands in for the docker
+// CLI. Both read fixtures/docker.json (Docker Engine API answers captured from throwaway containers); a request this file
+// does not know is logged as UNKNOWN and refused, so a new call by Unraid or FV3 shows up in the log.
+$d = json_decode((string)@file_get_contents(__DIR__ . '/../fixtures/docker.json'), true);
+if (!is_array($d)) { fwrite(STDERR, "fixtures/docker.json is unreadable\n"); exit(2); }
+
+function fv3d_log(string $line): void { file_put_contents('/var/log/fv3-fakes.log', "docker $line\n", FILE_APPEND | LOCK_EX); }
+
+function fv3d_container(array $d, string $ref): ?array {
+ foreach ($d['inspect'] as $ct) {
+ if (ltrim($ct['Name'], '/') === ltrim($ref, '/') || (strlen($ref) >= 12 && str_starts_with($ct['Id'], $ref))) return $ct;
+ }
+ return null;
+}
+
+function fv3d_running(array $d): array { return array_values(array_filter($d['containers'], fn($c) => $c['State'] === 'running')); }
+
+function fv3d_answer(array $d, string $method, string $target): array {
+ $path = (string)parse_url($target, PHP_URL_PATH);
+ parse_str((string)parse_url($target, PHP_URL_QUERY), $query);
+ if ($method !== 'GET') return [null, null];
+ if ($path === '/containers/json') return [200, ($query['all'] ?? '0') !== '0' ? $d['containers'] : fv3d_running($d)];
+ if (preg_match('#^/containers/([^/]+)/json$#', $path, $m)) {
+ $ct = fv3d_container($d, $m[1]);
+ return $ct ? [200, $ct] : [404, ['message' => "No such container: {$m[1]}"]];
+ }
+ if ($path === '/images/json') return [200, $d['images']];
+ if (preg_match('#^/images/(.+)/json$#', $path, $m)) {
+ foreach ($d['image_inspect'] as $id => $img) {
+ if ($m[1] === $id || in_array($m[1], $img['RepoTags'] ?? [], true)) return [200, $img];
+ }
+ return [404, ['message' => "No such image: {$m[1]}"]];
+ }
+ return [null, null];
+}
+
+// The docker CLI lines Unraid and FV3 run, answered in the CLI's own output format
+function fv3d_cli(array $d, array $args): ?array {
+ $format = null;
+ foreach ($args as $i => $a) if (str_starts_with($a, '--format=')) { $format = substr($a, 9); unset($args[$i]); }
+ $line = implode(' ', $args);
+ if ($line === 'network ls' && $format === '{{.Name}}={{.Driver}}') return array_map(fn($n) => "{$n['Name']}={$n['Driver']}", $d['networks']);
+ if ($line === 'ps -q --no-trunc') return array_column(fv3d_running($d), 'Id');
+ if (preg_match('/^ps --filter label=(\S+) --format \{\{\.Names\}\}$/', $line, $m)) {
+ return array_map(fn($c) => ltrim($c['Names'][0], '/'), array_values(array_filter(fv3d_running($d), fn($c) => isset($c['Labels'][$m[1]]))));
+ }
+ if (str_starts_with($line, 'stats --no-stream') && $format === '{{.ID}};{{.CPUPerc}};{{.MemUsage}}') {
+ return array_map(fn($c) => substr($c['Id'], 0, 12) . ';0.50%;12.5MiB / 7.7GiB', fv3d_running($d));
+ }
+ if (preg_match('/^inspect (\S+)$/', $line, $m) && ($ct = fv3d_container($d, $m[1]))) {
+ if ($format === '{{.Name}}') return [$ct['Name']];
+ if (preg_match('/^\{\{range \.NetworkSettings\.Networks\}\}\{\{\.(IPAddress|GlobalIPv6Address)\}\} \{\{end\}\}$/', (string)$format, $f)) {
+ return [implode('', array_map(fn($n) => ($n[$f[1]] ?? '') . ' ', $ct['NetworkSettings']['Networks']))];
+ }
+ }
+ return null;
+}
+
+if (($argv[1] ?? '') === 'cli') {
+ $args = array_slice($argv, 2);
+ $out = fv3d_cli($d, $args);
+ fv3d_log(($out === null ? 'UNKNOWN ' : '') . 'cli ' . implode(' ', $args));
+ if ($out === null) exit(1);
+ echo $out ? implode("\n", $out) . "\n" : '';
+ exit(0);
+}
+
+if (($argv[1] ?? '') === 'serve') {
+ $sock = '/var/run/docker.sock';
+ @unlink($sock);
+ $server = stream_socket_server("unix://$sock", $errno, $errstr);
+ if (!$server) { fwrite(STDERR, "docker.sock: $errstr\n"); exit(2); }
+ chmod($sock, 0666);
+ file_put_contents('/var/run/dockerd.pid', getmypid());
+ while (true) {
+ $conn = @stream_socket_accept($server, -1);
+ if (!$conn) continue;
+ $request = (string)fgets($conn);
+ while (($line = fgets($conn)) !== false && rtrim($line) !== '');
+ [$method, $target] = array_pad(explode(' ', trim($request)), 2, '');
+ [$status, $body] = fv3d_answer($d, $method, $target);
+ fv3d_log(($status === null ? 'UNKNOWN ' : '') . "socket $method $target");
+ if ($status === null) [$status, $body] = [404, ['message' => 'page not found']];
+ // One line of JSON with a length, as dockerd answers: DockerClient decodes the body line by line
+ $json = json_encode($body, JSON_UNESCAPED_SLASHES) . "\n";
+ fwrite($conn, "HTTP/1.1 $status " . ($status === 200 ? 'OK' : 'Not Found') . "\r\nContent-Type: application/json\r\nContent-Length: " . strlen($json) . "\r\nConnection: close\r\n\r\n$json");
+ fclose($conn);
+ }
+}
+fwrite(STDERR, "usage: docker.php serve | cli \n");
+exit(2);
diff --git a/.github/unraid-compat/fake/libvirt.php b/.github/unraid-compat/fake/libvirt.php
new file mode 100644
index 00000000..a4b3fde5
--- /dev/null
+++ b/.github/unraid-compat/fake/libvirt.php
@@ -0,0 +1,128 @@
+ $d) if (is_resource($dom) && fv3l_handle('domain', $name) === $dom) return $d;
+ $GLOBALS['fv3l_error'] = 'invalid domain handle';
+ return null;
+}
+
+function fv3l_lookup(string $field, $value) {
+ foreach (fv3l_domains() as $name => $d) if ($d[$field] === $value) return fv3l_handle('domain', $name);
+ $GLOBALS['fv3l_error'] = "Domain not found: no domain with matching $field '$value'";
+ return false;
+}
+
+function libvirt_connect($uri = null, $readonly = true, $credentials = []) { return fv3l_handle('connection', 'qemu:///system'); }
+function libvirt_get_last_error() { return $GLOBALS['fv3l_error'] ?? null; }
+function libvirt_logfile_set($filename, $maxsize = 0) { return true; }
+function libvirt_connect_get_uri($conn) { return 'qemu:///system'; }
+function libvirt_connect_get_hostname($conn) { return 'Tower'; }
+function libvirt_list_domains($conn) { return array_keys(fv3l_domains()); }
+function libvirt_list_active_domain_ids($conn) { return array_values(array_map(fn($d) => $d['id'], array_filter(fv3l_domains(), fn($d) => $d['id'] > 0))); }
+function libvirt_domain_lookup_by_name($conn, $name) { return fv3l_lookup('name', (string)$name); }
+function libvirt_domain_lookup_by_uuid_string($conn, $uuid) { return fv3l_lookup('uuid', (string)$uuid); }
+function libvirt_domain_get_name($dom) { return fv3l_domain($dom)['name'] ?? false; }
+function libvirt_domain_get_uuid_string($dom) { return fv3l_domain($dom)['uuid'] ?? false; }
+function libvirt_domain_get_id($dom) { $d = fv3l_domain($dom); return $d ? $d['id'] : false; }
+function libvirt_domain_is_active($dom) { $d = fv3l_domain($dom); return $d ? $d['id'] > 0 : false; }
+function libvirt_domain_get_autostart($dom) { $d = fv3l_domain($dom); return $d ? (int)$d['autostart'] : false; }
+function libvirt_domain_get_xml_desc($dom, $xpath = null, $flags = 0) { return fv3l_domain($dom)['xml'] ?? false; }
+function libvirt_list_domain_snapshots($dom) { return fv3l_domain($dom) ? [] : false; }
+
+function libvirt_domain_get_info($dom) {
+ $d = fv3l_domain($dom);
+ if (!$d) return false;
+ $xml = simplexml_load_string($d['xml']);
+ return ['maxMem' => (int)$xml->memory, 'memory' => (int)$xml->currentMemory, 'state' => $d['state'], 'nrVirtCpu' => (int)$xml->vcpu, 'cpuUsed' => $d['id'] > 0 ? 12.5 : 0];
+}
+
+function libvirt_node_get_info($conn) {
+ return ['model' => 'x86_64', 'memory' => 16777216, 'cpus' => 8, 'nodes' => 1, 'sockets' => 1, 'cores' => 4, 'threads' => 2, 'mhz' => 3600];
+}
+
+// Each disk is a 20 GiB image at the path its XML names
+function libvirt_domain_get_block_info($dom, $dev) {
+ $d = fv3l_domain($dom);
+ if (!$d) return false;
+ foreach (simplexml_load_string($d['xml'])->devices->disk as $disk) {
+ if ((string)$disk->target['dev'] !== (string)$dev) continue;
+ $size = 21474836480;
+ return ['device' => (string)$dev, 'file' => (string)$disk->source['file'], 'type' => (string)$disk->driver['type'], 'capacity' => $size, 'allocation' => $size, 'physical' => $size];
+ }
+ $GLOBALS['fv3l_error'] = "invalid argument: no disk with target $dev";
+ return false;
+}
+
+function libvirt_domain_get_counts($conn) {
+ $active = count(array_filter(fv3l_domains(), fn($d) => $d['id'] > 0));
+ return ['total' => count(fv3l_domains()), 'active' => $active, 'inactive' => count(fv3l_domains()) - $active];
+}
+
+// php-libvirt's answer: the matches' text in order, with their count under 'num'
+function libvirt_domain_xml_xpath($dom, $xpath, $flags = 0) {
+ $d = fv3l_domain($dom);
+ if (!$d) return false;
+ $doc = new DOMDocument();
+ $doc->loadXML($d['xml']);
+ $nodes = @(new DOMXPath($doc))->query($xpath);
+ if ($nodes === false) { $GLOBALS['fv3l_error'] = "invalid xpath $xpath"; return false; }
+ $out = ['xpath' => $xpath, 'num' => $nodes->length];
+ foreach ($nodes as $i => $node) $out[$i] = $node->nodeValue;
+ return $out;
+}
+
+// Every other name in Unraid's libvirt.php, libvirt_helpers.php and VMMachines.php: none has an answer here yet
+foreach (['libvirt_connect_get_information', 'libvirt_connect_get_capabilities', 'libvirt_connect_get_machine_types',
+ 'libvirt_connect_get_domain_capabilities', 'libvirt_connect_get_all_domain_stats', 'libvirt_has_feature',
+ 'libvirt_list_nodedevs', 'libvirt_nodedev_get', 'libvirt_nodedev_get_xml_desc', 'libvirt_nodedev_get_information',
+ 'libvirt_nodedev_capabilities', 'libvirt_list_networks', 'libvirt_network_get', 'libvirt_network_get_xml_desc', 'libvirt_get_net_res',
+ 'libvirt_get_net_list', 'libvirt_get_net_xml', 'libvirt_domain_interface_addresses',
+ 'libvirt_domain_interface_stats', 'libvirt_domain_get_interface_devices', 'libvirt_domain_memory_stats',
+ 'libvirt_domain_get_screen_dimensions', 'libvirt_domain_qemu_agent_command', 'libvirt_domain_define_xml', 'libvirt_domain_create_xml',
+ 'libvirt_domain_undefine', 'libvirt_domain_update_device', 'libvirt_domain_create', 'libvirt_domain_destroy', 'libvirt_domain_shutdown',
+ 'libvirt_domain_reboot', 'libvirt_domain_suspend', 'libvirt_domain_resume', 'libvirt_domain_managedsave', 'libvirt_domain_set_autostart',
+ 'libvirt_domain_change_boot_devices', 'libvirt_domain_disk_remove', 'libvirt_domain_send_keys', 'libvirt_domain_send_pointer_event',
+ 'libvirt_domain_snapshot_create', 'libvirt_domain_snapshot_delete', 'libvirt_domain_snapshot_get_xml', 'libvirt_domain_snapshot_lookup_by_name',
+ 'libvirt_domain_snapshot_revert', 'libvirt_storagevolume_create_xml'] as $fv3lName) {
+ eval("function $fv3lName(...\$args) { fv3l_log('UNKNOWN $fv3lName'); \$GLOBALS['fv3l_error'] = 'not in the fake'; return false; }");
+}
+unset($fv3lName);
diff --git a/.github/unraid-compat/fake/prepend.php b/.github/unraid-compat/fake/prepend.php
new file mode 100644
index 00000000..b45b0259
--- /dev/null
+++ b/.github/unraid-compat/fake/prepend.php
@@ -0,0 +1,5 @@
+
+set -u
+version=$2; repo=$(pwd); here=$repo/.github/unraid-compat
+. "$here/lib.sh"
+fail() { echo "FAILED [Unraid $version]: $*"; exit 1; }
+fv3_docroot "$1" || fail "no Unraid webGUI under $1"
+
+# FV3 as upgradepkg leaves it, and the config folder its .plg makes
+fv3_build "$repo" 2099.01.01 beta || fail 'package build'
+tar -xJf "$work/2099.01.01/dist/$name-2099.01.01-x86_64-1.txz" -C / || fail 'package unpack'
+mkdir -p "$flash/styles" "$flash/scripts" && printf '2099.01.01' > "$flash/version"
+
+# Unraid's own state, as emhttp writes it with the array started
+printf 'version="%s"\n' "$version" > /etc/unraid-version
+cat >> /var/local/emhttp/var.ini < /var/local/emhttp/network.ini
+printf 'DOCKER_ENABLED="yes"\n' > /boot/config/docker.cfg
+# DEBUG keeps PHP warnings on: without it Unraid's libvirt_helpers.php, which FV3 loads, turns error reporting off
+printf 'SERVICE="enable"\nDEBUG="yes"\n' > /boot/config/domain.cfg
+# The OS image adds the Connect plugin, which the webGUI repo lacks from 7.2 on; 7.4's header requires its state class
+if [ ! -f $docroot/plugins/dynamix.my.servers/include/state.php ]; then
+ mkdir -p $docroot/plugins/dynamix.my.servers/include
+ printf ' $docroot/plugins/dynamix.my.servers/include/state.php
+ : > $docroot/plugins/dynamix.my.servers/include/myservers1.php
+fi
+ln -sf $docroot/plugins/dynamix.plugin.manager/scripts/plugin /usr/local/sbin/plugin
+
+# A saved setup: Media holds app-a by hand and app-b by its label, Tools takes tool-c by regex, app-d is loose; Lab holds a VM
+mkdir -p /boot/config/plugins/dockerMan/templates-user /boot/config/plugins/dynamix.vm.manager /var/lib/docker
+cat > "$flash/docker.json" <<'EOF'
+{"MediaAbCdEfGhIjKlMnO":{"name":"Media","icon":"","regex":"","containers":["app-a"],"settings":{"preview":1},"actions":[]},"ToolsPqRsTuVwXyZaBcD":{"name":"Tools","icon":"","regex":"^tool-","containers":[],"settings":{"preview":1},"actions":[]}}
+EOF
+cat > "$flash/vm.json" <<'EOF'
+{"LabFoldAbCdEfGhIjKlM":{"name":"Lab","icon":"","regex":"","containers":["Debian 12"],"settings":{"preview":1},"actions":[]}}
+EOF
+printf '0="folder-MediaAbCdEfGhIjKlMnO"\n1="app-a"\n2="app-b"\n3="folder-ToolsPqRsTuVwXyZaBcD"\n4="tool-c"\n5="app-d"\n' > /boot/config/plugins/dockerMan/userprefs.cfg
+printf '0="folder-LabFoldAbCdEfGhIjKlM"\n1="Debian 12"\n2="Home Assistant"\n3="Windows 11"\n' > /boot/config/plugins/dynamix.vm.manager/userprefs.cfg
+printf 'app-a\napp-d 10\n' > /var/lib/docker/unraid-autostart
+cat > /boot/config/plugins/dockerMan/templates-user/my-app-a.xml <<'EOF'
+
+
+ app-a
+ alpine:3.20
+ bridge
+ sh
+ http://[IP]:[PORT:8080]/
+ 18080
+
+EOF
+
+# Every PHP process starts as Unraid's php.ini has it: short tags, the prepend, errors to a log and never into a page
+cat > "$PHP_INI_DIR/conf.d/zz-fake-unraid.ini" < /var/log/phplog; : > /var/log/fv3-fakes.log
+
+# Docker and libvirtd under their own names, so Unraid's pgrep() and /proc/ checks find them running
+printf '#!/bin/sh\nexec php %s/fake/docker.php cli "$@"\n' "$here" > /usr/local/bin/docker && chmod +x /usr/local/bin/docker
+ln -sf "$(command -v php)" /usr/local/sbin/dockerd; ln -sf "$(command -v sleep)" /usr/local/sbin/libvirtd
+dockerd "$here/fake/docker.php" serve > /var/log/dockerd.log 2>&1 &
+mkdir -p /var/run/libvirt; libvirtd infinity & echo $! > /var/run/libvirt/libvirtd.pid
+php -S 127.0.0.1:80 -t $docroot "$here/fake/router.php" > /var/log/php-server.log 2>&1 &
+for _ in $(seq 300); do
+ [ -S /var/run/docker.sock ] && curl -sf -o /dev/null http://127.0.0.1/robots.txt && exit 0
+ sleep 0.1
+done
+fail "the fake Unraid did not start: $(cat /var/log/dockerd.log /var/log/php-server.log)"
diff --git a/.github/unraid-compat/fixtures/docker.json b/.github/unraid-compat/fixtures/docker.json
new file mode 100644
index 00000000..dc4bbea0
--- /dev/null
+++ b/.github/unraid-compat/fixtures/docker.json
@@ -0,0 +1,25 @@
+{
+ "containers": [
+ {"Id":"600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd","Names":["/app-d"],"Image":"alpine:3.20","ImageID":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}},"Command":"sleep 3600","Created":1794654654,"Ports":[],"Labels":{"net.unraid.docker.managed":"dockerman"},"State":"running","Status":"Up Less than a second","HostConfig":{"NetworkMode":"host"},"Health":{"Status":"none","FailingStreak":0},"NetworkSettings":{"Networks":{"host":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"1d8356c7e2572093121c6ecc3f3aa90f115043fc120bce24df492e9046968e53","EndpointID":"94d7de5784b83c465530aac4d83eb3748b59d47c8aaf458474145d73eb8c3a61","Gateway":"","IPAddress":"","MacAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"Mounts":[]},
+ {"Id":"32b7dac6e0272111835c5192f61054626ff79f117ba024985e9e48cd089e6629","Names":["/tool-c"],"Image":"alpine:3.20","ImageID":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}},"Command":"sleep 3600","Created":1794654654,"Ports":[],"Labels":{"net.unraid.docker.managed":"dockerman"},"State":"created","Status":"Created","HostConfig":{"NetworkMode":"bridge"},"Health":{"Status":"none","FailingStreak":0},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"","EndpointID":"","Gateway":"","IPAddress":"","MacAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"Mounts":[]},
+ {"Id":"37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1","Names":["/app-b"],"Image":"alpine:3.20","ImageID":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}},"Command":"sleep 3600","Created":1794654654,"Ports":[],"Labels":{"folder.view3":"Media","net.unraid.docker.managed":"dockerman"},"State":"running","Status":"Up Less than a second","HostConfig":{"NetworkMode":"bridge"},"Health":{"Status":"none","FailingStreak":0},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"47de28aa8e317df6a908d72b266290cc7dbc3a18a554e5269630623cd4f7fb71","EndpointID":"bd56c9e7b10762831e36c7f251099a298217e0e343ed1133bf195296107e552a","Gateway":"172.17.0.1","IPAddress":"172.17.0.3","MacAddress":"3e:b4:33:03:78:7e","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"Mounts":[]},
+ {"Id":"7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380","Names":["/app-a"],"Image":"alpine:3.20","ImageID":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}},"Command":"sleep 3600","Created":1794654653,"Ports":[{"IP":"0.0.0.0","PrivatePort":8080,"PublicPort":18080,"Type":"tcp"},{"IP":"::","PrivatePort":8080,"PublicPort":18080,"Type":"tcp"}],"Labels":{"net.unraid.docker.icon":"/plugins/dynamix.docker.manager/images/question.png","net.unraid.docker.managed":"dockerman","net.unraid.docker.webui":"http://[IP]:[PORT:8080]/"},"State":"running","Status":"Up Less than a second","HostConfig":{"NetworkMode":"bridge"},"Health":{"Status":"none","FailingStreak":0},"NetworkSettings":{"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"47de28aa8e317df6a908d72b266290cc7dbc3a18a554e5269630623cd4f7fb71","EndpointID":"b3f964c8ef346a2bef5b11a0f3f05fc5f9783db10a0fff31db735e8056c72e86","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","MacAddress":"0e:f7:ce:c2:79:80","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"Mounts":[]}
+ ],
+ "inspect": {
+ "app-a": {"Id":"7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380","Created":"2026-11-14T11:10:53.865989285Z","Path":"sleep","Args":["3600"],"State":{"Status":"running","Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":3201330,"ExitCode":0,"Error":"","StartedAt":"2026-11-14T11:10:53.881644066Z","FinishedAt":"0001-01-01T00:00:00Z"},"Image":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ResolvConfPath":"/var/lib/docker/containers/7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380/resolv.conf","HostnamePath":"/var/lib/docker/containers/7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380/hostname","HostsPath":"/var/lib/docker/containers/7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380/hosts","LogPath":"/var/lib/docker/containers/7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380/7d18800f0983d6ecb26b0723a8ca52934964675a8c4dbd20c0b85ca0d3b83380-json.log","Name":"/app-a","RestartCount":0,"Driver":"overlayfs","Platform":"linux","MountLabel":"","ProcessLabel":"","AppArmorProfile":"docker-default","ExecIDs":null,"HostConfig":{"Binds":null,"ContainerIDFile":"","LogConfig":{"Type":"json-file","Config":{}},"NetworkMode":"bridge","PortBindings":{"8080/tcp":[{"HostIp":"","HostPort":"18080"}]},"RestartPolicy":{"Name":"no","MaximumRetryCount":0},"AutoRemove":false,"VolumeDriver":"","VolumesFrom":null,"ConsoleSize":[0,0],"CapAdd":null,"CapDrop":null,"CgroupnsMode":"private","Dns":null,"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"GroupAdd":null,"IpcMode":"private","Cgroup":"","Links":null,"OomScoreAdj":0,"PidMode":"","Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"SecurityOpt":null,"UTSMode":"","UsernsMode":"","ShmSize":67108864,"Runtime":"runc","Isolation":"","CpuShares":0,"Memory":0,"NanoCpus":0,"CgroupParent":"","BlkioWeight":0,"BlkioWeightDevice":[],"BlkioDeviceReadBps":[],"BlkioDeviceWriteBps":[],"BlkioDeviceReadIOps":[],"BlkioDeviceWriteIOps":[],"CpuPeriod":0,"CpuQuota":0,"CpuRealtimePeriod":0,"CpuRealtimeRuntime":0,"CpusetCpus":"","CpusetMems":"","Devices":[],"DeviceCgroupRules":null,"DeviceRequests":null,"MemoryReservation":0,"MemorySwap":0,"MemorySwappiness":null,"OomKillDisable":null,"PidsLimit":null,"Ulimits":null,"CpuCount":0,"CpuPercent":0,"IOMaximumIOps":0,"IOMaximumBandwidth":0,"MaskedPaths":["/proc/acpi","/proc/asound","/proc/interrupts","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/sched_debug","/proc/scsi","/proc/timer_list","/proc/timer_stats","/sys/devices/virtual/powercap","/sys/firmware"],"ReadonlyPaths":["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"Storage":{"RootFS":{"Snapshot":{"Name":"overlayfs"}}},"Mounts":[],"Config":{"Hostname":"7d18800f0983","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"8080/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sleep","3600"],"Image":"alpine:3.20","Volumes":null,"WorkingDir":"/","Entrypoint":null,"Labels":{"net.unraid.docker.icon":"/plugins/dynamix.docker.manager/images/question.png","net.unraid.docker.managed":"dockerman","net.unraid.docker.webui":"http://[IP]:[PORT:8080]/"}},"NetworkSettings":{"SandboxID":"e3c238cede0e60f74780079e1c2b1301e97d101a00097cff872b2704404d2884","SandboxKey":"/var/run/docker/netns/e3c238cede0e","Ports":{"8080/tcp":[{"HostIp":"0.0.0.0","HostPort":"18080"},{"HostIp":"::","HostPort":"18080"}]},"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"47de28aa8e317df6a908d72b266290cc7dbc3a18a554e5269630623cd4f7fb71","EndpointID":"b3f964c8ef346a2bef5b11a0f3f05fc5f9783db10a0fff31db735e8056c72e86","Gateway":"172.17.0.1","IPAddress":"172.17.0.2","MacAddress":"0e:f7:ce:c2:79:80","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}}},
+ "app-b": {"Id":"37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1","Created":"2026-11-14T11:10:54.013835226Z","Path":"sleep","Args":["3600"],"State":{"Status":"running","Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":3201412,"ExitCode":0,"Error":"","StartedAt":"2026-11-14T11:10:54.04418883Z","FinishedAt":"0001-01-01T00:00:00Z"},"Image":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ResolvConfPath":"/var/lib/docker/containers/37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1/resolv.conf","HostnamePath":"/var/lib/docker/containers/37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1/hostname","HostsPath":"/var/lib/docker/containers/37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1/hosts","LogPath":"/var/lib/docker/containers/37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1/37a78efc3169096f5792940da290445b77e858951026d2d56a186e826fb793d1-json.log","Name":"/app-b","RestartCount":0,"Driver":"overlayfs","Platform":"linux","MountLabel":"","ProcessLabel":"","AppArmorProfile":"docker-default","ExecIDs":null,"HostConfig":{"Binds":null,"ContainerIDFile":"","LogConfig":{"Type":"json-file","Config":{}},"NetworkMode":"bridge","PortBindings":{},"RestartPolicy":{"Name":"no","MaximumRetryCount":0},"AutoRemove":false,"VolumeDriver":"","VolumesFrom":null,"ConsoleSize":[0,0],"CapAdd":null,"CapDrop":null,"CgroupnsMode":"private","Dns":null,"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"GroupAdd":null,"IpcMode":"private","Cgroup":"","Links":null,"OomScoreAdj":0,"PidMode":"","Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"SecurityOpt":null,"UTSMode":"","UsernsMode":"","ShmSize":67108864,"Runtime":"runc","Isolation":"","CpuShares":0,"Memory":0,"NanoCpus":0,"CgroupParent":"","BlkioWeight":0,"BlkioWeightDevice":[],"BlkioDeviceReadBps":[],"BlkioDeviceWriteBps":[],"BlkioDeviceReadIOps":[],"BlkioDeviceWriteIOps":[],"CpuPeriod":0,"CpuQuota":0,"CpuRealtimePeriod":0,"CpuRealtimeRuntime":0,"CpusetCpus":"","CpusetMems":"","Devices":[],"DeviceCgroupRules":null,"DeviceRequests":null,"MemoryReservation":0,"MemorySwap":0,"MemorySwappiness":null,"OomKillDisable":null,"PidsLimit":null,"Ulimits":null,"CpuCount":0,"CpuPercent":0,"IOMaximumIOps":0,"IOMaximumBandwidth":0,"MaskedPaths":["/proc/acpi","/proc/asound","/proc/interrupts","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/sched_debug","/proc/scsi","/proc/timer_list","/proc/timer_stats","/sys/devices/virtual/powercap","/sys/firmware"],"ReadonlyPaths":["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"Storage":{"RootFS":{"Snapshot":{"Name":"overlayfs"}}},"Mounts":[],"Config":{"Hostname":"37a78efc3169","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sleep","3600"],"Image":"alpine:3.20","Volumes":null,"WorkingDir":"/","Entrypoint":null,"Labels":{"folder.view3":"Media","net.unraid.docker.managed":"dockerman"}},"NetworkSettings":{"SandboxID":"b1ca3d1f194461b8d618bc13f55509aefdd2c0a86430e9cae3c169a5c1b9229f","SandboxKey":"/var/run/docker/netns/b1ca3d1f1944","Ports":{},"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"47de28aa8e317df6a908d72b266290cc7dbc3a18a554e5269630623cd4f7fb71","EndpointID":"bd56c9e7b10762831e36c7f251099a298217e0e343ed1133bf195296107e552a","Gateway":"172.17.0.1","IPAddress":"172.17.0.3","MacAddress":"3e:b4:33:03:78:7e","IPPrefixLen":16,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}}},
+ "tool-c": {"Id":"32b7dac6e0272111835c5192f61054626ff79f117ba024985e9e48cd089e6629","Created":"2026-11-14T11:10:54.108306911Z","Path":"sleep","Args":["3600"],"State":{"Status":"created","Running":false,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":0,"ExitCode":0,"Error":"","StartedAt":"0001-01-01T00:00:00Z","FinishedAt":"0001-01-01T00:00:00Z"},"Image":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ResolvConfPath":"","HostnamePath":"","HostsPath":"","LogPath":"","Name":"/tool-c","RestartCount":0,"Driver":"overlayfs","Platform":"linux","MountLabel":"","ProcessLabel":"","AppArmorProfile":"","ExecIDs":null,"HostConfig":{"Binds":null,"ContainerIDFile":"","LogConfig":{"Type":"json-file","Config":{}},"NetworkMode":"bridge","PortBindings":{},"RestartPolicy":{"Name":"no","MaximumRetryCount":0},"AutoRemove":false,"VolumeDriver":"","VolumesFrom":null,"ConsoleSize":[0,0],"CapAdd":null,"CapDrop":null,"CgroupnsMode":"private","Dns":null,"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"GroupAdd":null,"IpcMode":"private","Cgroup":"","Links":null,"OomScoreAdj":0,"PidMode":"","Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"SecurityOpt":null,"UTSMode":"","UsernsMode":"","ShmSize":67108864,"Runtime":"runc","Isolation":"","CpuShares":0,"Memory":0,"NanoCpus":0,"CgroupParent":"","BlkioWeight":0,"BlkioWeightDevice":[],"BlkioDeviceReadBps":[],"BlkioDeviceWriteBps":[],"BlkioDeviceReadIOps":[],"BlkioDeviceWriteIOps":[],"CpuPeriod":0,"CpuQuota":0,"CpuRealtimePeriod":0,"CpuRealtimeRuntime":0,"CpusetCpus":"","CpusetMems":"","Devices":[],"DeviceCgroupRules":null,"DeviceRequests":null,"MemoryReservation":0,"MemorySwap":0,"MemorySwappiness":null,"OomKillDisable":false,"PidsLimit":null,"Ulimits":null,"CpuCount":0,"CpuPercent":0,"IOMaximumIOps":0,"IOMaximumBandwidth":0,"MaskedPaths":["/proc/acpi","/proc/asound","/proc/interrupts","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/sched_debug","/proc/scsi","/proc/timer_list","/proc/timer_stats","/sys/devices/virtual/powercap","/sys/firmware"],"ReadonlyPaths":["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"Storage":{"RootFS":{"Snapshot":{"Name":"overlayfs"}}},"Mounts":[],"Config":{"Hostname":"32b7dac6e027","Domainname":"","User":"","AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sleep","3600"],"Image":"alpine:3.20","Volumes":null,"WorkingDir":"/","Entrypoint":null,"Labels":{"net.unraid.docker.managed":"dockerman"}},"NetworkSettings":{"SandboxID":"","SandboxKey":"","Ports":{},"Networks":{"bridge":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"","EndpointID":"","Gateway":"","IPAddress":"","MacAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}}},
+ "app-d": {"Id":"600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd","Created":"2026-11-14T11:10:54.137826016Z","Path":"sleep","Args":["3600"],"State":{"Status":"running","Running":true,"Paused":false,"Restarting":false,"OOMKilled":false,"Dead":false,"Pid":3201459,"ExitCode":0,"Error":"","StartedAt":"2026-11-14T11:10:54.155919462Z","FinishedAt":"0001-01-01T00:00:00Z"},"Image":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","ResolvConfPath":"/var/lib/docker/containers/600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd/resolv.conf","HostnamePath":"/var/lib/docker/containers/600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd/hostname","HostsPath":"/var/lib/docker/containers/600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd/hosts","LogPath":"/var/lib/docker/containers/600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd/600ab5c857f84d2318abb88f789cabd98504a5bcbcf8d54b8e15924838a7a2cd-json.log","Name":"/app-d","RestartCount":0,"Driver":"overlayfs","Platform":"linux","MountLabel":"","ProcessLabel":"","AppArmorProfile":"docker-default","ExecIDs":null,"HostConfig":{"Binds":null,"ContainerIDFile":"","LogConfig":{"Type":"json-file","Config":{}},"NetworkMode":"host","PortBindings":{},"RestartPolicy":{"Name":"no","MaximumRetryCount":0},"AutoRemove":false,"VolumeDriver":"","VolumesFrom":null,"ConsoleSize":[0,0],"CapAdd":null,"CapDrop":null,"CgroupnsMode":"private","Dns":null,"DnsOptions":[],"DnsSearch":[],"ExtraHosts":null,"GroupAdd":null,"IpcMode":"private","Cgroup":"","Links":null,"OomScoreAdj":0,"PidMode":"","Privileged":false,"PublishAllPorts":false,"ReadonlyRootfs":false,"SecurityOpt":null,"UTSMode":"","UsernsMode":"","ShmSize":67108864,"Runtime":"runc","Isolation":"","CpuShares":0,"Memory":0,"NanoCpus":0,"CgroupParent":"","BlkioWeight":0,"BlkioWeightDevice":[],"BlkioDeviceReadBps":[],"BlkioDeviceWriteBps":[],"BlkioDeviceReadIOps":[],"BlkioDeviceWriteIOps":[],"CpuPeriod":0,"CpuQuota":0,"CpuRealtimePeriod":0,"CpuRealtimeRuntime":0,"CpusetCpus":"","CpusetMems":"","Devices":[],"DeviceCgroupRules":null,"DeviceRequests":null,"MemoryReservation":0,"MemorySwap":0,"MemorySwappiness":null,"OomKillDisable":null,"PidsLimit":null,"Ulimits":null,"CpuCount":0,"CpuPercent":0,"IOMaximumIOps":0,"IOMaximumBandwidth":0,"MaskedPaths":["/proc/acpi","/proc/asound","/proc/interrupts","/proc/kcore","/proc/keys","/proc/latency_stats","/proc/sched_debug","/proc/scsi","/proc/timer_list","/proc/timer_stats","/sys/devices/virtual/powercap","/sys/firmware"],"ReadonlyPaths":["/proc/bus","/proc/fs","/proc/irq","/proc/sys","/proc/sysrq-trigger"]},"Storage":{"RootFS":{"Snapshot":{"Name":"overlayfs"}}},"Mounts":[],"Config":{"Hostname":"colima","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["sleep","3600"],"Image":"alpine:3.20","Volumes":null,"WorkingDir":"/","Entrypoint":null,"Labels":{"net.unraid.docker.managed":"dockerman"}},"NetworkSettings":{"SandboxID":"1146429705f7841f920992f51e91d518d4e11d95924a7b0173bda4e684c7c0df","SandboxKey":"/var/run/docker/netns/default","Ports":{},"Networks":{"host":{"IPAMConfig":null,"Links":null,"Aliases":null,"DriverOpts":null,"GwPriority":0,"NetworkID":"1d8356c7e2572093121c6ecc3f3aa90f115043fc120bce24df492e9046968e53","EndpointID":"94d7de5784b83c465530aac4d83eb3748b59d47c8aaf458474145d73eb8c3a61","Gateway":"","IPAddress":"","MacAddress":"","IPPrefixLen":0,"IPv6Gateway":"","GlobalIPv6Address":"","GlobalIPv6PrefixLen":0,"DNSNames":null}}},"ImageManifestDescriptor":{"mediaType":"application/vnd.oci.image.manifest.v1+json","digest":"sha256:45e09956dc667c5eff3583c9d94830261fb1ca0be10a0a7db36266edf5de9e1d","size":1026,"annotations":{"com.docker.official-images.bashbrew.arch":"arm64v8","org.opencontainers.image.base.name":"scratch","org.opencontainers.image.created":"2026-04-16T23:53:21Z","org.opencontainers.image.revision":"0db70ae354ee747109ce0b9a0cfbcd3c907bc822","org.opencontainers.image.source":"https://github.com/alpinelinux/docker-alpine.git#0db70ae354ee747109ce0b9a0cfbcd3c907bc822:aarch64","org.opencontainers.image.url":"https://hub.docker.com/_/alpine","org.opencontainers.image.version":"3.20.10"},"platform":{"architecture":"arm64","os":"linux","variant":"v8"}}}
+ },
+ "images": [
+ {"Containers":4,"Created":1776383604,"Id":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","Labels":{},"ParentId":"","Descriptor":{"mediaType":"application/vnd.oci.image.index.v1+json","digest":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","size":9226},"RepoDigests":["alpine@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc"],"RepoTags":["alpine:3.20"],"SharedSize":-1,"Size":13660215}
+ ],
+ "image_inspect": {
+ "sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc": {"Id":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","RepoTags":["alpine:3.20"],"RepoDigests":["alpine@sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc"],"Comment":"buildkit.dockerfile.v0","Created":"2026-04-16T23:53:24.896953537Z","Config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh"],"WorkingDir":"/"},"Architecture":"arm64","Variant":"v8","Os":"linux","Size":4103199,"RootFS":{"Type":"layers","Layers":["sha256:88b4fba61c4c714a2fc173ddf7e9324a257304696830bf41ad28ecc58c11c95f"]},"Metadata":{"LastTagTime":"2026-10-30T23:32:14.282085809Z"},"Descriptor":{"mediaType":"application/vnd.oci.image.index.v1+json","digest":"sha256:d9e853e87e55526f6b2917df91a2115c36dd7c696a35be12163d44e6e2a4b6bc","size":9226},"Identity":{"Pull":[{"Repository":"docker.io/library/alpine"}]}}
+ },
+ "networks": [
+ {"Name":"host","Driver":"host"},
+ {"Name":"none","Driver":"null"},
+ {"Name":"bridge","Driver":"bridge"}
+ ]
+}
diff --git a/.github/unraid-compat/fixtures/vms.json b/.github/unraid-compat/fixtures/vms.json
new file mode 100644
index 00000000..a2be0356
--- /dev/null
+++ b/.github/unraid-compat/fixtures/vms.json
@@ -0,0 +1,28 @@
+{
+ "domains": [
+ {
+ "name": "Debian 12",
+ "uuid": "803bd917-84b0-490f-ba3c-5e21b4cd6f07",
+ "state": 1,
+ "id": 1,
+ "autostart": true,
+ "xml": "\n Debian 12\n 803bd917-84b0-490f-ba3c-5e21b4cd6f07\n Debian 12 lab server\n \n \n \n 2097152\n 2097152\n \n \n \n 2\n \n hvm\n \n \n \n /usr/local/sbin/qemu\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"
+ },
+ {
+ "name": "Windows 11",
+ "uuid": "9fd1c657-7f2b-41b4-9ff3-5b42706315d5",
+ "state": 5,
+ "id": -1,
+ "autostart": false,
+ "xml": "\n Windows 11\n 9fd1c657-7f2b-41b4-9ff3-5b42706315d5\n \n \n \n \n 8388608\n 8388608\n \n \n \n 4\n \n hvm\n \n \n \n /usr/local/sbin/qemu\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"
+ },
+ {
+ "name": "Home Assistant",
+ "uuid": "39ec878e-ce44-4414-8dd1-b8fb3e57f9b2",
+ "state": 3,
+ "id": 2,
+ "autostart": true,
+ "xml": "\n Home Assistant\n 39ec878e-ce44-4414-8dd1-b8fb3e57f9b2\n \n \n \n \n 4194304\n 4194304\n \n \n \n 3\n \n hvm\n \n \n \n /usr/local/sbin/qemu\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n"
+ }
+ ]
+}
diff --git a/.github/unraid-compat/install_test.sh b/.github/unraid-compat/install_test.sh
index 2612bb54..380b3b6e 100755
--- a/.github/unraid-compat/install_test.sh
+++ b/.github/unraid-compat/install_test.sh
@@ -2,26 +2,18 @@
# FolderView3 through a real Unraid webGUI's plugin installer: install, upgrade over the last stable, remove, failures, min.
# Disposable container only, as root, with no network. Usage: install_test.sh
set -u
-# This replaces /usr/bin/php, package tools and plugin files, so it runs only in a fresh Docker container, never on a host.
-if [ ! -f /.dockerenv ] || [ -e /etc/unraid-version ] || [ -d /boot/config ]; then echo 'Refusing to run outside a fresh Docker container' >&2; exit 2; fi
version=$2; repo=$(pwd)
+. "$repo/.github/unraid-compat/lib.sh"
fail() { echo "FAILED [Unraid $version]: $*"; exit 1; }
-web=$(cd "$1" 2>/dev/null && pwd) && [ -f "$web/emhttp/plugins/dynamix.plugin.manager/scripts/plugin" ] || fail "no Unraid plugin installer under $1"
stable=$(cd "$3" 2>/dev/null && pwd) && [ -f "$stable/pkg_build.sh" ] || fail "no last-stable checkout with pkg_build.sh at $3"
awk --version 2>/dev/null | grep -q 'GNU Awk' || fail 'awk is not gawk, as it is on Unraid: the remove script needs RT'
+fv3_docroot "$1" || fail "no Unraid plugin installer under $1"
-name=folder.view3
-docroot=/usr/local/emhttp
-flash=/boot/config/plugins/$name
live=$docroot/plugins/$name
manifest=/boot/config/plugins/$name.plg
-mkdir -p "$docroot/plugins" /boot/config/plugins-error /var/log/plugins /var/log/packages /var/local/emhttp
-cp -R "$web/emhttp/plugins/dynamix" "$web/emhttp/plugins/dynamix.plugin.manager" "$docroot/plugins/"
-ln -sfn "$docroot/plugins/dynamix" "$docroot/webGui"
-printf 'csrf_token="compat-test-token"\n' > /var/local/emhttp/var.ini
-# Unraid's pre- and post-install hooks run as #!/usr/bin/php and keep their state under /tmp/plugins
+mkdir -p /boot/config/plugins-error /var/log/plugins /var/log/packages
+# Unraid's pre- and post-install hooks keep their state under /tmp/plugins
mkdir -p /tmp/plugins
-ln -sf "$(command -v php)" /usr/bin/php
plugin() { php "$docroot/plugins/dynamix.plugin.manager/scripts/plugin" "$@"; }
# Slackware's package tools, as they work: the record lists the package's files, and removepkg takes those and the folders
@@ -42,11 +34,7 @@ rm -f "$record"
STUB
chmod +x /sbin/upgradepkg /sbin/removepkg
-work=$(mktemp -d)
-build() { # build : the .plg and package as the release workflow makes them
- local dir="$work/$2"; mkdir -p "$dir"; cp -R "$1/src" "$1/$name.plg" "$1/pkg_build.sh" "$dir/"
- (cd "$dir" && bash pkg_build.sh --version "$2" --branch "$3" --out "$dir/dist" >/dev/null) || fail "package build of $2"
-}
+build() { fv3_build "$@" || fail "package build of $2"; }
old=2026.01.01; new=2099.01.01
build "$stable" $old main; build "$repo" $new beta
min=$(grep -o ']*min="[^"]*"' "$work/$new/$name.plg" | sed 's/.*min="//; s/"$//')
diff --git a/.github/unraid-compat/lib.sh b/.github/unraid-compat/lib.sh
new file mode 100644
index 00000000..f6ac976b
--- /dev/null
+++ b/.github/unraid-compat/lib.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Shared by install_test.sh and fake_unraid.sh. Source it from the repo root; it sets name, docroot, flash and work.
+# These scripts replace system files, so they run only in a fresh Docker container, never on a host.
+if [ ! -f /.dockerenv ] || [ -e /etc/unraid-version ] || [ -d /boot/config ]; then echo 'Refusing to run outside a fresh Docker container' >&2; exit 2; fi
+name=folder.view3
+docroot=/usr/local/emhttp
+flash=/boot/config/plugins/$name
+work=$(mktemp -d)
+
+fv3_docroot() { # fv3_docroot : Unraid's /usr/local/emhttp from that webGUI checkout, its symlinks included
+ [ -f "$1/emhttp/plugins/dynamix.plugin.manager/scripts/plugin" ] || return 1
+ mkdir -p $docroot /var/local/emhttp /boot/config/plugins
+ cp -a "$1/emhttp/." $docroot/
+ printf 'csrf_token="compat-test-token"\n' > /var/local/emhttp/var.ini
+ # Unraid's hooks and scripts run as #!/usr/bin/php
+ ln -sf "$(command -v php)" /usr/bin/php
+}
+
+fv3_build() { # fv3_build : the .plg and package as the release workflow makes them, in $work/
+ local dir="$work/$2"; mkdir -p "$dir"; cp -R "$1/src" "$1/$name.plg" "$1/pkg_build.sh" "$dir/"
+ (cd "$dir" && bash pkg_build.sh --version "$2" --branch "$3" --out "$dir/dist" >/dev/null)
+}
diff --git a/.github/unraid-compat/pages_test.php b/.github/unraid-compat/pages_test.php
new file mode 100644
index 00000000..f7177e3a
--- /dev/null
+++ b/.github/unraid-compat/pages_test.php
@@ -0,0 +1,187 @@
+
+$version = $argv[1] ?? '?';
+$failures = [];
+$checks = 0;
+function check(bool $ok, string $what): void { global $failures, $checks; $checks++; if (!$ok) $failures[] = $what; }
+
+// One request to the fake Unraid: [status, body, lower-cased response headers]; a POST carries Unraid's token unless told not to
+function req(string $method, string $path, array $fields = [], ?string $token = 'compat-test-token'): array {
+ $headers = [];
+ $ch = curl_init("http://127.0.0.1$path");
+ curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 60, CURLOPT_CUSTOMREQUEST => $method,
+ CURLOPT_HEADERFUNCTION => function ($ch, $line) use (&$headers) {
+ if (str_contains($line, ':')) { [$k, $v] = explode(':', $line, 2); $headers[strtolower(trim($k))] = trim($v); }
+ return strlen($line);
+ }]);
+ if ($method === 'POST') curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields + ($token === null ? [] : ['csrf_token' => $token])));
+ $body = curl_exec($ch);
+ $status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
+ curl_close($ch);
+ return [$status, (string)$body, $headers];
+}
+
+// What one .page file put on the page: Unraid opens each file's part, in the head and again in the body, with a comment naming it
+function fv3t_page_part(string $html, string $file): string {
+ preg_match_all('//', $html, $marks, PREG_OFFSET_CAPTURE);
+ $part = '';
+ foreach ($marks[0] as $i => [$mark, $at]) {
+ if ($marks[1][$i][0] !== $file) continue;
+ $from = $at + strlen($mark);
+ $part .= substr($html, $from, ($marks[0][$i + 1][1] ?? strlen($html)) - $from);
+ }
+ return $part;
+}
+
+function get_json(string $path, ?int &$status = null) {
+ [$status, $body] = req('GET', "/plugins/folder.view3/server/$path");
+ return json_decode($body, true);
+}
+
+$flash = '/boot/config/plugins/folder.view3';
+$media = 'MediaAbCdEfGhIjKlMnO';
+$tools = 'ToolsPqRsTuVwXyZaBcD';
+$lab = 'LabFoldAbCdEfGhIjKlM';
+$containers = ['app-a', 'app-b', 'app-d', 'tool-c'];
+$vms = ['Debian 12', 'Home Assistant', 'Windows 11'];
+$fixture = json_decode(file_get_contents(__DIR__ . '/fixtures/docker.json'), true);
+$shortId = fn(string $name) => substr($fixture['inspect'][$name]['Id'], 0, 12);
+$sorted = function (array $a): array { sort($a); return $a; };
+
+// Unraid's own lists, which FV3's pages fold into folders
+[$status, $body] = req('GET', '/plugins/dynamix.docker.manager/include/DockerContainers.php');
+check($status === 200 && substr_count($body, "
") . ' container rows, not 4');
+foreach ($containers as $ct) check(str_contains($body, $ct), "Docker list has no row for $ct");
+[$status, $body] = req('GET', '/plugins/dynamix.vm.manager/include/VMMachines.php');
+check($status === 200 && preg_match_all("/