omq-cli 0.14.2 → 0.14.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: 23eb8d602298e5db1259e6d7d0effe08e8e0dfacba55b8d9a5287800290f2eb9
4
- data.tar.gz: b492d78fd4997c82434853bc284f7f98c662d905a450e3545c1df2ae822bf40c
3
+ metadata.gz: a207b74cefe2b70d8f5910610be8ef955a2d466ae78e3b620860a5425361af8b
4
+ data.tar.gz: 7a15e05713459c741f2d780c89057bbfee435e63767464245041bcdfe5b31c59
5
5
  SHA512:
6
- metadata.gz: a3abd80d9856c52e2674c86a3e31ed4f02d6511cad2e3d9f35a2ab5b65faaf07acdc4c442f3746bc5ed0dd56e730df0fabc4930c0cdfe05ad8e289335fc0e8d4
7
- data.tar.gz: 98e5cf25c2e267aace41bb958843459ead62da2a338b8a64aa3f6fc3af571dfefaee30b01a0de720b8880a96c6c0c3b55fe7a8439a6b5151a54085233ded3aaa
6
+ metadata.gz: d38d7f5548147b2b5a4fdfe391180b29dba07975fe8fbd391586eaf580d739f66c05f66e0fbc488e976d47afaabbced2322940d39c1b783ed4c5636e5ce4d194
7
+ data.tar.gz: 301999bb8145e49e39d28f77dc75a71d22ead3ad3c01ebe85e809a73b2cc8baf3a59e980361dd43319d2c7d5be90ff7f22f74370ad89f7a53ae85e77e09634d9
data/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.14.3 — 2026-04-14
4
+
5
+ ### Fixed
6
+
7
+ - **`omq req` (and other interactive senders) no longer wedge on
8
+ blank input lines.** `Formatter#decode` used to return `[]` for
9
+ a blank line, which `BaseRunner#send_msg` then silently dropped
10
+ — so REQ never sent a request but still blocked in `recv_msg`
11
+ waiting for a reply. Blank lines now decode to a single empty
12
+ frame (`[""]`) via the new
13
+ `Formatter::EMPTY_MSG = [Protocol::ZMTP::Codec::EMPTY_BINARY]`
14
+ constant, so the request actually goes out. As a side effect,
15
+ ascii/quoted decoding now uses `split("\t", -1)` and preserves
16
+ trailing empty frames (`"a\t\n"` → `["a", ""]`).
17
+ - **Cleaner `:disconnected` log lines on plain peer close.**
18
+ `-vv` used to emit `omq: disconnected tcp://… (Stream finished
19
+ before reading enough data!)` — the raw io-stream message for
20
+ what is really just an `EOFError` at the ZMTP framing boundary.
21
+ `Term.format_event` now routes through a new
22
+ `Term.format_event_detail` helper that rewrites `EOFError` to
23
+ `(closed by peer)`, leaving other errors' messages untouched.
24
+ The underlying `event.detail[:error]` is unchanged.
25
+
26
+ ### Changed
27
+
28
+ - **Lowercased `Term.format_attach` verbs.** `omq: Bound to …` /
29
+ `omq: Connecting to …` now render as `omq: bound to …` /
30
+ `omq: connecting to …`, matching the lowercase style already
31
+ used by every other `omq:` log line (`disconnected`, `listening`,
32
+ `handshake_succeeded`, …).
33
+
3
34
  ## 0.14.2 — 2026-04-13
4
35
 
5
36
  ### Changed
@@ -7,6 +7,10 @@ module OMQ
7
7
  # (omq-rfc-zstd) once enabled via +socket.compression=+; the
8
8
  # formatter sees plaintext frames in both directions.
9
9
  class Formatter
10
+ # Single empty frame — used as the decoded form of a blank input line.
11
+ EMPTY_MSG = [::Protocol::ZMTP::Codec::EMPTY_BINARY].freeze
12
+
13
+
10
14
  # @param format [Symbol] wire format (:ascii, :quoted, :raw, :jsonl, :msgpack, :marshal)
11
15
  def initialize(format)
12
16
  @format = format
@@ -45,9 +49,11 @@ module OMQ
45
49
  def decode(line)
46
50
  case @format
47
51
  when :ascii, :marshal
48
- line.chomp.split("\t")
52
+ parts = line.chomp.split("\t", -1)
53
+ parts.empty? ? EMPTY_MSG : parts
49
54
  when :quoted
50
- line.chomp.split("\t").map { |p| "\"#{p}\"".undump }
55
+ parts = line.chomp.split("\t", -1).map { |p| "\"#{p}\"".undump }
56
+ parts.empty? ? EMPTY_MSG : parts
51
57
  when :raw
52
58
  [line]
53
59
  when :jsonl
data/lib/omq/cli/term.rb CHANGED
@@ -49,27 +49,46 @@ module OMQ
49
49
  "#{prefix}omq: << ZDICT (#{event.detail[:size]}B)"
50
50
  else
51
51
  ep = event.endpoint ? " #{event.endpoint}" : ""
52
- detail =
53
- if event.detail.is_a?(Hash) && event.detail[:reason]
54
- " (#{event.detail[:reason]})"
55
- elsif event.detail
56
- " #{event.detail}"
57
- else
58
- ""
59
- end
52
+ detail = format_event_detail(event.detail)
60
53
  "#{prefix}omq: #{event.type}#{ep}#{detail}"
61
54
  end
62
55
  end
63
56
 
64
57
 
65
- # Formats an "attached endpoint" log line (Bound to / Connecting to).
58
+ # Renders +MonitorEvent#detail+ as a " (...)" suffix for log lines.
59
+ # Rewrites plain peer-close exceptions (EOFError) to "closed by
60
+ # peer" — the io-stream library reports these as "Stream finished
61
+ # before reading enough data!", which is confusing noise for what
62
+ # is just a normal disconnect.
63
+ #
64
+ # @param detail [Hash, Object, nil]
65
+ # @return [String]
66
+ def format_event_detail(detail)
67
+ return "" if detail.nil?
68
+ return " #{detail}" unless detail.is_a?(Hash)
69
+
70
+ error = detail[:error]
71
+ reason = detail[:reason]
72
+
73
+ case error
74
+ when nil
75
+ reason ? " (#{reason})" : ""
76
+ when EOFError
77
+ " (closed by peer)"
78
+ else
79
+ " (#{reason || error.message})"
80
+ end
81
+ end
82
+
83
+
84
+ # Formats an "attached endpoint" log line (bound to / connecting to).
66
85
  #
67
86
  # @param kind [:bind, :connect]
68
87
  # @param url [String]
69
88
  # @param timestamps [Symbol, nil]
70
89
  # @return [String]
71
90
  def format_attach(kind, url, timestamps)
72
- verb = kind == :bind ? "Bound to" : "Connecting to"
91
+ verb = kind == :bind ? "bound to" : "connecting to"
73
92
  "#{log_prefix(timestamps)}omq: #{verb} #{url}"
74
93
  end
75
94
 
@@ -85,7 +104,7 @@ module OMQ
85
104
  end
86
105
 
87
106
 
88
- # Writes one "Bound to / Connecting to" line to +io+
107
+ # Writes one "bound to / connecting to" line to +io+
89
108
  # (default $stderr).
90
109
  #
91
110
  # @param kind [:bind, :connect]
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OMQ
4
4
  module CLI
5
- VERSION = "0.14.2"
5
+ VERSION = "0.14.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger