Skip to content

Commit a82bd4c

Browse files
committed
fix(s032): the smoke run asked for by TRINITY_SMOKE=1, so Kernel.CLI has no argument to mistake for a file
Package run 35608084951, macOS: 'No file named --smoke', exit 1, between the fourth line and the fifth. The workflow sets the variable; --smoke still works where the race is won. Signed-off-by: Ayla Croft <aylacroft@proton.me>
1 parent a954393 commit a82bd4c

5 files changed

Lines changed: 38 additions & 5 deletions

File tree

‎.github/workflows/package.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,10 @@ jobs:
192192
ours() { ps -eo pid,ppid,comm | grep -E 'burrito|beam\.smp|erl_child_setup|desktop_' | grep -v grep || true; }
193193
ours > ps-before.txt
194194
chmod +x "burrito_out/${{ matrix.artifact }}"
195-
"./burrito_out/${{ matrix.artifact }}" --no-halt --smoke | tee smoke.log
195+
# Slice 032: the variable, not `--smoke`: Kernel.CLI read the argument as a file
196+
# ("No file named --smoke", exit 1) and won the race against the halting Task on
197+
# macOS in run 35608084951.
198+
TRINITY_SMOKE=1 "./burrito_out/${{ matrix.artifact }}" --no-halt | tee smoke.log
196199
sleep 3
197200
ours > ps-after.txt
198201
grep -q '^TRINITY_SMOKE_PORT=[0-9][0-9]*$' smoke.log
@@ -212,7 +215,8 @@ jobs:
212215
shell: pwsh
213216
run: |
214217
$ErrorActionPreference = "Stop"
215-
& ".\burrito_out\${{ matrix.artifact }}" --no-halt --smoke | Tee-Object smoke.log
218+
$env:TRINITY_SMOKE = "1"
219+
& ".\burrito_out\${{ matrix.artifact }}" --no-halt | Tee-Object smoke.log
216220
if ($LASTEXITCODE -ne 0) { throw "smoke exited $LASTEXITCODE" }
217221
if (-not (Select-String -Path smoke.log -Pattern '^TRINITY_SMOKE_PORT=\d+$')) {
218222
throw "no port line"

‎config/runtime.exs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import Config
2424
# which is the same call: this file is evaluated before the application is available under
2525
# Mix, so it may not call project modules. `Burrito.Util.Args.get_arguments/0` reads the same
2626
# thing.
27-
smoke? = "--smoke" in Enum.map(:init.get_plain_arguments(), &to_string/1)
27+
smoke? =
28+
"--smoke" in Enum.map(:init.get_plain_arguments(), &to_string/1) or
29+
System.get_env("TRINITY_SMOKE") == "1"
2830

2931
if System.get_env("PHX_SERVER") || smoke? do
3032
config :trinity, TrinityWeb.Endpoint, server: true

‎docs/packaging.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ nothing downstream notices.
6666
process. It is the only part of "the desktop app works" that a terminal can answer on a machine
6767
with no display.
6868

69+
As built at slice 032, `TRINITY_SMOKE=1` in the environment asks for the same run and is the form
70+
the package workflow uses: `Kernel.CLI` reads the plain arguments once the application has started
71+
and treats `--smoke` as a file to run ("No file named --smoke", exit 1), a race the halting Task
72+
lost on macOS in run 35608084951. The run prints five lines: the port, the markdown renderer
73+
(slice 013), whether the EXLA NIF loaded (`TRINITY_SMOKE_EXLA`, recorded), a fake-vector search
74+
through the vector store in force on the binary's own database, rolled back (`TRINITY_SMOKE_VEC`,
75+
binding: exit 4), and the semantic tier's status (`TRINITY_SMOKE_SEMANTIC`, recorded). Slice
76+
032's PROOF.md AC7 has each bundle's answers.
77+
6978
## Measurements: linux x86_64 only
7079

7180
Machine: Linux 6.14.0-37-generic, x86_64. **These figures are for this host and this target.**

‎lib/trinity/smoke.ex‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,17 @@ defmodule Trinity.Smoke do
4444
@spec argv() :: [String.t()]
4545
def argv, do: Enum.map(:init.get_plain_arguments(), &to_string/1)
4646

47-
@doc "Whether `#{@flag}` was passed."
47+
@doc """
48+
Whether the smoke run was asked for: `#{@flag}` among the arguments, or `TRINITY_SMOKE=1` in
49+
the environment. The variable is the form the package workflow uses since slice 032:
50+
`Kernel.CLI` reads the same plain arguments once the application has started and treats
51+
`#{@flag}` as a file to run ("No file named --smoke", exit 1), and the Task that prints the
52+
lines and halts wins that race only sometimes (package run 35608084951, macOS: exit 1
53+
between the fourth line and the fifth). An environment variable is nothing for the CLI to
54+
read.
55+
"""
4856
@spec requested?([String.t()]) :: boolean()
49-
def requested?(args), do: @flag in args
57+
def requested?(args), do: @flag in args or System.get_env("TRINITY_SMOKE") == "1"
5058

5159
@doc """
5260
The line printed for the caller to parse. One key=value pair, no prose around it, so a shell

‎test/smoke_test.exs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ defmodule SmokeTest do
2929
refute Smoke.requested?(["--smoked"])
3030
refute Smoke.requested?(["smoke"])
3131
end
32+
33+
# Slice 032: the variable form, which Kernel.CLI cannot mistake for a file.
34+
test "true with TRINITY_SMOKE=1 and no argument" do
35+
System.put_env("TRINITY_SMOKE", "1")
36+
on_exit(fn -> System.delete_env("TRINITY_SMOKE") end)
37+
assert Smoke.requested?([])
38+
assert Smoke.probe([]) == [Trinity.Smoke.Probe]
39+
System.put_env("TRINITY_SMOKE", "0")
40+
refute Smoke.requested?([])
41+
end
3242
end
3343

3444
describe "port_line/1" do

0 commit comments

Comments
 (0)