@suss/adapter-ruby 0.10.0 → 0.12.0
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.
- package/README.md +2 -2
- package/dist/index.cjs +10 -2
- package/dist/index.js +10 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Ruby language adapter for suss. It parses source with tree-sitter (WASM), resolv
|
|
|
6
6
|
|
|
7
7
|
`@suss/adapter-ruby` is the Ruby language adapter, per [`docs/internal/facts-and-rules.md`](../../../docs/internal/facts-and-rules.md)'s Layer 1 contract: discover units, emit summaries in the shared IR, emit facts. It parses a file with `web-tree-sitter` and a vendored Ruby grammar (`grammar/tree-sitter-ruby.wasm`, no native build step), tracks class/module nesting to qualify a constant the way Ruby itself would resolve it lexically, and discovers graphql-ruby's class-based `field` DSL on a class extending a pack-configured base class. A `field :x, mutation: Mutations::Y` or `field :x, resolver: Queries::Z` reference is followed one hop: the referenced class's own file is located by Rails' constant-to-path convention and read for its declared return type. Discovered units become `RawCodeStructure` objects handed to `@suss/extractor`'s `assembleSummary`, the same assembly code the other adapters use.
|
|
8
8
|
|
|
9
|
-
v0 (this slice) reads graphql-ruby only: `routes.rb` is a separate, much larger macro-expansion problem, which the [language-adapters proposal](../../../
|
|
9
|
+
v0 (this slice) reads graphql-ruby only: `routes.rb` is a separate, much larger macro-expansion problem, which the [language-adapters proposal](../../../design/proposals/language-adapters.md) costs out and leaves for later. `require` is not resolved; class and module nesting is. A resolver's transitions are always empty (`branches: []`), since v0 does no path-engine work, and confidence is pinned low.
|
|
10
10
|
|
|
11
11
|
## The method behind a field
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ What the summary then says:
|
|
|
26
26
|
- When the walk reads a field's whole ancestry and finds no such method, `bodyContent` stays `"absent"` and the summary keeps its no-body sentence. That is right for such a field, because the library gets its value by reading the attribute off the object the field was resolved against.
|
|
27
27
|
- When the walk stops early, `bodyContent` stays unset and the summary gets one sentence saying what stopped it: an ancestor whose file the convention cannot locate, a `define_method` call that defines methods a reader of `def` nodes cannot see, or a wiring value that is not a constant path. `bodyContent` stays unset because the extractor writes its own sentence from that field, and any value would be a claim this reader cannot make. The walk does not read `method_missing` either.
|
|
28
28
|
|
|
29
|
-
An ancestor the reader could not open stops the search, rather than the search
|
|
29
|
+
An ancestor the reader could not open stops the search, rather than the search continuing to a method further along. Ruby would have called whatever that ancestor defines, so a method found past it is not the one that runs, and reporting it would be a confident wrong claim instead of an abstention.
|
|
30
30
|
|
|
31
31
|
What a body does still goes unread. Reading it needs the path engine: statements to walk, a return value to turn into a shape, and calls to resolve against something that knows what they return. `RawCodeStructure.dependencyCalls` is no shortcut around that, because nothing in the summary assembly reads it. A field's location also stays where the field is declared rather than moving to a resolver method in another file, so the path and line numbers on a summary keep pointing at the same place.
|
|
32
32
|
|
package/dist/index.cjs
CHANGED
|
@@ -15296,7 +15296,7 @@ function date4(params) {
|
|
|
15296
15296
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
15297
15297
|
config(en_default());
|
|
15298
15298
|
|
|
15299
|
-
// ../../ir-core/dist/chunk-
|
|
15299
|
+
// ../../ir-core/dist/chunk-AQYS5AC6.js
|
|
15300
15300
|
function gqlIdentityKey(typeName, fieldName) {
|
|
15301
15301
|
return `gql:${typeName}.${fieldName}`;
|
|
15302
15302
|
}
|
|
@@ -15598,6 +15598,9 @@ function normalizePath(path4) {
|
|
|
15598
15598
|
);
|
|
15599
15599
|
return normalized;
|
|
15600
15600
|
}
|
|
15601
|
+
function pathShape(path4) {
|
|
15602
|
+
return normalizePath(path4).replace(/\{[^}]*\}/g, "{}");
|
|
15603
|
+
}
|
|
15601
15604
|
function methodsAgree(a, b) {
|
|
15602
15605
|
if (a === null || b === null) {
|
|
15603
15606
|
return false;
|
|
@@ -15649,12 +15652,17 @@ var restSemantics = defineBoundarySemantics({
|
|
|
15649
15652
|
* settles it inside the bucket. The identity key stays what a reader
|
|
15650
15653
|
* sees and a suppression targets ("GET /users", "* /users"), and
|
|
15651
15654
|
* this key groups what a reader still tells apart.
|
|
15655
|
+
*
|
|
15656
|
+
* A parameter's name goes too. A spec written by hand says
|
|
15657
|
+
* `{userId}` where the Express route that serves it says `:id`, and
|
|
15658
|
+
* both match the same requests, so pairing on the name gave two
|
|
15659
|
+
* boundaries that never met and a run with nothing to report.
|
|
15652
15660
|
*/
|
|
15653
15661
|
pairingKey(semantics) {
|
|
15654
15662
|
if (semantics.method === null || semantics.path === null) {
|
|
15655
15663
|
return null;
|
|
15656
15664
|
}
|
|
15657
|
-
return `rest ${
|
|
15665
|
+
return `rest ${pathShape(semantics.path)}`;
|
|
15658
15666
|
},
|
|
15659
15667
|
sidesAgree(a, b) {
|
|
15660
15668
|
return methodsAgree(a.method, b.method);
|
package/dist/index.js
CHANGED
|
@@ -15245,7 +15245,7 @@ function date4(params) {
|
|
|
15245
15245
|
// ../../../node_modules/zod/v4/classic/external.js
|
|
15246
15246
|
config(en_default());
|
|
15247
15247
|
|
|
15248
|
-
// ../../ir-core/dist/chunk-
|
|
15248
|
+
// ../../ir-core/dist/chunk-AQYS5AC6.js
|
|
15249
15249
|
function gqlIdentityKey(typeName, fieldName) {
|
|
15250
15250
|
return `gql:${typeName}.${fieldName}`;
|
|
15251
15251
|
}
|
|
@@ -15547,6 +15547,9 @@ function normalizePath(path4) {
|
|
|
15547
15547
|
);
|
|
15548
15548
|
return normalized;
|
|
15549
15549
|
}
|
|
15550
|
+
function pathShape(path4) {
|
|
15551
|
+
return normalizePath(path4).replace(/\{[^}]*\}/g, "{}");
|
|
15552
|
+
}
|
|
15550
15553
|
function methodsAgree(a, b) {
|
|
15551
15554
|
if (a === null || b === null) {
|
|
15552
15555
|
return false;
|
|
@@ -15598,12 +15601,17 @@ var restSemantics = defineBoundarySemantics({
|
|
|
15598
15601
|
* settles it inside the bucket. The identity key stays what a reader
|
|
15599
15602
|
* sees and a suppression targets ("GET /users", "* /users"), and
|
|
15600
15603
|
* this key groups what a reader still tells apart.
|
|
15604
|
+
*
|
|
15605
|
+
* A parameter's name goes too. A spec written by hand says
|
|
15606
|
+
* `{userId}` where the Express route that serves it says `:id`, and
|
|
15607
|
+
* both match the same requests, so pairing on the name gave two
|
|
15608
|
+
* boundaries that never met and a run with nothing to report.
|
|
15601
15609
|
*/
|
|
15602
15610
|
pairingKey(semantics) {
|
|
15603
15611
|
if (semantics.method === null || semantics.path === null) {
|
|
15604
15612
|
return null;
|
|
15605
15613
|
}
|
|
15606
|
-
return `rest ${
|
|
15614
|
+
return `rest ${pathShape(semantics.path)}`;
|
|
15607
15615
|
},
|
|
15608
15616
|
sidesAgree(a, b) {
|
|
15609
15617
|
return methodsAgree(a.method, b.method);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/adapter-ruby",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruby language adapter for suss, parsing source with tree-sitter (WASM), resolving constant nesting with a lexical binder, and emitting raw extractions for the suss pipeline.",
|
|
6
6
|
"keywords": [
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"typecheck": "tsc --noEmit"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@suss/behavioral-ir": "0.
|
|
51
|
-
"@suss/datalog": "0.
|
|
52
|
-
"@suss/extractor": "0.
|
|
50
|
+
"@suss/behavioral-ir": "0.12.0",
|
|
51
|
+
"@suss/datalog": "0.12.0",
|
|
52
|
+
"@suss/extractor": "0.12.0",
|
|
53
53
|
"web-tree-sitter": "^0.26.11"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|