Skip to content

Preserve client metadata (supersedes #29) - #30

Merged
JarbasAl merged 4 commits into
devfrom
preserve-client-metadata
May 18, 2026
Merged

JarbasAl merged 4 commits into
devfrom
preserve-client-metadata

Conversation

@JarbasAl

Copy link
Copy Markdown
Member

Supersedes #29 by @goldyfruit — same Client.metadata persistence work, simplified for the released hivemind-plugin-manager>=0.5.0, with expanded tests.

Changes vs #29

  • Bumped hivemind-plugin-manager>=0.5.0,<1.0.0 — 0.5.0 ships Client.metadata, so runtime feature detection is no longer needed.
  • Removed CLIENT_SUPPORTS_METADATA runtime check and dual codepaths in _row_to_client / add_item. metadata is now a normal field.
  • Kept the ALTER TABLE clients ADD COLUMN metadata migration for backwards-compatible DB files.
  • Kept _metadata_to_json / _metadata_from_row helpers (real safety against garbage in the column).
  • Dropped @skipif(not CLIENT_SUPPORTS_METADATA, ...) markers.

Tests

45 passing (was 39). Metadata coverage now includes:

  • Round-trip through add_item / search_by_value / __iter__
  • Searching by JSON-encoded metadata value
  • Nested-dict and non-ASCII ("🚀", "Привет") round-trips
  • ALTER-TABLE migration from a pre-metadata clients table
  • Empty-dict default when no metadata kwarg passed
  • INSERT OR REPLACE overwrites metadata on same client_id
  • _metadata_to_json returns "{}" for non-dict (None, int, str)
  • _metadata_from_row coerces NULL / malformed JSON / non-object JSON to {}
  • Full-client-fields round trip including metadata

Safety

  • Not a destructive schema change — existing DB files get the metadata column added via ALTER TABLE on first open.
  • Forward-incompatible only in the rollback direction: old code reading a row with non-null metadata would just ignore the column.

Closes #29.

goldyfruit and others added 3 commits May 16, 2026 07:36
…ection

hivemind-plugin-manager 0.5.0 ships Client.metadata, so the
CLIENT_SUPPORTS_METADATA runtime detection and dual code paths are
dead code. Bump the dependency floor and always read/write metadata.

The schema migration (ALTER TABLE ... ADD COLUMN metadata) is kept
for backwards compatibility with DB files created by older versions.

Tests: drop feature-detection skips, add nested-dict and non-ASCII
metadata round-trip coverage.
- empty-dict default when no metadata kwarg
- INSERT OR REPLACE overwrites metadata on same client_id
- _metadata_to_json returns '{}' for non-dict inputs
- _metadata_from_row coerces NULL / malformed JSON / non-object JSON to {}
@coderabbitai

coderabbitai Bot commented May 18, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@JarbasAl has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 40 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 733729dc-7c95-4cfe-af26-9d18f757cccd

📥 Commits

Reviewing files that changed from the base of the PR and between 8e3402f and a7afc0e.

📒 Files selected for processing (10)
  • .github/workflows/build-tests.yml
  • .github/workflows/coverage.yml
  • .github/workflows/license_check.yml
  • .github/workflows/lint.yml
  • .github/workflows/pip_audit.yml
  • .github/workflows/release-preview.yml
  • .github/workflows/repo-health.yml
  • hivemind_sqlite_database/__init__.py
  • pyproject.toml
  • tests/test_sqlitedb.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch preserve-client-metadata

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JarbasAl JarbasAl mentioned this pull request May 18, 2026
@github-actions

github-actions Bot commented May 18, 2026 •

Copy link
Copy Markdown

Beep! Your PR results are served. 🍽️

I've aggregated the results of the automated checks for this PR below.

📋 Repo Health

Ensuring the repo's joints are well-oiled (aka CI/CD). ⚙️

✅ All required files present.

Latest Version: 0.3.0a1

✅ hivemind_sqlite_database/version.py — Version file
✅ README.md — README
✅ LICENSE.md — License file (consider renaming to LICENSE)
✅ pyproject.toml — pyproject.toml
⚠️ setup.py — setup.py
✅ CHANGELOG.md — Changelog
✅ hivemind_sqlite_database/version.py has valid version block markers

🔍 Lint

The automated gnomes have finished their shift. 🍄

✅ ruff: no issues

⚖️ License Check

Evaluating the impact of these changes on our licensing. 📈

✅ No license violations found (45 packages).

License distribution: 12× MIT License, 7× Apache-2.0, 6× MIT, 5× Apache Software License, 3× BSD-3-Clause, 2× ISC License (ISCL), 2× PSF-2.0, 1× Apache Software License; BSD License, +7 more

Full breakdown — 45 packages
Package Version License URL
bitarray 3.8.1 PSF-2.0 link
bitstring 4.4.0 MIT License link
build 1.5.0 MIT link
certifi 2026.4.22 Mozilla Public License 2.0 (MPL 2.0) link
cffi 2.0.0 MIT link
charset-normalizer 3.4.7 MIT link
click 8.4.0 BSD-3-Clause link
combo_lock 0.3.1 Apache-2.0 link
cryptography 48.0.0 Apache-2.0 OR BSD-3-Clause link
filelock 3.29.0 MIT link
hivemind-plugin-manager 0.5.0 Apache-2.0 link
hivemind-sqlite-database 0.3.0a1 Apache-2.0 link
hivemind_bus_client 0.4.4 Apache Software License link
idna 3.15 BSD-3-Clause link
json-database 0.10.1 MIT link
kthread 0.2.3 MIT License link
markdown-it-py 4.2.0 MIT License link
mdurl 0.1.2 MIT License link
memory-tempfile 2.2.3 MIT License link
ovos-bus-client 2.0.0a3 Apache Software License link
ovos-config 2.1.1 Apache-2.0 link
ovos-utils 0.8.5 Apache-2.0 link
packaging 26.2 Apache-2.0 OR BSD-2-Clause link
pexpect 4.9.0 ISC License (ISCL) link
poorman-handshake 1.0.1 Apache-2.0 link
ptyprocess 0.7.0 ISC License (ISCL) link
py-cpuinfo 9.0.0 MIT License link
pybase64 1.4.3 BSD License link
pycparser 3.0 BSD-3-Clause link
pycryptodomex 3.23.0 BSD License; Public Domain link
pyee 12.1.1 MIT License link
Pygments 2.20.0 BSD-2-Clause link
pyproject_hooks 1.2.0 MIT License link
python-dateutil 2.9.0.post0 Apache Software License; BSD License link
PyYAML 6.0.3 MIT License link
requests 2.34.2 Apache Software License link
rich 13.9.4 MIT License link
rich-click 1.9.7 MIT License

Copyright (c) 2022 Phil Ewels

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| link |
| six | 1.17.0 | MIT License | link |
| tibs | 0.5.7 | MIT License | link |
| typing_extensions | 4.15.0 | PSF-2.0 | link |
| urllib3 | 2.7.0 | MIT | link |
| watchdog | 6.0.0 | Apache Software License | link |
| websocket-client | 1.9.0 | Apache Software License | link |
| z85base91 | 0.0.5 | Apache-2.0 | link |

Policy: Apache 2.0 (universal donor). StrongCopyleft / NetworkCopyleft / WeakCopyleft / Other / Error categories fail. MPL allowed.

🔨 Build Tests

Verifying the structural soundness of your build. 🏗️

✅ All versions pass

Python Build Install Tests
3.10 ✅ ✅ ✅
3.11 ✅ ✅ ✅
3.12 ✅ ✅ ✅
3.13 ✅ ✅ ✅
3.14 ✅ ✅ ✅

🏷️ Release Preview

The release preview is now complete. 🏁

Current: 0.3.0a1 → Next: 0.3.0a2

Signal Value
Label (none)
PR title Preserve client metadata (supersedes #29)
Bump alpha

⚠️ No conventional commit prefix — alpha-only bump.
Suggested: fix: update the thing or feat: update the thing


🚀 Release Channel Compatibility

Predicted next version: 0.3.0a2

Channel Status Note Current Constraint
Stable ⚪ Not in channel -
Testing ⚪ Not in channel -
Alpha ✅ Compatible hivemind-sqlite-database>=0.2.1

📊 Coverage

Checking the structural integrity of our tests. 🏗️

✅ 84.1% total coverage

Per-file coverage (2 files)
File Coverage Missing lines
hivemind_sqlite_database/version.py 0.0% 5
hivemind_sqlite_database/__init__.py 88.2% 12

Full report: download the coverage-report artifact.

🔒 Security (pip-audit)

The security scan is now complete. 🏁

✅ No known vulnerabilities found (63 packages scanned).


Your friendly neighborhood bot 🕷️

- _metadata_to_json: document that default=str makes datetime/UUID
  insertable but they come back as strings (column is opaque JSON, not
  a typed map)
- _metadata_from_row: document the swallow-garbage rationale (one bad
  row mustn't break iteration)

No behavior change.
@JarbasAl
JarbasAl merged commit bbeb6d4 into dev May 18, 2026
16 checks passed
@JarbasAl
JarbasAl deleted the preserve-client-metadata branch May 18, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants