rubik 0.9.0 → 0.10.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.
- checksums.yaml +4 -4
- data/ATTRIBUTION.md +1 -1
- data/CHANGELOG.md +250 -43
- data/README.md +5 -1
- data/lib/rubik/adapter/base.rb +21 -1
- data/lib/rubik/adapter/generic.rb +0 -14
- data/lib/rubik/adapter/node.rb +2 -0
- data/lib/rubik/adapter/process.rb +28 -67
- data/lib/rubik/ast/treesitter/zig_walker.rb +15 -2
- data/lib/rubik/benchmark/vakanuvis_adoption.rb +10 -3
- data/lib/rubik/buffer/apply_contract.rb +3 -3
- data/lib/rubik/buffer/apply_transaction.rb +165 -0
- data/lib/rubik/buffer/manager.rb +26 -120
- data/lib/rubik/cli/workspace_trust.rb +16 -0
- data/lib/rubik/config/deep_ops.rb +4 -1
- data/lib/rubik/config/defaults.rb +29 -3
- data/lib/rubik/config/schema.rb +8 -0
- data/lib/rubik/config/secret_policy.rb +197 -0
- data/lib/rubik/config/store.rb +14 -0
- data/lib/rubik/config.rb +11 -0
- data/lib/rubik/diagnostics/collector.rb +0 -9
- data/lib/rubik/errors.rb +15 -0
- data/lib/rubik/event_bus.rb +2 -1
- data/lib/rubik/kernel/dispatcher.rb +16 -11
- data/lib/rubik/kernel/unit.rb +4 -1
- data/lib/rubik/llm/registry.rb +12 -9
- data/lib/rubik/llm/router.rb +2 -5
- data/lib/rubik/log.rb +23 -1
- data/lib/rubik/lsp/client.rb +152 -445
- data/lib/rubik/lsp/document_store.rb +209 -0
- data/lib/rubik/lsp/manager.rb +14 -10
- data/lib/rubik/lsp/transport.rb +365 -0
- data/lib/rubik/mcp/boot_lifecycle.rb +6 -2
- data/lib/rubik/mcp/boot_run.rb +190 -0
- data/lib/rubik/mcp/client.rb +4 -3
- data/lib/rubik/mcp/manager.rb +46 -165
- data/lib/rubik/mcp/transport/stdio.rb +55 -10
- data/lib/rubik/orchestrator/auto_apply.rb +4 -3
- data/lib/rubik/orchestrator/continuation_manager.rb +3 -22
- data/lib/rubik/orchestrator/goal_session.rb +519 -0
- data/lib/rubik/orchestrator/loop.rb +28 -47
- data/lib/rubik/orchestrator/maestro_gate.rb +5 -7
- data/lib/rubik/orchestrator/provider_recovery.rb +4 -2
- data/lib/rubik/orchestrator/provider_resolver.rb +4 -2
- data/lib/rubik/orchestrator/resume_window.rb +96 -0
- data/lib/rubik/orchestrator/shell_deps.rb +16 -0
- data/lib/rubik/orchestrator/stream_manager.rb +2 -1
- data/lib/rubik/orchestrator/subagent/deferred_spec.rb +4 -1
- data/lib/rubik/orchestrator/subagent/instance.rb +11 -12
- data/lib/rubik/orchestrator/subagent/journal.rb +2 -1
- data/lib/rubik/orchestrator/subagent/lifecycle.rb +3 -1
- data/lib/rubik/orchestrator/subagent/questioner.rb +24 -7
- data/lib/rubik/orchestrator/subagent/reaper.rb +3 -5
- data/lib/rubik/orchestrator/subagent/resilience.rb +4 -2
- data/lib/rubik/orchestrator/subagent/result_archive.rb +0 -4
- data/lib/rubik/orchestrator/subagent/run_cycle.rb +2 -7
- data/lib/rubik/orchestrator/subagent/spawn_transaction.rb +11 -2
- data/lib/rubik/orchestrator/subagent/step_runner.rb +11 -3
- data/lib/rubik/orchestrator/subagent/teardown.rb +4 -0
- data/lib/rubik/orchestrator/subagent/transcript_formatter.rb +2 -1
- data/lib/rubik/orchestrator/subagent/type_definition.rb +0 -4
- data/lib/rubik/orchestrator/tool_timeout.rb +121 -1
- data/lib/rubik/orchestrator.rb +1 -0
- data/lib/rubik/platform/io_drain.rb +2 -1
- data/lib/rubik/platform/process.rb +144 -54
- data/lib/rubik/platform.rb +17 -1
- data/lib/rubik/plugin/manager.rb +2 -1
- data/lib/rubik/plugin/storage.rb +20 -29
- data/lib/rubik/repl/commands/agent_context.rb +9 -8
- data/lib/rubik/repl/commands/agent_execution.rb +20 -502
- data/lib/rubik/repl/commands/agent_models.rb +4 -3
- data/lib/rubik/repl/commands/agent_providers.rb +43 -2
- data/lib/rubik/repl/commands/base.rb +47 -2
- data/lib/rubik/repl/commands/buffer.rb +6 -5
- data/lib/rubik/repl/commands/lsp.rb +3 -2
- data/lib/rubik/repl/commands/pruner.rb +2 -1
- data/lib/rubik/repl/commands/secrets.rb +151 -0
- data/lib/rubik/repl/commands/workspace.rb +60 -150
- data/lib/rubik/repl/commands/workspace_approval.rb +209 -0
- data/lib/rubik/repl/config_wiring.rb +3 -3
- data/lib/rubik/repl/hooks.rb +2 -1
- data/lib/rubik/repl/input_execution.rb +158 -76
- data/lib/rubik/repl/input_loop.rb +3 -2
- data/lib/rubik/repl/lifecycle.rb +82 -204
- data/lib/rubik/repl/notice_router.rb +319 -0
- data/lib/rubik/repl/paste_support.rb +3 -1
- data/lib/rubik/repl/presentation.rb +5 -3
- data/lib/rubik/repl/pruner/gate.rb +3 -1
- data/lib/rubik/repl/pruner/harness.rb +2 -1
- data/lib/rubik/repl/shell.rb +4 -3
- data/lib/rubik/repl/turn_recorder.rb +6 -5
- data/lib/rubik/runtime/discovery.rb +3 -2
- data/lib/rubik/runtime/loop_service.rb +4 -3
- data/lib/rubik/runtime/manifest_store.rb +124 -0
- data/lib/rubik/runtime/overlay_guard.rb +127 -0
- data/lib/rubik/runtime/overlay_storage.rb +269 -272
- data/lib/rubik/runtime/task_manager.rb +71 -27
- data/lib/rubik/runtime.rb +1 -0
- data/lib/rubik/sandbox/driver/docker.rb +5 -1
- data/lib/rubik/sandbox/runner.rb +16 -15
- data/lib/rubik/security/allowlist.rb +167 -0
- data/lib/rubik/security/audit_log.rb +72 -0
- data/lib/rubik/security/classifier/classifier.rb +8 -0
- data/lib/rubik/security/command_gate.rb +591 -0
- data/lib/rubik/security/guard.rb +94 -1077
- data/lib/rubik/security/path_policy.rb +117 -0
- data/lib/rubik/security/secret_store.rb +463 -0
- data/lib/rubik/security/synthesis_gate.rb +297 -0
- data/lib/rubik/security.rb +5 -0
- data/lib/rubik/session/manager.rb +7 -1
- data/lib/rubik/skills/manager.rb +2 -3
- data/lib/rubik/storage/ranking.rb +113 -0
- data/lib/rubik/storage/search.rb +49 -0
- data/lib/rubik/storage/store.rb +15 -112
- data/lib/rubik/storage/transcript_indexer.rb +2 -3
- data/lib/rubik/storage/vakanuvis/harness.rb +2 -3
- data/lib/rubik/tools/base.rb +22 -0
- data/lib/rubik/tools/builtins/files.rb +3 -15
- data/lib/rubik/tools/builtins/grep.rb +3 -9
- data/lib/rubik/tools/builtins/lifecycle.rb +96 -92
- data/lib/rubik/tools/builtins/synthesis.rb +3 -0
- data/lib/rubik/tools/lifecycle_rollbacks.rb +100 -0
- data/lib/rubik/tools/native_search.rb +2 -1
- data/lib/rubik/tools/truncator.rb +73 -36
- data/lib/rubik/ui/banner.rb +4 -3
- data/lib/rubik/ui/spinner.rb +3 -1
- data/lib/rubik/ui/statusline.rb +6 -5
- data/lib/rubik/version.rb +1 -1
- data/lib/rubik.rb +1 -2
- metadata +23 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 228307ab0a21e7b48cf596b995a15c3e5d046dee3cbade03df25663c16b857fd
|
|
4
|
+
data.tar.gz: 5a2d93700eb1c739680875952a0389004ae53493241fa08ac944840a9a46939d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b38148ccb7f93eaf442838fdf82540b5d6899e04843a1d278974dbac9898ee15038cc3f3f39241e708c93a4b37b0c158ae5a2121a1dddfa186da25d5b96222e
|
|
7
|
+
data.tar.gz: 24430386dbb423bc389445bcafe847a6beef46ab9e9829cca0c46b497c69452e86c44a20c1a1047d5a55c7382e0295be503fdc01ca86569186ad11d82d484462
|
data/ATTRIBUTION.md
CHANGED
|
@@ -121,7 +121,7 @@ SOFTWARE.
|
|
|
121
121
|
| **`strings-ansi`** | Piotr Murach | MIT | ANSI-aware string truncation and alignment for REPL formatters. |
|
|
122
122
|
| **`reline`** | Hiroshi SHIBATA & Ruby Team | Ruby License / BSD-2-Clause | Line-editing, history navigation, autocompletion hooks, and headless terminal adaptation. |
|
|
123
123
|
| **`prism`** | Kevin Newton & Ruby Core Team | MIT | High-performance Ruby parsing and AST extraction ([`Rubik::AST::RubyExtractor`](lib/rubik/ast/ruby_extractor.rb)). |
|
|
124
|
-
| **`minitest`** | Ryan Davis & seattlerb | MIT | Fast, modular test suite powering Rubik's 4,
|
|
124
|
+
| **`minitest`** | Ryan Davis & seattlerb | MIT | Fast, modular test suite powering Rubik's 4,500+ unit, integration, and contract tests. |
|
|
125
125
|
| **`rubocop`** | Bozhidar Batsov & contributors | MIT | Static code analysis, style enforcement, and architectural hygiene gates. |
|
|
126
126
|
| **`benchmark`, `logger`, `pstore`, `reline`, `fiddle`** | Ruby core / rubygems teams | Ruby License / BSD-2-Clause | Ruby stdlib gems pinned explicitly in `rubik.gemspec` as they are unbundled from the default set in Ruby 3.4/3.5. |
|
|
127
127
|
|
data/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,253 @@ commits, 2026-08-23 → 2026-10-09, see `git log`).
|
|
|
6
6
|
|
|
7
7
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
8
8
|
|
|
9
|
-
## [
|
|
9
|
+
## [0.10.0] - 2026-11-15
|
|
10
|
+
|
|
11
|
+
The secret-store minor: provider credentials leave the config files for the
|
|
12
|
+
OS secret store (Keychain, Credential Manager, secret-service) behind
|
|
13
|
+
`rubik-secret:` pointers with a project-scope plaintext guard and a `!secrets`
|
|
14
|
+
command, abandoned tool workers get an opt-in grace-then-kill reaper — while
|
|
15
|
+
the extraction wave continues its sweep across the config dialects, the buffer
|
|
16
|
+
apply transaction, the storage search pipeline, the LSP JSON-RPC transport,
|
|
17
|
+
the MCP boot choreography, and the REPL lifecycle, and a robustness round
|
|
18
|
+
closes silent failures and unbounded pipe writes.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- **Secret store for provider credentials (#493):** plaintext
|
|
23
|
+
`providers.<name>.api_key` values are no longer written to config files.
|
|
24
|
+
Writes are routed to the OS secret store (macOS Keychain via `security`,
|
|
25
|
+
Windows Credential Manager via PowerShell PasswordVault, Linux secret-service
|
|
26
|
+
via `secret-tool`) and the config file keeps only a `rubik-secret:` pointer
|
|
27
|
+
that resolves lazily at provider build time; an owner-only (0600)
|
|
28
|
+
`~/.rubik/secrets.yml` file store is the honest fallback when no OS keyring
|
|
29
|
+
is available. The `!secrets` command (`backend | list | has | delete |
|
|
30
|
+
migrate`) reports statuses without printing values and migrates legacy
|
|
31
|
+
plaintext keys in place.
|
|
32
|
+
- **`tools.timeout_kill_after` grace-then-kill reaper (#458):** an abandoned
|
|
33
|
+
tool-call worker (its join budget expired, the result discarded) can now be
|
|
34
|
+
reaped: when the knob is set, the worker is registered with a reaper thread
|
|
35
|
+
and `Thread#kill`ed after the grace period, with the kill logged under
|
|
36
|
+
`:tools`; workers that finish during grace are left to the existing
|
|
37
|
+
late-completion log. Default nil = OFF, byte-identical to the current
|
|
38
|
+
pure-abandonment behavior; invalid values warn and stay off.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- **Nil-safe config-fetch dialects converge on `Layout.config_get`
|
|
43
|
+
(#438, #489, #490, #491):** three hand-rolled dialects (respond_to? ternaries,
|
|
44
|
+
private fetch_cfg/safe_config copies) collapse onto the existing single home,
|
|
45
|
+
so a dotted knob resolves identically whichever file reads it; the two
|
|
46
|
+
deliberate nil/false-preserving fetches stay untouched per their ruling
|
|
47
|
+
comments.
|
|
48
|
+
- **Project-scoped secrets refused by default (#493):** `!config set
|
|
49
|
+
providers.x.api_key … --project` and project-scoped provider writes holding
|
|
50
|
+
plaintext keys fail with guidance (`--global`, `api_key_env`, or
|
|
51
|
+
`!secrets migrate`) — project config files live inside the repository and
|
|
52
|
+
leak through commits. The schema-backed `security.allow_project_secrets`
|
|
53
|
+
flag restores the legacy behavior, resolved from operator trust only (a
|
|
54
|
+
project config cannot enable it for itself). Project-scope store names carry
|
|
55
|
+
a `.project` suffix so the two scopes can never swap each other's credential;
|
|
56
|
+
`!config get/list`, the `!config set` echo, and `!provider set` no longer
|
|
57
|
+
display secret values; untrusted-workspace filtering now also drops the
|
|
58
|
+
`providers` section.
|
|
59
|
+
- **Truncator kept-window accounting single-homed (#439):** the four copies
|
|
60
|
+
of the six-step byte-budget cut + scrub + omitted-accounting block collapse
|
|
61
|
+
behind `clamp_head`/`clamp_tail`/`window_result` with the two sanctioned
|
|
62
|
+
notice spellings pinned byte-identical.
|
|
63
|
+
- **Traversal and file-not-found disclosures single-homed on BaseTool
|
|
64
|
+
(#440):** `traversal_blocked_message` and `file_not_found_message` own the
|
|
65
|
+
allowed-roots construction and the twin fuzzy-matching blocks that
|
|
66
|
+
list_files/grep_search/read_file/replace_file_content each hand-copied.
|
|
67
|
+
- **Adapter-command execution helpers single-homed on Commands::Base (#441):**
|
|
68
|
+
the pre-execution auto-apply choreography, the adapter fallback selection,
|
|
69
|
+
and the failure-diagnostic rendering that !test/!lint/!format/!sh each
|
|
70
|
+
carried move behind `pre_execution_apply`/`adapter_for`/`render_diagnostic`
|
|
71
|
+
with the pinned message wording byte-identical.
|
|
72
|
+
- **Guard/trust plane split out of OverlayStorage (#465):** path containment
|
|
73
|
+
and trust/bootstrap screening move verbatim into `Runtime::OverlayGuard`
|
|
74
|
+
(127 LOC) with the injected-guard kwarg seam preserved and the Kind adapter
|
|
75
|
+
merged into the single class body; OverlayStorage drops 623 → 558 LOC.
|
|
76
|
+
- **REPL lifecycle's notice routing extracted into NoticeRouter (#469, #485):**
|
|
77
|
+
the MCP boot notices, subagent event routing, and reactive-wakeup half of
|
|
78
|
+
lifecycle.rb move into `REPL::NoticeRouter` with the queue/mutex/token state
|
|
79
|
+
owned there and the safe-notice-print fallback single-homed; the Shell
|
|
80
|
+
public surface is unchanged.
|
|
81
|
+
- **LSP JSON-RPC transport extracted from Client (#470, #484):** process
|
|
82
|
+
spawn/teardown, the framing reader thread, request/response correlation, and
|
|
83
|
+
the sanitized spawn environment move into `LSP::Transport` (~700-LOC Client
|
|
84
|
+
split), with `shutdown` the exact LIFO inverse of spawn; the typed LSP
|
|
85
|
+
protocol API stays on Client.
|
|
86
|
+
- **Buffer apply transaction extracted (#472, #483):** the two-phase apply
|
|
87
|
+
(atomic writes, external-conflict detection, TOCTOU containment re-check,
|
|
88
|
+
structured `ApplyFailedError`) moves into `Buffer::ApplyTransaction`; the
|
|
89
|
+
Manager public API and last_* recording contracts are unchanged.
|
|
90
|
+
- **Storage search pipeline's pure text layer extracted (#473, #482):**
|
|
91
|
+
`Storage::Search` owns tokenization, haystack construction, and the
|
|
92
|
+
token-AND candidate gate; `Store#search`/`#search_ranked` delegate with
|
|
93
|
+
identical scoring, ordering, and tie-breaking.
|
|
94
|
+
- **WorkspaceApproval value object extracted (#474, #487)** and the Loop-side
|
|
95
|
+
goal-resume window concentrated into `Orchestrator::ResumeWindow` (#475,
|
|
96
|
+
#486) — ctx.extend lifecycle, the cross-process history prefix, and the
|
|
97
|
+
goal_resumed marker discipline become testable without running a turn.
|
|
98
|
+
- **MCP boot choreography threaded through a BootRun object (#460):** entries /
|
|
99
|
+
connected / outcomes / boot_epoch stop travelling as mutable side-channel
|
|
100
|
+
parameters; the absence-owes-stop rule becomes the named `owes_stop?`
|
|
101
|
+
predicate; monitor-hold boundaries and epoch gates are verbatim, manager.rb
|
|
102
|
+
drops 639 → 515 lines.
|
|
103
|
+
- **The dual popen3 + reader-thread implementations single-homed (#461)** and
|
|
104
|
+
`execute_free_text` split into named phases on InputExecution (#462) with
|
|
105
|
+
statement order, messages, and history mutation preserved verbatim.
|
|
106
|
+
- **The four unrelated StateError classes unified under `Rubik::StateError`
|
|
107
|
+
(#463):** one rescue target for state-machine violations while keeping the
|
|
108
|
+
module-qualified names, and six bare `raise "string"` sites on public APIs
|
|
109
|
+
typed under `Rubik::Error` with one small class per module.
|
|
110
|
+
- **Direct `$stderr` writes routed through Rubik::Log (#455, #467):** only the
|
|
111
|
+
two sanctioned sites write $stderr directly; overlay bootstrap refusals and
|
|
112
|
+
the synthesis-gate downgrade warn emit via `Log.warn(:security)`, and the
|
|
113
|
+
constructor-default loggers gain `Rubik::Log.forwarder(subsystem)` so they
|
|
114
|
+
respect `RUBIK_LOG_LEVEL` and the single-line format.
|
|
115
|
+
- **`verify_command_safety!` split into named phases (#457):** the 165-LOC
|
|
116
|
+
orchestrator reads as the AST fast-path condition, the fail-closed allowlist
|
|
117
|
+
valve, the three block sites, and the interactive-approval step; decisions,
|
|
118
|
+
messages, and audit events unchanged.
|
|
119
|
+
- **The shared goal-resume choreography extracted from GoalSession (#459)**,
|
|
120
|
+
white-box test coupling reduced across the worst offenders (#464, #476,
|
|
121
|
+
#488, #492), direct unit coverage added for OverlayGuard, BootRun, and
|
|
122
|
+
Platform::Process (#478) and the input_execution phases (#477, #481), and
|
|
123
|
+
raw-sleep cooldown assertions replaced with bounded polling (#456).
|
|
124
|
+
|
|
125
|
+
### Fixed
|
|
126
|
+
|
|
127
|
+
- **send_input pipe write bounded and the start registration window closed
|
|
128
|
+
(#466):** a child that stops reading stdin can no longer deadlock kill,
|
|
129
|
+
status, logs, and process shutdown — the write happens outside the manager
|
|
130
|
+
monitor with a deadline-bounded `Platform.write_until` loop, and a failure
|
|
131
|
+
between spawn and task registration now rolls back by killing the child.
|
|
132
|
+
- **Review-sweep robustness gaps closed (#468):** the kernel dispatcher's
|
|
133
|
+
stopped-check + queue-push is atomic under the lock (no more stranded events
|
|
134
|
+
wedging sync_drain), the LSP did_* rescues log instead of silently returning
|
|
135
|
+
false, the MCP stdio child-died diagnostic captures the pid before teardown,
|
|
136
|
+
and kill_tree gives TERM a bounded 200ms grace window before KILL escalates.
|
|
137
|
+
- **popen_capture wall clock bounded by a deadline watchdog (#479, #480):**
|
|
138
|
+
the kill now always lands before the join — a deadline breach kills the
|
|
139
|
+
child tree first and raises `Timeout::Error` only after the popen3 block
|
|
140
|
+
returns, instead of racing the unwind.
|
|
141
|
+
- **Silent-failure health sweep closed (#443):** corrupt JSON lines dropped
|
|
142
|
+
during session restore are logged with their line number, the at_exit sweep
|
|
143
|
+
is error-isolated per manager, a failed `docker rm -f` in the ensure warns
|
|
144
|
+
instead of vanishing, and five grep-verified dead methods are deleted.
|
|
145
|
+
- **Late completion of an abandoned tool worker logged (#442):** the worker's
|
|
146
|
+
ensure records an honest warn — which tool, how long the call took, and
|
|
147
|
+
whether it finished with a raise or a discarded result — closing the
|
|
148
|
+
observability gap while the budget still bounds turn latency.
|
|
149
|
+
|
|
150
|
+
## [0.9.1] - 2026-11-14
|
|
151
|
+
|
|
152
|
+
The hardening-and-single-homing patch: overlay commands seal their default
|
|
153
|
+
wrap and compare manifest hashes in constant time, the Guard god-file splits
|
|
154
|
+
into five deep modules with the allowlist gates failing closed, MCP stdio
|
|
155
|
+
spawns get host-runtime scrubbing and a per-server credential policy, the
|
|
156
|
+
parallel-stable test gate retires the capacity-flake adjudication burden
|
|
157
|
+
(#384) — and the single-homing wave collapses duplicated logic across the
|
|
158
|
+
BM25 ranker, LSP document store, goal session, preview truncation, and the
|
|
159
|
+
overlay kind adapter.
|
|
160
|
+
|
|
161
|
+
### Added
|
|
162
|
+
|
|
163
|
+
- **MCP stdio credential policy (#429):** MCP stdio servers keep inheriting the
|
|
164
|
+
host environment (minus the bundler/Ruby runtime variables the spawn-hygiene
|
|
165
|
+
scrub already unsets) — a non-breaking default, since many real servers
|
|
166
|
+
legitimately need operator credentials. A per-server `inherit_env:` option
|
|
167
|
+
(default `true`) opts out: with `inherit_env: false`, variables matching
|
|
168
|
+
`/_(API_KEY|TOKEN|SECRET|PASSWORD)$/` (case-insensitive) are additionally
|
|
169
|
+
unset for that server's subprocess, leaving the sanitized base plus only its
|
|
170
|
+
explicit `env:` entries. Explicit `env:` entries always win in both modes.
|
|
171
|
+
The policy is documented in `docs/reference/environment.md`, the README
|
|
172
|
+
security notes, and the workspace-trust notice.
|
|
173
|
+
|
|
174
|
+
### Changed
|
|
175
|
+
|
|
176
|
+
- **Guard split into five deep modules (#413):** `AuditLog`, `PathPolicy`,
|
|
177
|
+
`Allowlist`, `CommandGate`, and `SynthesisGate` each own one security
|
|
178
|
+
concern while `Guard` stays the delegating composition root (explicit
|
|
179
|
+
delegating defs, no `method_missing`); historical `Guard::` constants
|
|
180
|
+
alias to the owning module, and every security-sensitive move is
|
|
181
|
+
verbatim.
|
|
182
|
+
- **Allowlist matching and its fail-closed valve single-homed (#401,
|
|
183
|
+
#425):** the token-prefix match collapses behind one `allowlist_match_argv?`
|
|
184
|
+
core feeding both AST and raw paths, the four verbatim fail-closed
|
|
185
|
+
allowlist evaluations in CommandGate delegate to one helper with identical
|
|
186
|
+
deny semantics, `Classifier::Engine.builtin_dangerous?` becomes the public
|
|
187
|
+
predicate, and the dead `DANGEROUS_SYSTEM_ROOTS` constant is deleted.
|
|
188
|
+
- **Overlay command/tool quadruplets parameterized behind a Kind adapter
|
|
189
|
+
(#419):** save/delete/load collapse onto shared skeletons with the 22
|
|
190
|
+
public methods unchanged, the corrupt-manifest fail-closed contract is
|
|
191
|
+
single-homed, and byte-exact header emission is pinned by new tests.
|
|
192
|
+
- **LSP DocumentStore extracted (#418):** the four per-document hashes and
|
|
193
|
+
the three hand-rolled restore-on-failed-send rollbacks collapse into one
|
|
194
|
+
snapshot/restore helper; the lock-order invariant is single-homed and
|
|
195
|
+
the `did_close`/`did_change` failed-send restore coverage gaps are
|
|
196
|
+
closed.
|
|
197
|
+
- **GoalSession extracted from agent_execution (#414):** the 21 `!goal`
|
|
198
|
+
lifecycle methods move byte-identical into `Orchestrator::GoalSession`
|
|
199
|
+
and the duplicated goal-shaped orchestrator-loop stanza folds into one
|
|
200
|
+
builder; the command file shrinks 712 → 249 LOC.
|
|
201
|
+
- **BM25 ranking extracted into Storage::Ranking (#415):** the scored-search
|
|
202
|
+
math (Okapi scoring, field-tier bonuses, ordering) moves behind one pure
|
|
203
|
+
entry point with `Store#search_ranked` keeping its exact contract; the
|
|
204
|
+
dead backward-compat hash branch is dropped.
|
|
205
|
+
- **Preview truncation markers single-homed in Truncator (#402):** six
|
|
206
|
+
modules carrying three drifting marker spellings delegate to new
|
|
207
|
+
`clip`/`clip_line` homes with byte-for-byte legacy output pinned.
|
|
208
|
+
- **Questioner poll replaced with a condition variable (#434):** the 100 ms
|
|
209
|
+
answer poll becomes an unsynchronized-free condition-variable wake, the
|
|
210
|
+
lifecycle repair tool's `execute` splits into discover/verify/promote
|
|
211
|
+
phases (#435), and plugin/overlay integrity records share one manifest
|
|
212
|
+
store (#436).
|
|
213
|
+
- **Parallel-stable test gate (#417):** `rake test:parallel:stable` and
|
|
214
|
+
`rake test:stable` select the timing-insensitive subset (383 of 404
|
|
215
|
+
unit files), parallel runs export `RUBIK_TEST_PERF_RELAX=1` so the
|
|
216
|
+
wall-clock budgets degrade to report-only warns, and bounded `wait_until`
|
|
217
|
+
waits replace raw sleeps — closing #384.
|
|
218
|
+
- **Toolchain bumps (#420, #422):** `tree_sitter_language_pack` 1.25.0
|
|
219
|
+
(with the ZigWalker teaching both grammar spellings across the pack
|
|
220
|
+
range) and `prism` 2.1.0.
|
|
221
|
+
- **Reference docs refreshed (#433):** `RUBIK_TRUST_WORKSPACE` and
|
|
222
|
+
`RUBIK_TEST_ROOT` join the environment table, and a stray duplicated
|
|
223
|
+
0.7.1 changelog block is removed.
|
|
224
|
+
|
|
225
|
+
### Fixed
|
|
226
|
+
|
|
227
|
+
- **MCP stdio spawn hygiene (#424):** stdio servers no longer inherit the
|
|
228
|
+
host bundler/Ruby runtime variables; the LSP scrub single-homes as
|
|
229
|
+
`Rubik::Platform.sanitized_spawn_env` with explicitly configured `env:`
|
|
230
|
+
entries merging on top and winning.
|
|
231
|
+
- **Overlay integrity comparisons (#431):** overlay manifest hashes are
|
|
232
|
+
compared in constant time via the same `secure_compare` helper the
|
|
233
|
+
plugin packages already used.
|
|
234
|
+
- **Probe-shape tokenization fails closed (#430):** a quote-corrupted
|
|
235
|
+
command can no longer tokenize as a read-only probe and ride the
|
|
236
|
+
safe-probe exemption; the fallback yields nil and the gate denies.
|
|
237
|
+
- **TaskManager guard fallback and adapter sink validation (#410):** a
|
|
238
|
+
TaskManager constructed without a Guard falls back to a fresh fail-closed
|
|
239
|
+
one, and custom test/format adapter commands are validated through the
|
|
240
|
+
guard at execution sinks, closing the promotion TOCTOU.
|
|
241
|
+
- **Default overlay command wrap sealed (#412):** bare-body overlay
|
|
242
|
+
commands wrap into a sealed 2-arity handler on the deny-list path, and
|
|
243
|
+
the arity-3 raw-shell trust model is documented at both sites.
|
|
244
|
+
- **Boot-time config warnings surfaced (#411):** accumulated config
|
|
245
|
+
warnings print once per boot through the REPL notices seam with a
|
|
246
|
+
mirrored stderr `Log.warn`, and `RETIRED_KEYS` emits the tailored
|
|
247
|
+
`network.allow` deprecation.
|
|
248
|
+
- **Dispatcher failure logs carry the error class (#432)** so a subscriber
|
|
249
|
+
or dmesg failure says what failed, not just that it failed.
|
|
250
|
+
- **Bare rescues narrowed, LSP handshake failure logged (#400):** five
|
|
251
|
+
bare `rescue` clauses no longer swallow Ctrl-C, and `Client#start`
|
|
252
|
+
emits the handshake failure cause before stopping.
|
|
253
|
+
- **test-unit `omit` swapped for minitest `skip` (#416):** all 18
|
|
254
|
+
capability-guarded call sites would have raised `NoMethodError` the
|
|
255
|
+
moment their guard fired; now they skip.
|
|
10
256
|
|
|
11
257
|
## [0.9.0] - 2026-11-09
|
|
12
258
|
|
|
@@ -265,47 +511,6 @@ anyway.
|
|
|
265
511
|
class; the mapping is byte-identical (backslash doubles, pipe gains a
|
|
266
512
|
backslash) and truncation can no longer split an escape sequence.
|
|
267
513
|
|
|
268
|
-
## [0.7.1] - 2026-11-04
|
|
269
|
-
the RECALL_* policy constants moved out of the Harness thread core into
|
|
270
|
-
a pure Recall module - Harness#recall is now a one-line delegate, the
|
|
271
|
-
verbatim first_body_line duplication between Harness and Orientation is
|
|
272
|
-
gone, and Orientation/DistillGate no longer reach into Harness constants.
|
|
273
|
-
|
|
274
|
-
- **Tool-output normalization single-homed:** the root StepExecutor and the
|
|
275
|
-
subagent ToolDispatch each carried a private copy of the carrier
|
|
276
|
-
classification (Result / status-duck / raw string), the error-prefix
|
|
277
|
-
lexicon and the truncation-knob fetch. Both planes now delegate to
|
|
278
|
-
`Rubik::Tools::ResultNormalizer`; the parity suite stays as anti-drift
|
|
279
|
-
insurance and a non-fetchable config object now warns once instead of
|
|
280
|
-
silently dropping operator-set truncation limits. Subagent-plane edge
|
|
281
|
-
cases (blank error first line, error?/failed? precedence) unified onto
|
|
282
|
-
the root behavior, pinned by tests.
|
|
283
|
-
|
|
284
|
-
- **Tool plane membership declared on the tool:** ScopedRegistry's
|
|
285
|
-
hand-maintained `ROOT_ONLY_TOOLS` / `BUFFER_BOUND_TOOLS` name lists now
|
|
286
|
-
project from the tools' own `Declaration`s (`root_only:`, `buffer_bound:`)
|
|
287
|
-
via `Catalog` — the same declaration→projection pattern the archetype
|
|
288
|
-
allowlists, spawn set, write gate and maestro gate already use.
|
|
289
|
-
|
|
290
|
-
### Fixed
|
|
291
|
-
|
|
292
|
-
- **Strict typed schema enforcement:** `Config#set`, `Scoped#set`, and
|
|
293
|
-
`Scoped` constructor overrides now reject values that violate
|
|
294
|
-
`Schema::DEFINITIONS` (previously the validation result was ignored —
|
|
295
|
-
e.g. `set("agent.max_steps", 0)` was silently accepted). The per-key
|
|
296
|
-
prompt-grace escape hatch is gone; the schema is the single validation
|
|
297
|
-
authority, including whole-section writes (nested leaves are coerced
|
|
298
|
-
first) and boot-time merged-tree validation. The stale
|
|
299
|
-
`buffer.auto_apply` enum gained the documented `on_test`/`on_finish`
|
|
300
|
-
modes, `sandbox.driver` became free-form (the driver registry is
|
|
301
|
-
plugin-extensible), and `tools.call_timeout` accepts `0` as its
|
|
302
|
-
documented off value.
|
|
303
|
-
- **Phantom legacy env mappings removed:** six `LEGACY_MAP` entries pointed
|
|
304
|
-
at config keys no consumer reads (their real consumers read ENV
|
|
305
|
-
directly), so their deprecation advice was false and the mapped values
|
|
306
|
-
tripped "Unknown config key" warnings. Only config-backed legacy
|
|
307
|
-
variables remain.
|
|
308
|
-
|
|
309
514
|
## [0.7.1] - 2026-11-04
|
|
310
515
|
|
|
311
516
|
An LSP maturity patch: the language-server integration comes back from
|
|
@@ -1465,7 +1670,9 @@ installation section.
|
|
|
1465
1670
|
- Context: serialized index mutations, snapshot-outside-lock reconcile,
|
|
1466
1671
|
streaming-first truncation.
|
|
1467
1672
|
|
|
1468
|
-
[Unreleased]: https://github.com/ozgurulukir/rubik/compare/v0.
|
|
1673
|
+
[Unreleased]: https://github.com/ozgurulukir/rubik/compare/v0.10.0...HEAD
|
|
1674
|
+
[0.10.0]: https://github.com/ozgurulukir/rubik/compare/v0.9.1...v0.10.0
|
|
1675
|
+
[0.9.1]: https://github.com/ozgurulukir/rubik/compare/v0.9.0...v0.9.1
|
|
1469
1676
|
[0.9.0]: https://github.com/ozgurulukir/rubik/compare/v0.8.1...v0.9.0
|
|
1470
1677
|
[0.8.1]: https://github.com/ozgurulukir/rubik/compare/v0.8.0...v0.8.1
|
|
1471
1678
|
[0.8.0]: https://github.com/ozgurulukir/rubik/compare/v0.7.1...v0.8.0
|
data/README.md
CHANGED
|
@@ -125,7 +125,11 @@ a dependency from source; see the [installation guide](docs/how-to/installation.
|
|
|
125
125
|
12. **Extensions · MCP servers.** Connect external stdio servers and expose
|
|
126
126
|
discovered tools through Rubik's registry. Lifecycle cleanup removes proxy
|
|
127
127
|
tools and attempts to stop child processes when the server is disconnected.
|
|
128
|
-
|
|
128
|
+
Spawn commands pass the same Guard gate as agent commands; servers inherit
|
|
129
|
+
the host environment (minus bundler/Ruby runtime variables) by default, and
|
|
130
|
+
a per-server `inherit_env: false` opts out of forwarding credential-shaped
|
|
131
|
+
variables. See [MCP commands](docs/reference/commands.md) and the
|
|
132
|
+
[environment reference](docs/reference/environment.md).
|
|
129
133
|
13. **Recovery · Live service repair.** Inspect runtime state, verify a
|
|
130
134
|
replacement command in a disposable context, then promote it without
|
|
131
135
|
restarting the process. Failed promotion or persistence unwinds session
|
data/lib/rubik/adapter/base.rb
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
require "shellwords"
|
|
4
4
|
require_relative "process"
|
|
5
|
+
require_relative "../storage/layout"
|
|
5
6
|
require_relative "../platform"
|
|
6
7
|
require_relative "../runtime/discovery"
|
|
7
8
|
require_relative "../runtime/diagnostic_engine"
|
|
9
|
+
require_relative "../security/guard" unless defined?(Rubik::Security::Guard)
|
|
8
10
|
|
|
9
11
|
module Rubik
|
|
10
12
|
module Adapter
|
|
@@ -61,7 +63,7 @@ module Rubik
|
|
|
61
63
|
return unavailable_result(reason: reason)
|
|
62
64
|
end
|
|
63
65
|
|
|
64
|
-
eff_timeout = (timeout || (@config
|
|
66
|
+
eff_timeout = (timeout || Rubik::Storage::Layout.config_get(@config, "test.timeout", 30) || 30).to_i
|
|
65
67
|
work_dir = test_working_dir(root_dir, path)
|
|
66
68
|
res = ProcessRunner.run(cmd, timeout: eff_timeout, chdir: work_dir)
|
|
67
69
|
|
|
@@ -107,6 +109,7 @@ module Rubik
|
|
|
107
109
|
|
|
108
110
|
def resolve_test_cmd(root_dir = Dir.pwd, path: nil)
|
|
109
111
|
base = if @custom_test_cmd && !@custom_test_cmd.strip.empty?
|
|
112
|
+
validate_custom_command!(@custom_test_cmd)
|
|
110
113
|
@custom_test_cmd
|
|
111
114
|
else
|
|
112
115
|
discovered = if @config
|
|
@@ -135,6 +138,7 @@ module Rubik
|
|
|
135
138
|
|
|
136
139
|
def resolve_format_cmd(file_path)
|
|
137
140
|
if @custom_format_cmd && !@custom_format_cmd.strip.empty?
|
|
141
|
+
validate_custom_command!(@custom_format_cmd)
|
|
138
142
|
if @custom_format_cmd.include?("%s")
|
|
139
143
|
format(@custom_format_cmd, Shellwords.escape(file_path))
|
|
140
144
|
else
|
|
@@ -152,6 +156,22 @@ module Rubik
|
|
|
152
156
|
|
|
153
157
|
protected
|
|
154
158
|
|
|
159
|
+
# Validate a custom command string through the Security::Guard before it
|
|
160
|
+
# is ever interpolated into a shell string or executed. These commands
|
|
161
|
+
# are operator-supplied arbitrary shell commands; running them without
|
|
162
|
+
# classification is the exact RCE surface the adapters used to expose.
|
|
163
|
+
# Fail-closed: an unclassifiable or dangerous string raises
|
|
164
|
+
# BlockedWriteError rather than running. A subclass may pre-seed
|
|
165
|
+
# @validation_guard with the shared session guard (operator policy);
|
|
166
|
+
# the fresh fallback (silent audit, zero policy) serves standalone/test
|
|
167
|
+
# constructions only.
|
|
168
|
+
def validate_custom_command!(cmd_str, shell: nil)
|
|
169
|
+
return true if cmd_str.nil? || cmd_str.to_s.strip.empty?
|
|
170
|
+
|
|
171
|
+
(@validation_guard ||= Rubik::Security::Guard.new(audit_log_path: nil)).verify_command_safety!(cmd_str, shell: shell)
|
|
172
|
+
true
|
|
173
|
+
end
|
|
174
|
+
|
|
155
175
|
def default_test_cmd
|
|
156
176
|
nil
|
|
157
177
|
end
|
|
@@ -32,20 +32,6 @@ module Rubik
|
|
|
32
32
|
@custom_syntax_cmd = syntax_cmd
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# Validate a custom command string through the Security::Guard before it
|
|
36
|
-
# is ever executed. These commands are operator-supplied arbitrary shell
|
|
37
|
-
# commands; running them without classification is the exact RCE surface
|
|
38
|
-
# this adapter used to expose. Fail-closed: an unclassifiable or dangerous
|
|
39
|
-
# string raises BlockedWriteError rather than running. The injected
|
|
40
|
-
# session guard carries operator policy; the fresh fallback (silent
|
|
41
|
-
# audit, zero policy) serves standalone/test constructions only.
|
|
42
|
-
def validate_custom_command!(cmd_str, shell: nil)
|
|
43
|
-
return true if cmd_str.nil? || cmd_str.to_s.strip.empty?
|
|
44
|
-
|
|
45
|
-
(@validation_guard ||= Rubik::Security::Guard.new(audit_log_path: nil)).verify_command_safety!(cmd_str, shell: shell)
|
|
46
|
-
true
|
|
47
|
-
end
|
|
48
|
-
|
|
49
35
|
def available?
|
|
50
36
|
Runtime::Discovery.binary_available?(@binary_name)
|
|
51
37
|
end
|
data/lib/rubik/adapter/node.rb
CHANGED
|
@@ -19,6 +19,7 @@ module Rubik
|
|
|
19
19
|
|
|
20
20
|
def resolve_test_cmd(root_dir = Dir.pwd, path: nil)
|
|
21
21
|
base = if @custom_test_cmd && !@custom_test_cmd.strip.empty?
|
|
22
|
+
validate_custom_command!(@custom_test_cmd)
|
|
22
23
|
@custom_test_cmd
|
|
23
24
|
else
|
|
24
25
|
base_node_test_cmd(root_dir)
|
|
@@ -99,6 +100,7 @@ module Rubik
|
|
|
99
100
|
|
|
100
101
|
def resolve_format_cmd(file_path)
|
|
101
102
|
if @custom_format_cmd && !@custom_format_cmd.strip.empty?
|
|
103
|
+
validate_custom_command!(@custom_format_cmd)
|
|
102
104
|
if @custom_format_cmd.include?("%s")
|
|
103
105
|
format(@custom_format_cmd, Shellwords.escape(file_path))
|
|
104
106
|
else
|
|
@@ -1,79 +1,40 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
require "timeout"
|
|
5
|
-
require_relative "../log"
|
|
3
|
+
require_relative "../platform"
|
|
6
4
|
|
|
7
5
|
module Rubik
|
|
8
6
|
module Adapter
|
|
7
|
+
# Adapter-facing wrapper over the single-homed popen3 + drain core,
|
|
8
|
+
# Rubik::Platform::Process#popen_capture (issue #444). Preserves the
|
|
9
|
+
# legacy result contract exactly: no :pid key, and every swallowed IO
|
|
10
|
+
# error keeps its historical Log.debug(:adapter) trace via the observer
|
|
11
|
+
# below (event names mirror the platform core's swallow points).
|
|
9
12
|
class ProcessRunner
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
stdin.close
|
|
23
|
-
rescue StandardError => e
|
|
24
|
-
Rubik::Log.debug(:adapter, "stdin close failed during process execution: #{e.class}: #{e.message}")
|
|
25
|
-
end
|
|
26
|
-
t_out = Thread.new do
|
|
27
|
-
stdout.read
|
|
28
|
-
rescue StandardError => e
|
|
29
|
-
Rubik::Log.debug(:adapter, "stdout read failed during process execution: #{e.class}: #{e.message}")
|
|
30
|
-
""
|
|
31
|
-
end
|
|
32
|
-
t_err = Thread.new do
|
|
33
|
-
stderr.read
|
|
34
|
-
rescue StandardError => e
|
|
35
|
-
Rubik::Log.debug(:adapter, "stderr read failed during process execution: #{e.class}: #{e.message}")
|
|
36
|
-
""
|
|
37
|
-
end
|
|
38
|
-
begin
|
|
39
|
-
stdout_str = t_out.value.to_s
|
|
40
|
-
stderr_str = t_err.value.to_s
|
|
41
|
-
status = wait_thr.value
|
|
42
|
-
exit_code = status.exitstatus || (status.signaled? ? (128 + (status.termsig || 1)) : 1)
|
|
43
|
-
ensure
|
|
44
|
-
begin
|
|
45
|
-
t_out.kill
|
|
46
|
-
rescue StandardError => e
|
|
47
|
-
Rubik::Log.debug(:adapter, "t_out kill failed: #{e.class}: #{e.message}")
|
|
48
|
-
end
|
|
49
|
-
begin
|
|
50
|
-
t_err.kill
|
|
51
|
-
rescue StandardError => e
|
|
52
|
-
Rubik::Log.debug(:adapter, "t_err kill failed: #{e.class}: #{e.message}")
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
rescue Timeout::Error
|
|
58
|
-
Rubik::Platform.kill_tree(pid) if pid
|
|
59
|
-
stderr_str = "Execution timed out after #{timeout} seconds"
|
|
60
|
-
exit_code = 124
|
|
61
|
-
rescue Errno::ENOENT => e
|
|
62
|
-
stderr_str = "Binary not found: #{e.message}"
|
|
63
|
-
exit_code = 127
|
|
64
|
-
rescue StandardError => e
|
|
65
|
-
stderr_str = "Execution error: #{e.message}"
|
|
66
|
-
exit_code = 1
|
|
13
|
+
ON_IO_ERROR = lambda do |event, error|
|
|
14
|
+
case event
|
|
15
|
+
when :stdin_close
|
|
16
|
+
Rubik::Log.debug(:adapter, "stdin close failed during process execution: #{error.class}: #{error.message}")
|
|
17
|
+
when :stdout_read
|
|
18
|
+
Rubik::Log.debug(:adapter, "stdout read failed during process execution: #{error.class}: #{error.message}")
|
|
19
|
+
when :stderr_read
|
|
20
|
+
Rubik::Log.debug(:adapter, "stderr read failed during process execution: #{error.class}: #{error.message}")
|
|
21
|
+
when :stdout_kill
|
|
22
|
+
Rubik::Log.debug(:adapter, "t_out kill failed: #{error.class}: #{error.message}")
|
|
23
|
+
when :stderr_kill
|
|
24
|
+
Rubik::Log.debug(:adapter, "t_err kill failed: #{error.class}: #{error.message}")
|
|
67
25
|
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.run(cmd, timeout: 15, chdir: Dir.pwd)
|
|
29
|
+
result = Rubik::Platform.popen_capture(cmd, timeout: timeout, chdir: chdir, on_io_error: ON_IO_ERROR)
|
|
68
30
|
|
|
69
|
-
duration = Time.now - start_time
|
|
70
31
|
{
|
|
71
|
-
ok:
|
|
72
|
-
exit_code: exit_code,
|
|
73
|
-
stdout:
|
|
74
|
-
stderr:
|
|
75
|
-
output: [
|
|
76
|
-
duration: duration
|
|
32
|
+
ok: result[:ok],
|
|
33
|
+
exit_code: result[:exit_code],
|
|
34
|
+
stdout: result[:stdout],
|
|
35
|
+
stderr: result[:stderr],
|
|
36
|
+
output: result[:output],
|
|
37
|
+
duration: result[:duration]
|
|
77
38
|
}
|
|
78
39
|
end
|
|
79
40
|
end
|
|
@@ -6,9 +6,22 @@ module Rubik
|
|
|
6
6
|
module AST
|
|
7
7
|
module TreeSitter
|
|
8
8
|
class ZigWalker < BaseWalker
|
|
9
|
-
|
|
9
|
+
# Zig grammar node kinds vary by grammar version: the pre-1.25
|
|
10
|
+
# tree_sitter_language_pack grammar used Decl/FnProto/ProtoDecl/
|
|
11
|
+
# FunctionDecl/function_definition; 1.25+ (official tree-sitter-zig)
|
|
12
|
+
# uses function_declaration. Keep every known spelling so the walker
|
|
13
|
+
# works across the supported pack range.
|
|
14
|
+
FN_KINDS = ["FnProto", "ProtoDecl", "FunctionDecl", "function_definition",
|
|
15
|
+
"function_declaration"].freeze
|
|
10
16
|
private_constant :FN_KINDS
|
|
11
17
|
|
|
18
|
+
# Top-level declaration kinds per grammar version: pre-1.25 exposed a
|
|
19
|
+
# single "Decl" node; 1.25+ splits into variable_declaration and
|
|
20
|
+
# function_declaration (struct/enum containers are regex-matched in
|
|
21
|
+
# walk_decl off the variable_declaration text).
|
|
22
|
+
DECL_KINDS = ["Decl", "variable_declaration", "function_declaration"].freeze
|
|
23
|
+
private_constant :DECL_KINDS
|
|
24
|
+
|
|
12
25
|
def walk(root_node)
|
|
13
26
|
symbols = []
|
|
14
27
|
return symbols unless root_node
|
|
@@ -59,7 +72,7 @@ module Rubik
|
|
|
59
72
|
(0...node.named_child_count).each do |i|
|
|
60
73
|
child = node.named_child(i)
|
|
61
74
|
case child.kind
|
|
62
|
-
when
|
|
75
|
+
when *DECL_KINDS
|
|
63
76
|
walk_decl(child, symbols)
|
|
64
77
|
else
|
|
65
78
|
walk_children(child, symbols, depth: depth + 1)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "tmpdir"
|
|
4
4
|
require "fileutils"
|
|
5
|
+
require_relative "../errors"
|
|
5
6
|
require_relative "../storage/vakanuvis"
|
|
6
7
|
require_relative "../tools/builtins/storage"
|
|
7
8
|
require_relative "../tools/builtins/vakanuvis"
|
|
@@ -82,6 +83,12 @@ module Rubik
|
|
|
82
83
|
MAX_TURNS = 8
|
|
83
84
|
REPLAY_PROFILES = ["adopter", "wrong-path", "struggler"].freeze
|
|
84
85
|
|
|
86
|
+
# Bench-integrity contract (issue #448): a driver returning a
|
|
87
|
+
# non-Response, or toolbelt errors leaking into the measurement plane,
|
|
88
|
+
# is a broken harness — never model behavior. Typed so callers (and
|
|
89
|
+
# rake bench) can distinguish it from ordinary StandardError noise.
|
|
90
|
+
class BenchError < Rubik::Error; end
|
|
91
|
+
|
|
85
92
|
module_function
|
|
86
93
|
|
|
87
94
|
# ---- mağaza + araç masası ---------------------------------------------
|
|
@@ -198,7 +205,7 @@ module Rubik
|
|
|
198
205
|
# dönüş, respond_to? zincirlerine girip sahte "araç
|
|
199
206
|
# benimsemedi / tur sınırına vurdu" veri noktası üretmesin —
|
|
200
207
|
# dürüstçe patla.
|
|
201
|
-
raise "provider returned #{res.inspect}, expected Rubik::LLM::Response" unless res.is_a?(Rubik::LLM::Response)
|
|
208
|
+
raise BenchError, "provider returned #{res.inspect}, expected Rubik::LLM::Response" unless res.is_a?(Rubik::LLM::Response)
|
|
202
209
|
|
|
203
210
|
tool_calls = res.respond_to?(:tool_calls?) && res.tool_calls? ? res.tool_calls : []
|
|
204
211
|
if tool_calls.empty?
|
|
@@ -315,8 +322,8 @@ module Rubik
|
|
|
315
322
|
tool_errors = runs.sum { |r| r[:calls].count { |_n, _a, res| TOOL_ERROR_MARKERS.any? { |m| res.to_s.start_with?(m) } } }
|
|
316
323
|
if tool_errors.positive?
|
|
317
324
|
first_bad = runs.flat_map { |r| r[:calls] }.find { |_n, _a, res| TOOL_ERROR_MARKERS.any? { |m| res.to_s.start_with?(m) } }
|
|
318
|
-
raise "#{driver.label}: #{tool_errors} tool error(s) — the bench toolbelt itself failed; " \
|
|
319
|
-
|
|
325
|
+
raise BenchError, "#{driver.label}: #{tool_errors} tool error(s) — the bench toolbelt itself failed; " \
|
|
326
|
+
"these numbers would read as model behavior. first: #{first_bad[2].to_s[0, 160]}"
|
|
320
327
|
end
|
|
321
328
|
harness.shutdown
|
|
322
329
|
metrics_for(driver.label, runs).tap { |m| io&.puts(" [vakanuvis-adoption] #{m.label}: #{m.summary}") }
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require_relative "../storage/layout"
|
|
4
|
+
|
|
3
5
|
module Rubik
|
|
4
6
|
module Buffer
|
|
5
7
|
# The one home for the apply CONTRACT vocabulary (issue #146):
|
|
@@ -19,9 +21,7 @@ module Rubik
|
|
|
19
21
|
# documented default (true).
|
|
20
22
|
def model_can_apply?(shell_config:, manager_config:)
|
|
21
23
|
cfg = shell_config || manager_config
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
cfg.fetch("buffer.model_can_apply", true) != false
|
|
24
|
+
Rubik::Storage::Layout.config_get(cfg, "buffer.model_can_apply", true) != false
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# Partial-apply report lines. `sync` (when given) receives the applied
|