scout-rig 0.2.6 → 0.2.7
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.
- checksums.yaml +4 -4
- data/.vimproject +31 -13
- data/README.md +27 -4
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/doc/Improvements.md +396 -0
- data/doc/StartHere.md +95 -0
- data/doc/developer/Architecture.md +232 -0
- data/doc/developer/DataConversionInternals.md +407 -0
- data/doc/developer/DesignPrinciples.md +254 -0
- data/doc/developer/PythonTaskRunnerInternals.md +371 -0
- data/doc/developer/PythonWorkflowInternals.md +539 -0
- data/doc/developer/ScoutPythonInternals.md +504 -0
- data/doc/user/Cookbook.md +337 -0
- data/doc/user/DefiningPythonTasks.md +708 -0
- data/doc/user/DrivingWorkflowsFromPython.md +418 -0
- data/doc/user/IteratingPythonData.md +142 -0
- data/doc/user/PassingDataToPython.md +223 -0
- data/doc/user/PythonEnvironments.md +197 -0
- data/doc/user/RunningPythonFromRuby.md +267 -0
- data/doc/user/ScriptingPython.md +281 -0
- data/doc/user/TestingAndPackaging.md +487 -0
- data/lib/scout/python/script.rb +11 -2
- data/lib/scout/workflow/python/inputs.rb +33 -23
- data/lib/scout/workflow/python/task.rb +219 -22
- data/lib/scout/workflow/python.rb +236 -9
- data/lib/scout-rig/testing/availability.rb +608 -0
- data/python/README.md +51 -0
- data/python/scout/__init__.py +2 -0
- data/python/scout/runner.py +193 -29
- data/python/scout/task_errors.py +6 -0
- data/research/00_scope_and_themes.md +131 -0
- data/research/data-conversion-and-scripting-analysis.md +209 -0
- data/research/design-philosophy-analysis.md +246 -0
- data/research/python-helper-package-analysis.md +272 -0
- data/research/pythonworkflow-analysis.md +199 -0
- data/research/scoutpython-bridge-analysis.md +185 -0
- data/research/synthesis-report.md +109 -0
- data/research/testing-availability-baseline.md +1625 -0
- data/research/testing-availability-final-report.md +500 -0
- data/research/validation-report.md +149 -0
- data/scout-rig.gemspec +35 -5
- data/test/scout/python/test_util.rb +13 -0
- data/test/scout/test_python.rb +10 -0
- data/test/scout/workflow/python/test_task.rb +1119 -1
- data/test/scout-rig/testing/test_availability.rb +495 -0
- data/test/scout-rig/testing/test_test_support.rb +166 -0
- data/test/test_helper.rb +96 -19
- metadata +47 -4
- data/doc/Python.md +0 -482
- data/doc/PythonWorkflow.md +0 -163
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
# Testing availability for scout-rig — final report (step 8 of 8)
|
|
2
|
+
|
|
3
|
+
Closing report for the testing-availability task. HEAD `386954a4`
|
|
4
|
+
("Explain how to add extensions"); no commit was made at any step (by
|
|
5
|
+
design — see Environmental failures and residuals). Full per-step history,
|
|
6
|
+
raw scratch outputs and the pre-edit baseline live in
|
|
7
|
+
`research/testing-availability-baseline.md`; this file is the consolidated,
|
|
8
|
+
current-state deliverable.
|
|
9
|
+
|
|
10
|
+
Everything in "Validation runs" below was executed fresh for this report
|
|
11
|
+
(2026-10-11); no number in it is quoted from an earlier step.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Delivered API and require path
|
|
16
|
+
|
|
17
|
+
**Require (the only entry point, strictly opt-in):**
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
require 'scout-rig/testing/availability'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
That require loads `scout/testing/availability` (the scout-essentials
|
|
24
|
+
primitive) and **nothing else of consequence**: no scout-rig production
|
|
25
|
+
code, no `ScoutPython`, no PyCall bridge. Verified fresh in Validation
|
|
26
|
+
runs item 1: `defined?(PyCall)` is `nil` after the require.
|
|
27
|
+
|
|
28
|
+
**Module:** `ScoutRig::Testing::Availability`
|
|
29
|
+
(file `lib/scout-rig/testing/availability.rb`).
|
|
30
|
+
|
|
31
|
+
**Mixin:** the module extends itself, so both call styles share one
|
|
32
|
+
implementation and one memo store:
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
# module-function style
|
|
36
|
+
ScoutRig::Testing::Availability.python_modules?(:torch)
|
|
37
|
+
# mixin style — Helpers is the very same module object, not a copy
|
|
38
|
+
class MyTest < Test::Unit::TestCase
|
|
39
|
+
include ScoutRig::Testing::Availability # or include ScoutRig::Testing::Helpers
|
|
40
|
+
def test_x; python_modules?(:torch); end
|
|
41
|
+
end
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Every method, exactly as implemented (kwargs verbatim from the source,
|
|
45
|
+
not paraphrased):**
|
|
46
|
+
|
|
47
|
+
| Method | Signature | Returns |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| `python?` | `python?(executable: nil, route: DEFAULT_ROUTE, timeout: nil)` | `true` iff the selected Python exists **and runs** — sanity probe `python -c 'import sys'` must exit 0; decided on exit status, never output, never PATH existence alone |
|
|
50
|
+
| `python_modules?` | `python_modules?(*modules, executable: nil, route: DEFAULT_ROUTE, timeout: nil)` | `true` iff every named module imports under the selected interpreter; symbols accepted (normalized to strings); an empty list is vacuously true **only after an interpreter resolved** (no interpreter → absent-interpreter reason wins) |
|
|
51
|
+
| `python_modules_reason` | `python_modules_reason(*modules, executable: nil, route: DEFAULT_ROUTE, timeout: nil)` | `nil` on success; else one concise string: resolved executable path + missing module name(s) + bounded stderr tail |
|
|
52
|
+
| `rscript?` | `rscript?(executable: nil, timeout: nil)` | `true` iff the selected Rscript exists and runs (`Rscript --vanilla -e 'cat("ok")'` exits 0) |
|
|
53
|
+
| `r_packages?` | `r_packages?(*packages, executable: nil, timeout: nil)` | `true` iff every named package **loads** via `requireNamespace` (not an installation-list lookup) |
|
|
54
|
+
| `r_packages_reason` | `r_packages_reason(*packages, executable: nil, timeout: nil)` | `nil` on success; else resolved path + missing package list (stdout first) + stderr tail |
|
|
55
|
+
| `embedded_python` | `embedded_python` | the interpreter the embedded route **would** initialize: `ENV['PYTHON']` when set (blank = unset), else first of `python3`/`python` on PATH; `nil` when neither. A prediction, never a validation — it does not run the interpreter and never touches `ENV` |
|
|
56
|
+
| `subprocess_python` | `subprocess_python` | `'python'` when `python` is on PATH (the literal command `ScoutPython.script`/`run_file`/`python_task` spawn), else `nil`. `ENV['PYTHON']` never consulted |
|
|
57
|
+
| `python_routes_divergence_reason` | `python_routes_divergence_reason` | `nil` when both routes resolve (realpath, symlinks canonicalized) to the same interpreter; else one message naming both resolutions, the `ENV['PYTHON']`-vs-PATH cause, the remedy, and that no probe validates both routes |
|
|
58
|
+
| `reset!` | `reset!` | clears every memoized probe result; returns `nil` |
|
|
59
|
+
|
|
60
|
+
**Constants:** `DEFAULT_TIMEOUT = 30` (seconds; aligned with
|
|
61
|
+
`Scout::Testing::Availability::DEFAULT_TIMEOUT`), `DEFAULT_ROUTE =
|
|
62
|
+
:subprocess`, `ROUTES = [:subprocess, :embedded].freeze`, `REASON_TAIL =
|
|
63
|
+
400`, `MEMO` / `MEMO_MUTEX` (shared cache + lock), and the four frozen
|
|
64
|
+
probe-source constants (`PYTHON_SANITY_SOURCE`, `PYTHON_MODULES_PROBE`,
|
|
65
|
+
`RSCRIPT_SANITY_SOURCE`, `R_PACKAGES_PROBE`).
|
|
66
|
+
|
|
67
|
+
**R helpers are reference code only.** scout-rig ships no R execution
|
|
68
|
+
runtime; `rscript?` / `r_packages?` report whether R is usable *from a
|
|
69
|
+
test*, and there is no `route:` dimension for R for exactly that reason.
|
|
70
|
+
|
|
71
|
+
**Probe process discipline (all probes):** every launch goes through
|
|
72
|
+
`Scout::Testing::Availability.run_command` (bounded timeout, both streams
|
|
73
|
+
drained, launch failure and timeout reported on the result, not raised);
|
|
74
|
+
module/package names travel as process arguments to a fixed frozen probe
|
|
75
|
+
source and are never interpolated into Python/R source; the only rescue in
|
|
76
|
+
the file is a `StandardError`-scoped guard around a filesystem resolution
|
|
77
|
+
race — no `rescue Exception` anywhere, so `SignalException` /
|
|
78
|
+
`NoMemoryError` propagate instead of being cached as "unavailable".
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Selection semantics
|
|
83
|
+
|
|
84
|
+
**Two routes.** scout-rig runs Python in two ways, and they pick their
|
|
85
|
+
interpreter independently:
|
|
86
|
+
|
|
87
|
+
- **Subprocess route** — `ScoutPython.script` (`lib/scout/python/script.rb:105`)
|
|
88
|
+
and `ScoutPython.run_file` (`script.rb:113-122`), which is what every
|
|
89
|
+
`python_task` runs through (`lib/scout/workflow/python/task.rb`). It spawns
|
|
90
|
+
the literal command `python` from PATH; `ENV['PYTHON']` is **never**
|
|
91
|
+
consulted on this route.
|
|
92
|
+
- **Embedded route** — in-process PyCall via `lib/scout/python.rb:15`
|
|
93
|
+
`PyCall.init` (no argument), which makes pycall read `ENV['PYTHON']`, else
|
|
94
|
+
look for `python3` then `python` on PATH. Real `PyCall.init` also exports
|
|
95
|
+
`ENV['PYTHONHOME']` for the whole Ruby process (pycall
|
|
96
|
+
`libpython/finder.rb:46-51`); the probe helper never does.
|
|
97
|
+
|
|
98
|
+
**Selection precedence for the Python probes (first match wins):**
|
|
99
|
+
|
|
100
|
+
1. the `executable:` keyword (explicit; overrides everything, including pins)
|
|
101
|
+
2. `ENV['SCOUT_TEST_PYTHON']` — a **test-only** pin, applied to whichever
|
|
102
|
+
route is being probed
|
|
103
|
+
3. the route default — `route: :subprocess` (the default) resolves
|
|
104
|
+
`subprocess_python`; `route: :embedded` resolves `embedded_python`
|
|
105
|
+
|
|
106
|
+
R: `executable:` > `ENV['SCOUT_TEST_RSCRIPT']` > `Rscript` from PATH.
|
|
107
|
+
|
|
108
|
+
`PYTHON` and `PATH` are **production** inputs that this module never sets,
|
|
109
|
+
unsets or mutates. The `SCOUT_TEST_*` pins do not change production code
|
|
110
|
+
either; they exist for suites that must probe one absolute interpreter.
|
|
111
|
+
|
|
112
|
+
**PYTHON-vs-PATH divergence case.** The two routes can silently point at
|
|
113
|
+
different interpreters: `ENV['PYTHON']` selects only the embedded route,
|
|
114
|
+
PATH selects only the subprocess route. In this environment they coincide
|
|
115
|
+
(`python3` and `python` both realpath to `/usr/bin/python3.13`), which is
|
|
116
|
+
environmental luck, not a guarantee. `python_routes_divergence_reason`
|
|
117
|
+
returns `nil` when both routes canonicalize to the same absolute path, and
|
|
118
|
+
otherwise a message that names both resolutions ("the embedded route would
|
|
119
|
+
initialize X, while the subprocess route spawns the literal 'python' from
|
|
120
|
+
PATH (Y)"), the cause, and the remedy: **put the intended interpreter's bin
|
|
121
|
+
directory first on PATH and unset `PYTHON`**, so both routes resolve it. It
|
|
122
|
+
also reports when either side fails to resolve at all (including "neither
|
|
123
|
+
resolves") rather than reading as agreement. It deliberately **ignores**
|
|
124
|
+
`SCOUT_TEST_PYTHON`: a pin overrides probing only, and a pinned probe
|
|
125
|
+
silently hiding a real production divergence is exactly what the reporter
|
|
126
|
+
exists to expose. Likewise `embedded_python` and `subprocess_python` are
|
|
127
|
+
unaffected by the pin.
|
|
128
|
+
|
|
129
|
+
**Memoization semantics.** Probe results are memoized in `MEMO` (guarded by
|
|
130
|
+
`MEMO_MUTEX`) keyed on `[kind, canonical_realpath_of_resolved_executable,
|
|
131
|
+
sorted_names, timeout, route]`. Because the executable component is
|
|
132
|
+
re-resolved through the **current** `SCOUT_TEST_*` / `PYTHON` / `PATH` on
|
|
133
|
+
every call, a changed environment naturally produces a new key and re-probes.
|
|
134
|
+
Only **definitive** verdicts are stored — success, missing module, missing
|
|
135
|
+
package, broken interpreter: anything where the child reached an exit
|
|
136
|
+
status. A launch error or a timeout is returned to the caller but never
|
|
137
|
+
cached, so a transient condition cannot be frozen as "unavailable" for the
|
|
138
|
+
rest of the process. `reset!` (`MEMO_MUTEX.synchronize { MEMO.clear }`)
|
|
139
|
+
is the explicit hygiene hook: call it from test setup whenever you change
|
|
140
|
+
`SCOUT_TEST_PYTHON`, `SCOUT_TEST_RSCRIPT`, `PATH` or `ENV['PYTHON']` and
|
|
141
|
+
want a provably fresh probe. The lock is held across the probe so
|
|
142
|
+
concurrent test threads do not spawn duplicate children for one key.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Changed tests and rationale
|
|
147
|
+
|
|
148
|
+
**Gating audit verdict (step 4, written before any edit).** Per test file:
|
|
149
|
+
|
|
150
|
+
| Test file | Optional prereq (route) | Gate decision |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `test/scout/test_python.rb` | `torch` (:embedded — `pyimport :torch` runs in-process through `ScoutPython.binding_run`/PyCall) | **GATE** `test_binding` with `omit` + `python_modules?('torch', route: :embedded)`. The 10 `_`-disabled methods stay disabled (out of scope). |
|
|
153
|
+
| `test/scout/python/test_util.rb` | `numpy` (:embedded — `ScoutPython.run :numpy` and `tsv2df`/`df2tsv` run in-process via PyCall; no manifest requires it) | **GATE** `test_tuple` and `test_numpy`, same shape, naming `numpy`. |
|
|
154
|
+
| `test/scout/python/test_script.rb` | pandas / `scout`-py via `import scout` in the child (:subprocess) | **NO GATE** — the `scout` Python package is scout-rig's own packaged code and pandas is its manifest dependency (`python/pyproject.toml`); a missing import there is a packaging/path failure worth failing loudly. |
|
|
155
|
+
| `test/scout/workflow/test_python.rb` | `import scout` (:subprocess) | **NO GATE** — same own-code reasoning. |
|
|
156
|
+
| `test/scout/workflow/python/test_task.rb` | `import scout` in generated files (:subprocess; two tests stub `run_file` entirely) | **NO GATE** — own code required; stubbed tests need nothing. |
|
|
157
|
+
| `test/scout-rig/testing/test_availability.rb` | none (fakes only; 2 tests deliberately omit-gated on a real interpreter) | **NO GATE** (step-3 file, in scope by construction). |
|
|
158
|
+
| `test/test_helper.rb` | — | **one line added**: `require 'scout-rig/testing/availability'` after `require 'scout'`, so every test file gets the helpers without per-file requires. Test-only file, not a production entry point, so the opt-in rule holds. |
|
|
159
|
+
|
|
160
|
+
**The golden rule.** The probe governs **omission only**. The gate sits at
|
|
161
|
+
the top of the test method as
|
|
162
|
+
|
|
163
|
+
```ruby
|
|
164
|
+
omit("... #{...python_modules_reason('torch', route: :embedded)} ...") unless
|
|
165
|
+
ScoutRig::Testing::Availability.python_modules?('torch', route: :embedded)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
and the `pyimport` / `ScoutPython.run` under test still executes
|
|
169
|
+
**unconditionally** whenever the probe passed — a probe that says "torch is
|
|
170
|
+
importable" cannot mask a present-but-failing interpreter or a broken
|
|
171
|
+
native binding.
|
|
172
|
+
|
|
173
|
+
**Stub-probe check (recorded, throwaway, not committed).** With a
|
|
174
|
+
`/tmp/golden_pre.rb` stub pre-loaded that makes `python_modules?` return
|
|
175
|
+
`true` and `python_modules_reason` return `nil` (a probe that lies "torch
|
|
176
|
+
is importable"), running the real `test/scout/test_python.rb --name
|
|
177
|
+
test_binding` produced `1 tests, 0 assertions, 0 failures, 1 errors` with
|
|
178
|
+
`Error: test_binding(TestPython): PyCall::PyError: <class
|
|
179
|
+
'ModuleNotFoundError'>: No module named 'torch'` raised from the body's
|
|
180
|
+
`pyimport :torch`. That is the golden rule demonstrated both ways: with the
|
|
181
|
+
gate satisfied the omission does not fire and the real error surfaces; with
|
|
182
|
+
the real probe on this machine the gate fires **before** any PyCall call,
|
|
183
|
+
so no spurious error occurs.
|
|
184
|
+
|
|
185
|
+
**Effect.** The stock `rake test` went from
|
|
186
|
+
`53 tests, 204 assertions, 0 failures, 1 errors` (exit 1) to
|
|
187
|
+
`53 tests, 204 assertions, 0 failures, 0 errors, ... 1 omissions` (exit 0)
|
|
188
|
+
on this torch-less machine; the omission text names torch, the embedded
|
|
189
|
+
interpreter, the missing-module reason and the remedy.
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Validation runs (all executed fresh 2026-10-11, checkout root)
|
|
194
|
+
|
|
195
|
+
### 1. Isolation one-liner
|
|
196
|
+
|
|
197
|
+
Command: `ruby -Ilib -e "require 'scout-rig/testing/availability'; puts :loaded; p defined?(PyCall)"`
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
loaded
|
|
201
|
+
nil
|
|
202
|
+
EXIT=0
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Expectation met: the require loads the helper and leaves `PyCall`
|
|
206
|
+
undefined (`nil`), i.e. no embedded bridge is initialized by the helper.
|
|
207
|
+
|
|
208
|
+
### 2. Standalone focused tests
|
|
209
|
+
|
|
210
|
+
Command: `ruby -Ilib -Itest test/scout-rig/testing/test_availability.rb`
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
Loaded suite test/scout-rig/testing/test_availability
|
|
214
|
+
Started
|
|
215
|
+
Finished in 5.182025475 seconds.
|
|
216
|
+
-------------------------------------------------------------------------------
|
|
217
|
+
30 tests, 121 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
|
|
218
|
+
100% passed
|
|
219
|
+
-------------------------------------------------------------------------------
|
|
220
|
+
5.79 tests/s, 23.35 assertions/s
|
|
221
|
+
EXIT=0
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 3. Full suite
|
|
225
|
+
|
|
226
|
+
Command: `rake test` (tail of combined output; full run kept in
|
|
227
|
+
`tmp/step8-rake-test.log`)
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
Finished in 17.502765803 seconds.
|
|
231
|
+
-------------------------------------------------------------------------------
|
|
232
|
+
53 tests, 204 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications
|
|
233
|
+
100% passed
|
|
234
|
+
-------------------------------------------------------------------------------
|
|
235
|
+
3.03 tests/s, 11.66 assertions/s
|
|
236
|
+
RAKE_EXIT=0
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Exactly the expected shape: **53 tests / 204 assertions / 0 failures /
|
|
240
|
+
0 errors / 1 omission, exit 0**. (The omission is `test_binding`, torch
|
|
241
|
+
absent — see Environmental failures.) Unrelated stderr noise in the same
|
|
242
|
+
run: two `test/scout/workflow/python/test_task.rb:358: warning: method
|
|
243
|
+
redefined; discarding old run_file` warnings, which come from the
|
|
244
|
+
pre-existing not-ours working-tree changes in that file, not from anything
|
|
245
|
+
staged.
|
|
246
|
+
|
|
247
|
+
### 4. Touched-file spot checks
|
|
248
|
+
|
|
249
|
+
Command: `ruby -Ilib -Itest test/scout/test_python.rb`
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
Finished in 0.031946396 seconds.
|
|
253
|
+
-------------------------------------------------------------------------------
|
|
254
|
+
1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications
|
|
255
|
+
0% passed
|
|
256
|
+
-------------------------------------------------------------------------------
|
|
257
|
+
31.30 tests/s, 0.00 assertions/s
|
|
258
|
+
EXIT=0
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
The single omission is exactly the torch gate; verbatim text:
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
Omission: torch not importable in the embedded (PyCall) interpreter: /usr/bin/python3.13: missing Python modules: torch (torch: ModuleNotFoundError: No module named 'torch'). Install torch or pin SCOUT_TEST_PYTHON to an interpreter that has it. [test_binding(TestPython)]
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Command: `ruby -Ilib -Itest test/scout/python/test_util.rb`
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
Finished in 0.63066187 seconds.
|
|
271
|
+
-------------------------------------------------------------------------------
|
|
272
|
+
2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
|
|
273
|
+
100% passed
|
|
274
|
+
-------------------------------------------------------------------------------
|
|
275
|
+
3.17 tests/s, 3.17 assertions/s
|
|
276
|
+
EXIT=0
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
numpy is present in this environment, so both gated tests run green and
|
|
280
|
+
the numpy gate does not fire (as designed).
|
|
281
|
+
|
|
282
|
+
### 5. Gem inclusion (payload evidence exists in the step-6 note; not rebuilt)
|
|
283
|
+
|
|
284
|
+
Command: `grep -n "scout-rig/testing" scout-rig.gemspec`
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
46: "lib/scout-rig/testing/availability.rb",
|
|
288
|
+
74: "test/scout-rig/testing/test_availability.rb",
|
|
289
|
+
GREP_EXIT=0
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
The regenerated gemspec file list carries both the helper and its test.
|
|
293
|
+
Per step 6 (see baseline note), `gem build` + payload listing additionally
|
|
294
|
+
confirmed `lib/scout-rig/testing/availability.rb` at payload line 25 of
|
|
295
|
+
`scout-rig-0.2.6.gem`, with all 10 ours-files shipping (the built `.gem`
|
|
296
|
+
was then removed). Nothing was rebuilt for this report.
|
|
297
|
+
|
|
298
|
+
### 6. Process evidence
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
$ git log -1 --oneline
|
|
302
|
+
386954a Explain how to add extensions
|
|
303
|
+
|
|
304
|
+
$ git diff --cached --name-only
|
|
305
|
+
README.md
|
|
306
|
+
doc/developer/Architecture.md
|
|
307
|
+
doc/user/PythonEnvironments.md
|
|
308
|
+
doc/user/TestingAndPackaging.md
|
|
309
|
+
lib/scout-rig/testing/availability.rb
|
|
310
|
+
research/testing-availability-baseline.md
|
|
311
|
+
test/scout-rig/testing/test_availability.rb
|
|
312
|
+
test/scout/python/test_util.rb
|
|
313
|
+
test/scout/test_python.rb
|
|
314
|
+
test/test_helper.rb
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
(10 entries before this report; after this report and the baseline-note
|
|
318
|
+
pointer are staged, 11 — see the closing Process state below.)
|
|
319
|
+
|
|
320
|
+
`git status --porcelain` classification at the time of writing: the 10
|
|
321
|
+
ours-files staged; `scout-rig.gemspec` unstaged-modified (regenerated by
|
|
322
|
+
step 6, left unstaged on purpose); 5 modified tracked files that are
|
|
323
|
+
**not ours and untouched** (`doc/developer/PythonWorkflowInternals.md`,
|
|
324
|
+
`doc/user/DefiningPythonTasks.md`, `lib/scout/python/script.rb`,
|
|
325
|
+
`lib/scout/workflow/python/task.rb`, `test/scout/workflow/python/test_task.rb`).
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Environmental failures and residuals
|
|
330
|
+
|
|
331
|
+
1. **torch is absent in this environment — honest omission.** The single
|
|
332
|
+
omission in every suite run is `test_binding`, gated by
|
|
333
|
+
`python_modules?('torch', route: :embedded)`. torch is required by no
|
|
334
|
+
`lib/` code and no manifest (`python/pyproject.toml` requires only
|
|
335
|
+
pandas), so omitting (not failing, not silently passing) is the correct
|
|
336
|
+
classification. Nothing in the staged change set masks a real failure.
|
|
337
|
+
|
|
338
|
+
2. **scout-essentials checkout-vs-gem packaging gap (the top residual
|
|
339
|
+
risk).** The helper's only dependency beyond stdlib is
|
|
340
|
+
`require 'scout/testing/availability'`. In **this** environment that
|
|
341
|
+
file is provided by the scout-essentials **git checkout**
|
|
342
|
+
(`/home/mvazque2/git/scout-essentials/lib/scout/testing/availability.rb`,
|
|
343
|
+
where it is a staged-but-uncommitted addition; reference HEAD `759db2e`),
|
|
344
|
+
reached through `RUBYOPT -I`. The **released scout-essentials 1.9.1 gem
|
|
345
|
+
does not ship that file** (verified for 1.9.1, 1.9.0 and 1.8.8).
|
|
346
|
+
Consequence: any environment that resolves the released gem instead of
|
|
347
|
+
the checkout will fail the `require` with LoadError. scout-essentials
|
|
348
|
+
must ship `scout/testing/availability` (and this checkout's gemspec
|
|
349
|
+
gains nothing by hard-coding a gem version — it does not today) before
|
|
350
|
+
the helper works outside a checkout-pinned environment.
|
|
351
|
+
|
|
352
|
+
3. **Juwelier noise — known and non-blocking.** `rake gemspec` /
|
|
353
|
+
`gemspec:validate` emit `nil versions are discouraged and will be
|
|
354
|
+
deprecated in Rubygems 4`, and `gem build` warns about the open-ended
|
|
355
|
+
`pycall (> 0)` dependency and the missing `required_ruby_version`.
|
|
356
|
+
All three were present before this task; none blocks build, test or
|
|
357
|
+
staging.
|
|
358
|
+
|
|
359
|
+
4. **The `206 assertions` doc figure is predictive arithmetic, not an
|
|
360
|
+
executed run.** `doc/user/TestingAndPackaging.md` presents a
|
|
361
|
+
torch-bearing-PATH scenario with `53 tests, 206 assertions`. That
|
|
362
|
+
figure is derived: 204 assertions actually observed on this torch-less
|
|
363
|
+
machine plus the exactly-2 `assert`s inside `test_binding` counted from
|
|
364
|
+
its source. **No torch interpreter exists in this environment, so that
|
|
365
|
+
run could not have been executed here**; the doc block is framed as an
|
|
366
|
+
expected/derived total, not captured output. (This paragraph is the
|
|
367
|
+
honesty flag added after the Critic gate caught its absence.)
|
|
368
|
+
|
|
369
|
+
5. **No commit was made; staged-only state is deliberate.** The working
|
|
370
|
+
tree carries unrelated in-flight work (the 5 not-ours modified files,
|
|
371
|
+
which predate this task and were never touched). Committing was judged
|
|
372
|
+
outside this task's authority, so the deliverable is the staged set
|
|
373
|
+
plus the unstaged regenerated gemspec.
|
|
374
|
+
|
|
375
|
+
6. **What a future committer must know.** Commit the **staged ours-files
|
|
376
|
+
together with the regenerated `scout-rig.gemspec`** (i.e. `git add
|
|
377
|
+
scout-rig.gemspec` before the commit, or `git commit` the staged 11 and
|
|
378
|
+
then a second commit for the gemspec — one commit is cleaner). The
|
|
379
|
+
gemspec's file list is what ships the helper in the gem; committing
|
|
380
|
+
code without it ships a helper the gem omits. Do **not** fold the 5
|
|
381
|
+
not-ours files into the same commit: they belong to the separate
|
|
382
|
+
"Python exception support / extensions" work that is still in flight.
|
|
383
|
+
Note the gemspec also legitimately re-lists those 5 files (Juwelier
|
|
384
|
+
reads `git ls-files`); only the LIST regenerated, their contents stay
|
|
385
|
+
unstaged.
|
|
386
|
+
|
|
387
|
+
7. **Minor residuals (recorded, accepted).** `REASON_TAIL = 400` chars per
|
|
388
|
+
reason; the memo lock is held across each probe (serializes concurrent
|
|
389
|
+
probes for one key — a performance choice); `reset!` has no query
|
|
390
|
+
counterpart; R helpers remain unwired to any live scout-rig runtime by
|
|
391
|
+
design. The `_`-disabled tests in `test/scout/test_python.rb` (10
|
|
392
|
+
methods) were left disabled as out of scope.
|
|
393
|
+
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## Scout-AI handoff contract
|
|
397
|
+
|
|
398
|
+
This is the recipe a follow-on Scout-AI task consumes. The helper is
|
|
399
|
+
shipped and green; use it exactly like this.
|
|
400
|
+
|
|
401
|
+
**Require path (the only entry point, opt-in from test code only; never
|
|
402
|
+
required by production or entry files):**
|
|
403
|
+
|
|
404
|
+
```ruby
|
|
405
|
+
require 'scout-rig/testing/availability'
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**Probe calls to use:**
|
|
409
|
+
|
|
410
|
+
```ruby
|
|
411
|
+
# Python modules (symbols or strings):
|
|
412
|
+
ScoutRig::Testing::Availability.python_modules?('torch', route: :embedded) # => true/false
|
|
413
|
+
ScoutRig::Testing::Availability.python_modules_reason('torch', route: :embedded) # => nil, or human-usable diagnostic
|
|
414
|
+
# R packages (reference probes; scout-ai has no scout-rig R runtime either):
|
|
415
|
+
ScoutRig::Testing::Availability.r_packages?('base') # => true/false
|
|
416
|
+
ScoutRig::Testing::Availability.r_packages_reason('base') # => nil, or diagnostic
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
Prefer the `_reason` form inside an `omit` message: it already names the
|
|
420
|
+
resolved interpreter, the missing names and the condensed stderr tail.
|
|
421
|
+
|
|
422
|
+
**Route choice guidance.** Probe the route the code under test will
|
|
423
|
+
actually take:
|
|
424
|
+
|
|
425
|
+
- `route: :embedded` when the test runs Python **in-process through
|
|
426
|
+
PyCall** (`ScoutPython.run`, `binding_run`, `pyimport`, ...). The gate
|
|
427
|
+
in `test_binding` uses exactly this.
|
|
428
|
+
- default `route: :subprocess` (i.e. omit the kwarg) when the test runs
|
|
429
|
+
Python **in a child process** (`ScoutPython.script`, `run_file`,
|
|
430
|
+
`python_task`), because that route spawns the literal `python` from PATH.
|
|
431
|
+
|
|
432
|
+
If you are unsure, or run both in one process, call
|
|
433
|
+
`ScoutRig::Testing::Availability.python_routes_divergence_reason`; a
|
|
434
|
+
non-nil return means the two routes would use different interpreters and
|
|
435
|
+
no single probe certifies both — fix the environment (intended
|
|
436
|
+
interpreter's bin first on PATH, `PYTHON` unset) rather than probing
|
|
437
|
+
harder.
|
|
438
|
+
|
|
439
|
+
**Gating pattern (the exact shape used in scout-rig's own tests):**
|
|
440
|
+
|
|
441
|
+
```ruby
|
|
442
|
+
def test_binding
|
|
443
|
+
omit(
|
|
444
|
+
"torch not importable in the embedded (PyCall) interpreter: " \
|
|
445
|
+
"#{ScoutRig::Testing::Availability.python_modules_reason('torch', route: :embedded)}. " \
|
|
446
|
+
'Install torch or pin SCOUT_TEST_PYTHON to an interpreter that has it.'
|
|
447
|
+
) unless ScoutRig::Testing::Availability.python_modules?('torch', route: :embedded)
|
|
448
|
+
|
|
449
|
+
# body runs unconditionally once the gate passes
|
|
450
|
+
ScoutPython.binding_run { pyimport :torch }
|
|
451
|
+
end
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
Test-only pin when a suite must probe one absolute interpreter:
|
|
455
|
+
`ENV['SCOUT_TEST_PYTHON'] = '/path/to/python'` (and
|
|
456
|
+
`SCOUT_TEST_RSCRIPT` for R); call `reset!` after changing it, `PATH` or
|
|
457
|
+
`ENV['PYTHON']` in-process. Remember the pin applies to **probing only**
|
|
458
|
+
and deliberately hides nothing from `python_routes_divergence_reason`.
|
|
459
|
+
|
|
460
|
+
**Never mask PyCall failures (the golden rule, restated).** The probe
|
|
461
|
+
gates **omission only**. Never wrap the `pyimport`/`ScoutPython.run` call
|
|
462
|
+
itself in a probe guard, never `begin/rescue` a native-binding failure into
|
|
463
|
+
a skip, and never omit on anything that is not a genuinely optional
|
|
464
|
+
dependency: a missing module in scout-rig's **own** `scout` Python package
|
|
465
|
+
is a packaging failure and must fail loudly. Once the probe passes, the
|
|
466
|
+
import under test runs unconditionally — that is what keeps a
|
|
467
|
+
present-but-broken interpreter visible.
|
|
468
|
+
|
|
469
|
+
**No-network guarantee.** Every probe launches only the local interpreter
|
|
470
|
+
(`-c` / `-e` with fixed, frozen probe source; module and package names
|
|
471
|
+
arrive as argv, never interpolated into source). No probe performs any
|
|
472
|
+
network access; ordinary unit tests stay offline. (A generic
|
|
473
|
+
`tcp_reachable?` exists on the scout-essentials primitive, but nothing in
|
|
474
|
+
this helper calls it.)
|
|
475
|
+
|
|
476
|
+
**Where the fuller docs live:**
|
|
477
|
+
|
|
478
|
+
- `doc/user/TestingAndPackaging.md` — the full user-facing reference: API
|
|
479
|
+
table, result meanings, selection precedence, route semantics and
|
|
480
|
+
divergence, the gating recipe.
|
|
481
|
+
- `doc/user/PythonEnvironments.md` — the two-route interpreter split, the
|
|
482
|
+
`PYTHONHOME` side effect of a real `PyCall.init`, and the
|
|
483
|
+
bin-first-on-PATH remedy.
|
|
484
|
+
- `README.md` — short pointer plus one gating example.
|
|
485
|
+
- `research/testing-availability-baseline.md` — per-step evidence, raw
|
|
486
|
+
runs, the pre-edit baseline, and the scout-essentials handoff digest
|
|
487
|
+
(which scopes endpoint/model/accelerator probes to scout-ai, **not**
|
|
488
|
+
scout-rig — do not add `cuda?` / `hf_model_cached?` / `endpoint_*` /
|
|
489
|
+
`InfrastructureProbes` here).
|
|
490
|
+
|
|
491
|
+
Layer boundary, restated: scout-essentials owns the generic primitives
|
|
492
|
+
(`executable?`, `run_command`, `tcp_reachable?`); scout-rig owns the
|
|
493
|
+
interpreter knowledge (`python_modules?`, `r_packages?`, routes,
|
|
494
|
+
divergence); scout-ai owns the endpoint/model/accelerator layer.
|
|
495
|
+
|
|
496
|
+
---
|
|
497
|
+
|
|
498
|
+
*Report written 2026-10-11 against HEAD `386954a4`, staged set of 10
|
|
499
|
+
ours-files (11 with this report), no commits. All validation outputs in
|
|
500
|
+
this file were captured fresh for this report.*
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Validation Report
|
|
2
|
+
|
|
3
|
+
> **Non-normative.** This report records the validation checks performed on
|
|
4
|
+
> the scout-rig documentation.
|
|
5
|
+
>
|
|
6
|
+
> **Status note (2026-09-12):** predates the subsystem verification
|
|
7
|
+
> campaign. Its PASS verdict applied to the page set as it stood then,
|
|
8
|
+
> before `PythonEnvironments.md`, `TestingAndPackaging.md` and
|
|
9
|
+
> `PythonTaskRunnerInternals.md` existed. A later corpus-level sweep
|
|
10
|
+
> (27 files — README.md, doc/, research/ and python/README.md; 122 relative
|
|
11
|
+
> links, all resolving, plus the remote scout-essentials/scout-ai URLs) is
|
|
12
|
+
> recorded in the Cortex artifact `scout-rig/subsys/doc-corpus.md`.
|
|
13
|
+
|
|
14
|
+
## Validation scope
|
|
15
|
+
|
|
16
|
+
- **Link integrity:** All internal cross-references resolve correctly.
|
|
17
|
+
- **User doc purity:** No implementation internals in user-facing docs.
|
|
18
|
+
- **Module coverage:** All subsystems covered in both user and developer docs.
|
|
19
|
+
- **GitHub URL correctness:** scout-essentials links use correct org/path.
|
|
20
|
+
- **Style consistency:** Layered information structure followed.
|
|
21
|
+
|
|
22
|
+
## 1. Link integrity
|
|
23
|
+
|
|
24
|
+
### Method
|
|
25
|
+
|
|
26
|
+
Python script checked all 69 internal markdown links across all `doc/**/*.md`
|
|
27
|
+
files. Each relative link was resolved against the directory of the file
|
|
28
|
+
containing it, and file existence was verified.
|
|
29
|
+
|
|
30
|
+
### Results
|
|
31
|
+
|
|
32
|
+
- **Checked:** 69 internal links
|
|
33
|
+
- **Broken:** 0
|
|
34
|
+
- **Verdict: PASS** — All internal cross-references resolve correctly.
|
|
35
|
+
|
|
36
|
+
## 2. User doc purity
|
|
37
|
+
|
|
38
|
+
### Method
|
|
39
|
+
|
|
40
|
+
Searched `doc/user/*.md` for implementation-internal terms: `MUTEX`,
|
|
41
|
+
`QUEUE_IN`, `QUEUE_OUT`, `@@__init`, `at_exit`, `instance_exec`,
|
|
42
|
+
`module_eval`, `PyCall::Import`, `Binding.new`, `init_scout`, `init_thread`,
|
|
43
|
+
`process_paths`, `run_in_thread`, `@@`.
|
|
44
|
+
|
|
45
|
+
### Results
|
|
46
|
+
|
|
47
|
+
- `Cookbook.md` — CLEAN
|
|
48
|
+
- `DefiningPythonTasks.md` — CLEAN
|
|
49
|
+
- `DrivingWorkflowsFromPython.md` — CLEAN
|
|
50
|
+
- `ScriptingPython.md` — CLEAN
|
|
51
|
+
- `PassingDataToPython.md` — Contains `pyimport :json` in code examples.
|
|
52
|
+
This is the **public PyCall DSL** that users write inside `run` blocks,
|
|
53
|
+
not an implementation internal. Acceptable.
|
|
54
|
+
- `RunningPythonFromRuby.md` — Contains `pyimport`, `pyfrom`, and
|
|
55
|
+
`stop_thread`. These are **public API methods** that users call directly
|
|
56
|
+
(`ScoutPython.run { pyimport :numpy }`, `ScoutPython.stop_thread`).
|
|
57
|
+
Not implementation internals. Acceptable.
|
|
58
|
+
- `IteratingPythonData.md` — Contains `pyimport :json` in code examples.
|
|
59
|
+
Public API. Acceptable.
|
|
60
|
+
|
|
61
|
+
**True implementation internals** (`MUTEX`, `QUEUE_IN`, `at_exit`,
|
|
62
|
+
`instance_exec`, `init_scout`, `process_paths`, etc.) appear **only** in
|
|
63
|
+
developer documentation and research artifacts.
|
|
64
|
+
|
|
65
|
+
**Verdict: PASS.** No leaked implementation internals in user-facing docs.
|
|
66
|
+
|
|
67
|
+
## 3. Module coverage
|
|
68
|
+
|
|
69
|
+
| Subsystem | User doc | Developer doc |
|
|
70
|
+
|-----------|----------|---------------|
|
|
71
|
+
| ScoutPython execution modes | RunningPythonFromRuby | ScoutPythonInternals |
|
|
72
|
+
| Import helpers | RunningPythonFromRuby | ScoutPythonInternals |
|
|
73
|
+
| Data converters (tsv2df, etc.) | PassingDataToPython | DataConversionInternals |
|
|
74
|
+
| script() facility | ScriptingPython | DataConversionInternals |
|
|
75
|
+
| PythonWorkflow (python_task) | DefiningPythonTasks | PythonWorkflowInternals |
|
|
76
|
+
| Python `scout` package | DrivingWorkflowsFromPython | Architecture |
|
|
77
|
+
| Remote workflow client | DrivingWorkflowsFromPython | Architecture |
|
|
78
|
+
| Iteration helpers | IteratingPythonData | ScoutPythonInternals |
|
|
79
|
+
| Threading model | RunningPythonFromRuby | ScoutPythonInternals |
|
|
80
|
+
| GC / shutdown | (implicit in RunningPythonFromRuby) | ScoutPythonInternals |
|
|
81
|
+
| Type mapping | DefiningPythonTasks | PythonWorkflowInternals |
|
|
82
|
+
| CLI dispatch | DefiningPythonTasks | PythonWorkflowInternals |
|
|
83
|
+
|
|
84
|
+
**Verdict: PASS.** All subsystems covered in both layers.
|
|
85
|
+
|
|
86
|
+
## 4. GitHub URL correctness
|
|
87
|
+
|
|
88
|
+
### Method
|
|
89
|
+
|
|
90
|
+
Extracted all GitHub URLs from documentation files and verified org/repo
|
|
91
|
+
names against actual git remotes.
|
|
92
|
+
|
|
93
|
+
### Results
|
|
94
|
+
|
|
95
|
+
- **Org verified:** `mikisvaz` (from `git remote -v` in scout-essentials:
|
|
96
|
+
`git@github.com:mikisvaz/scout-essentials.git`)
|
|
97
|
+
- **Branch:** `main` (assumed standard default)
|
|
98
|
+
|
|
99
|
+
All GitHub cross-references found:
|
|
100
|
+
|
|
101
|
+
| URL | Status |
|
|
102
|
+
|-----|--------|
|
|
103
|
+
| `github.com/mikisvaz/scout-essentials/blob/main/doc/StartHere.md` | ✓ |
|
|
104
|
+
| `github.com/mikisvaz/scout-essentials/blob/main/doc/user/AnnotatingData.md` | ✓ |
|
|
105
|
+
| `github.com/mikisvaz/scout-essentials/blob/main/doc/user/LoggingAndProgress.md` | ✓ |
|
|
106
|
+
| `github.com/mikisvaz/scout-essentials/blob/main/doc/user/RunningCommands.md` | ✓ |
|
|
107
|
+
| `github.com/mikisvaz/scout-essentials/blob/main/doc/developer/Architecture.md` | ✓ |
|
|
108
|
+
| `github.com/mikisvaz/scout-essentials/blob/main/doc/developer/DesignPrinciples.md` | ✓ |
|
|
109
|
+
| `github.com/mikisvaz/scout-ai/blob/main/doc/developer/DesignPrinciples.md` | ✓ |
|
|
110
|
+
| `github.com/mikisvaz/scout-ai/blob/main/doc/Improvements.md` | ✓ (typo `scout-avai` fixed) |
|
|
111
|
+
| `github.com/mrkn/pycall.rb` | ✓ (correct PyCall repo) |
|
|
112
|
+
|
|
113
|
+
**Verdict: PASS.** All GitHub URLs use correct org/repo names.
|
|
114
|
+
|
|
115
|
+
## 5. Issues found and fixed during validation
|
|
116
|
+
|
|
117
|
+
### Issue 1: Typo `scout-avai` in `doc/Improvements.md`
|
|
118
|
+
|
|
119
|
+
**Found:** `https://github.com/mikisvaz/scout-avai/blob/main/doc/Improvements.md`
|
|
120
|
+
**Fixed:** Corrected to `https://github.com/mikisvaz/scout-ai/blob/main/doc/Improvements.md`
|
|
121
|
+
**Command:** `sed -i 's|scout-avai|scout-ai|g' doc/Improvements.md`
|
|
122
|
+
|
|
123
|
+
### Issue 2: Typo `scout-effils` in `doc/user/IteratingPythonData.md`
|
|
124
|
+
|
|
125
|
+
**Found:** Validation report draft initially flagged this, but actual grep
|
|
126
|
+
confirmed it was already correct in the file. No fix needed.
|
|
127
|
+
|
|
128
|
+
## 6. Style consistency
|
|
129
|
+
|
|
130
|
+
All user docs follow the layered structure:
|
|
131
|
+
- Purpose → Audience → When to use → Core concepts → Usage → Examples → Common mistakes → See also
|
|
132
|
+
|
|
133
|
+
All developer docs follow the layered structure:
|
|
134
|
+
- Purpose → Audience → Why this exists → Architecture → Implementation details → Key design decisions → Known issues → See also
|
|
135
|
+
|
|
136
|
+
**Verdict: PASS.** Consistent style across all files.
|
|
137
|
+
|
|
138
|
+
## 7. Old documentation removal
|
|
139
|
+
|
|
140
|
+
- `doc/Python.md` — DELETED (superseded)
|
|
141
|
+
- `doc/PythonWorkflow.md` — DELETED (superseded)
|
|
142
|
+
|
|
143
|
+
**Verdict: PASS.** No old flat documentation files remain.
|
|
144
|
+
|
|
145
|
+
## Overall verdict
|
|
146
|
+
|
|
147
|
+
**PASS.** All validation checks passed. Two typos found and fixed during
|
|
148
|
+
validation. Documentation is complete, internally consistent, and follows
|
|
149
|
+
the three-layer model.
|