test: replace mock smoke matrix with a live-only drift check

The 43-case mock smoke duplicated tests/cli.rs, which already runs the
real binary against fixture providers. Replace the flake's smoke-mock
check with a small packaged-cli check (version JSON, bash completions,
one mock quote), and cut scripts/live-smoke.sh from 672 to ~170 lines:
it now only runs shipped commands against live MSN/Yahoo/IDX and
validates output shape. Rewrite docs/SMOKE.md around the Nix gate and
the drift check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hermes 2026-10-14 07:45:51 +00:00
commit 86c108f6eb
7 changed files with 188 additions and 771 deletions

View file

@ -189,19 +189,19 @@
doInstallCargoArtifacts = false;
installPhaseCommand = "touch $out";
});
smoke-mock = pkgs.runCommand "idx-smoke-mock"
{ nativeBuildInputs = with pkgs; [ bash coreutils diffutils findutils gnugrep gnused gawk jq ]; }
# Sanity check of the packaged (wrapped) binary; CLI behavior is
# covered by tests/cli.rs.
packaged-cli = pkgs.runCommand "idx-packaged-cli"
{ nativeBuildInputs = with pkgs; [ bash jq ]; }
''
mkdir -p scripts
cp ${./scripts/live-smoke.sh} scripts/live-smoke.sh
chmod u+w scripts/live-smoke.sh
patchShebangs scripts/live-smoke.sh
# The mock provider reads fixtures relative to the working dir.
mkdir -p tests
cp -r ${./tests/fixtures} tests/fixtures
export HOME="$TMPDIR"
${idxPackage}/bin/idx version
bash scripts/live-smoke.sh --bin ${idxPackage}/bin/idx --no-build --mode mock
${idxPackage}/bin/idx -o json version | jq -e '.version | type == "string"'
${idxPackage}/bin/idx completions bash | bash -n
IDX_USE_MOCK_PROVIDER=1 ${idxPackage}/bin/idx -o json stocks quote BBCA \
| jq -e '.[0].price | type == "number"'
touch "$out"
'';
install-script-sh = installerCheck "sh";