legion-apollo 0.5.2 → 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: 9320cef3392467f9819e47c9cacc3893f45ffab9570825cb5d6b270ff3ce6a67
4
- data.tar.gz: d38343aa96c9ba0b1d634f6e4d3850e22c899fe81c13550dce19809cec290a94
3
+ metadata.gz: a45052ee6c52f3642d1247538a691ace760e67bb5ec35f59fab03f42f95e8768
4
+ data.tar.gz: 7adc4eba3d571ef523c0588be61179e27b519b4f0f5ec620e06b9253004468a5
5
5
  SHA512:
6
- metadata.gz: 2dcaf3fc8fbf087b8e59c079e71921aebf8c53620e32d9cd8939a00981474747b78e978412d28a5c3ff4f204df01b9538f23a81c82a76a0d94afab8080219e46
7
- data.tar.gz: 8d078c7e1c727bd23b08bfdb09af0abe7581296132d715b7ed7c4c5205d4645c004f1f980af6546239961c6649e9433e66a725341e2275e3cdb2e1de7f1687a3
6
+ metadata.gz: 37c9de5b076d469c36f43a3cb55e608a053c146e97e9da63b5b4009772943adecff5f56ce6e416d105c52664c2616346a25cf6f2857c42b561ef84b5a95a007c
7
+ data.tar.gz: d4e73cf548045b9fce1b6713aaeb0e0abaca29757534feaf484f62300ec2c80eed16a2a514d9388fa80fde9ada1d5321f97dad8904d4fc9864f81c6d0efe2a31
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.3] - 2026-04-27
4
+
5
+ ### Fixed
6
+ - Preserve temporal validity windows when promoting local knowledge to global Apollo.
7
+ - Treat nil or blank `raw_content` as absent so indexed content remains the raw-content fallback.
8
+ - Ignore unparseable temporal inputs instead of storing arbitrary strings that break lexical validity comparisons.
9
+
3
10
  ## [0.5.2] - 2026-04-27
4
11
 
5
12
  ### Added
@@ -205,6 +205,8 @@ module Legion
205
205
  result = Legion::Apollo.ingest(
206
206
  content: entry[:content],
207
207
  raw_content: entry[:raw_content] || entry[:content],
208
+ valid_from: entry[:valid_from],
209
+ valid_to: entry[:valid_to],
208
210
  tags: entry_tags + ['promoted_from_local'],
209
211
  source_channel: 'local_promotion',
210
212
  submitted_by: "node:#{hostname}",
@@ -437,7 +439,7 @@ module Legion
437
439
 
438
440
  def ingest_without_lock(content:, tags:, **opts) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
439
441
  content = normalize_text_input(content)
440
- raw_content = normalize_text_input(opts.key?(:raw_content) ? opts[:raw_content] : content)
442
+ raw_content = normalize_raw_content_input(opts[:raw_content], fallback: content)
441
443
  hash = content_hash(content)
442
444
  return deduplicated_ingest(hash) if duplicate?(hash)
443
445
 
@@ -760,7 +762,16 @@ module Legion
760
762
 
761
763
  Time.parse(text).utc.strftime('%Y-%m-%dT%H:%M:%S.%LZ')
762
764
  rescue StandardError
763
- text
765
+ nil
766
+ end
767
+
768
+ def normalize_raw_content_input(value, fallback:)
769
+ if defined?(Legion::Apollo) && Legion::Apollo.respond_to?(:normalize_raw_content_input, true)
770
+ return Legion::Apollo.send(:normalize_raw_content_input, value, fallback: fallback)
771
+ end
772
+
773
+ normalized = normalize_text_input(value)
774
+ normalized.strip.empty? ? fallback : normalized
764
775
  end
765
776
 
766
777
  def normalize_tags_input(tags)
@@ -87,9 +87,8 @@ module Legion
87
87
  # TagNormalizer hard-caps to MAX_TAGS=20 internally; clamp here to make that limit explicit.
88
88
  effective_max_tags = [max_tags, Legion::Apollo::Helpers::TagNormalizer::MAX_TAGS].min
89
89
  tags = Legion::Apollo::Helpers::TagNormalizer.normalize(Array(body[:tags])).first(effective_max_tags)
90
- result = Legion::Apollo.ingest(
90
+ ingest_payload = {
91
91
  content: body[:content],
92
- raw_content: body[:raw_content],
93
92
  content_type: body[:content_type] || :observation,
94
93
  tags: tags,
95
94
  source_agent: body[:source_agent] || 'api',
@@ -109,7 +108,10 @@ module Legion
109
108
  source_hash: body[:source_hash],
110
109
  relevance_score: body[:relevance_score],
111
110
  extraction_method: body[:extraction_method]
112
- )
111
+ }
112
+ raw_content = body[:raw_content].to_s
113
+ ingest_payload[:raw_content] = body[:raw_content] unless raw_content.strip.empty?
114
+ result = Legion::Apollo.ingest(**ingest_payload)
113
115
  json_response(result, status_code: apollo_status_code(result, success_status: 201))
114
116
  end
115
117
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Legion
4
4
  module Apollo
5
- VERSION = '0.5.2'
5
+ VERSION = '0.5.3'
6
6
  end
7
7
  end
data/lib/legion/apollo.rb CHANGED
@@ -98,7 +98,7 @@ module Legion
98
98
 
99
99
  normalized_tags = normalize_tags_input(tags)
100
100
  normalized_content = normalize_text_input(content)
101
- normalized_raw_content = normalize_text_input(opts.key?(:raw_content) ? opts[:raw_content] : content)
101
+ normalized_raw_content = normalize_raw_content_input(opts[:raw_content], fallback: normalized_content)
102
102
  payload = { **opts, content: normalized_content, raw_content: normalized_raw_content, tags: normalized_tags }
103
103
  log.info do
104
104
  "Apollo ingest requested scope=#{scope} content_length=#{payload[:content].to_s.length} " \
@@ -509,6 +509,11 @@ module Legion
509
509
  text.delete("\u0000")
510
510
  end
511
511
 
512
+ def normalize_raw_content_input(value, fallback:)
513
+ normalized = normalize_text_input(value)
514
+ normalized.strip.empty? ? fallback : normalized
515
+ end
516
+
512
517
  def normalize_tags_input(tags)
513
518
  Legion::Apollo::Helpers::TagNormalizer.normalize(Array(tags)).first(apollo_max_tags)
514
519
  rescue StandardError => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legion-apollo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity