fast-completions 0.4.0 → 0.4.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: 5741f8a7684abbb66479904f8b49d14afebfd783cf3069e2e2c91717a0765238
4
- data.tar.gz: 1a20474b48f9278d815b1561101a34cc229ac37c1cfcaeb83ffe9f1ba5bbcf9a
3
+ metadata.gz: 826572d669198677861fb62faea347d0e74bf99ca3ba39d2e899a159161e762b
4
+ data.tar.gz: 4e5d12637cc2b273596a38d7cdd39b50ee5f2018a3ba0c18e2c4001a88c32e22
5
5
  SHA512:
6
- metadata.gz: bae0596f622cdee7289c271939aca77dc8e10d539aeed94b8c18388ad445957db4b19beb45a6359da7c971d3173d24e42ca917720499cfd081b398fd4e70f3ec
7
- data.tar.gz: 30d7cc0ac12964163ca196e3e6a87e2e9e150de3db334ad342d55d923b55f0c522073108def6618c727a78593c5fb5d67f90d2e6d3267e794753575d9ab36bfe
6
+ metadata.gz: 7dde6dc44db9e1993071f6f494a743dad1e89990c67c6b2beeef61638e28cc57aff5af2026b66a42209d4eb27ee8c4848eec559593fbcdcbab1938bf5251d8fc
7
+ data.tar.gz: '09c28b1d9d980d29abd13a670feba40ec60fb79f3c65246251bc3b1ac042e3ae093728cf3fd2affbadfc09799c97f1f9f4fe59657c535b2376c2eeb0523a024a'
data/CHANGELOG.md CHANGED
@@ -3,6 +3,31 @@
3
3
  Notable changes to the fast-completions gem. The format is prose-first,
4
4
  one section per released version, newest first.
5
5
 
6
+ ## 0.4.1 (2026-10-16)
7
+
8
+ - Fix a mid-stream crash in the tool-call live-parse (regression against
9
+ pi, found live on zai/glm-5.3): when a delta boundary split an escape
10
+ sequence, the arguments scratch buffer ended mid-string with a lone
11
+ trailing backslash; `repair_json` doubled it (repaired != partial) and
12
+ the re-parse of the still-unterminated string raised `JSON::ParserError`
13
+ — uncaught, because Ruby rescue clauses do not cascade (an exception
14
+ raised in one rescue body is not handled by the next rescue clause of
15
+ the same method). The repaired re-parse now gets its own rescue (the
16
+ same lesson `Client#parse_repaired` already had), returning `{}` as the
17
+ last resort — pi's `parseStreamingJson` wraps the repair path in a
18
+ try/catch and always returns a valid object; the port dropped that
19
+ outer catch.
20
+ - Bench harness (perf-baseline): `gems/completions/bench/` ships four
21
+ deterministic, network-free, stdlib-only benchmark scripts over the hot
22
+ paths (text-heavy SSE+protocol stream; tool-args-heavy stream through the
23
+ O(n²) per-delta live re-parse; Codec normalize → to_wire round-trip;
24
+ strict-schema rewrite) and compare_refs.rb, which measures v0.2.0 →
25
+ v0.3.0 → v0.4.0 → 0.4.1 through temporary read-only worktrees and writes
26
+ bench/BASELINE.md — per-path × ref medians, consecutive-release deltas,
27
+ and per-pair verdicts against frozen per-op floors. No behavior changes;
28
+ the capture is single-machine, and future runs compare against the
29
+ floors, never the cells.
30
+
6
31
  ## 0.4.0 (2026-10-14)
7
32
 
8
33
  - Strict-sampling tool schemas (pi constrained-sampling, JSON-schema half):
@@ -210,14 +210,24 @@ module Fast
210
210
  end
211
211
 
212
212
  # OQ-4: control-character repair (pi utils/json-parse.ts repairJson
213
- # :20-77), {} as the last resort (pi's partial-json fallback).
213
+ # :20-77), {} as the last resort (pi's partial-json fallback). The
214
+ # repaired re-parse gets its OWN method — a rescue body's exception
215
+ # is not caught by a later rescue clause of the same method (the
216
+ # 0.4.0 leak: a delta boundary splitting an escape sequence left the
217
+ # scratch buffer mid-string with a trailing backslash; repair "fixed"
218
+ # it, the re-parse raised, and the step died). pi's outer try/catch
219
+ # absorbs this; so do we.
214
220
  def parse_streaming_json(partial)
215
221
  return {} if partial.nil? || partial.strip.empty?
216
222
 
217
223
  JSON.parse(partial)
218
224
  rescue JSON::ParserError
219
225
  repaired = repair_json(partial)
220
- repaired == partial ? {} : JSON.parse(repaired)
226
+ repaired == partial ? {} : parse_repaired_json(repaired)
227
+ end
228
+
229
+ def parse_repaired_json(repaired)
230
+ JSON.parse(repaired)
221
231
  rescue JSON::ParserError
222
232
  {}
223
233
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Fast
4
4
  module Completions
5
- VERSION = "0.4.0"
5
+ VERSION = "0.4.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast-completions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Jacobs