telegram-support-bot 0.1.14 → 0.1.16

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: 1aa04c608a30e8eb69bd222ab37e804224d4850472bc183d52dee74b397557c1
4
- data.tar.gz: a84baa26e47cb70191bc6b5736e86de0187efc799f1735b47b31114c03d7066d
3
+ metadata.gz: fa277fa81bc6ee057b77777a2d95810f824d31ef6b7d059c27ba421bd83848a7
4
+ data.tar.gz: 4d50ba56cd4b32172171a2de94277be16efa3be397176b2e0206b7107c60cf9e
5
5
  SHA512:
6
- metadata.gz: a4e14a5cc0d07a7f05764eaf0577eb965ef9db5e86e276d74196ed3e08c9f0956315e0bec3e9b5b5b2ec1b94f7429186e299b16a80473fff24731122ba481263
7
- data.tar.gz: b875c18abaef4ad4dc5ce57d2e94635f354ca3e69d055fc2e9a0f8bdf626527dcd3ba16a021decd58d30746d0dfc7900f21aff707223955ccba8661d051ddb36
6
+ metadata.gz: 6002edf0a9948bd06c6ca3447e0fb632cef101b117bbb2d840ab6fbf56f5976cf42548101da13d628e5d1c6e20ca90e2692c778c4c855d8b577de4e5df2cc05f
7
+ data.tar.gz: fe7f510f82589e03f9b523d2c22abd0ae06c08f04cc1bfae8bbf25d16ce45a1d0d3edeae2cfabb86eee3ad6f33a91b0d214f774ada6dc04fccbebbe566c927c0
data/CHANGELOG.md CHANGED
@@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
- ## [0.1.14] - 2026-02-26
7
+ ## [0.1.16] - 2026-02-26
8
+
9
+ ### Fixed
10
+ - Simplified dedup marker evaluation to strict boolean/hash semantics and removed permissive fallback coercion.
11
+ - Dedup marker read/write failures now fail open (warn and continue) instead of breaking webhook update processing.
12
+
13
+ ## [0.1.15] - 2026-02-26
8
14
 
9
15
  ### Added
10
16
  - Optional `forward_start_to_support` configuration to forward the first user `/start`
@@ -15,6 +21,8 @@ All notable changes to this project will be documented in this file.
15
21
  ### Fixed
16
22
  - Initial `/start` forwarding is now fail-safe: errors in forwarding/persisting first-message
17
23
  marker no longer crash update processing and block subsequent updates.
24
+ - Redis-backed marker storage for update/start dedup now writes JSON objects (not scalar booleans),
25
+ fixing `JSON::GeneratorError: only generation of JSON objects or arrays allowed` on stricter runtimes.
18
26
 
19
27
  ## [0.1.12] - 2026-02-26
20
28
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TelegramSupportBot
4
- VERSION = "0.1.14"
4
+ VERSION = "0.1.16"
5
5
  end
@@ -526,31 +526,60 @@ module TelegramSupportBot
526
526
  return unless should_forward_start_to_support?(chat_id)
527
527
  return unless forward_message_to_support_chat(message, chat_id: chat_id)
528
528
 
529
- start_forwarded_users[chat_id] = true
529
+ start_forwarded_users[chat_id] = start_forwarded_marker_value
530
530
  rescue StandardError => error
531
531
  warn_start_forwarding_failure(chat_id: chat_id, message_id: message['message_id'], error: error)
532
532
  end
533
533
 
534
534
  def start_forwarded_to_support?(chat_id)
535
- !start_forwarded_users[chat_id].nil?
535
+ marker_enabled?(start_forwarded_users[chat_id])
536
536
  end
537
537
 
538
538
  def duplicate_update?(update_id)
539
539
  return false if update_id.nil?
540
540
 
541
- !processed_updates[update_id].nil?
541
+ marker_enabled?(processed_updates[update_id])
542
+ rescue StandardError => error
543
+ warn_processed_update_marker_read_failure(update_id: update_id, error: error)
544
+ false
542
545
  end
543
546
 
544
547
  def mark_update_as_processed(update_id)
545
548
  return if update_id.nil?
546
549
 
547
- processed_updates[update_id] = true
550
+ processed_updates[update_id] = processed_update_marker_value
551
+ rescue StandardError => error
552
+ warn_processed_update_marker_write_failure(update_id: update_id, error: error)
553
+ end
554
+
555
+ def marker_enabled?(value)
556
+ return true if value == true
557
+ return false if value.nil? || value == false
558
+ return marker_enabled?(value[:present] || value['present']) if value.is_a?(Hash)
559
+
560
+ false
561
+ end
562
+
563
+ def start_forwarded_marker_value
564
+ { present: true }
565
+ end
566
+
567
+ def processed_update_marker_value
568
+ { present: true }
548
569
  end
549
570
 
550
571
  def warn_start_forwarding_failure(chat_id:, message_id:, error:)
551
572
  warn "Failed to forward initial /start for chat_id=#{chat_id} message_id=#{message_id}: #{error.class}: #{error.message}"
552
573
  end
553
574
 
575
+ def warn_processed_update_marker_read_failure(update_id:, error:)
576
+ warn "Failed to read processed update marker for update_id=#{update_id}: #{error.class}: #{error.message}"
577
+ end
578
+
579
+ def warn_processed_update_marker_write_failure(update_id:, error:)
580
+ warn "Failed to persist processed update marker for update_id=#{update_id}: #{error.class}: #{error.message}"
581
+ end
582
+
554
583
  def contact_known_for_user?(chat_id)
555
584
  !user_profile(chat_id).nil?
556
585
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram-support-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Buslaev