revund-ruby-worker 0.1.0 → 0.1.2
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/README.md +3 -3
- data/lib/ruby_worker/service.rb +6 -11
- data/lib/ruby_worker/version.rb +1 -1
- data/lib/worker/v1/worker_pb.rb +37 -0
- data/lib/worker/v1/worker_services_pb.rb +112 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 297b104bad97b94ac3797145ee977a83fc760411b159ef91f3732f925e0efe26
|
|
4
|
+
data.tar.gz: 5e5abdb3fb0b94624c150299edccce59f25dbe442419109f3fd4dd4d6676374a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c9789c2c44ecfa8ef694bd81636ea25eeb6b4e0a8fd0852d51c2a7a0148d5a7514b43b8097c9d922bfdda73e49b184e06f56dd88cf05ee8bf55e0538e4951ee8
|
|
7
|
+
data.tar.gz: e7accdaded54025c8f3a70de761a5a7c0521fe5bb2c4e1d018d1374ab80ae9478051d14078ea6f0ad8b5b47888e30cca27c5dad3a3f1f0b37c1a5bca4a5b39e4
|
data/README.md
CHANGED
|
@@ -51,9 +51,9 @@ The worker advertises one capability via the `Describe` RPC:
|
|
|
51
51
|
## Contract
|
|
52
52
|
|
|
53
53
|
The wire contract is defined in
|
|
54
|
-
[`proto/worker/v1/worker.proto`](./proto/worker/v1/worker.proto),
|
|
55
|
-
inside the gem
|
|
56
|
-
|
|
54
|
+
[`proto/worker/v1/worker.proto`](./proto/worker/v1/worker.proto),
|
|
55
|
+
vendored inside the gem and loaded by the generated
|
|
56
|
+
`worker_pb` / `worker_services_pb` stubs.
|
|
57
57
|
|
|
58
58
|
## License
|
|
59
59
|
|
data/lib/ruby_worker/service.rb
CHANGED
|
@@ -3,23 +3,18 @@
|
|
|
3
3
|
require_relative 'parser'
|
|
4
4
|
require_relative 'fetcher'
|
|
5
5
|
# Generated by grpc_tools_ruby_protoc from
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# require 'worker/v1/worker_services_pb'
|
|
6
|
+
# proto/worker/v1/worker.proto via `rake gen_stubs`. The output
|
|
7
|
+
# lands under lib/worker/v1/ so standard require paths pick it up.
|
|
8
|
+
require 'worker/v1/worker_pb'
|
|
9
|
+
require 'worker/v1/worker_services_pb'
|
|
11
10
|
|
|
12
11
|
module RubyWorker
|
|
13
12
|
# Service implements the universal `revund.worker.v1.Worker`
|
|
14
13
|
# contract — the same contract ts-worker and php-worker speak.
|
|
15
14
|
#
|
|
16
15
|
# Each handler is thin — it translates between the gRPC wire
|
|
17
|
-
# shape and the Parser domain object.
|
|
18
|
-
|
|
19
|
-
# swapping the stub in is mechanical.
|
|
20
|
-
class Service
|
|
21
|
-
# include ::Revund::Worker::V1::Worker::Service
|
|
22
|
-
|
|
16
|
+
# shape and the Parser domain object.
|
|
17
|
+
class Service < ::Revund::Worker::V1::Worker::Service
|
|
23
18
|
NAME = 'ruby-worker'
|
|
24
19
|
LANGUAGES = ['ruby'].freeze
|
|
25
20
|
CAPABILITIES = %w[parse self_fetch].freeze
|
data/lib/ruby_worker/version.rb
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# source: worker/v1/worker.proto
|
|
4
|
+
|
|
5
|
+
require 'google/protobuf'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
descriptor_data = "\n\x16worker/v1/worker.proto\x12\x10revund.worker.v1\"\x11\n\x0f\x44\x65scribeRequest\"Z\n\x10\x44\x65scribeResponse\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x11\n\tlanguages\x18\x03 \x03(\t\x12\x14\n\x0c\x63\x61pabilities\x18\x04 \x03(\t\"M\n\nRepoSource\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x0b\n\x03ref\x18\x02 \x01(\t\x12\x12\n\nauth_token\x18\x03 \x01(\t\x12\x11\n\tauth_user\x18\x04 \x01(\t\"\x0f\n\rHealthRequest\"!\n\x0eHealthResponse\x12\x0f\n\x07version\x18\x01 \x01(\t\"c\n\x0cParseRequest\x12\x11\n\trepo_path\x18\x01 \x01(\t\x12\r\n\x05\x66iles\x18\x02 \x03(\t\x12\x31\n\x0brepo_source\x18\x03 \x01(\x0b\x32\x1c.revund.worker.v1.RepoSource\"<\n\rParseResponse\x12+\n\x05\x66iles\x18\x01 \x03(\x0b\x32\x1c.revund.worker.v1.ParsedFile\"\x83\x02\n\nParsedFile\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\x10\n\x08language\x18\x02 \x01(\t\x12,\n\x07imports\x18\x03 \x03(\x0b\x32\x1b.revund.worker.v1.ImportRef\x12(\n\x05\x64\x65\x63ls\x18\x04 \x03(\x0b\x32\x19.revund.worker.v1.DeclRef\x12\x30\n\tfunctions\x18\x05 \x03(\x0b\x32\x1d.revund.worker.v1.FunctionRef\x12\x36\n\x08\x63oncerns\x18\x07 \x03(\x0b\x32$.revund.worker.v1.ConcernEvidenceRef\x12\x13\n\x0bparse_error\x18\x06 \x01(\t\"6\n\tImportRef\x12\x0c\n\x04path\x18\x01 \x01(\t\x12\r\n\x05\x61lias\x18\x02 \x01(\t\x12\x0c\n\x04line\x18\x03 \x01(\x05\"W\n\x07\x44\x65\x63lRef\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04kind\x18\x02 \x01(\t\x12\x0c\n\x04line\x18\x03 \x01(\x05\x12\x10\n\x08\x65nd_line\x18\x04 \x01(\x05\x12\x10\n\x08\x65xported\x18\x05 \x01(\x08\"\xcf\x01\n\x0b\x46unctionRef\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nstart_line\x18\x02 \x01(\x05\x12\x10\n\x08\x65nd_line\x18\x03 \x01(\x05\x12\x12\n\ncomplexity\x18\x04 \x01(\x05\x12\x11\n\tis_method\x18\x05 \x01(\x08\x12\x13\n\x0bis_exported\x18\x06 \x01(\x08\x12\x0c\n\x04hash\x18\x07 \x01(\t\x12\x16\n\x0e\x63\x61nonical_hash\x18\x08 \x01(\t\x12*\n\x06\x62locks\x18\t \x03(\x0b\x32\x1a.revund.worker.v1.BlockRef\"d\n\x08\x42lockRef\x12\x0c\n\x04kind\x18\x01 \x01(\t\x12\x12\n\nstart_line\x18\x02 \x01(\x05\x12\x10\n\x08\x65nd_line\x18\x03 \x01(\x05\x12\x0c\n\x04hash\x18\x04 \x01(\t\x12\x16\n\x0e\x63\x61nonical_hash\x18\x05 \x01(\t\"R\n\x12\x43oncernEvidenceRef\x12\x10\n\x08\x63\x61tegory\x18\x01 \x01(\t\x12\x0c\n\x04line\x18\x02 \x01(\x05\x12\x0e\n\x06symbol\x18\x03 \x01(\t\x12\x0c\n\x04note\x18\x04 \x01(\t\"{\n\x0eResolveRequest\x12\x11\n\trepo_path\x18\x01 \x01(\t\x12\x0c\n\x04\x64iff\x18\x02 \x01(\t\x12\x15\n\rchanged_files\x18\x03 \x03(\t\x12\x31\n\x0brepo_source\x18\x04 \x01(\x0b\x32\x1c.revund.worker.v1.RepoSource\"@\n\x0fResolveResponse\x12-\n\x07symbols\x18\x01 \x03(\x0b\x32\x1c.revund.worker.v1.SymbolDecl\"a\n\nSymbolDecl\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\tfile_path\x18\x02 \x01(\t\x12\x12\n\nstart_line\x18\x03 \x01(\x05\x12\x10\n\x08\x65nd_line\x18\x04 \x01(\x05\x12\x0c\n\x04text\x18\x05 \x01(\t\"p\n\x12\x44iagnosticsRequest\x12\x11\n\trepo_path\x18\x01 \x01(\t\x12\x14\n\x0c\x66ilter_files\x18\x02 \x03(\t\x12\x31\n\x0brepo_source\x18\x03 \x01(\x0b\x32\x1c.revund.worker.v1.RepoSource\"H\n\x13\x44iagnosticsResponse\x12\x31\n\x0b\x64iagnostics\x18\x01 \x03(\x0b\x32\x1c.revund.worker.v1.Diagnostic\"T\n\nDiagnostic\x12\x0c\n\x04\x66ile\x18\x01 \x01(\t\x12\x0c\n\x04line\x18\x02 \x01(\x05\x12\x0b\n\x03\x63ol\x18\x03 \x01(\x05\x12\x0c\n\x04\x63ode\x18\x04 \x01(\t\x12\x0f\n\x07message\x18\x05 \x01(\t2\xa8\x03\n\x06Worker\x12Q\n\x08\x44\x65scribe\x12!.revund.worker.v1.DescribeRequest\x1a\".revund.worker.v1.DescribeResponse\x12K\n\x06Health\x12\x1f.revund.worker.v1.HealthRequest\x1a .revund.worker.v1.HealthResponse\x12H\n\x05Parse\x12\x1e.revund.worker.v1.ParseRequest\x1a\x1f.revund.worker.v1.ParseResponse\x12U\n\x0eResolveSymbols\x12 .revund.worker.v1.ResolveRequest\x1a!.revund.worker.v1.ResolveResponse\x12]\n\x0eRunDiagnostics\x12$.revund.worker.v1.DiagnosticsRequest\x1a%.revund.worker.v1.DiagnosticsResponseBGZEgithub.com/revund-dev/revund/core/pkg/worker/proto/worker/v1;workerpbb\x06proto3"
|
|
9
|
+
|
|
10
|
+
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
|
12
|
+
|
|
13
|
+
module Revund
|
|
14
|
+
module Worker
|
|
15
|
+
module V1
|
|
16
|
+
DescribeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.DescribeRequest").msgclass
|
|
17
|
+
DescribeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.DescribeResponse").msgclass
|
|
18
|
+
RepoSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.RepoSource").msgclass
|
|
19
|
+
HealthRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.HealthRequest").msgclass
|
|
20
|
+
HealthResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.HealthResponse").msgclass
|
|
21
|
+
ParseRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ParseRequest").msgclass
|
|
22
|
+
ParseResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ParseResponse").msgclass
|
|
23
|
+
ParsedFile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ParsedFile").msgclass
|
|
24
|
+
ImportRef = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ImportRef").msgclass
|
|
25
|
+
DeclRef = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.DeclRef").msgclass
|
|
26
|
+
FunctionRef = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.FunctionRef").msgclass
|
|
27
|
+
BlockRef = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.BlockRef").msgclass
|
|
28
|
+
ConcernEvidenceRef = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ConcernEvidenceRef").msgclass
|
|
29
|
+
ResolveRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ResolveRequest").msgclass
|
|
30
|
+
ResolveResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.ResolveResponse").msgclass
|
|
31
|
+
SymbolDecl = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.SymbolDecl").msgclass
|
|
32
|
+
DiagnosticsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.DiagnosticsRequest").msgclass
|
|
33
|
+
DiagnosticsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.DiagnosticsResponse").msgclass
|
|
34
|
+
Diagnostic = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("revund.worker.v1.Diagnostic").msgclass
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
2
|
+
# Source: worker/v1/worker.proto for package 'revund.worker.v1'
|
|
3
|
+
# Original file comments:
|
|
4
|
+
# worker.proto — the universal AST-worker contract.
|
|
5
|
+
#
|
|
6
|
+
# # Public API
|
|
7
|
+
#
|
|
8
|
+
# This file defines the wire contract every Revund AST
|
|
9
|
+
# sidecar speaks. It is designed for STABILITY since the
|
|
10
|
+
# contract may eventually be published as an open-source
|
|
11
|
+
# interface that third-party language sidecars target.
|
|
12
|
+
#
|
|
13
|
+
# Compatibility rules:
|
|
14
|
+
#
|
|
15
|
+
# - Adding fields to existing messages: ALLOWED (proto3
|
|
16
|
+
# ignores unknown fields gracefully).
|
|
17
|
+
# - Adding new RPCs: ALLOWED (clients negotiate capability
|
|
18
|
+
# via Describe).
|
|
19
|
+
# - Removing or renaming fields: BREAKING — bump the
|
|
20
|
+
# package version (v1 → v2). Old clients keep speaking v1.
|
|
21
|
+
# - Changing field types: BREAKING.
|
|
22
|
+
#
|
|
23
|
+
# # Sidecar contract
|
|
24
|
+
#
|
|
25
|
+
# A Revund worker is any process implementing this service.
|
|
26
|
+
# It can be:
|
|
27
|
+
#
|
|
28
|
+
# - A first-party reference implementation we maintain
|
|
29
|
+
# (ts-worker, php-worker, ruby-worker)
|
|
30
|
+
# - A community-built sidecar for any language
|
|
31
|
+
# - A proprietary worker a customer builds for their
|
|
32
|
+
# in-house DSL
|
|
33
|
+
#
|
|
34
|
+
# The bot dials the worker by host:port, calls `Describe`
|
|
35
|
+
# to learn which languages + capabilities it advertises,
|
|
36
|
+
# and routes Parse RPCs based on the response. The bot
|
|
37
|
+
# does NOT hardcode language-to-worker mappings — every
|
|
38
|
+
# worker self-identifies.
|
|
39
|
+
#
|
|
40
|
+
# # Minimum viable worker
|
|
41
|
+
#
|
|
42
|
+
# Implement only `Describe`, `Health`, and `Parse`. Set
|
|
43
|
+
# `capabilities = ["parse"]`. The bot uses that worker for
|
|
44
|
+
# its advertised languages and skips the rest gracefully.
|
|
45
|
+
#
|
|
46
|
+
# # Symbol resolution / diagnostics (optional)
|
|
47
|
+
#
|
|
48
|
+
# Capabilities are advisory. Workers that ALSO support
|
|
49
|
+
# symbol resolution (returning declarations of identifiers
|
|
50
|
+
# referenced in changed code) advertise
|
|
51
|
+
# `capabilities = ["parse", "resolve_symbols"]`. Workers
|
|
52
|
+
# that run language-specific type-checkers (TypeScript's
|
|
53
|
+
# `tsc --noEmit`, PHP's PHPStan, Ruby's Sorbet) advertise
|
|
54
|
+
# `["parse", "diagnostics"]`. The bot uses these features
|
|
55
|
+
# when present, falls back to "just parse" when not.
|
|
56
|
+
#
|
|
57
|
+
|
|
58
|
+
require 'grpc'
|
|
59
|
+
require 'worker/v1/worker_pb'
|
|
60
|
+
|
|
61
|
+
module Revund
|
|
62
|
+
module Worker
|
|
63
|
+
module V1
|
|
64
|
+
module Worker
|
|
65
|
+
class Service
|
|
66
|
+
|
|
67
|
+
include ::GRPC::GenericService
|
|
68
|
+
|
|
69
|
+
self.marshal_class_method = :encode
|
|
70
|
+
self.unmarshal_class_method = :decode
|
|
71
|
+
self.service_name = 'revund.worker.v1.Worker'
|
|
72
|
+
|
|
73
|
+
# Describe identifies the worker. The bot calls this
|
|
74
|
+
# first to learn what languages + capabilities it
|
|
75
|
+
# supports. Idempotent, side-effect-free.
|
|
76
|
+
rpc :Describe, ::Revund::Worker::V1::DescribeRequest, ::Revund::Worker::V1::DescribeResponse
|
|
77
|
+
# Health is a standard k8s-style liveness probe.
|
|
78
|
+
rpc :Health, ::Revund::Worker::V1::HealthRequest, ::Revund::Worker::V1::HealthResponse
|
|
79
|
+
# Parse returns a minimal AST view (imports + decls +
|
|
80
|
+
# functions + concerns) for the requested files. Per-
|
|
81
|
+
# file parse errors are returned INSIDE the response,
|
|
82
|
+
# never as RPC errors. REQUIRED capability — every
|
|
83
|
+
# healthy worker implements this.
|
|
84
|
+
rpc :Parse, ::Revund::Worker::V1::ParseRequest, ::Revund::Worker::V1::ParseResponse
|
|
85
|
+
# ResolveSymbols returns the declarations of identifiers
|
|
86
|
+
# referenced in a diff but defined elsewhere in the
|
|
87
|
+
# repo. Used by the bot's ingest layer to enrich the
|
|
88
|
+
# LLM bundle with cross-file type information.
|
|
89
|
+
#
|
|
90
|
+
# OPTIONAL capability — workers advertise
|
|
91
|
+
# "resolve_symbols" in Describe.Capabilities when
|
|
92
|
+
# implemented. Workers that don't implement it return
|
|
93
|
+
# UNIMPLEMENTED; the bot's caller checks the capability
|
|
94
|
+
# list and skips the call when unsupported.
|
|
95
|
+
rpc :ResolveSymbols, ::Revund::Worker::V1::ResolveRequest, ::Revund::Worker::V1::ResolveResponse
|
|
96
|
+
# RunDiagnostics runs the language's native type-checker
|
|
97
|
+
# (tsc --noEmit for TypeScript, PHPStan for PHP, Sorbet
|
|
98
|
+
# for Ruby, etc.) and returns errors touching the
|
|
99
|
+
# changed files. Empty when the project has no errors
|
|
100
|
+
# or the worker doesn't run a type-checker — never an
|
|
101
|
+
# RPC error.
|
|
102
|
+
#
|
|
103
|
+
# OPTIONAL capability — workers advertise "diagnostics"
|
|
104
|
+
# in Describe.Capabilities when implemented.
|
|
105
|
+
rpc :RunDiagnostics, ::Revund::Worker::V1::DiagnosticsRequest, ::Revund::Worker::V1::DiagnosticsResponse
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
Stub = Service.rpc_stub_class
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: revund-ruby-worker
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Revund
|
|
@@ -86,6 +86,8 @@ files:
|
|
|
86
86
|
- lib/ruby_worker/server.rb
|
|
87
87
|
- lib/ruby_worker/service.rb
|
|
88
88
|
- lib/ruby_worker/version.rb
|
|
89
|
+
- lib/worker/v1/worker_pb.rb
|
|
90
|
+
- lib/worker/v1/worker_services_pb.rb
|
|
89
91
|
- proto/worker/v1/worker.proto
|
|
90
92
|
homepage: https://revund.dev
|
|
91
93
|
licenses:
|