Skip to content

Commit 10cd4cd

Browse files
committed
fix(ml): provisioning writes user-local interscript-ml paths; secryst path kept as legacy fallback
1 parent d46ff62 commit 10cd4cd

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎lib/interscript/ml/provisioning.rb‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ def prepare_environment
2727
# we use it to store the Secryst data we need. Otherwise, we try the following
2828
# paths:
2929

30-
possible_paths = [
31-
"/var/lib/secryst",
32-
"/usr/local/share/secryst",
33-
"/usr/share/secryst",
34-
File.join(Dir.home, ".local/share/secryst")
35-
]
30+
possible_paths = candidate_paths
3631

3732
# We find the first writable path to become the primary one. The remaining
3833
# ones will be used read-only if they exist
@@ -95,6 +90,13 @@ def prepare_environment
9590
@preload_models.each { |i| locate(i) }
9691
end
9792

93+
def self.candidate_paths
94+
[
95+
File.join(Dir.home, ".local/share/interscript-ml"),
96+
File.join(Dir.home, ".local/share/secryst") # legacy fallback
97+
]
98+
end
99+
98100
def locate(name)
99101
# Shortcut this if user gave a filename.
100102
return name if name =~ %r{[.\\/]}

‎spec/stdlib_functions_spec.rb‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,14 @@
9393
expect(described_class.name).to eq("Interscript::Stdlib::Functions::SecrystAdapter")
9494
end
9595
end
96+
97+
RSpec.describe Interscript::ML::Provisioning do
98+
describe "candidate paths" do
99+
it "prefers interscript-ml locations, keeping secryst paths as legacy fallbacks" do
100+
paths = described_class.candidate_paths
101+
expect(paths.first).to eq(File.join(Dir.home, ".local/share/interscript-ml"))
102+
expect(paths).to include(File.join(Dir.home, ".local/share/secryst"))
103+
expect(paths.join(" ")).not_to match(%r{/var/lib/secryst})
104+
end
105+
end
106+
end

0 commit comments

Comments
 (0)