mirror of
https://github.com/got-feedBack/feedBack.git
synced 2026-09-12 07:48:32 +00:00
fix: address PR #332 review feedback
Addresses 12 of 13 review comments from Copilot and CodeRabbit on PR #332. One comment (no-manifests in validate-plugins.yml) is declined and answered inline; the rest are applied here. Substantive fixes: - .github/workflows/validate-plugins.yml — add --noconftest to the schema-tests step. tests/conftest.py imports structlog at module level, but the CI job only installs requirements-test.txt (pytest/httpx/jsonschema), so pytest collection would fail at conftest import. The schema tests don't use shared fixtures, so skipping conftest is safe and avoids dragging the full runtime requirements into a 2 KB validation job. (Copilot) - schema/plugin.schema.json — tighten the server_files regex on both settings.server_files and diagnostics.server_files to match the runtime _validate_relpath rules in plugins/__init__.py. The previous regex only blocked absolute paths, drive letters, backslashes, and "..". The runtime also rejects "//", "./", "/./", and leading-dotfile segments. Schema-valid manifests are now also load-time-valid. Verified the regex against 12 cases: the 3 in-tree manifests still validate. (Copilot) - .claude/skills/plugin-validate/SKILL.md — add a per-iteration plugin_ok flag so we no longer print "OK <path>" after an earlier FAIL in the same manifest. Schema-pass + id-mismatch previously produced both FAIL and OK lines for one plugin. (CodeRabbit) - docs/websocket-protocol.md — clarify song_info.tuning array length is source-dependent (typically 6 guitar, 4 bass, but extended-range GP imports can be 7/8/5/6). Recommend highway.getStringCount() for the authoritative count. Line 30 already said this; the table row on line 12 was the stale half. (CodeRabbit) Trivial fixes: - .claude/rules/plugin-author.md — "wants included" -> "wants to include" in the settings.server_files rule. (CodeRabbit) - Markdown MD040 — add `text` language tags to 7 bare-fence code blocks across AGENTS.md, docs/PLUGIN_AUTHORING.md, docs/testing-plugins.md, docs/plugin-logging.md, .claude/README.md, .claude/agents/slopsmith-reviewer.md, and .claude/skills/plugin-validate/SKILL.md (two fences). (CodeRabbit) Declined: - .github/workflows/validate-plugins.yml no-manifests -> exit 0 (CodeRabbit suggested exit 1). Plugins in this repo are in-tree, not submodules (no .gitmodules, git submodule status empty), and the workflow has a path filter on plugins/**/plugin.json so it only runs when a manifest actually changes. Exit 0 is correct. Answered inline on the PR. Verification: pytest tests/test_plugin_schema.py -v --noconftest # 8 passed python -c "import json,glob,jsonschema; s=json.load(open('schema/plugin.schema.json')); [jsonschema.validate(json.load(open(p)), s) for p in sorted(glob.glob('plugins/*/plugin.json'))]" # ok — all 3 in-tree manifests validate against tightened schema Signed-off-by: Miguel_LZPF <mgcdreamer@gmail.com>
This commit is contained in:
@@ -31,6 +31,7 @@ for path in sorted(glob.glob('plugins/*/plugin.json')):
|
||||
plugin_dir = pathlib.Path(path).parent
|
||||
plugin_id = plugin_dir.name
|
||||
m = json.load(open(path))
|
||||
plugin_ok = True # per-iteration flag so we don't print OK after a later FAIL
|
||||
# 1. Schema
|
||||
try:
|
||||
jsonschema.validate(m, schema)
|
||||
@@ -42,16 +43,19 @@ for path in sorted(glob.glob('plugins/*/plugin.json')):
|
||||
if m['id'] != plugin_id:
|
||||
print(f"FAIL {path}: id={m['id']!r} but directory is {plugin_id!r}")
|
||||
ok = False
|
||||
plugin_ok = False
|
||||
# 3. Declared files exist
|
||||
for field in ('script', 'routes', 'tour'):
|
||||
if field in m and not (plugin_dir / m[field]).exists():
|
||||
print(f"FAIL {path}: {field}={m[field]!r} but file missing")
|
||||
ok = False
|
||||
plugin_ok = False
|
||||
if 'settings' in m and 'html' in m['settings']:
|
||||
h = m['settings']['html']
|
||||
if not (plugin_dir / h).exists():
|
||||
print(f"FAIL {path}: settings.html={h!r} but file missing")
|
||||
ok = False
|
||||
plugin_ok = False
|
||||
for field in ('settings', 'diagnostics'):
|
||||
if field in m and 'server_files' in m[field]:
|
||||
for relpath in m[field]['server_files']:
|
||||
@@ -61,7 +65,9 @@ for path in sorted(glob.glob('plugins/*/plugin.json')):
|
||||
if '..' in relpath or relpath.startswith('/') or '\\' in relpath:
|
||||
print(f"FAIL {path}: {field}.server_files contains unsafe path {relpath!r}")
|
||||
ok = False
|
||||
print(f"OK {path}")
|
||||
plugin_ok = False
|
||||
if plugin_ok:
|
||||
print(f"OK {path}")
|
||||
sys.exit(0 if ok else 1)
|
||||
PY
|
||||
```
|
||||
@@ -84,13 +90,13 @@ pytest tests/test_plugin_schema.py::test_schema_license_enum_subset_of_contribut
|
||||
|
||||
Use the format from the script: `OK <path>` per validated manifest, `FAIL <path>: <reason>` per failure. Add a one-line summary:
|
||||
|
||||
```
|
||||
```text
|
||||
Result: 3/3 plugins valid (OK app_tour_library, app_tour_settings, highway_3d)
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
```text
|
||||
Result: 2/3 plugins valid; 1 FAIL (see above)
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user