runtime_analysis 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4f871284e8d1fdb22c45994b2de0243b87c28c4a84913c0dfd4fb7b103fb841
4
- data.tar.gz: 2804cb59aebc02f3e7cc97983819756fcf8e7ed1a7d8f40c69fb7a4737d81256
3
+ metadata.gz: 012254c21b3c3e0e794e1854dac060caa2b1171fa6ef3744607f5305467210d9
4
+ data.tar.gz: 87b07a6a764d385707d969e73616442f3f3d7506b025424c570114c8276c8693
5
5
  SHA512:
6
- metadata.gz: b6df13fb8a3b3a392e27256094cbe614eeab1f7a7f13fac461faf9737ab6ee46069f28bbd0db4337a1ae8259279006655cb3933802000ac6a31ff1b6f518682f
7
- data.tar.gz: 7f22714d8a25796a365bfc7d7b0319e5630ba2dcb9be53b329ef8ad6b99c4252ed748f4ed4cd30348f528d2646fdc0541e36b605c09b95e95a55ed5ab9db1ef7
6
+ metadata.gz: cfa168052ff7f753f3c2e4acb5f756f004ef24108005dd7270fe4ffa393fb80a804003743b4d5049d32aea7d92d2079269ea5b4a30484cd56366eef7277b3213
7
+ data.tar.gz: 4aaa15fda0ac8699946588b9a22989612c7e5798d598dcbe819e49d5cda2d559d32d3ff976344560fa2b6c4ed3261974a91f5a4a40df73b3559578613790f23d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [1.0.1] - 2026-12-06
2
+
3
+ - Pin a run's files with the hash its repository uses. A run records each file it wrapped a method in by its git blob id, and the tools read an older version of a file back from git by that id. The id was always SHA-1, so in a repository that hashes with SHA-256 git found none of them and every older version read as never stored. The recorder now hashes as the run's repository does, which the length of the run's commit id says, and with no commit it is SHA-1 as before. A recording made before this compares as it did
4
+ - Pass the specs on Ruby 3.2 and 3.3. The JSON report's spec compared text, and the json those Rubies ship lays out an empty array across lines. The gem's output was right; the spec now checks what the JSON says and how it is indented
5
+
1
6
  ## [1.0.0] - 2026-11-28
2
7
 
3
8
  - Install on JRuby and TruffleRuby. `gem install` ran the extension's build on every Ruby, and on JRuby it failed there with mkmf's "Could not create Makefile". The build now does nothing on a Ruby that is not CRuby, which records with `config.mechanism = :pure` as before. RubyGems still runs `make` there, so the machine needs one. `ra` and `RUNTIME_ANALYSIS_ROOT` no longer ask for the C wrapper when `RUNTIME_ANALYSIS_MECHANISM` is unset, so they record on those Rubies too, and asking for the extension where there is none says to use `:pure` instead of to build it
@@ -7,7 +7,11 @@ module RuntimeAnalysis
7
7
  module Blob
8
8
  module_function
9
9
 
10
- def id(content) = Digest::SHA1.hexdigest("blob #{content.bytesize}\0#{content}")
10
+ SHA256_ID_LENGTH = 64
11
+
12
+ def id(content, like: nil) = algorithm_of(like).hexdigest("blob #{content.bytesize}\0#{content}")
13
+
14
+ def algorithm_of(repository_id) = repository_id.to_s.length == SHA256_ID_LENGTH ? Digest::SHA256 : Digest::SHA1
11
15
  end
12
16
  end
13
17
  end
@@ -50,7 +50,7 @@ module RuntimeAnalysis
50
50
  end
51
51
 
52
52
  def pin(config, files, pid: Process.pid)
53
- add(config, pid, "sources" => blobs(files))
53
+ change(config, pid) { |said| { "sources" => blobs(files, said["git_sha"]) } }
54
54
  end
55
55
 
56
56
  def seen(config, tally, pid: Process.pid, now: Time.now)
@@ -61,9 +61,12 @@ module RuntimeAnalysis
61
61
  add(config, pid, "never_wrapped" => { "count" => methods.size, "methods" => methods.first(LISTED) })
62
62
  end
63
63
 
64
- def add(config, pid, fields)
64
+ def add(config, pid, fields) = change(config, pid) { fields }
65
+
66
+ def change(config, pid)
65
67
  file = path(config.recording_dir, pid)
66
- replace(file, JSON.generate(said(config, file, pid).merge(fields)))
68
+ said = said(config, file, pid)
69
+ replace(file, JSON.generate(said.merge(yield(said))))
67
70
  rescue SystemCallError, Errors.unreadable_json
68
71
  nil
69
72
  end
@@ -79,8 +82,8 @@ module RuntimeAnalysis
79
82
  File.rename("#{file}.new", file)
80
83
  end
81
84
 
82
- def blobs(files)
83
- files.filter_map { |source| (blob = SourceBlob.of(source)) && [source, blob] }
85
+ def blobs(files, commit)
86
+ files.filter_map { |source| (blob = SourceBlob.of(source, like: commit)) && [source, blob] }
84
87
  end
85
88
 
86
89
  def run(**fields) = Run.new(**fields)
@@ -9,9 +9,9 @@ module RuntimeAnalysis
9
9
  module SourceBlob
10
10
  module_function
11
11
 
12
- def of(path)
12
+ def of(path, like:)
13
13
  content = File.binread(path)
14
- Blob.id(content)
14
+ Blob.id(content, like: like)
15
15
  rescue SystemCallError
16
16
  nil
17
17
  end
@@ -45,7 +45,7 @@ module RuntimeAnalysis
45
45
 
46
46
  def format_header = Format.header
47
47
 
48
- def blob_id(content) = Blob.id(content)
48
+ def blob_id(content, like: nil) = Blob.id(content, like: like)
49
49
 
50
50
  def raise_ids = RaiseIds
51
51
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # no-unit-test: version constant, asserted via spec/runtime_analysis_spec.rb
4
4
  module RuntimeAnalysis
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runtime_analysis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Runtime Analysis
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-12-06 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: prism