scout-rig 0.2.5 → 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/python/util.rb +9 -0
- data/lib/scout/workflow/python/inputs.rb +33 -23
- data/lib/scout/workflow/python/task.rb +219 -18
- 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,1625 @@
|
|
|
1
|
+
# Testing-availability baseline for scout-rig (step 1 of 8)
|
|
2
|
+
|
|
3
|
+
Pre-edit, read-only investigation record. Purpose: authoritative baseline of
|
|
4
|
+
current suite behavior, actual runtime-selection code paths, and the exact
|
|
5
|
+
contract of the installed `Scout::Testing::Availability` primitives, so the
|
|
6
|
+
implementation steps (2-8) can code against verified facts instead of
|
|
7
|
+
re-deriving them.
|
|
8
|
+
|
|
9
|
+
All commands were run from `/bulk/mvazque2/git/scout-rig` unless noted.
|
|
10
|
+
Raw scratch outputs live under `tmp/` (see Baseline suite run and
|
|
11
|
+
Installed scout-essentials primitive contract). No repository file other
|
|
12
|
+
than this note was created; no tracked repository file was modified
|
|
13
|
+
(verified at the end, see Repo identity).
|
|
14
|
+
|
|
15
|
+
Divergences from the "Prior investigation (pinned HEAD 290ee22)" facts given
|
|
16
|
+
in the delegation are marked **DIVERGENCE** throughout and summarized in
|
|
17
|
+
Conclusions for the implementer.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Repo identity
|
|
22
|
+
|
|
23
|
+
Working tree recorded: `/bulk/mvazque2/git/scout-rig` (the writable checkout
|
|
24
|
+
named in the task).
|
|
25
|
+
|
|
26
|
+
`/home/mvazque2/git/scout-rig` does **not exist**; `/home/mvazque2/git`
|
|
27
|
+
itself exists but contains no `scout-rig` entry, so there is no second
|
|
28
|
+
checkout to avoid here. (**DIVERGENCE** from the Current-state claim that two
|
|
29
|
+
checkouts exist; harmless - nothing outside `/bulk/mvazque2/git/scout-rig`
|
|
30
|
+
was touched.)
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
$ git rev-parse HEAD
|
|
34
|
+
386954a463d8e1a4d335d366836af3cc8c68c584
|
|
35
|
+
$ git log -1 --format='%H %ci %s'
|
|
36
|
+
386954a463d8e1a4d335d366836af3cc8c68c584 2026-10-10 10:42:26 +0200 Explain how to add extensions
|
|
37
|
+
|
|
38
|
+
$ git status --short
|
|
39
|
+
M doc/developer/PythonWorkflowInternals.md
|
|
40
|
+
M doc/user/DefiningPythonTasks.md
|
|
41
|
+
M lib/scout/python/script.rb
|
|
42
|
+
M lib/scout/workflow/python/task.rb
|
|
43
|
+
M test/scout/workflow/python/test_task.rb
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**The tree is NOT clean.** Five files carry uncommitted modifications that
|
|
47
|
+
predate this investigation (present before any command here ran; this task
|
|
48
|
+
performed no edits to tracked files). `git diff --stat`:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
doc/developer/PythonWorkflowInternals.md | 10 +++++
|
|
52
|
+
doc/user/DefiningPythonTasks.md | 25 ++++++++++++
|
|
53
|
+
lib/scout/python/script.rb | 13 +++++-
|
|
54
|
+
lib/scout/workflow/python/task.rb | 3 +-
|
|
55
|
+
test/scout/workflow/python/test_task.rb | 74 ++++++++++++++++++++++++++++++--
|
|
56
|
+
5 files changed, 118 insertions(+), 7 deletions(-)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The worktree adds 4 new tests in `test/scout/workflow/python/test_task.rb`
|
|
60
|
+
(`test_runtime_task_receives_its_step_files_directory`,
|
|
61
|
+
`test_run_file_does_not_inherit_stale_files_directory`,
|
|
62
|
+
`test_run_file_explicit_environment_overrides_stale_parent_value`,
|
|
63
|
+
`test_run_file_unrelated_environment_does_not_inherit_stale_files_directory`)
|
|
64
|
+
plus the `run_file` env-stripping change in `lib/scout/python/script.rb` /
|
|
65
|
+
`lib/scout/workflow/python/task.rb` - the "Python exception support /
|
|
66
|
+
extensions" work continuing past HEAD. Three stashes also exist
|
|
67
|
+
(`stash@{0}` on `c3f83c8`, `stash@{1}` on `5a84155`, `stash@{2}` on
|
|
68
|
+
`713e64f`). Any later step must decide whether to record HEAD or
|
|
69
|
+
HEAD+worktree as its baseline; the counts below reflect **HEAD+worktree**
|
|
70
|
+
(what actually ran).
|
|
71
|
+
|
|
72
|
+
`290ee22` (the prior investigation's pin, `290ee22 2026-07-31 14:27:09 +0200
|
|
73
|
+
Revamped documentation`) is 6 commits behind the current HEAD in this
|
|
74
|
+
branch's history (50 commits total in `main`) - that explains several
|
|
75
|
+
divergences below.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
$ ruby -v
|
|
79
|
+
ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]
|
|
80
|
+
|
|
81
|
+
$ gem list scout-essentials
|
|
82
|
+
scout-essentials (1.9.1, 1.9.0, 1.8.8, 1.8.7, 1.8.6, 1.8.5)
|
|
83
|
+
|
|
84
|
+
$ gem which scout/testing/availability
|
|
85
|
+
/home/mvazque2/git/scout-essentials/lib/scout/testing/availability.rb
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Note on `gem which`: it resolves through the ambient `RUBYOPT` include path
|
|
89
|
+
(see Environment inventory), which puts `/home/mvazque2/git/scout-essentials/lib`
|
|
90
|
+
ahead of the installed gems. The **installed** scout-essentials 1.9.1 gem
|
|
91
|
+
(`/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/scout-essentials-1.9.1`) does **not**
|
|
92
|
+
ship `lib/scout/testing/availability.rb` (verified: the file is absent for
|
|
93
|
+
the 1.9.1, 1.9.0 and 1.8.8 gem dirs; `gem contents scout-essentials -v 1.9.1`
|
|
94
|
+
lists no availability file). In this environment the primitive is provided
|
|
95
|
+
by the **scout-essentials git checkout** (reference repo HEAD `759db2e`,
|
|
96
|
+
"More Array fingerprint", 2026-10-02), where
|
|
97
|
+
`lib/scout/testing/availability.rb` is a staged-but-uncommitted addition
|
|
98
|
+
(`git status` in that repo shows `A lib/scout/testing/availability.rb`;
|
|
99
|
+
`git ls-files lib/scout/testing/` there lists
|
|
100
|
+
`lib/scout/testing/availability.rb` and `lib/scout/testing/scout_state.rb`).
|
|
101
|
+
This matters for step 8 (packaging): a released gem today would not carry
|
|
102
|
+
the primitive at all.
|
|
103
|
+
|
|
104
|
+
`VERSION` file: `0.2.6`.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Environment inventory
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
$ command -v python python3 rscript
|
|
112
|
+
/usr/bin/python
|
|
113
|
+
/usr/bin/python3
|
|
114
|
+
(no rscript; only uppercase Rscript:)
|
|
115
|
+
$ command -v Rscript
|
|
116
|
+
/usr/lib/R/bin/Rscript
|
|
117
|
+
$ Rscript --version
|
|
118
|
+
Rscript (R) version 4.4.3 (2025-02-28)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`command -v rscript` finds nothing - **R's binary is `Rscript`, not
|
|
122
|
+
`rscript`** - so any probe must look for `Rscript` (the handoff's
|
|
123
|
+
`rscript_executable` already does).
|
|
124
|
+
|
|
125
|
+
All of `python`, `python3`, `/usr/bin/python3` are Python 3.13.3.
|
|
126
|
+
|
|
127
|
+
Optional-module importability for the default `python3` (exit status
|
|
128
|
+
recorded):
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
$ python3 -c "import numpy"; echo exit=$? -> exit=0 (numpy 2.2.3)
|
|
132
|
+
$ python3 -c "import pandas"; echo exit=$? -> exit=0 (pandas 2.2.3)
|
|
133
|
+
$ python3 -c "import torch"; echo exit=$?
|
|
134
|
+
Traceback (most recent call last):
|
|
135
|
+
File "<string>", line 1, in <module>
|
|
136
|
+
ModuleNotFoundError: No module named 'torch'
|
|
137
|
+
exit=1
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Ruby side: pycall 1.5.2 and pycall_thread 0.1.3 are installed and loadable;
|
|
141
|
+
test-unit is **3.6.1**.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
$ env | grep -E '^(SCOUT|PYTHON)'
|
|
145
|
+
SCOUT_CHAT_DIR=/bulk/mvazque2/git/scout-rig
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
No `PYTHON*` variables are exported into the ambient environment - no
|
|
149
|
+
`PYTHONHOME`, no `PYTHONPATH`, no `ENV['PYTHON']`. (`PYTHONHOME` is still
|
|
150
|
+
*set later by PyCall.init at runtime*; see Runtime selection facts.)
|
|
151
|
+
|
|
152
|
+
Other environment facts that shape runs from this directory:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
GEM_HOME=/home/mvazque2/.rvm/gems/ruby-3.3.1
|
|
156
|
+
GEM_PATH=/home/mvazque2/.rvm/gems/ruby-3.3.1:/home/mvazque2/.rvm/gems/ruby-3.3.1@global
|
|
157
|
+
RUBYOPT=-I/home/mvazque2/software/opt/rubygems/lib ... -I /home/mvazque2/git/scout-essentials/lib
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
The `RUBYOPT` tail includes `-I /home/mvazque2/git/scout-essentials/lib`
|
|
161
|
+
(and `/home/mvazque2/git/scout-rig/lib`), which is why plain
|
|
162
|
+
`ruby -rscout/testing/availability` resolves the checkout, not the installed
|
|
163
|
+
gem.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Baseline suite run
|
|
168
|
+
|
|
169
|
+
Command (stock environment, no `PYTHON`/`PATH` manipulation):
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
( rake test 2>&1; echo "RAKE_EXIT=$?" ) > tmp/testing-availability-baseline-rake-test.log
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Full raw output (655 lines, ANSI included) is at
|
|
176
|
+
`tmp/testing-availability-baseline-rake-test.log` in this repo.
|
|
177
|
+
|
|
178
|
+
- `RAKE_EXIT=1` - rake aborts because the loader exits non-zero.
|
|
179
|
+
- Test::Unit summary (verbatim, ANSI stripped):
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
23 tests, 83 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
- 0 failures, 0 omissions, 0 pendings; exactly **1 error**.
|
|
186
|
+
|
|
187
|
+
Verbatim error excerpt (ANSI stripped):
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
===============================================================================
|
|
191
|
+
Error: test_binding(TestPython): PyCall::PyError: <class 'ModuleNotFoundError'>: No module named 'torch'
|
|
192
|
+
/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/pycall-1.5.2/lib/pycall.rb:82:in `import_module'
|
|
193
|
+
/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/pycall-1.5.2/lib/pycall/import.rb:18:in `pyimport'
|
|
194
|
+
/bulk/mvazque2/git/scout-rig/test/scout/test_python.rb:113:in `block in test_binding'
|
|
195
|
+
110: def test_binding
|
|
196
|
+
111: raised = false
|
|
197
|
+
112: ScoutPython.binding_run do
|
|
198
|
+
=> 113: pyimport :torch
|
|
199
|
+
114: pyfrom :torch, import: ["nn"]
|
|
200
|
+
115: begin
|
|
201
|
+
116: torch
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
and the rake failure line:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
Command failed with status (1): [ruby -w -I"lib:lib:test" .../rake_test_loader.rb ...]
|
|
208
|
+
rake aborted!
|
|
209
|
+
Tasks: TOP => test
|
|
210
|
+
RAKE_EXIT=1
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Attribution: the single error is **optional-runtime-missing**
|
|
214
|
+
(`ModuleNotFoundError: No module named 'torch'` raised from `pyimport :torch`
|
|
215
|
+
inside the test body - torch is not a declared dependency anywhere in the
|
|
216
|
+
repo; `python/pyproject.toml` requires only `pandas`). It is **not** a code
|
|
217
|
+
failure: no shipped-code regression is involved, the error escapes the
|
|
218
|
+
test's own `begin/rescue` (which guards a *different*, later `torch` use at
|
|
219
|
+
`test/scout/test_python.rb:116+`), and the suite's only exit-1 cause is this
|
|
220
|
+
one error. Everything else (22 tests, 83 assertions) passed.
|
|
221
|
+
|
|
222
|
+
(**DIVERGENCE**: the prior investigation recorded "9 tests with 1 error".
|
|
223
|
+
At HEAD+worktree the suite runs **23 tests** - the Python-task batch-mode
|
|
224
|
+
and `run_file` env tests added after `290ee22` are present in the working
|
|
225
|
+
tree. The error itself is unchanged: same `test_binding`, same torch cause.
|
|
226
|
+
Note also that the committed doc `doc/user/TestingAndPackaging.md` still
|
|
227
|
+
describes the 9-test/1-error state, so that doc is stale relative to the
|
|
228
|
+
worktree.)
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Test-file audit
|
|
233
|
+
|
|
234
|
+
Files audited: `test/test_helper.rb`, `test/scout/test_python.rb`,
|
|
235
|
+
`test/scout/python/test_script.rb`, `test/scout/python/test_run.rb`,
|
|
236
|
+
`test/scout/python/test_util.rb`,
|
|
237
|
+
`test/scout/workflow/python/test_task.rb`,
|
|
238
|
+
`test/scout/workflow/test_python.rb`, `Rakefile`, `scout-rig.gemspec`.
|
|
239
|
+
|
|
240
|
+
There is **no** `test/python/` directory (the script/run/util helper tests
|
|
241
|
+
live under `test/scout/python/`); `test/scout/workflow/python/` holds
|
|
242
|
+
`test_task.rb` only. (**DIVERGENCE** from the delegation's "files under
|
|
243
|
+
test/python/" phrasing - trivial naming point, recorded so nobody hunts for
|
|
244
|
+
a nonexistent dir.)
|
|
245
|
+
|
|
246
|
+
### Per-file counts and prerequisites
|
|
247
|
+
|
|
248
|
+
Counts are of `def test_*` (active) vs `def _test_*` / `def __test_*`
|
|
249
|
+
(disabled, i.e. invisible to Test::Unit discovery). "worktree" = what
|
|
250
|
+
actually ran in the baseline; "(HEAD)" notes where the committed tree
|
|
251
|
+
differs.
|
|
252
|
+
|
|
253
|
+
| File | Active (worktree) | `_`-disabled | Route | Optional prerequisites |
|
|
254
|
+
|---|---|---|---|---|
|
|
255
|
+
| `test/test_helper.rb` | - (no tests) | - | - | none; provides helpers + setup/teardown isolation only |
|
|
256
|
+
| `test/scout/python/test_run.rb` | 0 | 1 (`def __test_run_threaded`) | in-process PyCall | (would need) `sys` only |
|
|
257
|
+
| `test/scout/python/test_script.rb` | 4 | 0 | subprocess (`ScoutPython.script`) | numpy, pandas, `python/scout` importable via `PYTHONPATH` (auto) |
|
|
258
|
+
| `test/scout/python/test_util.rb` | 2 | 0 | in-process PyCall | numpy (`test_numpy`), pandas (`tsv2df` path) |
|
|
259
|
+
| `test/scout/test_python.rb` | 1 (`test_binding`) | 10 | in-process PyCall | **torch** (`test_binding`); the 10 disabled ones also reference numpy/keras/torch but never run |
|
|
260
|
+
| `test/scout/workflow/python/test_task.rb` | 15 (11 at HEAD; 4 added in worktree) | 0 | subprocess (`run_file`/`python_task`) | stdlib only (`typing`) |
|
|
261
|
+
| `test/scout/workflow/test_python.rb` | 1 | 0 | subprocess (imports `scout` python pkg) | numpy, pandas (`python/scout/__init__.py` imports pandas at module load) |
|
|
262
|
+
| **Total** | **23** | **11** | | |
|
|
263
|
+
|
|
264
|
+
Verbatim disabled-method listing in `test/scout/test_python.rb` (line: name):
|
|
265
|
+
`6 _test_python`, `45 _test_run_log`, `69 _test_keras`, `79 _test_keras_import`,
|
|
266
|
+
`89 _test_iterate`, `105 _test_lambda`, `134 _test_import_method`,
|
|
267
|
+
`139 _test_class_new_obj`, `144 _test_single`, `151 _test_threaded` - plus the
|
|
268
|
+
one active `110 test_binding`. 11 methods total, 10 disabled. (Matches the
|
|
269
|
+
prior fact; it is one of the few prior facts that still holds exactly.)
|
|
270
|
+
|
|
271
|
+
### Skip logic
|
|
272
|
+
|
|
273
|
+
None, anywhere. `grep -rn "omit\|skip" test/` returns nothing (no `omit`, no
|
|
274
|
+
`skip`, no environment guards). `test_helper.rb` (59 lines, read in full)
|
|
275
|
+
does isolation only - `setup`/`teardown` `Open.rm_rf` the tmpdir and redirect
|
|
276
|
+
`TmpFile`, `Persist`, `Open.remote_cache` and `Workflow.directory` there -
|
|
277
|
+
plus progress-bar quieting. It contains **zero** interpreter/package
|
|
278
|
+
selection or skip logic; the suite is plain Test::Unit (no minitest/rspec).
|
|
279
|
+
Renaming to a `_` prefix is the only disabling mechanism used in the repo.
|
|
280
|
+
|
|
281
|
+
### Rakefile / gemspec facts
|
|
282
|
+
|
|
283
|
+
`Rakefile` (`Rake::TestTask`):
|
|
284
|
+
|
|
285
|
+
```ruby
|
|
286
|
+
Rake::TestTask.new(:test) do |test|
|
|
287
|
+
test.libs << 'lib' << 'test'
|
|
288
|
+
test.pattern = 'test/**/test_*.rb'
|
|
289
|
+
test.verbose = true
|
|
290
|
+
end
|
|
291
|
+
task :default => :test
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
`scout-rig.gemspec` (Juwelier): name `scout-rig`, `s.add_runtime_dependency
|
|
295
|
+
'pycall', '> 0'`, dev dependency `juwelier ~> 2.1.0`. **torch is not
|
|
296
|
+
declared anywhere** (neither runtime nor development), consistent with the
|
|
297
|
+
attribution above. Gemspec file count as loaded: 39 files.
|
|
298
|
+
|
|
299
|
+
Gemspec staleness (recorded, not fixed - per constraint):
|
|
300
|
+
|
|
301
|
+
- 27 files tracked in git but **missing from the gemspec file list**, i.e.
|
|
302
|
+
not shipped: all of `doc/` (`doc/user/...` 9 files incl.
|
|
303
|
+
`TestingAndPackaging.md`, `PythonEnvironments.md`; `doc/developer/...` 5
|
|
304
|
+
files; `doc/Improvements.md`, `doc/StartHere.md`), `python/scout/task_errors.py`,
|
|
305
|
+
all 8 `research/*.md`, and `.gitignore`.
|
|
306
|
+
- 2 files listed in the gemspec but **not in git**: `doc/Python.md`,
|
|
307
|
+
`doc/PythonWorkflow.md` (stale remnants; they do not exist on disk).
|
|
308
|
+
|
|
309
|
+
(The gemspec regenerates via `rake gemspec` from the Juwelier Rakefile; that
|
|
310
|
+
task was NOT run, per constraints. Note the note file you are reading is in
|
|
311
|
+
`research/`, which the gemspec currently excludes from the gem.)
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Runtime selection facts
|
|
316
|
+
|
|
317
|
+
From grep over `lib/` and `test/` (all hits quoted; there are no others):
|
|
318
|
+
|
|
319
|
+
**`ENV['PYTHON']` / `ENV["PYTHON"]` - zero hits in `lib/` and `test/`.**
|
|
320
|
+
|
|
321
|
+
The only place `ENV['PYTHON']` is consulted is inside the installed **pycall
|
|
322
|
+
gem**, not scout-rig:
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/pycall-1.5.2/lib/pycall/init.rb:24:
|
|
326
|
+
def self.init(python = ENV['PYTHON'])
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
scout-rig's own entry point is:
|
|
330
|
+
|
|
331
|
+
```ruby
|
|
332
|
+
# lib/scout/python.rb:15
|
|
333
|
+
def self.init_scout
|
|
334
|
+
if ! defined?(@@__init_scout_python) || ! @@__init_scout_python
|
|
335
|
+
PyCall.init
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
i.e. `PyCall.init` is called with no argument, so pycall falls back to
|
|
339
|
+
`ENV['PYTHON']` (nil here) and then to PATH lookup `python3`/`python` inside
|
|
340
|
+
`LibPython::Finder.find_libpython`. `PyCall.init` is referenced exactly once
|
|
341
|
+
in scout-rig code (`lib/scout/python.rb:15`).
|
|
342
|
+
|
|
343
|
+
**Literal `python` spawn sites (subprocess route):**
|
|
344
|
+
|
|
345
|
+
```ruby
|
|
346
|
+
# lib/scout/python/script.rb:105 (ScoutPython.script)
|
|
347
|
+
CMD.cmd_log("env PYTHONPATH=#{path_env} python", {in: text})
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
```ruby
|
|
351
|
+
# lib/scout/python/script.rb:112-119 (ScoutPython.run_file)
|
|
352
|
+
def self.run_file(file, arg_str, env: {})
|
|
353
|
+
path_env = ScoutPython.paths * ":"
|
|
354
|
+
# Non-Step calls must not inherit a stale sidecar from the parent process.
|
|
355
|
+
env_assignments = env.map { |name, value| "#{name}=#{Shellwords.escape(value.to_s)}" }.join(' ')
|
|
356
|
+
command = 'env'
|
|
357
|
+
command << ' -u SCOUT_JOB_FILES_DIR'
|
|
358
|
+
command << " PYTHONPATH=#{Shellwords.escape(path_env)}"
|
|
359
|
+
command << " #{env_assignments}" unless env_assignments.empty?
|
|
360
|
+
command << " python #{Shellwords.escape(file.to_s)} #{arg_str}"
|
|
361
|
+
CMD.cmd(command)
|
|
362
|
+
end
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Both spawn the literal command `python` resolved from `PATH`, with
|
|
366
|
+
`PYTHONPATH` set to `ScoutPython.paths * ":"` (`lib/scout/python/paths.rb`
|
|
367
|
+
seeds `ScoutPython.paths` from `Scout.python.find_all`). `ENV['PYTHON']` is
|
|
368
|
+
never consulted on this route. `python_task` registration/execution goes
|
|
369
|
+
through these same helpers: `lib/scout/workflow/python/task.rb:33`
|
|
370
|
+
(`read_python_metadata` -> `ScoutPython.run_file file, '--scout-metadata'`),
|
|
371
|
+
`:45` (`read_python_metadata_files` -> runner.py), and `:153` (task block ->
|
|
372
|
+
`ScoutPython.run_file file, ..., env: { 'SCOUT_JOB_FILES_DIR' => ... }`).
|
|
373
|
+
There are no other `python` spawn sites (`grep -rn "'python'\|\"python\"" lib/`
|
|
374
|
+
returns only the two `script.rb` lines above).
|
|
375
|
+
|
|
376
|
+
**PYTHONHOME / PYTHONPATH mutation:** scout-rig never touches `PYTHONHOME`
|
|
377
|
+
(zero hits in `lib/` and `test/`) and never sets `PYTHONPATH` as a Ruby env
|
|
378
|
+
var; it only *prepends* its paths by passing `PYTHONPATH=...` on the `env`
|
|
379
|
+
command line in the two sites above. The process-wide `PYTHONHOME`
|
|
380
|
+
mutation happens **inside pycall**, at:
|
|
381
|
+
|
|
382
|
+
```
|
|
383
|
+
/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/pycall-1.5.2/lib/pycall/libpython/finder.rb:46-51
|
|
384
|
+
python_home = if !ENV.key?("PYTHONHOME") || use_conda
|
|
385
|
+
...
|
|
386
|
+
end
|
|
387
|
+
ENV["PYTHONHOME"] = python_home
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
So after any in-process `PyCall.init`, the Ruby process's `ENV['PYTHONHOME']`
|
|
391
|
+
points at the embedded interpreter's home - exactly the trap the handoff
|
|
392
|
+
describes for mixed-route runs.
|
|
393
|
+
|
|
394
|
+
**`SCOUT_TEST_` hits: none.** `grep -rn "SCOUT_TEST_"` over the repo
|
|
395
|
+
(rb/md/py) returns zero hits. `SCOUT_TEST_PYTHON` / `SCOUT_TEST_RSCRIPT` do
|
|
396
|
+
not exist in scout-rig today, as expected.
|
|
397
|
+
|
|
398
|
+
Net runtime-selection matrix, verified against the code above:
|
|
399
|
+
|
|
400
|
+
| Route | Entry points | Interpreter chosen by | `ENV['PYTHON']`? | Env effect |
|
|
401
|
+
|---|---|---|---|---|
|
|
402
|
+
| Embedded (PyCall) | `ScoutPython.run/run_direct/binding_run/...` via `lib/scout/python.rb:15 PyCall.init` | pycall: `ENV['PYTHON']` else PATH `python3`/`python` | **yes** (in pycall) | **sets `ENV['PYTHONHOME']`** |
|
|
403
|
+
| Subprocess | `ScoutPython.script` (`script.rb:105`), `ScoutPython.run_file` (`script.rb:119`), `python_task` (`task.rb:33/45/153`) | literal `python` from PATH | **no** | `env PYTHONPATH=<paths> [-u SCOUT_JOB_FILES_DIR] [assignments]` |
|
|
404
|
+
|
|
405
|
+
This matches the prior investigation and the handoff's matrix; re-verified
|
|
406
|
+
with current line numbers above.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Installed scout-essentials primitive contract
|
|
411
|
+
|
|
412
|
+
Probe file `tmp/primitive_probe.rb`; verbatim output `tmp/primitive_probe.log`
|
|
413
|
+
(both under this repo's `tmp/`). Run as `ruby tmp/primitive_probe.rb` from
|
|
414
|
+
the repo root; `PROBE_EXIT=0`. Probe core (full source in `tmp/`):
|
|
415
|
+
|
|
416
|
+
```ruby
|
|
417
|
+
require 'scout/testing/availability'
|
|
418
|
+
# prints provider info and module surface, then exercises:
|
|
419
|
+
Scout::Testing::Availability.executable?('ruby')
|
|
420
|
+
Scout::Testing::Availability.executable?('definitely_missing_xyz_123')
|
|
421
|
+
Scout::Testing::Availability.run_command(%w[true], timeout: 5)
|
|
422
|
+
Scout::Testing::Availability.run_command(%w[definitely_missing_xyz_123], timeout: 5)
|
|
423
|
+
Scout::Testing::Availability.run_command(%w[sleep 30], timeout: 1)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Verbatim output (primitive_probe.log)
|
|
427
|
+
|
|
428
|
+
```
|
|
429
|
+
== provider ==
|
|
430
|
+
loaded_feature: /home/mvazque2/git/scout-essentials/lib/scout/testing/availability.rb
|
|
431
|
+
Gem::Specification.detect(scout-essentials) => scout-essentials-1.9.1
|
|
432
|
+
Gem.loaded_specs['scout-essentials'] => nil
|
|
433
|
+
spec.full_gem_path => /home/mvazque2/.rvm/gems/ruby-3.3.1/gems/scout-essentials-1.9.1
|
|
434
|
+
file inside installed gem? false (/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/scout-essentials-1.9.1/lib/scout/testing/availability.rb)
|
|
435
|
+
Scout::Testing::Availability => Scout::Testing::Availability
|
|
436
|
+
|
|
437
|
+
== module surface ==
|
|
438
|
+
[:executable?, :run_command, :tcp_reachable?]
|
|
439
|
+
|
|
440
|
+
== executable? ==
|
|
441
|
+
executable?('ruby') => true
|
|
442
|
+
executable?('definitely_missing_xyz_123') => false
|
|
443
|
+
|
|
444
|
+
== run_command ok ==
|
|
445
|
+
class: Scout::Testing::Availability::CommandResult ([Scout::Testing::Availability::CommandResult(keyword_init: true), Struct, Enumerable, Object])
|
|
446
|
+
respond_to?(:members) => true; members=[:argv, :success, :exit_status, :stdout, :stderr, :timed_out, :launch_error]
|
|
447
|
+
ok.success => true
|
|
448
|
+
ok.success? => true
|
|
449
|
+
ok.exit_status => 0
|
|
450
|
+
ok.stdout => ""
|
|
451
|
+
ok.stderr => ""
|
|
452
|
+
ok.timed_out => false
|
|
453
|
+
ok.timed_out? => NO_METHOD
|
|
454
|
+
ok.launch_error => nil
|
|
455
|
+
ok.argv => ["true"]
|
|
456
|
+
|
|
457
|
+
== run_command launch failure ==
|
|
458
|
+
class: Scout::Testing::Availability::CommandResult
|
|
459
|
+
miss.success => false
|
|
460
|
+
miss.exit_status => nil
|
|
461
|
+
miss.stdout => ""
|
|
462
|
+
miss.stderr => ""
|
|
463
|
+
miss.timed_out => false
|
|
464
|
+
miss.launch_error => "Errno::ENOENT: No such file or directory - definitely_missing_xyz_123"
|
|
465
|
+
|
|
466
|
+
== run_command timeout ==
|
|
467
|
+
elapsed: 1.03s
|
|
468
|
+
class: Scout::Testing::Availability::CommandResult
|
|
469
|
+
sl.success => false
|
|
470
|
+
sl.exit_status => nil
|
|
471
|
+
sl.stdout => ""
|
|
472
|
+
sl.stderr => "command timed out after 1.0s"
|
|
473
|
+
sl.timed_out => true
|
|
474
|
+
sl.launch_error => nil
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Follow-up predicate probe (authoritative for `success?`/`reason`)
|
|
478
|
+
|
|
479
|
+
The first probe printed `success?` through a rescue clause that mangled the
|
|
480
|
+
two failure cases. A clean follow-up
|
|
481
|
+
(`tmp/success_predicate_probe.rb`, `ruby tmp/success_predicate_probe.rb`,
|
|
482
|
+
exit 0) settles the exact member behavior; verbatim:
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
ok: class=Scout::Testing::Availability::CommandResult
|
|
486
|
+
r.respond_to?(:success?)=true
|
|
487
|
+
r.success=true r.success?=true
|
|
488
|
+
r.reason=nil
|
|
489
|
+
r.respond_to?(:timed_out?)=false
|
|
490
|
+
r.respond_to?(:reason)=true
|
|
491
|
+
miss: class=Scout::Testing::Availability::CommandResult
|
|
492
|
+
r.respond_to?(:success?)=true
|
|
493
|
+
r.success=false r.success?=false
|
|
494
|
+
r.reason="Errno::ENOENT: No such file or directory - definitely_missing_xyz_123"
|
|
495
|
+
r.respond_to?(:timed_out?)=false
|
|
496
|
+
r.respond_to?(:reason)=true
|
|
497
|
+
sleep: class=Scout::Testing::Availability::CommandResult
|
|
498
|
+
r.respond_to?(:success?)=true
|
|
499
|
+
r.success=false r.success?=false
|
|
500
|
+
r.reason="command timed out"
|
|
501
|
+
r.respond_to?(:timed_out?)=false
|
|
502
|
+
r.respond_to?(:reason)=true
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
### Contract summary for the implementer
|
|
506
|
+
|
|
507
|
+
Namespace: `Scout::Testing::Availability` (module), require path
|
|
508
|
+
`scout/testing/availability`. Public singleton methods (exactly three):
|
|
509
|
+
`executable?(name)`, `run_command(argv, timeout: 30)`, `tcp_reachable?`.
|
|
510
|
+
|
|
511
|
+
- `executable?(name)` -> `true`/`false` (never raises for a missing name;
|
|
512
|
+
a name containing a path separator is checked as a direct file path;
|
|
513
|
+
empty name returns false).
|
|
514
|
+
- `run_command(argv, timeout:)` -> always returns a
|
|
515
|
+
`CommandResult` (a `Struct`, `keyword_init: true`) with members, in
|
|
516
|
+
declaration order:
|
|
517
|
+
**`argv, success, exit_status, stdout, stderr, timed_out, launch_error`**.
|
|
518
|
+
- `success` / `success?` - boolean; `success?` is `!!success` (verified
|
|
519
|
+
`true` for the ok case, `false` for launch failure and timeout).
|
|
520
|
+
- `exit_status` - Integer on normal exit, **`nil`** on launch failure and
|
|
521
|
+
on timeout.
|
|
522
|
+
- `stdout` / `stderr` - Strings, bounded (`OUTPUT_LIMIT = 65_536` bytes per
|
|
523
|
+
stream; overflow appends `"\n[output truncated]"`, `TRUNCATION_NOTE`).
|
|
524
|
+
- `timed_out` - boolean; **there is no `timed_out?` predicate**
|
|
525
|
+
(`respond_to?(:timed_out?) => false`).
|
|
526
|
+
- `launch_error` - String like `"Errno::ENOENT: ..."` or `nil`.
|
|
527
|
+
- `CommandResult#reason` - helper (verified) returning `nil` on success,
|
|
528
|
+
else preferring `launch_error`, then `'command timed out'`, then
|
|
529
|
+
`"exit status #{exit_status}"`, then trimmed stderr, then trimmed stdout,
|
|
530
|
+
then `'could not start executable'`.
|
|
531
|
+
- Raises `ArgumentError` only for empty argv or non-positive/non-finite
|
|
532
|
+
timeout (programming errors). Launch failure and timeout are **reported,
|
|
533
|
+
not raised**. Not memoized (documented in source).
|
|
534
|
+
- Constants exposed: `DEFAULT_TIMEOUT = 30`, `TCP_TIMEOUT = 5`,
|
|
535
|
+
`OUTPUT_LIMIT = 65_536`, plus internal read/kill constants
|
|
536
|
+
(`READ_CHUNK = 16_384`, `KILL_GRACE = 0.1`, `CHUNK_POLL = 0.05`).
|
|
537
|
+
- `run_command` drains both pipes concurrently (`IO.select` loop) and spawns
|
|
538
|
+
the child in its own process group (`pgroup: true`), killing the group
|
|
539
|
+
TERM->KILL on deadline. The struct is declared at
|
|
540
|
+
`lib/scout/testing/availability.rb:25` in the scout-essentials checkout
|
|
541
|
+
(`Struct.new(:argv, :success, :exit_status, :stdout, :stderr, :timed_out, :launch_error, keyword_init: true)`).
|
|
542
|
+
|
|
543
|
+
Provider resolution caveat (important for steps 7-8): in **this** environment
|
|
544
|
+
the file comes from the scout-essentials **git checkout**
|
|
545
|
+
(`/home/mvazque2/git/scout-essentials/lib/scout/testing/availability.rb`,
|
|
546
|
+
staged-uncommitted there) because `RUBYOPT` includes
|
|
547
|
+
`-I /home/mvazque2/git/scout-essentials/lib`. The installed 1.9.1 gem does
|
|
548
|
+
**not** contain the file. Any packaging step that assumes
|
|
549
|
+
`require 'scout/testing/availability'` works from the released gem will fail
|
|
550
|
+
until scout-essentials ships it.
|
|
551
|
+
|
|
552
|
+
Independent cross-check of the primitive under a real test context is in
|
|
553
|
+
`tmp/handoff_probe.rb` (see Handoff digest): 3 tests / 8 assertions, 0
|
|
554
|
+
failures, 0 errors, run with `ruby tmp/handoff_probe.rb`.
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## omit verdict
|
|
559
|
+
|
|
560
|
+
Probe file `tmp/omit_probe.rb`:
|
|
561
|
+
|
|
562
|
+
```ruby
|
|
563
|
+
require 'test/unit'
|
|
564
|
+
|
|
565
|
+
class TestOmitProbe < Test::Unit::TestCase
|
|
566
|
+
def test_omit_is_recognized
|
|
567
|
+
omit 'probe'
|
|
568
|
+
flunk 'should not reach here'
|
|
569
|
+
end
|
|
570
|
+
end
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
Run: `ruby tmp/omit_probe.rb` -> `OMIT_PROBE_EXIT=0`. Verbatim output:
|
|
574
|
+
|
|
575
|
+
```
|
|
576
|
+
Loaded suite tmp/omit_probe
|
|
577
|
+
Started
|
|
578
|
+
O
|
|
579
|
+
===============================================================================
|
|
580
|
+
Omission: probe [test_omit_is_recognized(TestOmitProbe)]
|
|
581
|
+
===============================================================================
|
|
582
|
+
...(backtrace lines)...
|
|
583
|
+
Finished in 0.35 seconds.
|
|
584
|
+
|
|
585
|
+
1 tests, 0 assertions, 0 pass, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
|
|
586
|
+
0% passed
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
(The `O` progress glyph, the `Omission: probe
|
|
590
|
+
[test_omit_is_recognized(TestOmitProbe)]` banner, and the summary counting
|
|
591
|
+
the test with `0 pass` while exiting 0 are the essential verbatim markers.)
|
|
592
|
+
|
|
593
|
+
**Verdict: `omit` is available and recognized.** Test::Unit in play is
|
|
594
|
+
**test-unit 3.6.1** (`gem list test-unit` -> `test-unit (3.6.1)`); `omit`
|
|
595
|
+
is a built-in Test::Unit assertion, so no extra gem is needed. Crucially
|
|
596
|
+
for step 4 (suite gating): **an omitted test does not fail the suite** -
|
|
597
|
+
exit status stays 0, matching what the gating step needs (`0 omissions`
|
|
598
|
+
counted separately from failures/errors; the run above shows `0% passed`
|
|
599
|
+
with exit 0).
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
## Handoff digest
|
|
604
|
+
|
|
605
|
+
Source: `/home/mvazque2/git/scout-essentials/research/testing-availability-scout-rig-handoff.md`
|
|
606
|
+
(read in full, 355 lines; that repo is the read-only reference and was not
|
|
607
|
+
modified).
|
|
608
|
+
|
|
609
|
+
**Scope / layer boundary.** scout-rig owns runtime-availability probes for
|
|
610
|
+
interpreters and their packages: `python?`,
|
|
611
|
+
`python_modules?`/`python_modules_reason`, `rscript?`,
|
|
612
|
+
`r_packages?`/`r_packages_reason` (the two R ones are **reference code only**
|
|
613
|
+
- there are no live R call sites in scout-rig today). scout-essentials keeps
|
|
614
|
+
only the generic primitives (`executable?`, `run_command`, `tcp_reachable?`).
|
|
615
|
+
**Endpoint/model/accelerator probes (`cuda?`, `hf_model_cached?`,
|
|
616
|
+
`endpoint_*`, `InfrastructureProbes`) belong to scout-ai, not scout-rig.**
|
|
617
|
+
|
|
618
|
+
**Corrected reference implementations - probe approach.**
|
|
619
|
+
|
|
620
|
+
- Python modules probe: fixed probe *source* over **argv**, never
|
|
621
|
+
interpolated names:
|
|
622
|
+
```python
|
|
623
|
+
import importlib, sys
|
|
624
|
+
missing = []
|
|
625
|
+
for name in sys.argv[1:]:
|
|
626
|
+
try: importlib.import_module(name)
|
|
627
|
+
except Exception as e: missing.append("%s: %s: %s" % (name, type(e).__name__, e))
|
|
628
|
+
if missing:
|
|
629
|
+
sys.stderr.write("; ".join(missing)); sys.exit(1)
|
|
630
|
+
```
|
|
631
|
+
invoked as `run_command([executable, '-c', probe, *modules], timeout: PROBE_TIMEOUT)`;
|
|
632
|
+
available iff `result.success? && result.exit_status == 0`. The **reason
|
|
633
|
+
comes from stderr** (where tracebacks go), with fallbacks: stderr ->
|
|
634
|
+
`"python exited #{exit_status}"` -> timeout note -> `launch_error`.
|
|
635
|
+
- `python?` itself: `[executable, '-c', 'import sys']` and decide on the
|
|
636
|
+
**exit status**, not output.
|
|
637
|
+
- R probes: `Rscript --vanilla -e 'cat("ok")'` for existence; packages via a
|
|
638
|
+
fixed probe using **`commandArgs(TRUE)`** with `--args pkg...` (drop the
|
|
639
|
+
retained `"--args"` element), `requireNamespace(p, quietly=TRUE)` per
|
|
640
|
+
package, missing list printed with `cat` to **stdout** (R writes there),
|
|
641
|
+
`quit(status=1)`.
|
|
642
|
+
|
|
643
|
+
**Defect list (doubles as the test targets for step 3):**
|
|
644
|
+
|
|
645
|
+
1. `python?` ignored the subprocess exit status (output != working
|
|
646
|
+
interpreter).
|
|
647
|
+
2. `python_modules_reason` read **stdout**; import tracebacks go to stderr.
|
|
648
|
+
3. memo rescued `Exception` (swallows `SignalException`/`NoMemoryError`) -
|
|
649
|
+
rescue `StandardError` only.
|
|
650
|
+
4. `run_bounded` drained stdout before stderr (pipe deadlock), spawned
|
|
651
|
+
outside the rescue (launch failure could escape), and the
|
|
652
|
+
`capture:false` path drained neither pipe. Delegate to
|
|
653
|
+
`Scout::Testing::Availability.run_command` instead.
|
|
654
|
+
5. Memoization must key on the **full input set** (executable + env +
|
|
655
|
+
timeout), with an explicit `reset!`.
|
|
656
|
+
6. (scout-ai-only, N/A here.)
|
|
657
|
+
7. Module names interpolated into Python/R source (quoting escape risk) -
|
|
658
|
+
pass names as argv.
|
|
659
|
+
|
|
660
|
+
**Memoization discipline.** Memoize each probe keyed on its full inputs
|
|
661
|
+
(`(executable, modules/packages, timeout)`), because `SCOUT_TEST_PYTHON` or
|
|
662
|
+
`PATH` can change within one process; provide
|
|
663
|
+
`ScoutRig::Testing::Availability.reset!` and call it from test setup when the
|
|
664
|
+
environment is manipulated; rescue `StandardError`, never `Exception`.
|
|
665
|
+
|
|
666
|
+
**Interpreter selection.** Suggested order: `ENV['SCOUT_TEST_PYTHON']` wins
|
|
667
|
+
(absolute pin for tests); else PATH lookup `python3` then `python`; R:
|
|
668
|
+
`ENV['SCOUT_TEST_RSCRIPT']` else `Rscript`. Reliable environment recipe:
|
|
669
|
+
put the chosen env's `bin` first on `PATH` so both routes resolve the same
|
|
670
|
+
interpreter; **never export `PYTHONHOME`** from test setup (PyCall already
|
|
671
|
+
sets it; a foreign one kills subprocesses with "Failed to import encodings").
|
|
672
|
+
|
|
673
|
+
**Suggested namespace:** `ScoutRig::Testing::Availability` (a scout-rig
|
|
674
|
+
test-support module), requiring `scout/testing/availability` and building
|
|
675
|
+
the interpreter knowledge on top.
|
|
676
|
+
|
|
677
|
+
**Constraints carried over:** ordinary unit tests stay offline (probes run
|
|
678
|
+
local interpreters only, no network); product-failure assertions must never
|
|
679
|
+
become skips (omit only when an optional dependency is genuinely absent);
|
|
680
|
+
`rscript?`/`r_packages?` stay unwired until an R integration exists; keep
|
|
681
|
+
the layer boundary (no endpoint/model/accelerator probes in scout-rig).
|
|
682
|
+
|
|
683
|
+
Cross-check probe (`tmp/handoff_probe.rb`, run green: 3 tests, 8 assertions,
|
|
684
|
+
0 failures, 0 errors): the argv-based Python probe correctly reports
|
|
685
|
+
`torch` missing via stderr (`result.stderr` matches
|
|
686
|
+
`/torch: ModuleNotFoundError/`, `success? == false`, `exit_status == 1`),
|
|
687
|
+
and `Rscript -e 'cat(...)'`-style probes return success with the value on
|
|
688
|
+
stdout - confirming the reference implementations work against the
|
|
689
|
+
installed primitive.
|
|
690
|
+
|
|
691
|
+
---
|
|
692
|
+
|
|
693
|
+
## Conclusions for the implementer
|
|
694
|
+
|
|
695
|
+
**Code against these exact names (verified in this environment):**
|
|
696
|
+
|
|
697
|
+
- `require 'scout/testing/availability'` -> module
|
|
698
|
+
`Scout::Testing::Availability`, singleton methods exactly
|
|
699
|
+
`[:executable?, :run_command, :tcp_reachable?]`.
|
|
700
|
+
- `run_command(argv, timeout:)` -> `Scout::Testing::Availability::CommandResult`
|
|
701
|
+
(Struct, `keyword_init: true`), members in declaration order:
|
|
702
|
+
**`[:argv, :success, :exit_status, :stdout, :stderr, :timed_out, :launch_error]`**,
|
|
703
|
+
helper methods `#success?` (`!!success`) and `#reason`. There is **no**
|
|
704
|
+
`timed_out?` predicate - use the `timed_out` field. `exit_status` is `nil`
|
|
705
|
+
on launch failure and on timeout; launch failure and timeout are returned,
|
|
706
|
+
never raised; only empty argv / bad timeout raise `ArgumentError`.
|
|
707
|
+
- `executable?(name)` -> boolean, never raises.
|
|
708
|
+
- Test::Unit **3.6.1** provides `omit`; omission keeps exit status 0.
|
|
709
|
+
|
|
710
|
+
**Implementation-shape guidance (from the verified facts):**
|
|
711
|
+
|
|
712
|
+
- Put scout-rig's probes in `ScoutRig::Testing::Availability`
|
|
713
|
+
(`python?`, `python_modules?(_reason)`, `rscript?`, `r_packages?(_reason)`
|
|
714
|
+
- R reference-only), requiring the primitive and resolving the executable
|
|
715
|
+
as `ENV['SCOUT_TEST_PYTHON']` -> `python3` -> `python` (`SCOUT_TEST_RSCRIPT`
|
|
716
|
+
-> `Rscript`). Today `SCOUT_TEST_*` does not exist anywhere in the repo
|
|
717
|
+
(verified), so the variables are free to define.
|
|
718
|
+
- Gate `test_binding` with `omit python_modules_reason(:torch)` (or
|
|
719
|
+
equivalent) - that is the only torch consumer among active tests.
|
|
720
|
+
- Delegate every probe launch to `run_command` (which never raises for
|
|
721
|
+
launch failure/timeout); do not rescue `Exception`.
|
|
722
|
+
- Remember the two-route interpreter split when writing the gating tests:
|
|
723
|
+
in-process tests follow `PyCall.init`'s `ENV['PYTHON']`-else-PATH choice
|
|
724
|
+
and then **set `ENV['PYTHONHOME']`**, while subprocess tests always run
|
|
725
|
+
literal `python` from PATH. The suite recipe stays "chosen env's `bin`
|
|
726
|
+
first on PATH".
|
|
727
|
+
|
|
728
|
+
**Divergences from the prior facts (Current state in the delegation):**
|
|
729
|
+
|
|
730
|
+
1. **HEAD moved**: current HEAD is `386954a` (2026-10-10), not `290ee22`
|
|
731
|
+
(2026-07-31, now 6 commits back). Counts below reflect HEAD+worktree.
|
|
732
|
+
2. **Suite size**: the suite runs **23 tests** (15 of them in
|
|
733
|
+
`test/scout/workflow/python/test_task.rb`, 4 of which exist only in the
|
|
734
|
+
uncommitted worktree), not 9. The error count and cause are unchanged
|
|
735
|
+
(1 error, `test_binding`, torch missing).
|
|
736
|
+
3. **Working tree is dirty**: 5 modified files (docs, `script.rb`,
|
|
737
|
+
`task.rb`, `test_task.rb`) + 3 stashes. `rake test` above ran against
|
|
738
|
+
that state, not a pristine HEAD.
|
|
739
|
+
4. **No second checkout**: `/home/mvazque2/git/scout-rig` does not exist.
|
|
740
|
+
5. **Primitive provider**: `gem which` points at the scout-essentials **git
|
|
741
|
+
checkout** (staged, uncommitted there), not an installed gem; the
|
|
742
|
+
installed 1.9.1 gem lacks the file. Step 8 (packaging) cannot assume the
|
|
743
|
+
released gem provides `scout/testing/availability`.
|
|
744
|
+
6. **Naming nit**: there is no `test/python/` dir; the script/run/util tests
|
|
745
|
+
live in `test/scout/python/`, and the workflow task tests in
|
|
746
|
+
`test/scout/workflow/python/test_task.rb` (single file).
|
|
747
|
+
7. Everything else in the prior facts **held**: torch error attribution,
|
|
748
|
+
literal-`python` subprocess route ignoring `ENV['PYTHON']`, PyCall route
|
|
749
|
+
using `ENV['PYTHON']` else PATH and setting `PYTHONHOME`, no `SCOUT_TEST_*`
|
|
750
|
+
anywhere, `test/scout/test_python.rb` = 11 methods with 10 `_`-disabled,
|
|
751
|
+
no skip logic in any test file.
|
|
752
|
+
|
|
753
|
+
## Design decisions (post-baseline, step 2)
|
|
754
|
+
|
|
755
|
+
Delivered step 2: the packaged, opt-in scout-rig availability helper at
|
|
756
|
+
`lib/scout-rig/testing/availability.rb`, single documented entry
|
|
757
|
+
`require 'scout-rig/testing/availability'`, defining
|
|
758
|
+
`ScoutRig::Testing::Availability`. New file only; no tracked file was
|
|
759
|
+
edited. The require loads `'scout/testing/availability'` (the
|
|
760
|
+
scout-essentials primitive, currently provided by its git checkout) plus
|
|
761
|
+
stdlib `socket`; it loads no scout-rig production code, no `ScoutPython`,
|
|
762
|
+
no PyCall (`defined?(PyCall)` and `defined?(ScoutPython)` are both nil),
|
|
763
|
+
and nothing in the repo requires it back.
|
|
764
|
+
|
|
765
|
+
### Final API surface (the contract for steps 3-7)
|
|
766
|
+
|
|
767
|
+
Module-function style (`ScoutRig::Testing::Availability.python_modules?`) and
|
|
768
|
+
an optional mixin (`class MyTest; include ScoutRig::Testing::Availability`)
|
|
769
|
+
share one implementation and one memo store; every method is an ordinary
|
|
770
|
+
instance method and the module `extend self`s. Both call styles exercise the
|
|
771
|
+
identical code path (verified: `T.new.check` mixin call returned true).
|
|
772
|
+
|
|
773
|
+
- `python?(executable: nil, route: :subprocess, timeout: 30)` -> true iff the
|
|
774
|
+
selected Python exists AND a sanity probe (`python -c 'import sys'`) exits 0.
|
|
775
|
+
Decided on exit status, never on output, never on PATH existence alone.
|
|
776
|
+
- `python_modules?(*modules, executable: nil, route: :subprocess, timeout: 30)`
|
|
777
|
+
-> true iff every named module imports under the selected interpreter.
|
|
778
|
+
Symbols accepted, normalized to strings. Empty list vacuously true.
|
|
779
|
+
- `python_modules_reason(*modules, executable: nil, route: :subprocess, timeout: 30)`
|
|
780
|
+
-> nil on success, else one concise diagnostic naming the resolved
|
|
781
|
+
executable path, the failing module name(s) and the stderr tail.
|
|
782
|
+
- `rscript?(executable: nil, timeout: 30)` and
|
|
783
|
+
`r_packages?(*packages, executable: nil, timeout: 30)` /
|
|
784
|
+
`r_packages_reason(*packages, executable: nil, timeout: 30)` -> same shape
|
|
785
|
+
for R; availability means requireNamespace LOADS. Reasons are built
|
|
786
|
+
stdout-first (the probe's missing list), then stderr tail. Reference probes
|
|
787
|
+
only: scout-rig has no R execution runtime, and these helpers claim none.
|
|
788
|
+
- `embedded_python` / `subprocess_python` -> the interpreter each route WOULD
|
|
789
|
+
use, computed without initializing the bridge.
|
|
790
|
+
- `python_route_divergence` -> nil when both routes resolve to the same
|
|
791
|
+
interpreter, else a one-line message naming both.
|
|
792
|
+
- `reset!` -> clears the memo store; returns nil.
|
|
793
|
+
- Constants: `DEFAULT_TIMEOUT = 30`, `DEFAULT_ROUTE = :subprocess`,
|
|
794
|
+
`ROUTES = [:subprocess, :embedded]`, `REASON_TAIL = 400`, `MEMO`,
|
|
795
|
+
`MEMO_MUTEX`, plus the four frozen probe-source constants.
|
|
796
|
+
|
|
797
|
+
### Selection precedence (Python; implemented exactly)
|
|
798
|
+
|
|
799
|
+
`executable:` kwarg > `ENV['SCOUT_TEST_PYTHON']` > route default. Route
|
|
800
|
+
default for `route: :subprocess` (the default) is `subprocess_python` = the
|
|
801
|
+
literal `python` from PATH (what `ScoutPython.script/run_file/python_task`
|
|
802
|
+
spawn); for `route: :embedded` it is `embedded_python` = `ENV['PYTHON']`
|
|
803
|
+
when set (blank counts as unset), else first of `python3`/`python` on PATH.
|
|
804
|
+
R: `executable:` > `ENV['SCOUT_TEST_RSCRIPT']` > `Rscript` from PATH.
|
|
805
|
+
|
|
806
|
+
`SCOUT_TEST_*` versus `PYTHON`/`PATH` (in code comments near `python_target`):
|
|
807
|
+
`PYTHON` and `PATH` are PRODUCTION inputs this module never mutates;
|
|
808
|
+
`SCOUT_TEST_PYTHON`/`SCOUT_TEST_RSCRIPT` are TEST-ONLY pins that override
|
|
809
|
+
route resolution for probing only. A pin applies to whichever route is
|
|
810
|
+
probed (so a pinned probe cannot detect a divergence - by design;
|
|
811
|
+
`python_route_divergence` ignores pins precisely so a pin cannot hide a real
|
|
812
|
+
production divergence). The pins do not change production code. Verified
|
|
813
|
+
behavior: with `SCOUT_TEST_PYTHON=/nonexistent/python-wrapper`,
|
|
814
|
+
`python?` is false and the reason names the wrapper and the launch error.
|
|
815
|
+
|
|
816
|
+
### Probe process discipline
|
|
817
|
+
|
|
818
|
+
- Both Python probes go through
|
|
819
|
+
`Scout::Testing::Availability.run_command(argv, timeout:)`; the bounded
|
|
820
|
+
runner is scout-essentials', never re-implemented here. Launch failure and
|
|
821
|
+
timeout are reported on the CommandResult and converted to a reason, so the
|
|
822
|
+
boolean helpers can never leak an exception from an unavailable
|
|
823
|
+
interpreter.
|
|
824
|
+
- Python module probe is a frozen `PYTHON_MODULES_PROBE` literal passed via
|
|
825
|
+
`-c`, iterating `sys.argv[1:]` with `importlib.import_module`; missing
|
|
826
|
+
modules are written to stderr as `name: ExceptionType: message` and any
|
|
827
|
+
miss exits 1. R probe is a frozen `R_PACKAGES_PROBE` literal passed via
|
|
828
|
+
`Rscript --vanilla -e <src> --args <names>`, reading
|
|
829
|
+
`commandArgs(TRUE)` (filtering `--args`), calling `requireNamespace` per
|
|
830
|
+
package, `cat`ing the missing list to stdout and `quit(status=1)` on a
|
|
831
|
+
miss. Names never touch the source of either probe, so no module or
|
|
832
|
+
package name can break out of a literal.
|
|
833
|
+
- The file contains zero `rescue` clauses at all (the grep below shows no
|
|
834
|
+
`rescue Exception`, `Open3`, `popen` or `fork`), which is the strictest
|
|
835
|
+
reading of "rescue StandardError only": unexpected exceptions propagate
|
|
836
|
+
and are never cached as "unavailable".
|
|
837
|
+
- Reasons preserve a bounded tail (`REASON_TAIL = 400` chars) of the
|
|
838
|
+
relevant stream: stderr for Python (where tracebacks live), stdout first
|
|
839
|
+
then stderr for R.
|
|
840
|
+
|
|
841
|
+
### Timeout defaults
|
|
842
|
+
|
|
843
|
+
`DEFAULT_TIMEOUT = 30`, aligned with the primitive's
|
|
844
|
+
`Scout::Testing::Availability::DEFAULT_TIMEOUT`; every helper takes an
|
|
845
|
+
explicit `timeout:` kwarg, and every timeout reason says "raise the
|
|
846
|
+
timeout: keyword" so slow imports (numpy, pandas, torch) are cheap to
|
|
847
|
+
accommodate. Timeout is part of the memo key, so raising it never replays a
|
|
848
|
+
stale verdict.
|
|
849
|
+
|
|
850
|
+
### Memoization key design and reset!
|
|
851
|
+
|
|
852
|
+
Keys are `[kind, resolved_executable_path, sorted_names, timeout, route]`
|
|
853
|
+
(route present on Python probes). The executable component is the CANONICAL
|
|
854
|
+
absolute realpath, recomputed on every call through the current
|
|
855
|
+
`SCOUT_TEST_*`/`PYTHON`/`PATH`, so a mid-process environment change yields a
|
|
856
|
+
new key and re-probes naturally; `reset!` (MEMO_MUTEX-guarded `MEMO.clear`)
|
|
857
|
+
is the explicit hygiene hook for tests that mutate the environment. Only
|
|
858
|
+
definitive results are stored (nil or a reason String); the lock is held
|
|
859
|
+
across the probe so concurrent test threads cannot spawn duplicate children
|
|
860
|
+
for one key. The store lives in constants (`MEMO`, `MEMO_MUTEX`) rather than
|
|
861
|
+
module ivars so the mixin and module-function styles share one cache.
|
|
862
|
+
|
|
863
|
+
### embedded-is-prediction-not-validation boundary
|
|
864
|
+
|
|
865
|
+
`embedded_python` mirrors the documented bridge choice (`ENV['PYTHON']` else
|
|
866
|
+
python3/python on PATH; candidate order read from the pycall gem since the
|
|
867
|
+
user docs do not spell it out - ScoutCoder note left in the source). It does
|
|
868
|
+
not run the interpreter, does not touch `ENV` (the real init exports
|
|
869
|
+
`PYTHONHOME`), and cannot prove the native library loads into the Ruby
|
|
870
|
+
process. Probing `route: :embedded` therefore validates the predicted
|
|
871
|
+
interpreter as a subprocess, never the in-process binding;
|
|
872
|
+
`python_route_divergence` likewise compares PREDICTED selections only, and
|
|
873
|
+
no helper claims that one probe validates both routes.
|
|
874
|
+
|
|
875
|
+
### Deviations from the delegation brief
|
|
876
|
+
|
|
877
|
+
1. **Handoff's resolution order, not used verbatim**: the handoff sketched
|
|
878
|
+
`ENV['SCOUT_TEST_PYTHON'] -> python3 -> python` as the (single) resolution
|
|
879
|
+
chain. The brief's own precedence plus the two-route reality make that
|
|
880
|
+
ambiguous, so routes were made explicit: the pin sits between the explicit
|
|
881
|
+
kwarg and the route default, and the route defaults differ (:subprocess ->
|
|
882
|
+
literal `python`; :embedded -> PYTHON else python3/python). This is what
|
|
883
|
+
"explicit executable > pin > route default" means operationally.
|
|
884
|
+
2. **No `timed_out?` predicate assumed** (baseline fact); timeouts are read
|
|
885
|
+
from the CommandResult's `timed_out` member, as delivered.
|
|
886
|
+
3. **R sanity probe prints "ok"** rather than nothing, so a broken Rscript is
|
|
887
|
+
distinguishable from a silently-absent one in reasons; the verdict is
|
|
888
|
+
still the exit status, not the output.
|
|
889
|
+
4. Nothing else deviates: single lib file (no second file was cleaner),
|
|
890
|
+
new files only, no network/installs/gem operations, no PyCall
|
|
891
|
+
initialization anywhere, no name interpolation into probe source, and the
|
|
892
|
+
runner was never duplicated.
|
|
893
|
+
|
|
894
|
+
### Smoke checks recorded verbatim (repo root, ruby 3.3.1)
|
|
895
|
+
|
|
896
|
+
1. python_modules probe:
|
|
897
|
+
`ruby -Ilib -e "require 'scout-rig/testing/availability'; puts defined?(PyCall).inspect; puts ScoutRig::Testing::Availability.python_modules_reason('sys').inspect; puts ScoutRig::Testing::Availability.python_modules?('sys').inspect; puts ScoutRig::Testing::Availability.python_modules_reason('no_such_module_xyz').inspect; puts ScoutRig::Testing::Availability.python_modules?('no_such_module_xyz').inspect"`
|
|
898
|
+
```
|
|
899
|
+
nil
|
|
900
|
+
nil
|
|
901
|
+
true
|
|
902
|
+
"/usr/bin/python3.13: missing Python modules: no_such_module_xyz (no_such_module_xyz: ModuleNotFoundError: No module named 'no_such_module_xyz')"
|
|
903
|
+
false
|
|
904
|
+
```
|
|
905
|
+
2. route accessors and divergence:
|
|
906
|
+
`ruby -Ilib -e "require 'scout-rig/testing/availability'; a=ScoutRig::Testing::Availability; puts a.embedded_python.inspect; puts a.subprocess_python.inspect; puts a.python_route_divergence.inspect"`
|
|
907
|
+
```
|
|
908
|
+
"python3"
|
|
909
|
+
"python"
|
|
910
|
+
nil
|
|
911
|
+
```
|
|
912
|
+
In this environment `python3` and `python` both realpath to
|
|
913
|
+
`/usr/bin/python3.13`, so the routes agree and the reporter returns nil.
|
|
914
|
+
3. R probes (R IS present here, /usr/lib/R/bin/Rscript, base loads):
|
|
915
|
+
`ruby -Ilib -e "require 'scout-rig/testing/availability'; puts ScoutRig::Testing::Availability.rscript?.inspect; puts ScoutRig::Testing::Availability.r_packages_reason('base').inspect"`
|
|
916
|
+
```
|
|
917
|
+
true
|
|
918
|
+
nil
|
|
919
|
+
```
|
|
920
|
+
4. grep of the delivered file (only hit is a comment mentioning PyCall.init's
|
|
921
|
+
documented ENV['PYTHON'] behavior; no `rescue Exception`, `Open3`,
|
|
922
|
+
`popen`, `fork`):
|
|
923
|
+
```
|
|
924
|
+
$ grep -n "PyCall\|rescue Exception\|Open3\|popen\|fork" lib/scout-rig/testing/availability.rb
|
|
925
|
+
220: # PyCall.init reads ENV['PYTHON'] and otherwise investigates python3
|
|
926
|
+
```
|
|
927
|
+
5. isolation (require leaves ScoutPython, PyCall undefined; `Scout` is the
|
|
928
|
+
primitive's own `Scout::Testing` namespace, unavoidable and intentional):
|
|
929
|
+
```
|
|
930
|
+
ruby -Ilib -e "require 'scout-rig/testing/availability'; puts defined?(ScoutPython).inspect; puts defined?(PyCall).inspect; puts defined?(Scout).inspect"
|
|
931
|
+
nil
|
|
932
|
+
nil
|
|
933
|
+
"constant"
|
|
934
|
+
```
|
|
935
|
+
6. extra validation beyond the brief: mixin call style returns true for
|
|
936
|
+
`python_modules?('sys')`; symbol args work (`r_packages?(:base)` -> true);
|
|
937
|
+
multi-module probe with a miss (`python_modules?('no_such_module_abc',
|
|
938
|
+
'sys')` -> false, reason names only the missing one); with
|
|
939
|
+
`SCOUT_TEST_PYTHON=/nonexistent/python-wrapper` after `reset!`,
|
|
940
|
+
`python?` -> false and the reason carries the launch error;
|
|
941
|
+
`r_packages?('nosuchpkgxyz123')` -> false with reason
|
|
942
|
+
`"/usr/lib/R/bin/Rscript: missing R packages: nosuchpkgxyz123"`;
|
|
943
|
+
`ENV['PYTHON']='/tmp/other_python'` (unresolvable) makes
|
|
944
|
+
`python_route_divergence` name both sides; clearing PATH makes
|
|
945
|
+
`subprocess_python` nil and the divergence message say the subprocess
|
|
946
|
+
route cannot run.
|
|
947
|
+
|
|
948
|
+
### Layer boundary reminder for later steps
|
|
949
|
+
|
|
950
|
+
No endpoint/model/accelerator probes here - those belong to scout-ai (see
|
|
951
|
+
the scout-essentials handoff). Step 8 (packaging) must remember that the
|
|
952
|
+
released scout-essentials gem (1.9.1) does NOT yet ship
|
|
953
|
+
`scout/testing/availability`; only its git checkout does.
|
|
954
|
+
|
|
955
|
+
---
|
|
956
|
+
|
|
957
|
+
## Step-1 re-verification addendum (independent second pass, 2026-10-11)
|
|
958
|
+
|
|
959
|
+
Every load-bearing fact above was re-derived in a fresh pass over the same
|
|
960
|
+
tree rather than trusted. One clarification and one required section
|
|
961
|
+
(open questions and risks) are added here; nothing above was rewritten.
|
|
962
|
+
|
|
963
|
+
Re-verified, unchanged:
|
|
964
|
+
|
|
965
|
+
- `git rev-parse HEAD` -> `386954a463d8e1a4d335d366836af3cc8c68c584`;
|
|
966
|
+
`git status --short` still shows the same 5 modified files and the
|
|
967
|
+
untracked `lib/scout-rig/` + this note; `VERSION` -> `0.2.6`.
|
|
968
|
+
- Fresh `rake test` (raw log `/tmp/rig_baseline_rake_test.log`):
|
|
969
|
+
`23 tests, 83 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions,
|
|
970
|
+
0 notifications`, `exit=1` (rake aborts on the loader's non-zero status).
|
|
971
|
+
Sole error unchanged: `Error: test_binding(TestPython): PyCall::PyError:
|
|
972
|
+
<class 'ModuleNotFoundError'>: No module named 'torch'` raised from
|
|
973
|
+
`test/scout/test_python.rb:113` (`pyimport :torch`). Classification:
|
|
974
|
+
**environmental** (optional package absent; torch is not declared in the
|
|
975
|
+
gemspec or `python/pyproject.toml`, which requires only pandas). Zero
|
|
976
|
+
code failures.
|
|
977
|
+
- `python3 --version` / `python --version` -> Python 3.13.3;
|
|
978
|
+
`which python python3` -> `/usr/bin/python` / `/usr/bin/python3`;
|
|
979
|
+
`python3 -c 'import torch'` -> ModuleNotFoundError, exit 1.
|
|
980
|
+
- Selection facts re-grepped at the same line numbers: embedded route
|
|
981
|
+
`lib/scout/python.rb:15` calls `PyCall.init` with no argument (pycall's
|
|
982
|
+
`init.rb:24` supplies `python = ENV['PYTHON']`, `LibPython::Finder`
|
|
983
|
+
`DEFAULT_PYTHON = ['python3','python']`, `finder.rb:46-51` exports
|
|
984
|
+
`ENV['PYTHONHOME']`); subprocess route spawns literal `python` from PATH
|
|
985
|
+
at `lib/scout/python/script.rb:105` (`ScoutPython.script`) and
|
|
986
|
+
`script.rb:113-122` (`ScoutPython.run_file`), consumed by
|
|
987
|
+
`lib/scout/workflow/python/task.rb:33/45/153`. `ENV['PYTHON']` has zero
|
|
988
|
+
hits in scout-rig's own `lib/`. `SCOUT_TEST_` still appears only in the
|
|
989
|
+
step-2 file `lib/scout-rig/testing/availability.rb` and in this note.
|
|
990
|
+
- Primitive contract re-probed in a fresh process:
|
|
991
|
+
members `[:argv, :success, :exit_status, :stdout, :stderr, :timed_out,
|
|
992
|
+
:launch_error]`; singleton methods `[:executable?, :run_command,
|
|
993
|
+
:tcp_reachable?]`; `success?` and `reason` exist, `timed_out?` does NOT
|
|
994
|
+
(`CommandResult.instance_methods(false).include?(:timed_out?) => false`).
|
|
995
|
+
Newly pinned exact raise messages and reason strings:
|
|
996
|
+
`run_command([], timeout: 5)` -> `ArgumentError "argv must not be empty"`;
|
|
997
|
+
`run_command(%w[true], timeout: 0)` -> `ArgumentError "timeout must be
|
|
998
|
+
positive and finite"`; exit-1 child -> `success=false, exit_status=1,
|
|
999
|
+
reason="exit status 1"`; missing executable -> `exit_status=nil,
|
|
1000
|
+
reason="Errno::ENOENT: No such file or directory - ..."`; timeout ->
|
|
1001
|
+
`timed_out=true, exit_status=nil, reason="command timed out"`. The
|
|
1002
|
+
require itself succeeded (no blocker).
|
|
1003
|
+
- Provider still the checkout: `$LOADED_FEATURES` resolves
|
|
1004
|
+
`/home/mvazque2/git/scout-essentials/lib/scout/testing/availability.rb`
|
|
1005
|
+
(via `RUBYOPT -I`), while `Gem::Specification.find_by_name` reports
|
|
1006
|
+
scout-essentials **1.9.1** at
|
|
1007
|
+
`/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/scout-essentials-1.9.1`.
|
|
1008
|
+
|
|
1009
|
+
### Clarification on the omit probe command
|
|
1010
|
+
|
|
1011
|
+
The delegation's literal probe
|
|
1012
|
+
(`Test::Unit::TestCase.instance_methods(false).map(&:to_s).grep(/omit/)`)
|
|
1013
|
+
returns `[]` and would be misread as "omit unavailable". `omit`,
|
|
1014
|
+
`omit_if` and `omit_unless` are **not defined directly on
|
|
1015
|
+
`Test::Unit::TestCase`**: they are mixed in, and
|
|
1016
|
+
`Test::Unit::TestCase.instance_method(:omit).owner` is
|
|
1017
|
+
`Test::Unit::TestCaseOmissionSupport` (test-unit 3.6.1). The verdict above
|
|
1018
|
+
stands (omission works and keeps exit status 0); the correct introspection
|
|
1019
|
+
is `Test::Unit::TestCase.method_defined?(:omit)` (true) or an actual
|
|
1020
|
+
omitting test.
|
|
1021
|
+
|
|
1022
|
+
### Open questions and risks
|
|
1023
|
+
|
|
1024
|
+
1. **Packaging risk (highest).** The released scout-essentials 1.9.1 gem
|
|
1025
|
+
does **not** ship `lib/scout/testing/availability.rb`; only the git
|
|
1026
|
+
checkout does, where the file is still staged-uncommitted. Any
|
|
1027
|
+
environment resolving the gem instead of the checkout will fail the
|
|
1028
|
+
require. Step 8 must not assume the released gem provides it.
|
|
1029
|
+
2. **Dirty-tree risk.** The baseline ran against HEAD+worktree: 5 modified
|
|
1030
|
+
tracked files plus the untracked step-2 deliverable and this note. The
|
|
1031
|
+
23-test count includes 4 tests that exist only in the worktree copy of
|
|
1032
|
+
`test/scout/workflow/python/test_task.rb`; a pristine-HEAD checkout runs
|
|
1033
|
+
19. Later steps must state which baseline they code against.
|
|
1034
|
+
3. **PYTHONHOME poisoning.** Any in-process `PyCall.init` exports
|
|
1035
|
+
`ENV['PYTHONHOME']` for the whole Ruby process (pycall
|
|
1036
|
+
`libpython/finder.rb:46-51`). Test setup must never export PYTHONHOME,
|
|
1037
|
+
and mixed-route runs (embedded then subprocess in one process) can break
|
|
1038
|
+
the subprocess interpreter with "Failed to import encodings".
|
|
1039
|
+
4. **Two-route interpreter split.** Subprocess = literal `python` from PATH;
|
|
1040
|
+
embedded = `ENV['PYTHON']` else `python3`/`python`. They coincide here
|
|
1041
|
+
(both `/usr/bin/python3.13`) but that is environmental luck, not a
|
|
1042
|
+
guarantee; the recommended recipe stays "chosen env's bin first on PATH".
|
|
1043
|
+
5. **No `timed_out?` predicate.** Code assuming one raises NoMethodError;
|
|
1044
|
+
read the `timed_out` member (and `reason` for the human string).
|
|
1045
|
+
6. **Red stock run.** `rake test` exits 1 whenever any test errors, so until
|
|
1046
|
+
step 4 gates `test_binding` on torch availability the stock suite stays
|
|
1047
|
+
red in torch-less environments. Gating must convert this to an omission,
|
|
1048
|
+
not to a skip that hides genuine failures.
|
|
1049
|
+
7. **Gemspec staleness.** 27 tracked files are missing from the gemspec file
|
|
1050
|
+
list (all of `doc/`, all `research/*.md`, `python/scout/task_errors.py`,
|
|
1051
|
+
`.gitignore`) and 2 listed files no longer exist
|
|
1052
|
+
(`doc/Python.md`, `doc/PythonWorkflow.md`). Regenerating via
|
|
1053
|
+
`rake gemspec` was deliberately not run.
|
|
1054
|
+
8. **R stays reference-only.** No R runtime is exercised by the suite;
|
|
1055
|
+
`rscript?`/`r_packages?` must remain unwired to unit tests until an R
|
|
1056
|
+
integration exists.
|
|
1057
|
+
9. **Agent-tooling observation (not a repo defect).** In this environment,
|
|
1058
|
+
files created under `tmp/` via the Workspace `write` task were not
|
|
1059
|
+
subsequently visible to `bash`/`list_directory` exec calls, while
|
|
1060
|
+
bash-created files were visible to the read tasks. Scratch probes that
|
|
1061
|
+
must be executed by the exec tasks should be created with bash heredocs.
|
|
1062
|
+
|
|
1063
|
+
## Step 2 design decisions
|
|
1064
|
+
|
|
1065
|
+
Implemented `lib/scout-rig/testing/availability.rb` (this file is untracked
|
|
1066
|
+
alongside the rest of `lib/scout-rig/`, which was already untracked before
|
|
1067
|
+
step 2; no tracked file was touched by this step).
|
|
1068
|
+
|
|
1069
|
+
### Adapt-vs-replace decision
|
|
1070
|
+
|
|
1071
|
+
**Replace.** The pre-existing untracked draft at
|
|
1072
|
+
`lib/scout-rig/testing/availability.rb` (24228 bytes, provenance unknown,
|
|
1073
|
+
mtime 2026-10-11 00:53) was read in full and compared against the
|
|
1074
|
+
scout-essentials handoff's corrected reference implementations and defect
|
|
1075
|
+
list. It was substantively unsound: it committed the handoff's failure
|
|
1076
|
+
modes. Concretely, the draft:
|
|
1077
|
+
|
|
1078
|
+
- built its reason strings from `stdout` first (the handoff's
|
|
1079
|
+
"stdout-based reasons" defect), instead of stderr-first for Python and
|
|
1080
|
+
stdout-first-only-for-R;
|
|
1081
|
+
- used a plain `rescue => e` in one place that the handoff flags as too
|
|
1082
|
+
broad for signal hygiene in the specific spots the draft used it;
|
|
1083
|
+
- cached its probe results keyed on the *requested* module names with the
|
|
1084
|
+
timeout baked into the key but NOT keyed on the *resolved* executable
|
|
1085
|
+
identity (no symlink canonicalization, so `python3` and `python`
|
|
1086
|
+
aliasing one binary produced two cache entries while a PATH change
|
|
1087
|
+
mid-process could serve a stale verdict);
|
|
1088
|
+
- left the embedded-route prediction as "the interpreter from ENV['PYTHON']
|
|
1089
|
+
or PATH" without ever defining what PATH order it would use, and
|
|
1090
|
+
documented `python_routes_divergence_reason` as validating both routes.
|
|
1091
|
+
|
|
1092
|
+
The rewrite keeps the draft's one good idea — routing all launches through
|
|
1093
|
+
`Scout::Testing::Availability.run_command` — and discards everything else.
|
|
1094
|
+
The final file is a full rewrite, not a patch of the draft.
|
|
1095
|
+
|
|
1096
|
+
Provenance caveat: the draft was read in full once, before being replaced
|
|
1097
|
+
by this rewrite; it no longer exists anywhere in the tree, so the defect
|
|
1098
|
+
observations above are as-observed from that single read and cannot be
|
|
1099
|
+
re-verified from the working copy. The replace decision, not the itemized
|
|
1100
|
+
defect list, is what this note guarantees: nothing of the draft survives
|
|
1101
|
+
except the choice to launch through the scout-essentials primitive, which
|
|
1102
|
+
the rewrite would have made independently.
|
|
1103
|
+
|
|
1104
|
+
### Namespace / require rationale
|
|
1105
|
+
|
|
1106
|
+
`ScoutRig::Testing::Availability` in
|
|
1107
|
+
`lib/scout-rig/testing/availability.rb`. `require
|
|
1108
|
+
'scout-rig/testing/availability'` loads only
|
|
1109
|
+
`scout/testing/availability` (the scout-essentials primitive) plus stdlib
|
|
1110
|
+
`socket` transitively. It does NOT load `scout-rig.rb`, `scout/python.rb`,
|
|
1111
|
+
or PyCall, verified: `defined?(PyCall)` is nil, `defined?(ScoutPython)` is
|
|
1112
|
+
nil, and `$LOADED_FEATURES` contains neither `scout/python.rb` nor
|
|
1113
|
+
`scout-rig.rb` after require in a fresh process. No production file
|
|
1114
|
+
requires it back, so it remains strictly opt-in for test suites.
|
|
1115
|
+
|
|
1116
|
+
### Selection precedence (Python)
|
|
1117
|
+
|
|
1118
|
+
1. `executable:` keyword (explicit; overrides everything, including pins)
|
|
1119
|
+
2. `ENV['SCOUT_TEST_PYTHON']` (test-only pin)
|
|
1120
|
+
3. route default — `:subprocess` (default) → `subprocess_python` (the
|
|
1121
|
+
literal `python` from PATH, matching `lib/scout/python/script.rb`'s
|
|
1122
|
+
`CMD.cmd(... "python" ...)` spawn); `:embedded` → `embedded_python`
|
|
1123
|
+
(`ENV['PYTHON']` if set, else first of `python3`, `python` found on
|
|
1124
|
+
PATH, mirroring `PyCall.init`/`LibPython::Finder::DEFAULT_PYTHON`)
|
|
1125
|
+
|
|
1126
|
+
R: `executable:` → `ENV['SCOUT_TEST_RSCRIPT']` → `Rscript` from PATH.
|
|
1127
|
+
|
|
1128
|
+
`SCOUT_TEST_PYTHON` deliberately does not affect
|
|
1129
|
+
`python_routes_divergence_reason`, `embedded_python`, or
|
|
1130
|
+
`subprocess_python`: a pinned probe that silently hid a real production
|
|
1131
|
+
divergence is exactly what the divergence reporter exists to expose.
|
|
1132
|
+
|
|
1133
|
+
### Cache-key definition
|
|
1134
|
+
|
|
1135
|
+
`[probe_kind, resolved_executable_identity, sorted_names, timeout, route]`
|
|
1136
|
+
where `resolved_executable_identity` is `File.realpath` of the resolved
|
|
1137
|
+
candidate (name → first PATH hit → symlink-canonicalized absolute path, or
|
|
1138
|
+
the raw name when unresolvable) so aliasing interpreters collapse to one
|
|
1139
|
+
entry and a PATH change mid-process re-resolves and produces a fresh key.
|
|
1140
|
+
|
|
1141
|
+
Only definitive outcomes are memoized (success / missing module / missing
|
|
1142
|
+
package — anything where the child reached an exit status). A timeout or a
|
|
1143
|
+
launch error is never memoized; an identical later call re-runs. The
|
|
1144
|
+
primitive's own contract is the authority here: `run_command` never
|
|
1145
|
+
memoizes on its side either.
|
|
1146
|
+
|
|
1147
|
+
### Defaults chosen
|
|
1148
|
+
|
|
1149
|
+
- `DEFAULT_TIMEOUT = 30` seconds, aligned with
|
|
1150
|
+
`Scout::Testing::Availability::DEFAULT_TIMEOUT`. Rationale: importing
|
|
1151
|
+
numpy/pandas/torch cold is slower than a stdlib import, and 30 s is
|
|
1152
|
+
comfortably above interpreter start time on this host (probe overhead
|
|
1153
|
+
observed ~0.5 s) without making a genuinely-hung interpreter painful in
|
|
1154
|
+
a test run. Overridable per call via `timeout:`.
|
|
1155
|
+
- `DEFAULT_ROUTE = :subprocess` for all Python probe helpers, because the
|
|
1156
|
+
subprocess route is what `ScoutPython.script` / `run_file` /
|
|
1157
|
+
`python_task` actually spawn today.
|
|
1158
|
+
- `REASON_TAIL = 400` chars of captured output kept in a reason string.
|
|
1159
|
+
- Probe argv layout: `[exe, '-c', SOURCE, *names]` for Python (verified:
|
|
1160
|
+
everything after `-c <source>` lands in `sys.argv` verbatim, even names
|
|
1161
|
+
like `-c` or `--version`; none of those are re-parsed as interpreter
|
|
1162
|
+
options when they arrive in trailing position). R:
|
|
1163
|
+
`[exe, '--vanilla', '-e', SOURCE, '--args', *names]`, with the probe
|
|
1164
|
+
filtering the literal `'--args'` element that `commandArgs(TRUE)`
|
|
1165
|
+
retains.
|
|
1166
|
+
|
|
1167
|
+
### Deviations from the spec
|
|
1168
|
+
|
|
1169
|
+
1. `python_modules_reason` on a *missing module* under a broken
|
|
1170
|
+
interpreter cannot name the resolved executable and the module list
|
|
1171
|
+
both cleanly when the interpreter itself is the failure; the reason
|
|
1172
|
+
string keeps both (executable first, then the tail) rather than
|
|
1173
|
+
dropping either. No behavior change, just reason-string shape.
|
|
1174
|
+
2. The spec's example name for the divergence helper was
|
|
1175
|
+
`python_routes_divergence_reason`; the implemented name is exactly
|
|
1176
|
+
that, and no shorter alias (`python_route_divergence_reason`) exists.
|
|
1177
|
+
3. The memoization mutex is held across the child launch (so concurrent
|
|
1178
|
+
test threads don't duplicate work for one key). This serializes probes
|
|
1179
|
+
in threaded test suites, which is a performance choice, not a
|
|
1180
|
+
correctness one; the alternative (double-checked locking) was
|
|
1181
|
+
considered and rejected as unnecessary complexity for this consumer.
|
|
1182
|
+
4. `reset!` returns nil and there is no `reset?` predicate — the spec
|
|
1183
|
+
named no return contract, and nil keeps it a hygiene hook, not a query.
|
|
1184
|
+
5. Deviation flagged for honesty, not behavior: the itemized defects of
|
|
1185
|
+
the replaced draft (see the provenance caveat above) were recorded from
|
|
1186
|
+
a single read and cannot be re-verified, because the rewrite replaced
|
|
1187
|
+
the file in place. The replace-vs-adapt decision does not depend on the
|
|
1188
|
+
itemization being exhaustive — the draft also simply lacked the
|
|
1189
|
+
route-aware resolution (`embedded_python`/`subprocess_python`/divergence
|
|
1190
|
+
diagnostic), the `SCOUT_TEST_PYTHON`/`SCOUT_TEST_RSCRIPT` pin precedence,
|
|
1191
|
+
and the R-side probes that this step's spec required, so even a
|
|
1192
|
+
defect-free draft would have needed the same structural rewrite.
|
|
1193
|
+
6. `python_routes_divergence_reason` reports a divergence when EITHER route
|
|
1194
|
+
fails to resolve (including "neither resolves"), not only when both
|
|
1195
|
+
resolve to different interpreters. A silent nil for "both broken" would
|
|
1196
|
+
read as agreement to a test that never runs the probe, which is worse
|
|
1197
|
+
than the noise.
|
|
1198
|
+
|
|
1199
|
+
## Step 3 test evidence
|
|
1200
|
+
|
|
1201
|
+
- File: `test/scout-rig/testing/test_availability.rb` (30 tests, 121
|
|
1202
|
+
assertions in a normal environment).
|
|
1203
|
+
- Standalone run, normal environment
|
|
1204
|
+
(`ruby -Ilib -Itest test/scout-rig/testing/test_availability.rb`):
|
|
1205
|
+
|
|
1206
|
+
30 tests, 121 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
|
|
1207
|
+
100% passed
|
|
1208
|
+
|
|
1209
|
+
- Hostile no-python/no-R environment (PATH restricted to a scratch dir
|
|
1210
|
+
holding only `ruby sh bash gcc cc make as ld ar cat sleep uname`; ruby
|
|
1211
|
+
itself still resolves because `RUBYOPT` and the gem paths stay untouched
|
|
1212
|
+
and the harness only needs the toolchain for the RubyInline build that
|
|
1213
|
+
`test_helper.rb`'s `require 'scout'` triggers once):
|
|
1214
|
+
|
|
1215
|
+
30 tests, 113 assertions, 0 failures, 0 errors, 0 pendings, 2 omissions, 0 notifications
|
|
1216
|
+
100% passed
|
|
1217
|
+
|
|
1218
|
+
The two omissions are exactly the real-interpreter-gated tests below;
|
|
1219
|
+
everything else passes on fakes alone.
|
|
1220
|
+
|
|
1221
|
+
- Harness discovery (`rake test`, which globs `test/**/test_*.rb` through
|
|
1222
|
+
the juwelier/rake test loader and therefore picks the new file up with
|
|
1223
|
+
no Rakefile change):
|
|
1224
|
+
|
|
1225
|
+
53 tests, 204 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
|
|
1226
|
+
|
|
1227
|
+
23 -> 53 tests (30 new). The 1 error is the pre-existing,
|
|
1228
|
+
unrelated `TestPython#test_binding` torch error already documented in
|
|
1229
|
+
the Step 1 baseline (`ModuleNotFoundError: No module named 'torch'`);
|
|
1230
|
+
the new file contributes 0 failures and 0 errors to the harness run.
|
|
1231
|
+
|
|
1232
|
+
- Real-interpreter-gated tests (the only `omit`s in the file):
|
|
1233
|
+
- `test_python_modules_real_stdlib_gated` — needs a real python to import
|
|
1234
|
+
the real stdlib `sys`; omits with "no python interpreter available".
|
|
1235
|
+
- `test_r_packages_real_runtime_gated` — needs a real Rscript to prove
|
|
1236
|
+
`r_packages?` answers for a genuinely present package (`base`); omits
|
|
1237
|
+
with "no Rscript available".
|
|
1238
|
+
Both gates probe with the default route, so they also verify the
|
|
1239
|
+
default-route plumbing whenever a real interpreter exists.
|
|
1240
|
+
|
|
1241
|
+
- Helper-code changes made during this step: **none**. Every failure during
|
|
1242
|
+
test-driven refinement was an over-strict or wrongly-assumed test
|
|
1243
|
+
expectation, fixed in the test file only:
|
|
1244
|
+
- `subprocess_python` in a PATH without `python` returns nil (it mirrors
|
|
1245
|
+
the production route's literal `python`), so the resolution test now
|
|
1246
|
+
asserts nil there and a new test covers the `python`-present case.
|
|
1247
|
+
- `defined?(PyCall)` returns nil (not the string "nil"), so the isolated
|
|
1248
|
+
probe serializes `nil` explicitly before JSON.
|
|
1249
|
+
- The isolated-probe helper needed the repo `lib/` derived from `__dir__`
|
|
1250
|
+
(three levels up) plus the scout-essentials checkout on the load path,
|
|
1251
|
+
with `RUBYOPT` cleared so the ambient 22-entry `-I` stack does not make
|
|
1252
|
+
the isolation assertion vacuous.
|
|
1253
|
+
|
|
1254
|
+
## Step 4 gating audit
|
|
1255
|
+
|
|
1256
|
+
Table 1 — every test file under `test/` (counts are methods, not assertions).
|
|
1257
|
+
"Route" is the interpreter route the running tests actually exercise.
|
|
1258
|
+
"Gate" is what this step did.
|
|
1259
|
+
|
|
1260
|
+
| file | running | `_`-disabled (pre-existing) | optional prereq (route) | required deps | gate decision |
|
|
1261
|
+
|---|---|---|---|---|---|
|
|
1262
|
+
| `test/scout/test_python.rb` | 1 (`test_binding`) | 9 (`_test_python`, `_test_run_log`, `_test_keras`, `_test_keras_import`, `_test_iterate`, `_test_lambda`, `_test_import_method`, `_test_class_new_obj`, `_test_single`, `_test_threaded`) | `torch` (:embedded — `pyimport :torch` runs IN-PROCESS through `ScoutPython.binding_run`/PyCall, so the interpreter that must have it is the one PyCall init selects) | none (torch required by no `lib/` code and no manifest; `python/pyproject.toml` needs only pandas) | **GATE** `test_binding` with `omit` + `python_modules?` :embedded. The 9 disabled tests stay disabled (out of scope this pass); apparent prereqs: torch/keras, plain stdlib, PyCall lambda eval — none re-enabled. |
|
|
1263
|
+
| `test/scout/python/test_script.rb` | 4 (`test_script`, `test_script_tsv`, `test_script_tsv_save`, `test_script_exception`) | 0 | pandas/scout-py via `import scout` in the child script (:subprocess — `ScoutPython.script` spawns literal `python`), but `import scout` is scout-rig's OWN packaged Python code → treated as REQUIRED, not gateable-by-package-probe | `scout` python package (own code); pandas (manifest dep of the python package, which the manifest requires for the tested `scout.tsv` path) | **NO GATE.** A missing `scout` import there is a packaging/path failure worth failing loudly. pandas is part of the packaged package's manifest → same verdict (required). All 4 pass here today. |
|
|
1264
|
+
| `test/scout/python/test_util.rb` | 2 (`test_tuple`, `test_numpy`) | 0 | `numpy` (:embedded — `ScoutPython.run :numpy` and `tsv2df` run in-process via PyCall) | numpy is required by no `lib/` code and no manifest → optional test prerequisite | **GATE** both, embedded route, reason names numpy. |
|
|
1265
|
+
| `test/scout/python/test_run.rb` | 0 | 1 (`__test_run_threaded`) | (n/a — not running) | n/a | **NO GATE** (nothing runs; file contributes 0 tests). Pre-existing disabled, prereq: plain stdlib + threaded PyCall. |
|
|
1266
|
+
| `test/scout/workflow/test_python.rb` | 1 (`test_file`) | 0 | `import scout` in the task file (:subprocess — `python_task` runs the file in a child process) | `scout` python package = own packaged code → REQUIRED | **NO GATE.** Packaging failure must fail loudly. Passes here today. |
|
|
1267
|
+
| `test/scout/workflow/python/test_task.rb` | 15 | 0 | `import scout` in generated task files and `python/pyproject.toml`-style packaging (:subprocess for `run_file`/`load_directory` metadata collection; two tests stub `ScoutPython.run_file` and never launch python) | `scout` python package = own packaged code → REQUIRED | **NO GATE.** Passes here today; stubbed tests need nothing. |
|
|
1268
|
+
| `test/scout-rig/testing/test_availability.rb` | 30 | 0 | none (fakes only; 2 omit-gated on a REAL interpreter, added deliberately in step 3) | scout-essentials `scout/testing/availability` (required, asserted in-file) | **NO GATE** (out of scope this step, untouched). |
|
|
1269
|
+
| `test/test_helper.rb` | — (harness, 0 tests) | — | — | — | **ADD ONE `require 'scout-rig/testing/availability'`** 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. |
|
|
1270
|
+
|
|
1271
|
+
Golden rule restated for the edits: the probe governs OMITTION ONLY. The gate
|
|
1272
|
+
sits at the top of the test method, and the `pyimport`/`ScoutPython.run` under
|
|
1273
|
+
test still executes unconditionally whenever the probe passed — so a passing
|
|
1274
|
+
probe can never mask a PyCall/native-binding failure.
|
|
1275
|
+
|
|
1276
|
+
## Step 4 evidence
|
|
1277
|
+
|
|
1278
|
+
- Audit: see "Step 4 gating audit" above (written BEFORE any test edit).
|
|
1279
|
+
- Files edited (3, all ours; the 5 not-ours files untouched):
|
|
1280
|
+
- `test/test_helper.rb` — one require added after `require 'scout'`:
|
|
1281
|
+
# Test-only availability probes (scout-rig testing support). Loaded here so
|
|
1282
|
+
# every test file can gate optional prerequisites with omit; NOT required by
|
|
1283
|
+
# any production entry point.
|
|
1284
|
+
require 'scout-rig/testing/availability'
|
|
1285
|
+
- `test/scout/test_python.rb` — gate at the top of `test_binding` (route
|
|
1286
|
+
`:embedded`), body unchanged and unconditional after it:
|
|
1287
|
+
omit(
|
|
1288
|
+
"torch not importable in the embedded (PyCall) interpreter: #{ScoutRig::Testing::Availability.python_modules_reason('torch', route: :embedded)}. " \
|
|
1289
|
+
'Install torch or pin SCOUT_TEST_PYTHON to an interpreter that has it.'
|
|
1290
|
+
) unless ScoutRig::Testing::Availability.python_modules?('torch', route: :embedded)
|
|
1291
|
+
- `test/scout/python/test_util.rb` — same shape for `test_tuple` and
|
|
1292
|
+
`test_numpy`, naming `numpy` instead of torch (numpy is the actual
|
|
1293
|
+
in-process dependency of `tsv2df`/`df2tsv` and `ScoutPython.run :numpy`).
|
|
1294
|
+
- `test/scout-rig/testing/test_availability.rb`: untouched (still 30/121).
|
|
1295
|
+
|
|
1296
|
+
- `rake test` BEFORE this step (recorded in step 3, torch-less machine):
|
|
1297
|
+
|
|
1298
|
+
53 tests, 204 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
|
|
1299
|
+
|
|
1300
|
+
- `rake test` AFTER this step (verbatim; exit 0):
|
|
1301
|
+
|
|
1302
|
+
53 tests, 204 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications
|
|
1303
|
+
|
|
1304
|
+
1 error -> 0 errors, 1 omission: the torch-less environment now omits
|
|
1305
|
+
`test_binding` with a reason naming torch, the embedded interpreter and the
|
|
1306
|
+
remedy. numpy is present here, so `test_util.rb` runs both tests (no
|
|
1307
|
+
omission on this machine; the gate fires only where numpy is missing).
|
|
1308
|
+
|
|
1309
|
+
- Touched files standalone (verbatim summaries):
|
|
1310
|
+
- `test/scout/test_python.rb`: `1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications`
|
|
1311
|
+
- `test/scout/python/test_util.rb`: `2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications`
|
|
1312
|
+
- `test/test_helper.rb` change verified by every standalone run above
|
|
1313
|
+
loading the helpers through it.
|
|
1314
|
+
- Untouched files re-run to confirm no collateral change:
|
|
1315
|
+
`test/scout/python/test_script.rb` 4/6/0/0, `test/scout/workflow/test_python.rb` 1/1/0/0,
|
|
1316
|
+
`test/scout/workflow/python/test_task.rb` 15/74/0/0, `test/scout-rig/testing/test_availability.rb` 30/121/0/0.
|
|
1317
|
+
|
|
1318
|
+
- Omission text observed in the suite (verbatim):
|
|
1319
|
+
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)]
|
|
1320
|
+
|
|
1321
|
+
- Golden-rule check (throwaway, `/tmp/golden_pre.rb`, NOT committed):
|
|
1322
|
+
pre-loaded a stub that makes `ScoutRig::Testing::Availability.python_modules?`
|
|
1323
|
+
return true and `python_modules_reason` return nil (i.e. a probe that lies
|
|
1324
|
+
"torch is importable"), then ran the real
|
|
1325
|
+
`test/scout/test_python.rb --name test_binding`:
|
|
1326
|
+
|
|
1327
|
+
ruby -Ilib -Itest -r/tmp/golden_pre.rb test/scout/test_python.rb --name test_binding
|
|
1328
|
+
Error: test_binding(TestPython): PyCall::PyError: <class 'ModuleNotFoundError'>: No module named 'torch'
|
|
1329
|
+
/home/mvazque2/.rvm/gems/ruby-3.3.1/gems/pycall-1.5.2/lib/pycall/import.rb:18:in `pyimport'
|
|
1330
|
+
=> 123: pyimport :torch
|
|
1331
|
+
1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
|
|
1332
|
+
|
|
1333
|
+
Interpretation: with the gate satisfied (probe true) the omission does NOT
|
|
1334
|
+
fire and the unconditional `pyimport :torch` inside the body raises the real
|
|
1335
|
+
PyCall::PyError — the gate cannot mask a present-but-failing interpreter or
|
|
1336
|
+
binding. Conversely, with the real probe on this machine the gate fires
|
|
1337
|
+
BEFORE any PyCall call, so no spurious error occurs.
|
|
1338
|
+
|
|
1339
|
+
## Step 5 documentation evidence
|
|
1340
|
+
|
|
1341
|
+
Files edited (4, all in the allowed set; no other doc touched):
|
|
1342
|
+
|
|
1343
|
+
- `doc/user/TestingAndPackaging.md` — primary target. Suite-state refresh
|
|
1344
|
+
(layout tree, 9 -> 53 tests, per-file prereq table now including the
|
|
1345
|
+
availability test file), rewritten "What rake test does today" (omission,
|
|
1346
|
+
not error, with the verbatim omission text), new "Optional-prerequisite
|
|
1347
|
+
gating with the availability helpers" section carrying the full API table,
|
|
1348
|
+
result meanings, selection precedence, route semantics + divergence +
|
|
1349
|
+
recommended practice, probe-vs-PyCall-validation distinction, the gate
|
|
1350
|
+
pattern, and the gating recipe; footer updated to
|
|
1351
|
+
"Verified against HEAD `386954a4`".
|
|
1352
|
+
- `README.md` — development/testing section rewritten: the suite now reports
|
|
1353
|
+
an honest omission instead of erroring; short require path + one gating
|
|
1354
|
+
example; pointer to the full page.
|
|
1355
|
+
- `doc/user/PythonEnvironments.md` — one tight addition after the PyCall
|
|
1356
|
+
selection paragraph: the subprocess route's independent selection, the
|
|
1357
|
+
`PYTHONHOME` side effect, `python_routes_divergence_reason` as the
|
|
1358
|
+
reporter, and the bin-first-on-PATH remedy, cross-linking
|
|
1359
|
+
TestingAndPackaging.md.
|
|
1360
|
+
- `doc/developer/Architecture.md` — External (Python packages) entry for
|
|
1361
|
+
`torch` updated: optional test prerequisite gated via the availability
|
|
1362
|
+
helpers; numpy likewise; neither required by production code.
|
|
1363
|
+
|
|
1364
|
+
API table as committed (extracted verbatim from the file after editing):
|
|
1365
|
+
|
|
1366
|
+
| Method | Returns |
|
|
1367
|
+
|---|---|
|
|
1368
|
+
| `python?(executable: nil, route: :subprocess, timeout: nil)` | `true` iff the selected Python exists **and runs** (a sanity probe must exit 0); `false` otherwise. PATH existence alone is not enough. |
|
|
1369
|
+
| `python_modules?(*modules, executable: nil, route: :subprocess, timeout: nil)` | `true` iff every named module imports in the selected interpreter. An empty list is vacuously true **once an interpreter was resolved**. |
|
|
1370
|
+
| `python_modules_reason(*modules, ...)` | `nil` on success; otherwise one concise string: the resolved executable path, the missing/unloadable module names, and the condensed exception text from stderr. |
|
|
1371
|
+
| `rscript?(executable: nil, timeout: nil)` | `true` iff the selected Rscript exists and runs (sanity probe exits 0). |
|
|
1372
|
+
| `r_packages?(*packages, executable: nil, timeout: nil)` | `true` iff every named package **loads** (`requireNamespace`), not merely appears in an installation list. |
|
|
1373
|
+
| `r_packages_reason(*packages, ...)` | `nil` on success; otherwise the resolved executable path, the missing package names (stdout first), then the stderr tail. |
|
|
1374
|
+
| `embedded_python` | The interpreter the embedded route **would** use, without running anything: `ENV['PYTHON']` if set, else the first `python3`/`python` on PATH. `nil` when neither exists. |
|
|
1375
|
+
| `subprocess_python` | The interpreter the subprocess route uses: the literal command `python` from PATH (`ENV['PYTHON']` is never consulted there). `nil` when PATH has no `python`. |
|
|
1376
|
+
| `python_routes_divergence_reason` | `nil` when both routes resolve to the same interpreter (symlinks canonicalized); otherwise one sentence naming both resolutions, the `ENV['PYTHON']`/PATH cause, and that no probe validates both routes. |
|
|
1377
|
+
| `reset!` | Clears all memoized probe results (returns `nil`). |
|
|
1378
|
+
|
|
1379
|
+
Scope check, `git diff --stat` after the edits:
|
|
1380
|
+
|
|
1381
|
+
README.md | 19 +++-
|
|
1382
|
+
doc/developer/Architecture.md | 10 +-
|
|
1383
|
+
doc/developer/PythonWorkflowInternals.md | 10 ++
|
|
1384
|
+
doc/user/DefiningPythonTasks.md | 25 +++++
|
|
1385
|
+
doc/user/PythonEnvironments.md | 20 ++++
|
|
1386
|
+
doc/user/TestingAndPackaging.md | 189 +++++++++++++++++++++++++-----
|
|
1387
|
+
lib/scout/python/script.rb | 13 ++-
|
|
1388
|
+
lib/scout/workflow/python/task.rb | 3 +-
|
|
1389
|
+
test/scout/python/test_util.rb | 13 +++
|
|
1390
|
+
test/scout/test_python.rb | 10 ++
|
|
1391
|
+
test/scout/workflow/python/test_task.rb | 74 +++++++++++-
|
|
1392
|
+
test/test_helper.rb | 5 +
|
|
1393
|
+
12 files changed, 339 insertions(+), 38 deletions(-)
|
|
1394
|
+
|
|
1395
|
+
(The five not-ours rows carry the same +/- counts as before the edits; only
|
|
1396
|
+
their width padding differs. `git diff <not-ours files>` is byte-identical to
|
|
1397
|
+
the pre-edit diff.)
|
|
1398
|
+
|
|
1399
|
+
Cross-link/render sanity: every relative `.md` link in the four edited files
|
|
1400
|
+
resolves (`realpath` check over all link targets: OK), and the two
|
|
1401
|
+
intra-document anchors (`#python-interpreter-selection-for-the-suite`,
|
|
1402
|
+
`#optional-prerequisite-gating-with-the-availability-helpers`) match existing
|
|
1403
|
+
`###` headings at lines 160 and 214 of TestingAndPackaging.md.
|
|
1404
|
+
|
|
1405
|
+
Post-edit suite re-run: `53 tests, 204 assertions, 0 failures, 0 errors,
|
|
1406
|
+
0 pendings, 1 omissions, 0 notifications`, exit 0 — docs-only change did not
|
|
1407
|
+
disturb the suite.
|
|
1408
|
+
Post-edit suite re-run: `53 tests, 204 assertions, 0 failures, 0 errors,
|
|
1409
|
+
0 pendings, 1 omissions, 0 notifications`, exit 0 — docs-only change did not
|
|
1410
|
+
disturb the suite.
|
|
1411
|
+
|
|
1412
|
+
Honesty flag (added after the Critic gate caught its absence): the
|
|
1413
|
+
`53 tests, 206 assertions` example block in `doc/user/TestingAndPackaging.md`
|
|
1414
|
+
(the torch-bearing-PATH scenario) is DERIVED ARITHMETIC, NOT an executed run —
|
|
1415
|
+
204 assertions were actually observed in the torch-less run, plus the exactly-2
|
|
1416
|
+
`assert`s inside `test_binding` counted from its source, giving 206 as the
|
|
1417
|
+
expected figure. No torch interpreter exists in this environment (the baseline
|
|
1418
|
+
recorded `PyCall::PyError: No module named 'torch'` for exactly that reason),
|
|
1419
|
+
so that run could not have been executed here; the doc block is framed as an
|
|
1420
|
+
expected/derived total, not captured output.
|
|
1421
|
+
|
|
1422
|
+
## Step 6 packaging evidence
|
|
1423
|
+
|
|
1424
|
+
Date: 2026-10-11. HEAD `386954a4`, VERSION 0.2.6 (unchanged by this step).
|
|
1425
|
+
All commands run from the checkout root (`/bulk/mvazque2/git/scout-rig`).
|
|
1426
|
+
|
|
1427
|
+
### 1. Status before staging
|
|
1428
|
+
|
|
1429
|
+
`git status --porcelain` (snapshot kept at `tmp/step6-status-before.txt`):
|
|
1430
|
+
|
|
1431
|
+
```
|
|
1432
|
+
M README.md
|
|
1433
|
+
M doc/developer/Architecture.md
|
|
1434
|
+
M doc/developer/PythonWorkflowInternals.md
|
|
1435
|
+
M doc/user/DefiningPythonTasks.md
|
|
1436
|
+
M doc/user/PythonEnvironments.md
|
|
1437
|
+
M doc/user/TestingAndPackaging.md
|
|
1438
|
+
M lib/scout/python/script.rb
|
|
1439
|
+
M lib/scout/workflow/python/task.rb
|
|
1440
|
+
M test/scout/python/test_util.rb
|
|
1441
|
+
M test/scout/test_python.rb
|
|
1442
|
+
M test/scout/workflow/python/test_task.rb
|
|
1443
|
+
M test/test_helper.rb
|
|
1444
|
+
?? lib/scout-rig/
|
|
1445
|
+
?? research/testing-availability-baseline.md
|
|
1446
|
+
?? test/scout-rig/
|
|
1447
|
+
```
|
|
1448
|
+
|
|
1449
|
+
### 2. Staging (explicit paths only)
|
|
1450
|
+
|
|
1451
|
+
```
|
|
1452
|
+
git add lib/scout-rig/testing/availability.rb \
|
|
1453
|
+
test/scout-rig/testing/test_availability.rb \
|
|
1454
|
+
research/testing-availability-baseline.md \
|
|
1455
|
+
test/test_helper.rb test/scout/test_python.rb \
|
|
1456
|
+
test/scout/python/test_util.rb \
|
|
1457
|
+
README.md doc/user/TestingAndPackaging.md \
|
|
1458
|
+
doc/user/PythonEnvironments.md doc/developer/Architecture.md
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
Status after (`tmp/step6-status-after-add.txt`): the 10 ours-files staged
|
|
1462
|
+
(`A`/`M ` in column 1); the 5 not-ours files remain ` M` — unstaged.
|
|
1463
|
+
Verification `git diff --cached --name-only | grep -E '<the 5 not-ours
|
|
1464
|
+
paths>'` → no match ("none of the 5 not-ours files staged (correct)").
|
|
1465
|
+
|
|
1466
|
+
Staged set (exactly 10):
|
|
1467
|
+
`README.md`, `doc/developer/Architecture.md`, `doc/user/PythonEnvironments.md`,
|
|
1468
|
+
`doc/user/TestingAndPackaging.md`, `lib/scout-rig/testing/availability.rb`,
|
|
1469
|
+
`research/testing-availability-baseline.md`,
|
|
1470
|
+
`test/scout-rig/testing/test_availability.rb`, `test/scout/python/test_util.rb`,
|
|
1471
|
+
`test/scout/test_python.rb`, `test/test_helper.rb`.
|
|
1472
|
+
|
|
1473
|
+
### 3. Gemspec regeneration
|
|
1474
|
+
|
|
1475
|
+
`rake gemspec` → `Generated: scout-rig.gemspec` / `scout-rig.gemspec is
|
|
1476
|
+
valid.`, exit 0 (full output is 2 lines; `rake gemspec:validate` → `nil
|
|
1477
|
+
versions are discouraged and will be deprecated in Rubygems 4` +
|
|
1478
|
+
`scout-rig.gemspec is valid.`, exit 0 — the "nil versions" line is the known
|
|
1479
|
+
Juwelier lint noise, plus the two `gem build` warnings about the open-ended
|
|
1480
|
+
`pycall (> 0)` dependency and missing `required_ruby_version`; neither blocks
|
|
1481
|
+
the build).
|
|
1482
|
+
|
|
1483
|
+
`git diff --stat scout-rig.gemspec`: `33 ++++++++++++++++++++++++++++++---`
|
|
1484
|
+
(1 file changed, **30 insertions(+), 3 deletions(-)**). Full diff kept at
|
|
1485
|
+
`tmp/step6-gemspec.diff` (pre-regeneration copy at
|
|
1486
|
+
`tmp/step6-gemspec-before.gemspec`).
|
|
1487
|
+
|
|
1488
|
+
File-list changes — **29 entries added, 2 removed**:
|
|
1489
|
+
|
|
1490
|
+
- Removed (2): the stale nonexistent `doc/Python.md`, `doc/PythonWorkflow.md`.
|
|
1491
|
+
- Added: 20 tracked-but-previously-omitted files (18 `doc/**`, 1
|
|
1492
|
+
`python/scout/task_errors.py`, plus our newly tracked set) and 9 of ours
|
|
1493
|
+
(the 3 brand-new files: `lib/scout-rig/testing/availability.rb`,
|
|
1494
|
+
`test/scout-rig/testing/test_availability.rb`,
|
|
1495
|
+
`research/testing-availability-baseline.md`; the file list picks up the
|
|
1496
|
+
tracked content of the 7 modified ours-files too, but for those the entry
|
|
1497
|
+
itself was already listed — only the 3 new paths are new entries).
|
|
1498
|
+
- Our entries appearing in `s.files` for the first time (3):
|
|
1499
|
+
`lib/scout-rig/testing/availability.rb`,
|
|
1500
|
+
`test/scout-rig/testing/test_availability.rb`,
|
|
1501
|
+
`research/testing-availability-baseline.md`.
|
|
1502
|
+
- Also regenerated: `s.rubygems_version "3.7.0.dev" -> "3.7.2"` (recording
|
|
1503
|
+
the running rubygems); `s.date` remains the Juwelier placeholder
|
|
1504
|
+
`1980-01-02`, as before.
|
|
1505
|
+
|
|
1506
|
+
The regenerated list includes the 5 not-ours files (`doc/developer/
|
|
1507
|
+
PythonWorkflowInternals.md`, `doc/user/DefiningPythonTasks.md`,
|
|
1508
|
+
`lib/scout/python/script.rb`, `lib/scout/workflow/python/task.rb`,
|
|
1509
|
+
`test/scout/workflow/python/test_task.rb`): they are already tracked in the
|
|
1510
|
+
repo, so Juwelier's `git ls-files` listing is legitimate and expected. Only
|
|
1511
|
+
the file LIST regenerated, not their contents; their working-tree changes
|
|
1512
|
+
stay unstaged.
|
|
1513
|
+
|
|
1514
|
+
### 4. Build and payload verification
|
|
1515
|
+
|
|
1516
|
+
```
|
|
1517
|
+
gem build scout-rig.gemspec
|
|
1518
|
+
# WARNING: open-ended dependency on pycall (> 0) is not recommended
|
|
1519
|
+
# WARNING: make sure you specify the oldest ruby version constraint ... required_ruby_version
|
|
1520
|
+
# Successfully built RubyGem
|
|
1521
|
+
# Name: scout-rig
|
|
1522
|
+
# Version: 0.2.6
|
|
1523
|
+
# File: scout-rig-0.2.6.gem (166400 bytes)
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1526
|
+
Payload listing (kept at `tmp/step6-payload-list.txt`, 60 entries):
|
|
1527
|
+
|
|
1528
|
+
```
|
|
1529
|
+
tar -xOf scout-rig-0.2.6.gem data.tar.gz | tar -tzf -
|
|
1530
|
+
```
|
|
1531
|
+
|
|
1532
|
+
**Payload verdict — `lib/scout-rig/testing/availability.rb` IS in the gem**
|
|
1533
|
+
(payload line 25).
|
|
1534
|
+
|
|
1535
|
+
Ours-files in the payload (all 10, sorted as listed):
|
|
1536
|
+
`README.md` (l4), `doc/developer/Architecture.md` (l9),
|
|
1537
|
+
`doc/user/PythonEnvironments.md` (l20),
|
|
1538
|
+
`doc/user/TestingAndPackaging.md` (l23),
|
|
1539
|
+
`lib/scout-rig/testing/availability.rb` (l25),
|
|
1540
|
+
`research/testing-availability-baseline.md` (l50),
|
|
1541
|
+
`test/scout-rig/testing/test_availability.rb` (l53),
|
|
1542
|
+
`test/test_helper.rb` (l60), plus `test/scout/test_python.rb` and
|
|
1543
|
+
`test/scout/python/test_util.rb` (both listed, see the full payload list).
|
|
1544
|
+
I.e. **nothing of ours is dev-only: every ours-file ships** in this gem's
|
|
1545
|
+
payload. This is by Juwelier design here: `.document` only drives RDoc
|
|
1546
|
+
(`lib/**/*.rb`, `bin/*`, `features/**/*.feature`, `LICENSE.txt` — with the
|
|
1547
|
+
`- ` marker suppressing the default `README`/`lib` auto-inclusion), while
|
|
1548
|
+
`s.files` is the whole tracked file set, so tests and research/ notes are
|
|
1549
|
+
packaged as well (60 files total, 10 under `lib/`).
|
|
1550
|
+
|
|
1551
|
+
### 5. Nothing-else-broke checks
|
|
1552
|
+
|
|
1553
|
+
- `ruby -Ilib -e "require 'scout-rig/testing/availability'; puts :ok"` →
|
|
1554
|
+
`ok`, exit 0.
|
|
1555
|
+
- `rake test | tail -5` → `53 tests, 204 assertions, 0 failures, 0 errors,
|
|
1556
|
+
0 pendings, 1 omissions, 0 notifications` / `100% passed`, exit 0
|
|
1557
|
+
(baseline preserved).
|
|
1558
|
+
|
|
1559
|
+
### 6. Cleanup and final state
|
|
1560
|
+
|
|
1561
|
+
`scout-rig-0.2.6.gem` removed (`rm -f`; `ls scout-rig-*.gem` → "No such file
|
|
1562
|
+
or directory"). It was never git-ignored (root-level, outside `pkg`/`tmp`),
|
|
1563
|
+
so removal was required rather than optional. Evidence snapshots live under
|
|
1564
|
+
the ignored `tmp/` (`step6-status-before.txt`, `step6-status-after-add.txt`,
|
|
1565
|
+
`step6-gemspec-before.gemspec`, `step6-gemspec.diff`, `step6-gem-build.log`,
|
|
1566
|
+
`step6-payload-list.txt`, `step6-added.txt`, `step6-removed.txt`,
|
|
1567
|
+
`step6-status-final.txt`) and do not appear in `git status`.
|
|
1568
|
+
|
|
1569
|
+
Final `git status --porcelain` (`tmp/step6-status-final.txt`): the 10
|
|
1570
|
+
ours-files staged + `scout-rig.gemspec` regenerated (` M`), the 5 not-ours
|
|
1571
|
+
files still ` M` unstaged, nothing else. **No commit made**: the tree holds
|
|
1572
|
+
unrelated in-flight work and committing is outside this step's authority;
|
|
1573
|
+
staging is exactly what Juwelier's file-list generation reads.
|
|
1574
|
+
|
|
1575
|
+
## Step 8 final report (pointer)
|
|
1576
|
+
|
|
1577
|
+
Final consolidated report written and staged at
|
|
1578
|
+
**`research/testing-availability-final-report.md`**. It supersedes nothing
|
|
1579
|
+
here — this note remains the per-step evidence trail; the report is the
|
|
1580
|
+
deliverable a follow-on Scout-AI task consumes (see its "Scout-AI handoff
|
|
1581
|
+
contract" section).
|
|
1582
|
+
|
|
1583
|
+
Fresh validation runs captured for the report (2026-10-11, HEAD `386954a4`,
|
|
1584
|
+
all from the checkout root; verbatim, none quoted from earlier steps):
|
|
1585
|
+
|
|
1586
|
+
1. Isolation one-liner
|
|
1587
|
+
`ruby -Ilib -e "require 'scout-rig/testing/availability'; puts :loaded; p defined?(PyCall)"`:
|
|
1588
|
+
|
|
1589
|
+
loaded
|
|
1590
|
+
nil
|
|
1591
|
+
EXIT=0
|
|
1592
|
+
|
|
1593
|
+
2. Standalone focused tests
|
|
1594
|
+
`ruby -Ilib -Itest test/scout-rig/testing/test_availability.rb`:
|
|
1595
|
+
|
|
1596
|
+
30 tests, 121 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
|
|
1597
|
+
100% passed
|
|
1598
|
+
|
|
1599
|
+
3. Full suite `rake test` (full log at `tmp/step8-rake-test.log`):
|
|
1600
|
+
|
|
1601
|
+
53 tests, 204 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications
|
|
1602
|
+
100% passed
|
|
1603
|
+
RAKE_EXIT=0
|
|
1604
|
+
|
|
1605
|
+
4. Touched-file spot checks: `test/scout/test_python.rb` →
|
|
1606
|
+
`1 tests, 0 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions,
|
|
1607
|
+
0 notifications` (the torch omission, expected); `test/scout/python/test_util.rb`
|
|
1608
|
+
→ `2 tests, 2 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions,
|
|
1609
|
+
0 notifications` (numpy present, gate does not fire).
|
|
1610
|
+
5. Gem inclusion: `grep -n "scout-rig/testing" scout-rig.gemspec` →
|
|
1611
|
+
line 46 `lib/scout-rig/testing/availability.rb`, line 74
|
|
1612
|
+
`test/scout-rig/testing/test_availability.rb` (payload evidence from
|
|
1613
|
+
step 6, not rebuilt).
|
|
1614
|
+
6. Process evidence: HEAD still `386954a Explain how to add extensions`;
|
|
1615
|
+
staged set was exactly the 10 ours-files before the report was staged;
|
|
1616
|
+
gemspec left unstaged on purpose; the 5 not-ours files untouched.
|
|
1617
|
+
|
|
1618
|
+
Expected vs observed: no discrepancy. The suite landed exactly on
|
|
1619
|
+
53/204/0 failures/0 errors/1 omission with exit 0, and the focused file on
|
|
1620
|
+
30/121/0/0. The single omission is the honest torch gate (torch absent in
|
|
1621
|
+
this environment — classification: environmental, not code).
|
|
1622
|
+
|
|
1623
|
+
Task closed. Remaining open item for a human committer: commit the staged
|
|
1624
|
+
11 (10 + final report) **together with the regenerated `scout-rig.gemspec`**,
|
|
1625
|
+
and keep the 5 not-ours files in their own in-flight work.
|