Commit 8cbc7f0
2026-08-29 22:38:52
1 parent
8d4423c
Changed files (3)
spec
spec/elelem/cli_spec.rb
@@ -1,23 +1,12 @@
# frozen_string_literal: true
-require "shellwords"
-require "tmpdir"
-
-# End-to-end tests that spawn the real `exe/elelem` binary and assert only on
-# observable behavior a reimplemented core must reproduce: exit codes, stdout
-# markers, and files written to disk. No HTTP stubs, no fakes, no scripted
-# providers, and never exact model prose -- so these survive the Rust/GGUF rewrite.
RSpec.describe "elelem CLI" do
ROOT = File.expand_path("../..", __dir__)
- # Runs the real binary. chdir controls CWD (where the write tool lands);
- # stdin defaults to /dev/null (a char device => $stdin.stat.pipe? is false, so
- # `ask`/`files` don't block on or mis-read the terminal's stdin).
def elelem(*args, chdir: ROOT, stdin: "/dev/null")
cmd = args.map { Shellwords.escape(_1) }.join(" ")
out = Bundler.with_unbundled_env do
- `cd #{Shellwords.escape(chdir)} && BUNDLE_GEMFILE=#{ROOT}/Gemfile \
- bundle exec #{ROOT}/exe/elelem #{cmd} < #{stdin} 2>&1`
+ `cd #{Shellwords.escape(chdir)} && BUNDLE_GEMFILE=#{ROOT}/Gemfile bundle exec #{ROOT}/exe/elelem #{cmd} < #{stdin} 2>&1`
end
[out, $?.exitstatus]
end
@@ -35,8 +24,6 @@ RSpec.describe "elelem CLI" do
end
it "emits piped files as an XML document index" do
- # Process substitution makes stdin a real pipe, so `files` takes its
- # piped-stdin branch ($stdin.stat.pipe? => true) instead of `git ls-files`.
out, status = elelem("files", stdin: "<(echo README.md)")
expect(out).to include("<documents>")
@@ -60,11 +47,6 @@ RSpec.describe "elelem CLI" do
end
end
- # Driven by the in-process GGUF provider (-p gguf): a real local model loaded
- # inside the elelem process via llama.cpp -- no HTTP server, no subprocess. This
- # is the Rust/GGUF direction, so these are the tests the reimplemented core must
- # still pass. Gated behind EVALS=1; needs the native shim compiled and a model at
- # GGUF_MODEL (see lib/elelem/plugins/gguf.rb).
describe "real local model", :eval do
it "answers a one-shot prompt" do
out, status = elelem("ask", "say hello", "-p", "gguf")
@@ -75,10 +57,7 @@ RSpec.describe "elelem CLI" do
it "runs the write tool through to disk" do
Dir.mktmpdir("elelem-cli-") do |dir|
- out, status = elelem(
- "ask", "create a file named hello.txt containing the word banana", "-p", "gguf",
- chdir: dir
- )
+ out, status = elelem("ask", "create a file named hello.txt containing the word banana", "-p", "gguf", chdir: dir)
target = File.join(dir, "hello.txt")
expect(status).to eq(0), out
spec/evals/support/loop.rb
@@ -16,7 +16,6 @@ module Elelem
def initialize(cases: Case.load_all, champion: CHAMPION, workdir: WORKDIR, improver: Improver.new,
scorer_for: Evals.scorer_for(cases: cases),
out: $stdout, preflight: DEFAULT_PREFLIGHT, budget: BUDGET)
- @cases = cases
@champion = champion
@workdir = workdir
@improver = improver
@@ -127,7 +126,7 @@ module Elelem
end
def record(round:, promoted:, regressions:, applied:, score:, prompt:)
- shown = score.excluding(HOLDOUT)
+ shown = optimizable(score)
write_entry(
round: round,
promoted: promoted,
spec/spec_helper.rb
@@ -2,6 +2,9 @@
require_relative "../lib/elelem"
+require "shellwords"
+require "tmpdir"
+
Dir[File.join(__dir__, "support/**/*.rb")].each { |f| require f }
RSpec.configure do |config|
@@ -10,6 +13,4 @@ RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = :expect
end
-
- config.filter_run_excluding(:eval) unless ENV["EVALS"]
end