legion-data 1.7.3 → 1.7.4
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/.pre-commit-config.yaml +29 -0
- data/CHANGELOG.md +10 -0
- data/README.md +23 -5
- data/lib/legion/data/connection.rb +3 -1
- data/lib/legion/data/version.rb +1 -1
- data/scripts/pre-commit-rubocop.sh +16 -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: b562a2c2ce70e81d1b71038255dd8a23a34fc78805acadc34da983dc995b2690
|
|
4
|
+
data.tar.gz: ae6cb3c93f9498b9f16df5294c3a9ce871a47723da87933c7ae5ac48b2fcf4cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ec953bd837aa49a737584ea20c8668eb35156953593584297fc80edca0d9c7b7594a55b91976006a572b7521b797e44310d7244c4055683b5cf6c673bcddd8fd
|
|
7
|
+
data.tar.gz: 750707075046c2b09edbd5a0f8bca49059e3b60bf6707fe0ffdb694b54df868e358a308d7e86fbbaf1b1e5c005a797517edde17cfdcf0782d9338532c067d460
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Standard LegionIO pre-commit configuration
|
|
2
|
+
# Install: pre-commit install
|
|
3
|
+
# Manual: pre-commit run --all-files
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: v5.0.0
|
|
7
|
+
hooks:
|
|
8
|
+
- id: trailing-whitespace
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: check-yaml
|
|
11
|
+
- id: check-json
|
|
12
|
+
exclude: Gemfile\.lock
|
|
13
|
+
- id: check-merge-conflict
|
|
14
|
+
|
|
15
|
+
- repo: local
|
|
16
|
+
hooks:
|
|
17
|
+
- id: rubocop
|
|
18
|
+
name: RuboCop (autofix)
|
|
19
|
+
entry: scripts/pre-commit-rubocop.sh
|
|
20
|
+
language: script
|
|
21
|
+
types: [ruby]
|
|
22
|
+
pass_filenames: true
|
|
23
|
+
|
|
24
|
+
- id: ruby-syntax
|
|
25
|
+
name: Ruby syntax check
|
|
26
|
+
entry: bash -c 'status=0; for file in "$@"; do ruby -c "$file" || status=$?; done; exit $status' --
|
|
27
|
+
language: system
|
|
28
|
+
types: [ruby]
|
|
29
|
+
pass_filenames: true
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.7.4] - 2026-04-28
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Pre-commit RuboCop hook now distinguishes missing tools from real RuboCop failures and propagates failures instead of silently passing.
|
|
9
|
+
- Ruby syntax pre-commit hook now checks every staged Ruby file instead of only the first argument.
|
|
10
|
+
- Connection setup now refreshes the configured adapter before each setup call and clears fallback state on shutdown so fallback health checks do not stay stale across reconnects.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- README refreshed for the current migration count, version line, fallback diagnostics, pre-commit workflow, and recent model surface.
|
|
14
|
+
|
|
5
15
|
## [1.7.3] - 2026-04-27
|
|
6
16
|
|
|
7
17
|
### Added
|
data/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# legion-data
|
|
2
2
|
|
|
3
|
-
Persistent database storage for the [LegionIO](https://github.com/LegionIO/LegionIO) async job engine and AI coding assistant platform. Provides database connectivity via the [Sequel ORM](https://sequel.jeremyevans.net/), automatic schema migrations (
|
|
3
|
+
Persistent database storage for the [LegionIO](https://github.com/LegionIO/LegionIO) async job engine and AI coding assistant platform. Provides database connectivity via the [Sequel ORM](https://sequel.jeremyevans.net/), automatic schema migrations (76 numbered migrations), Sequel models for the full LegionIO control plane, and a parallel local SQLite database for on-node agentic cognitive state.
|
|
4
4
|
|
|
5
|
-
**Version**: 1.
|
|
5
|
+
**Version**: 1.7.4 | **Ruby**: >= 3.4 | **License**: Apache-2.0
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -51,17 +51,19 @@ Legion::Data (singleton module)
|
|
|
51
51
|
│ ├── .adapter # Reads adapter from settings (:sqlite, :mysql2, :postgres)
|
|
52
52
|
│ ├── .setup # Establish connection (dev_mode fallback to SQLite if unreachable)
|
|
53
53
|
│ ├── .sequel # Raw Sequel::Database accessor
|
|
54
|
+
│ ├── .connection_info # Adapter, liveness, and fallback diagnostics
|
|
55
|
+
│ ├── .fallback_active? # True when dev fallback moved a network DB to SQLite
|
|
54
56
|
│ ├── .stats # Pool metrics, tuning snapshot, adapter-specific DB stats
|
|
55
57
|
│ └── .shutdown # Disconnect and close query file logger
|
|
56
58
|
│
|
|
57
|
-
├── Migration # Auto-migration system (
|
|
59
|
+
├── Migration # Auto-migration system (76 numbered Sequel DSL migrations)
|
|
58
60
|
│
|
|
59
61
|
├── Model # Sequel model autoloader
|
|
60
62
|
│ └── Models: Extension, Function, Runner, Node, Task, TaskLog, Setting,
|
|
61
63
|
│ DigitalWorker, Relationship, AuditLog, AuditRecord, Chain,
|
|
62
64
|
│ RbacRoleAssignment, RbacRunnerGrant, RbacCrossTeamGrant,
|
|
63
65
|
│ IdentityProvider, Principal, Identity, IdentityGroup,
|
|
64
|
-
│ IdentityGroupMembership,
|
|
66
|
+
│ IdentityGroupMembership, IdentityAuditLog,
|
|
65
67
|
│ ApolloEntry, ApolloRelation, ApolloExpertise, ApolloAccessLog (PG only)
|
|
66
68
|
│
|
|
67
69
|
├── Local # Parallel local SQLite for agentic cognitive state
|
|
@@ -117,6 +119,10 @@ Legion::Data.local.db_path # => "legionio_local.db"
|
|
|
117
119
|
Legion::Data.connected? # => true
|
|
118
120
|
Legion::Data.stats # => { shared: {...}, local: {...} }
|
|
119
121
|
|
|
122
|
+
# Inspect shared DB diagnostics, including dev fallback state
|
|
123
|
+
Legion::Data::Connection.connection_info
|
|
124
|
+
# => { adapter: :sqlite, connected: true, fallback_active: false, ... }
|
|
125
|
+
|
|
120
126
|
# Shut down both connections
|
|
121
127
|
Legion::Data.shutdown
|
|
122
128
|
```
|
|
@@ -314,6 +320,8 @@ When `dev_mode: true` and a network database is unreachable, the shared connecti
|
|
|
314
320
|
{ "data": { "dev_mode": true, "dev_fallback": true } }
|
|
315
321
|
```
|
|
316
322
|
|
|
323
|
+
Fallback is intentionally loud. `Connection.setup` logs the degraded mode at error level, `Connection.fallback_active?` returns `true`, and `Connection.connection_info` reports the configured adapter, actual adapter, connection state, and Sequel liveness. Data written during fallback is local-only SQLite data and will not appear in the configured network database after reconnect.
|
|
324
|
+
|
|
317
325
|
### HashiCorp Vault Integration
|
|
318
326
|
|
|
319
327
|
When Vault is connected, credentials are fetched dynamically from `database/creds/legion`, overriding any static `creds` block.
|
|
@@ -412,7 +420,8 @@ Apollo models require PostgreSQL with the `pgvector` extension. They are skipped
|
|
|
412
420
|
| 050 | Critical indexes across 13 tables |
|
|
413
421
|
| 058–067 | Audit records, chains, knowledge tiers, tool embedding cache, identity system (providers, principals, identities, groups) |
|
|
414
422
|
| 068–071 | Entity type on audit records, principal on nodes, approval queue resume, engine on relationships |
|
|
415
|
-
| 072–
|
|
423
|
+
| 072–073 | Identity audit log and multi-instance identity columns |
|
|
424
|
+
| 074–076 | Apollo field width fixes, task idempotency columns, and Extract step timing rows |
|
|
416
425
|
|
|
417
426
|
Run migrations standalone:
|
|
418
427
|
|
|
@@ -462,6 +471,15 @@ bundle exec rspec # all tests must pass
|
|
|
462
471
|
bundle exec rubocop -A # zero offenses expected
|
|
463
472
|
```
|
|
464
473
|
|
|
474
|
+
This repo also includes a pre-commit configuration:
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
pre-commit install
|
|
478
|
+
pre-commit run --all-files
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
The local RuboCop hook auto-corrects staged Ruby files when RuboCop is available and fails the commit when RuboCop reports real offenses. The Ruby syntax hook checks every staged Ruby file.
|
|
482
|
+
|
|
465
483
|
Follow the [LegionIO contribution guide](https://github.com/LegionIO/.github/blob/main/CONTRIBUTING.md). Open a PR against `main`.
|
|
466
484
|
|
|
467
485
|
---
|
|
@@ -161,6 +161,7 @@ module Legion
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
def setup
|
|
164
|
+
@adapter = Legion::Settings[:data][:adapter]&.to_sym || :sqlite
|
|
164
165
|
opts = sequel_opts
|
|
165
166
|
log.info("Legion::Data::Connection setup adapter=#{adapter}")
|
|
166
167
|
@fallback_active = false
|
|
@@ -173,7 +174,7 @@ module Legion
|
|
|
173
174
|
rescue StandardError => e
|
|
174
175
|
raise unless dev_fallback?
|
|
175
176
|
|
|
176
|
-
log.error("Legion::Data FALLING BACK TO SQLITE — #{attempted_adapter} connection failed: #{e.message}")
|
|
177
|
+
log.error("Legion::Data FALLING BACK TO SQLITE — #{attempted_adapter} network DB connection failed: #{e.message}")
|
|
177
178
|
log.error("Legion::Data WARNING: Data written to SQLite will NOT be visible when #{attempted_adapter} reconnects. " \
|
|
178
179
|
'Apollo knowledge, audit logs, and other DB-backed services will use a local-only store.')
|
|
179
180
|
handle_exception(e, level: :error, handled: true, operation: :shared_connect, fallback: :sqlite)
|
|
@@ -261,6 +262,7 @@ module Legion
|
|
|
261
262
|
@sequel&.disconnect
|
|
262
263
|
@query_file_logger&.close
|
|
263
264
|
@query_file_logger = nil
|
|
265
|
+
@fallback_active = false
|
|
264
266
|
Legion::Settings[:data][:connected] = false
|
|
265
267
|
log.info 'Legion::Data connection closed'
|
|
266
268
|
end
|
data/lib/legion/data/version.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Pre-commit hook: run RuboCop with autofix on staged Ruby files.
|
|
3
|
+
set -uo pipefail
|
|
4
|
+
|
|
5
|
+
FILES=("$@")
|
|
6
|
+
|
|
7
|
+
if command -v rubocop >/dev/null 2>&1; then
|
|
8
|
+
exec rubocop -A --force-exclusion "${FILES[@]}"
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
if bundle exec rubocop -v >/dev/null 2>&1; then
|
|
12
|
+
exec bundle exec rubocop -A --force-exclusion "${FILES[@]}"
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
echo "RuboCop is not available locally; CI will enforce RuboCop."
|
|
16
|
+
exit 0
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: legion-data
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Esity
|
|
@@ -107,6 +107,7 @@ files:
|
|
|
107
107
|
- ".github/dependabot.yml"
|
|
108
108
|
- ".github/workflows/ci.yml"
|
|
109
109
|
- ".gitignore"
|
|
110
|
+
- ".pre-commit-config.yaml"
|
|
110
111
|
- ".rubocop.yml"
|
|
111
112
|
- AGENTS.md
|
|
112
113
|
- CHANGELOG.md
|
|
@@ -257,6 +258,7 @@ files:
|
|
|
257
258
|
- lib/legion/data/storage_tiers.rb
|
|
258
259
|
- lib/legion/data/vector.rb
|
|
259
260
|
- lib/legion/data/version.rb
|
|
261
|
+
- scripts/pre-commit-rubocop.sh
|
|
260
262
|
homepage: https://github.com/LegionIO/legion-data
|
|
261
263
|
licenses:
|
|
262
264
|
- Apache-2.0
|