tebako-release 0.5.1 → 0.5.3

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: cc98dded830844b0afdda4fdba2ede81155f424bb58eaab89601a9588e0251c2
4
- data.tar.gz: c471ef97c8de46dc8ff5d8dfb5868a20288cf41aace0a91af8d9efbc5dbbfe2a
3
+ metadata.gz: 1b53759a657e4e43faf1ba35f8501d96f9d946f2314ecd281c29e126d9bb2922
4
+ data.tar.gz: 34561554830259839c72191cb3b490b34b09a2a4e948103156001a8222f9359f
5
5
  SHA512:
6
- metadata.gz: 68ba9ef2fde5b4f6fa9522673f2e9480b87fe9ceb2fb6a39a72560bd7511f90c3d3f7e44ac5772fe32aac8c24cdd54205bce2a4e955eb8eb304907cbc9607d84
7
- data.tar.gz: b1e26cefc882eb129067448ce5eb5dd2cd8320675bfd336c49ef17876717b6e59572e4081847f55b4389dc206b3a112752f20efbcab48106de7a37aec9b1ad77
6
+ metadata.gz: 56d98f5d26a5b541e6ae44c9806420708a0ec79f7b088d17fa08cd9472b3b4d99e2d073338ad3760971505076bcd41501517f8a17dc2b835a5ddbf8dee1a6eb3
7
+ data.tar.gz: 418c0e58af44255d25563a9ee866a781cbfe4be44d87f96a0394e04bab7f5c3000af95ddf87fb6d9ceaf7a252dce59b381ce356ff5cfb74eeb1f462cb3fb9b1d
@@ -102,13 +102,20 @@ module TebakoRelease
102
102
 
103
103
  # Class (a): an unconditional call. Rate-limit responses ride out
104
104
  # (never consuming the transient attempts); transport drops retry with
105
- # escalating waits; every other error propagates to the caller's own
106
- # semantics untouched.
105
+ # escalating waits; the gateway trio of 5xx (502/503/504 — GitHub's
106
+ # side failing, the request never wrong) rides the same policy, while
107
+ # every other server error keeps its semantics — a 500 is a bug's
108
+ # signature, not a window's (tebako#1048: a 502 on the audit's asset
109
+ # pagination once failed an otherwise-green publish because ServerError
110
+ # was in no rescue set); every other error propagates to the caller's
111
+ # own semantics untouched.
107
112
  def with_transient_retries(target = "GitHub call", attempts: TRANSIENT_ATTEMPTS) # rubocop:disable Metrics/MethodLength
108
113
  budget = attempts
109
114
  with_rate_limit_rideout(target) do
110
115
  yield
111
- rescue *TRANSIENT_ERRORS => e
116
+ rescue *TRANSIENT_ERRORS, Octokit::ServerError => e
117
+ raise if e.is_a?(Octokit::ServerError) && !transient_server_error?(e)
118
+
112
119
  attempts -= 1
113
120
  raise if attempts <= 0
114
121
 
@@ -119,6 +126,16 @@ module TebakoRelease
119
126
  end
120
127
  end
121
128
 
129
+ # The retryable server class: the gateway trio only. A bare-raised
130
+ # error carries no response — and no claim of transience.
131
+ def transient_server_error?(error)
132
+ return false unless error.is_a?(Octokit::ServerError)
133
+
134
+ [502, 503, 504].include?(error.response_status.to_i)
135
+ rescue NoMethodError
136
+ false
137
+ end
138
+
122
139
  # The quota ride-out, bounded twice (RATE_LIMIT_ATTEMPTS per call,
123
140
  # RATE_LIMIT_BUDGET wall-clock per process). Octokit 7 maps a 403 with
124
141
  # a quota body — primary and secondary limits alike — to
@@ -144,6 +144,7 @@ module TebakoRelease
144
144
  stale = stale_targets(targets, assets)
145
145
  puts "#{@tag}: #{targets.size} signature targets, #{stale.size} need (re)signing"
146
146
  by_name = assets.to_h { |asset| [asset.name, asset] }
147
+ converged = []
147
148
  stale.each do |name|
148
149
  digest = listed_sha(by_name.fetch(name))
149
150
  if digest.empty?
@@ -153,8 +154,9 @@ module TebakoRelease
153
154
  end
154
155
 
155
156
  sign_one(work, key_file, tool, release, name, digest, by_name["#{name}.asc"])
157
+ converged << name
156
158
  end
157
- assert_coverage!(release, targets)
159
+ assert_coverage!(targets, stale, converged)
158
160
  end
159
161
  :signed
160
162
  end
@@ -458,12 +460,20 @@ module TebakoRelease
458
460
  .find { |asset| asset.name == name }
459
461
  end
460
462
 
461
- # The coverage assertion: after the pass, every target has a .asc on
462
- # the release — a partially signed release is a named failure, never a
463
+ # The coverage assertion, without a re-listing (tebako-release#3): a
464
+ # target is covered when its .asc was already fresh at the pass-start
465
+ # listing (not stale) or its upload was converged this pass — and
466
+ # converge_asc proves convergence on the single-asset endpoint with
467
+ # the served digest equal to our bytes, which is exactly the server
468
+ # truth a fresh listing would re-read. The full listing at this point
469
+ # cost ~5 pages per leg at catalog size with nothing to add: legs own
470
+ # disjoint name sets (SIGN_ONLY_STEMS), so no other writer can touch
471
+ # a name this pass covers. The computation stays: a target that is
472
+ # neither fresh-at-start nor converged is a named failure, never a
463
473
  # quiet state.
464
- def assert_coverage!(release, targets)
465
- names = with_transient_retries("release assets") { @client.release_assets(release.url) }.map(&:name)
466
- missing = targets.reject { |name| names.include?("#{name}.asc") }
474
+ def assert_coverage!(targets, stale, converged)
475
+ covered = (targets - stale) | converged
476
+ missing = targets - covered
467
477
  return if missing.empty?
468
478
 
469
479
  raise SigningGateError,
@@ -425,7 +425,46 @@ module TebakoRelease
425
425
  # of burning polls). Creation is write-once, never a wedge.
426
426
  def get_or_create_release # rubocop:disable Naming/AccessorMethodName
427
427
  puts "Looking for release with tag: #{@tag}"
428
- find_release || create_release_race_safe
428
+ release = find_release
429
+ return release if release
430
+
431
+ canonicalize_created_release(create_release_race_safe)
432
+ end
433
+
434
+ # GitHub does not enforce tag_name uniqueness atomically: two
435
+ # concurrent creates can BOTH commit (200, never the loser's 422), and
436
+ # the tag then resolves to one object while the other — same
437
+ # tag_name, different id — stays API-addressable. A leg holding that
438
+ # ghost uploads to it, reports success, and its bytes are unreachable
439
+ # (tebako-release#19: the v0.17.1 publish's seven arm64 assets, found
440
+ # only because another leg's audit named them missing).
441
+ #
442
+ # So a create is never trusted on its own answer: the tag's own
443
+ # resolution is re-read and adopted. The leg then uploads where
444
+ # consumers look, and a duplicate is named with the remedy — it is
445
+ # never deleted here (a delete is the owner's call, and the ghost can
446
+ # only ever hold orphaned bytes).
447
+ def canonicalize_created_release(created)
448
+ canonical = await_tag_resolution
449
+ return canonical if canonical.id == created.id
450
+
451
+ puts "::warning::#{@tag} resolves to release #{canonical.id}, but this leg created #{created.id} — " \
452
+ "a duplicate release object exists for the tag; uploading to #{canonical.id}. " \
453
+ "Delete #{created.id} (it holds no reachable bytes)."
454
+ canonical
455
+ end
456
+
457
+ # The tag's resolution, polled over the release-visibility budget: a
458
+ # create that lands is not instantly readable by tag.
459
+ def await_tag_resolution
460
+ RELEASE_VISIBILITY_DELAYS.each do |pause|
461
+ release = find_release
462
+ return release if release
463
+
464
+ sleep pause
465
+ end
466
+ raise "the release for #{@tag} was created but the tag does not resolve to any release — " \
467
+ "the create's answer and the tag disagree; delete the stray release object and re-run this leg"
429
468
  end
430
469
 
431
470
  # A rescue clause's own exceptions never re-enter the sibling rescues —
@@ -1390,13 +1429,31 @@ module TebakoRelease
1390
1429
  end
1391
1430
 
1392
1431
  # The non-executable artifacts a package is expected to carry: the
1393
- # filesystem image everywhere, the runtime DLL on windows.
1432
+ # filesystem image everywhere, and the runtime DLL on windows WHEN the
1433
+ # factory ships that facet (the ruby/python shape: the exe's imports
1434
+ # resolve against the PE sibling the store materializes). An
1435
+ # exec-cache runtime — the openjdk shape, julia among them — carries
1436
+ # the whole SDK tree (libjulia & co.) in the env image, which the
1437
+ # driver materializes host-side; it declares no DLL install name and
1438
+ # the gate must never demand the facet it never publishes.
1394
1439
  def expected_facets(name)
1395
1440
  facets = ["#{name}.tfs"]
1396
- facets << "#{name}.dll" if name.include?("windows")
1441
+ facets << "#{name}.dll" if name.include?("windows") && dll_facet?(name)
1397
1442
  facets
1398
1443
  end
1399
1444
 
1445
+ # Whether the package owes a windows runtime-DLL facet, per the
1446
+ # adapter's dll_install_name declaration (nil → the runtime ships no
1447
+ # DLL facet). An unparseable name keeps the expectation — the closed
1448
+ # gate: a drifted name grammar must never silently shrink a release's
1449
+ # expected asset set.
1450
+ def dll_facet?(name)
1451
+ version, host_id = parse_package_filename(name)
1452
+ return true if version.nil?
1453
+
1454
+ !@config.adapter.dll_install_name(version, host_id).nil?
1455
+ end
1456
+
1400
1457
  # The metadata a landed package owes: one sidecar per landed asset plus
1401
1458
  # its shard — and, when signatures are required (spec 09 §5: no
1402
1459
  # artifact is ever "covered by" another's signature), one `.asc` per
@@ -1407,11 +1464,13 @@ module TebakoRelease
1407
1464
  expected.reject { |asset| present.include?(asset) }
1408
1465
  end
1409
1466
 
1410
- # The windows legs ship the runtime DLL as a third artifact: a windows
1411
- # executable without its DLL cannot load any native extension, and an
1412
- # unowned DLL means a leg's upload never landed.
1467
+ # The windows legs of a DLL-facet factory (ruby/python) ship the
1468
+ # runtime DLL as a third artifact: a windows executable without its
1469
+ # DLL cannot load any native extension, and an unowned DLL means a
1470
+ # leg's upload never landed. Exec-cache runtimes (the openjdk shape)
1471
+ # declare no facet and are never warned about (dll_facet?).
1413
1472
  def report_dll_gaps(executables, dlls)
1414
- windows = executables.select { |name| name.include?("windows") }
1473
+ windows = executables.select { |name| name.include?("windows") && dll_facet?(name) }
1415
1474
  (windows - dlls).sort.each do |name|
1416
1475
  puts "::warning::Runtime package #{name} has no runtime DLL (#{name}.dll); " \
1417
1476
  "the windows runtime cannot load native extensions without it"
@@ -5,5 +5,5 @@
5
5
  # This file is a part of tamatebako
6
6
 
7
7
  module TebakoRelease
8
- VERSION = "0.5.1"
8
+ VERSION = "0.5.3"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tebako-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc
@@ -9,6 +9,20 @@ bindir: exe
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: base64
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: octokit
14
28
  requirement: !ruby/object:Gem::Requirement