mcp_authorization 0.6.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/mcp_authorization/rbs_schema_compiler.rb +26 -8
- data/lib/mcp_authorization/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d09c532c9c775775e5b5dbea5d44df18cb9a693212641fff9b86621101806e4a
|
|
4
|
+
data.tar.gz: 18c5e6cc485efd2e73265e22d4ab037f3b21d32f72c377285794a644c8d4a225
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 27959d3f62484456e2e6978f51cef90d8879584a978c4f4937e52fa599451c01ad41cfea2cb79607726ab2dcba166f50917c46b0bc0057639d1fba5aa4b4a249
|
|
7
|
+
data.tar.gz: cbdc8f8187594e942afc039248a8f8db638325b33f257972d85e5d8cbb62ec8d64f6e9f57b8e1ca022f9e1cbae1f7a0d590fa3cb5ea5784ad9cb87e20072e20a
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,11 @@ All notable changes to this gem are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and this project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.6.1] - 2026-07-01
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **Single-line string-literal-union type aliases (e.g. `type logic = "AND" | "OR"`) lost every member after the first.** Both the `# @rbs type` inline-comment parser and the shared `sig/shared/*.rbs` file parser only scanned *subsequent lines* for `| "value"` continuations, so a union written entirely on one line — the common shape for short enums like `"AND" | "OR"` — resolved to `{type: "string", enum: ["AND"]}` instead of `["AND", "OR"]`. Multi-line unions (`"low"\n| "medium"\n| "high"`) were unaffected. Literal unions written directly inline on a record field (not behind a named alias) were also unaffected, since those go through the RBS-parser union visitor rather than the alias collector.
|
|
11
|
+
|
|
7
12
|
## [0.6.0] - 2026-06-25
|
|
8
13
|
|
|
9
14
|
Per-request work is now scoped to what each MCP method needs, and the
|
|
@@ -1364,7 +1364,7 @@ module McpAuthorization
|
|
|
1364
1364
|
current_name = $1.to_s
|
|
1365
1365
|
current_base = nil
|
|
1366
1366
|
current_body = "{"
|
|
1367
|
-
elsif stripped =~ /\Atype (\w+) = "([^"]
|
|
1367
|
+
elsif stripped =~ /\Atype (\w+) = ("[^"]*"(?:\s*\|\s*"[^"]*")*)/
|
|
1368
1368
|
aliases[$1.to_s] = parse_rbs_string_union($2.to_s, line, content)
|
|
1369
1369
|
elsif current_name
|
|
1370
1370
|
current_body << strip_rbs_comment(stripped)
|
|
@@ -1380,15 +1380,24 @@ module McpAuthorization
|
|
|
1380
1380
|
aliases
|
|
1381
1381
|
end
|
|
1382
1382
|
|
|
1383
|
-
# Parse a
|
|
1383
|
+
# Parse a string literal union from an .rbs file, either written on
|
|
1384
|
+
# one line:
|
|
1385
|
+
# type logic = "AND" | "OR"
|
|
1386
|
+
# or continued across multiple lines:
|
|
1384
1387
|
# type priority = "low"
|
|
1385
1388
|
# | "medium"
|
|
1386
1389
|
# | "high"
|
|
1387
1390
|
#
|
|
1391
|
+
# +first_segment+ is everything captured after the +=+ on the
|
|
1392
|
+
# opening line, which may itself already contain the full
|
|
1393
|
+
# +"a" | "b" | "c"+ union — a single-line union has no continuation
|
|
1394
|
+
# lines, so capturing only its first quoted literal (the prior
|
|
1395
|
+
# behavior) silently dropped every member after the first.
|
|
1396
|
+
#
|
|
1388
1397
|
# @return [Hash] +{type: "string", enum: ["low", "medium", "high"]}+
|
|
1389
1398
|
#: (String, String, String) -> Hash[Symbol, untyped]
|
|
1390
|
-
def parse_rbs_string_union(
|
|
1391
|
-
values = [
|
|
1399
|
+
def parse_rbs_string_union(first_segment, line, content)
|
|
1400
|
+
values = first_segment.scan(/"([^"]*)"/).flatten
|
|
1392
1401
|
content.each_line.drop_while { |l| l != line }.drop(1).each do |next_line|
|
|
1393
1402
|
if next_line =~ /^\s*\|\s*"([^"]+)"/
|
|
1394
1403
|
values << $1.to_s
|
|
@@ -1491,7 +1500,7 @@ module McpAuthorization
|
|
|
1491
1500
|
current_name = nil
|
|
1492
1501
|
current_body = +""
|
|
1493
1502
|
end
|
|
1494
|
-
elsif line =~ /#\s*@rbs type (\w+)\s*=\s*"([^"]
|
|
1503
|
+
elsif line =~ /#\s*@rbs type (\w+)\s*=\s*("[^"]*"(?:\s*\|\s*"[^"]*")*)/
|
|
1495
1504
|
aliases[$1.to_s] = parse_string_union($2.to_s, line, content)
|
|
1496
1505
|
elsif current_name
|
|
1497
1506
|
stripped = strip_rbs_comment(line.strip.sub(/^#\s*/, ""))
|
|
@@ -1961,15 +1970,24 @@ module McpAuthorization
|
|
|
1961
1970
|
str.count("{") == str.count("}")
|
|
1962
1971
|
end
|
|
1963
1972
|
|
|
1964
|
-
# Parse a
|
|
1973
|
+
# Parse a string literal union from handler source comments, either
|
|
1974
|
+
# written on one line:
|
|
1975
|
+
# # @rbs type logic = "AND" | "OR"
|
|
1976
|
+
# or continued across multiple lines:
|
|
1965
1977
|
# # @rbs type priority = "low"
|
|
1966
1978
|
# # | "medium"
|
|
1967
1979
|
# # | "high"
|
|
1968
1980
|
#
|
|
1981
|
+
# +first_segment+ is everything captured after the +=+ on the
|
|
1982
|
+
# opening line, which may itself already contain the full
|
|
1983
|
+
# +"a" | "b" | "c"+ union — a single-line union has no continuation
|
|
1984
|
+
# lines, so capturing only its first quoted literal (the prior
|
|
1985
|
+
# behavior) silently dropped every member after the first.
|
|
1986
|
+
#
|
|
1969
1987
|
# @return [Hash] +{type: "string", enum: ["low", "medium", "high"]}+
|
|
1970
1988
|
#: (String, String, String) -> Hash[Symbol, untyped]
|
|
1971
|
-
def parse_string_union(
|
|
1972
|
-
values = [
|
|
1989
|
+
def parse_string_union(first_segment, line, content)
|
|
1990
|
+
values = first_segment.scan(/"([^"]*)"/).flatten
|
|
1973
1991
|
content.each_line.drop_while { |l| l != line }.drop(1).each do |next_line|
|
|
1974
1992
|
if next_line =~ /^\s*#\s*\|\s*"([^"]+)"/
|
|
1975
1993
|
values << $1.to_s
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mcp_authorization
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- AndyGauge
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|