@openmixer/plugin-qualify 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +59 -9
  2. package/bin/plugin-qualify.mjs +62 -29
  3. package/dist/clap-loader.d.ts +1 -1
  4. package/dist/clap-loader.js +3 -3
  5. package/dist/clap-loader.js.map +1 -1
  6. package/dist/clap-qualify.d.ts +21 -45
  7. package/dist/clap-qualify.js +60 -82
  8. package/dist/clap-qualify.js.map +1 -1
  9. package/dist/cost-fields.d.ts +26 -0
  10. package/dist/cost-fields.js +30 -0
  11. package/dist/cost-fields.js.map +1 -1
  12. package/dist/host-profiles.d.ts +14 -0
  13. package/dist/host-profiles.js +27 -1
  14. package/dist/host-profiles.js.map +1 -1
  15. package/dist/hosting-codes.d.ts +6 -2
  16. package/dist/hosting-codes.js +9 -4
  17. package/dist/hosting-codes.js.map +1 -1
  18. package/dist/hosting-suitability.d.ts +43 -4
  19. package/dist/hosting-suitability.js +46 -8
  20. package/dist/hosting-suitability.js.map +1 -1
  21. package/dist/index.d.ts +5 -0
  22. package/dist/index.js +5 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/judge-cli.d.ts +41 -0
  25. package/dist/judge-cli.js +114 -0
  26. package/dist/judge-cli.js.map +1 -0
  27. package/dist/measure-host.js +2 -2
  28. package/dist/measurement/format.d.ts +1 -1
  29. package/dist/measurement/probe-json.js +1 -0
  30. package/dist/measurement/probe-json.js.map +1 -1
  31. package/dist/measurement/vocabulary.d.ts +1 -1
  32. package/dist/measurement/vocabulary.js +7 -1
  33. package/dist/measurement/vocabulary.js.map +1 -1
  34. package/dist/probe-judge.d.ts +60 -0
  35. package/dist/probe-judge.js +213 -0
  36. package/dist/probe-judge.js.map +1 -0
  37. package/dist/probe-output-fixtures.d.ts +25 -0
  38. package/dist/probe-output-fixtures.js +134 -0
  39. package/dist/probe-output-fixtures.js.map +1 -0
  40. package/dist/probe-output.d.ts +150 -0
  41. package/dist/probe-output.js +369 -0
  42. package/dist/probe-output.js.map +1 -0
  43. package/dist/probe-runner.d.ts +79 -0
  44. package/dist/probe-runner.js +191 -0
  45. package/dist/probe-runner.js.map +1 -0
  46. package/dist/qualification-record.d.ts +80 -0
  47. package/dist/qualification-record.js +85 -0
  48. package/dist/qualification-record.js.map +1 -0
  49. package/dist/qualify-cli.js +1 -1
  50. package/dist/qualify-cli.js.map +1 -1
  51. package/dist/qualify-declarations.d.ts +26 -6
  52. package/dist/qualify-declarations.js +25 -7
  53. package/dist/qualify-declarations.js.map +1 -1
  54. package/fixtures/clap-scan/fake.json +30 -6
  55. package/fixtures/probe-output/memory-limit-refused.json +190 -0
  56. package/fixtures/probe-output/plugin-crash.json +236 -0
  57. package/fixtures/probe-output/success-msi.json +363 -0
  58. package/package.json +7 -2
  59. package/src/clap-loader.ts +3 -2
  60. package/src/clap-qualify.ts +70 -124
  61. package/src/cost-fields.ts +39 -0
  62. package/src/host-profiles.ts +29 -1
  63. package/src/hosting-codes.ts +9 -4
  64. package/src/hosting-suitability.ts +82 -11
  65. package/src/index.ts +5 -0
  66. package/src/judge-cli.ts +133 -0
  67. package/src/measure-host.ts +2 -2
  68. package/src/measurement/format.ts +1 -1
  69. package/src/measurement/probe-json.ts +1 -0
  70. package/src/measurement/vocabulary.ts +8 -1
  71. package/src/probe-judge.ts +264 -0
  72. package/src/probe-output-fixtures.ts +146 -0
  73. package/src/probe-output.ts +505 -0
  74. package/src/probe-runner.ts +244 -0
  75. package/src/qualification-record.ts +142 -0
  76. package/src/qualify-cli.ts +1 -1
  77. package/src/qualify-declarations.ts +28 -8
  78. package/tools/ai-trace-commit-check.sh +114 -0
  79. package/tools/ai-trace-patterns.json +33 -0
  80. package/tools/benchmark.py +13 -1
  81. package/tools/private-refs-check.sh +90 -0
@@ -1086,6 +1086,14 @@ OPTIONS = "http://lv2plug.in/ns/ext/options#"
1086
1086
  BUFSZ = "http://lv2plug.in/ns/ext/buf-size#"
1087
1087
  PARAMS = "http://lv2plug.in/ns/ext/parameters#"
1088
1088
  WORKER = "http://lv2plug.in/ns/ext/worker#"
1089
+ # The refusal's code: the LV2 worker spec does not make `work` or `work_response` optional, so a plugin
1090
+ # whose interface leaves either NULL is not hostable (end_run may be NULL).
1091
+ WORKER_NONCONFORMING = "hosting.worker.nonconforming"
1092
+
1093
+
1094
+ class WorkerInterfaceError(Exception):
1095
+ """The plugin's LV2_Worker_Interface is incomplete; the message starts with WORKER_NONCONFORMING."""
1096
+
1089
1097
 
1090
1098
 
1091
1099
  LV2_WORKER_SUCCESS = 0
@@ -1095,7 +1103,7 @@ LV2_WORKER_ERR_NO_SPACE = 3
1095
1103
  class WorkerQueue:
1096
1104
  """The host half of `worker:schedule`: jobs are QUEUED, and run between blocks, off `run()`.
1097
1105
 
1098
- Spec 2a (`2026-09-25-plugin-qualify.md`): a schedule that accepts a job and
1106
+ A schedule that accepts a job and
1099
1107
  drops it measures an UNBUILT plugin — the Hex Chain amp read 0.9 us/sample that way against 5.4
1100
1108
  built. After every block the host calls `pump(interface)`: the plugin's `work()` for each
1101
1109
  queued job, then `work_response()` with whatever it answered, then `end_run()` once every answer
@@ -1261,6 +1269,10 @@ class _Host:
1261
1269
  handle = ctypes.c_void_p(instance.get_handle())
1262
1270
  except (AttributeError, TypeError, ValueError):
1263
1271
  return None
1272
+ # calling a NULL function pointer through ctypes kills the process: refuse before anything is called
1273
+ for name in ("work", "work_response"):
1274
+ if not getattr(iface, name):
1275
+ raise WorkerInterfaceError(f"{WORKER_NONCONFORMING}: LV2_Worker_Interface.{name} is NULL")
1264
1276
 
1265
1277
  def keep(buf):
1266
1278
  return ctypes.create_string_buffer(bytes(buf), len(buf))
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env bash
2
+ # SPDX-License-Identifier: GPL-3.0-or-later
3
+ # Copyright (C) 2026 Pau Aliagas <linuxnow@gmail.com>
4
+ #
5
+ # private-refs-check.sh — this repository is public, so its tracked files state facts and never point
6
+ # into a private repository: no private repository name, no private issue or pull request number, no
7
+ # private branch name or file path, no name of a private specification file. Say what the value is and
8
+ # why instead, and cite only public repositories (omx-dsp, omx-contract, omx-plugins, omx-clap-core, plugin-qualify).
9
+ # Product-name mentions of OpenMixer, and values such as the org.openmixer.* CLAP ids, the
10
+ # urn:openmixer:* LV2 URIs and the @openmixer npm scope, are not pointers and are not matched.
11
+ #
12
+ # tools/private-refs-check.sh the check, over every tracked file (generated ones included)
13
+ # tools/private-refs-check.sh --self-test each sabotage, in every kind of file, must go red
14
+ #
15
+ # ALLOW lists the tracked files exempt from the check, each with the reason; nothing else is.
16
+ set -euo pipefail
17
+ HERE="$(cd "$(dirname "$0")/.." && pwd)"
18
+
19
+ # <file> — <why it may name them>
20
+ ALLOW=(
21
+ "tools/private-refs-check.sh" # it spells the patterns it looks for
22
+ )
23
+ EXTRA_PATHSPEC=() # the self-test sets a bad one, to prove a git grep error is red
24
+
25
+ # Extended regexps, matched case-insensitively. A new kind of pointer is one line here.
26
+ PATTERNS=(
27
+ 'FreeMixer/openmixer([^A-Za-z0-9_-]|$)' # the private repository
28
+ 'openmixer-ops' # the private operations repository
29
+ 'openmixer ?#[0-9]' # one of its issues or pull requests
30
+ '[A-Za-z0-9_.]-dev#[0-9]' # an issue of a private *-dev repository
31
+ 'integration/[A-Za-z0-9]' # a private integration branch
32
+ 'packages/[a-z][a-z0-9-]+' # a path into the private repository's packages
33
+ '\.vue([^A-Za-z0-9_]|$)' # its web UI components
34
+ "openmixer's spec" # its specification files
35
+ 'docs/design/' # its design documents
36
+ 'harness/' # its test harness
37
+ '20[0-9]{2}-[0-9]{2}-[0-9]{2}-[a-z][a-z0-9-]+\.md' # a dated specification file name
38
+ 'spec 20[0-9]{2}-[0-9]{2}-[0-9]{2}' # a citation of one
39
+ )
40
+
41
+ check() { # <root>
42
+ local root="$1" fail=0 args=() p a hits
43
+ for p in "${PATTERNS[@]}"; do args+=(-e "$p"); done
44
+ local excl=()
45
+ for a in "${ALLOW[@]}"; do excl+=(":(exclude)${a%% *}"); done
46
+ [ -n "$(git -C "$root" ls-files)" ] || { echo "private-refs-check: git lists no file" >&2; return 1; }
47
+ # git grep exits 1 for no match and 128 or more for an error; an error must not read as "no hits"
48
+ hits=$(git -C "$root" grep -nIiE "${args[@]}" -- . "${excl[@]}" "${EXTRA_PATHSPEC[@]}") || rc=$?
49
+ case "${rc:-0}" in 0|1) ;; *) echo "private-refs-check: git grep failed (exit $rc)" >&2; return 1 ;; esac
50
+ hits=$(printf '%s' "$hits" | cut -c1-200)
51
+ [ -z "$hits" ] || { printf '%s\n' "$hits" >&2; fail=1; }
52
+ [ "$fail" = 0 ] || { echo "private-refs-check: the lines above point into private repositories; state the fact instead" >&2; return 1; }
53
+ echo "private-refs-check: no tracked file points into a private repository"
54
+ }
55
+
56
+ if [ "${1:-}" = --self-test ]; then
57
+ scratch="$(mktemp -d)"; trap 'rm -rf "$scratch"' EXIT
58
+ fail=0
59
+ # a clean tree with one file of each kind the repository tracks; every sabotage writes one private pointer into one
60
+ mk() { rm -rf "$scratch/t"; mkdir -p "$scratch/t/src" "$scratch/t/tools" "$scratch/t/docs"
61
+ git -C "$scratch" init -q t
62
+ printf 'rdfs:comment "The OpenMixer console x." ;\nlv2:binary <x.so> ; # urn:openmixer:x\n' > "$scratch/t/src/x.ttl"
63
+ printf '// org.openmixer.x, @openmixer/x\n' > "$scratch/t/tools/gen.mjs"
64
+ printf '# Docs\n\nOpenMixer plugins.\n' > "$scratch/t/docs/a.md"
65
+ printf '/* x */\n' > "$scratch/t/src/x.h"; printf '#!/bin/sh\n# x\n' > "$scratch/t/tools/x.sh"; }
66
+ sab() { # <name> <file> <line>
67
+ mk; printf '%s\n' "$3" >> "$scratch/t/$2"; git -C "$scratch/t" add -A
68
+ if check "$scratch/t" >/dev/null 2>&1; then echo "SABOTAGE $1: STAYED GREEN"; fail=1; else echo "SABOTAGE $1: red"; fi; }
69
+ mk; git -C "$scratch/t" add -A
70
+ check "$scratch/t" >/dev/null || { echo "self-test: the clean tree is not green" >&2; exit 1; }
71
+ sab repo-in-header src/x.h '/* as FreeMixer/openmixer draws it */'
72
+ sab branch-in-sh tools/x.sh '# drawn on integration/lean-engine'
73
+ sab issue-in-md docs/a.md 'see openmixer#1580'
74
+ sab path-in-md docs/a.md 'packages/web-ui/Foo.vue'
75
+ sab default-path tools/x.sh 'plugin=${P:-$root/../openmixer/packages/omx-plugins/bin/omx-delay.clap}'
76
+ sab ops-in-mjs tools/gen.mjs '// see openmixer-ops'
77
+ sab dev-in-mjs tools/gen.mjs '// omx-dsp-dev#32'
78
+ sab spec-in-mjs tools/gen.mjs "// openmixer's spec 2026-10-09-plugin-from-contract.md"
79
+ sab ttl src/x.ttl 'rdfs:comment "see FreeMixer/openmixer#12" ;'
80
+ sab header src/x.h '/* packages/core/src/x.ts */'
81
+ sab design-dir docs/a.md 'the notes in docs/design/specs'
82
+ sab harness-dir tools/gen.mjs '// harness/dsp-check.sh'
83
+ mk; git -C "$scratch/t" add -A
84
+ if ( EXTRA_PATHSPEC=(":(bogus)x"); check "$scratch/t" >/dev/null 2>&1 ); then echo "SABOTAGE git-grep-error: STAYED GREEN"; fail=1; else echo "SABOTAGE git-grep-error: red"; fi
85
+ [ "$fail" = 0 ] || exit 1
86
+ check "$HERE" >/dev/null || { echo "self-test: the repository is not green" >&2; exit 1; }
87
+ echo "private-refs-check self-test: every sabotage red"
88
+ exit 0
89
+ fi
90
+ check "$HERE"