Commit Graph
2 Commits
Author SHA1 Message Date
bterkuileandClaude Sonnet 5 bde6df57f4 Counter/Lock: Redis INCR parity and safe lock release
- Counter#increment now seeds a missing key at the delta (Redis INCR/INCRBY
  semantics). Couchbase's native increment seeds at 'initial' and ignores the
  delta on creation, so the first INCR returned 0 — a drop-in replacement that
  silently undercounts by one is exactly the kind of bug nobody ever finds.
  Explicit initial: still overrides. Decrement keeps initial: 0 and its
  unsigned clamp-at-zero divergence from Redis is now documented and tested.
- Lock#release requires the CAS handle: passing nil used to delete the lock
  document unconditionally, so any caller could unlock a lock it never held.
  force_release! is the explicit administrative override.
- Lock#acquire validates a positive ttl — a nil/zero ttl would create a lock
  that survives its holder's crash forever.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-06 18:42:17 -05:00
GregandClaude Opus 4.8 86299b8827 SimplyBased 0.1.0 — Couchbase-native ActiveModel ORM
A from-scratch fork of simply_couch's model layer that runs on Couchbase
natively: `include SimplyBased::Model` instead of `include SimplyCouch::Model`.

- SimplyBased::Store replaces the CouchDB layer: KV documents, N1QL/SQL++
  finders + lazily-created GSIs, CAS mapped onto _rev. No design documents or
  JavaScript map/reduce — the hand-written association views become N1QL
  (belongs_to/has_many/has_one scalar FK; habtm via ANY ... SATISFIES + array
  index, or KV multi-get on the storing side).
- Redis replacements on the same cluster: Counter (atomic increment/decrement),
  Cache (ActiveSupport::Cache::Store over KV+TTL, drop-in Rails.cache/ActiveJob),
  Lock (insert-if-absent + TTL + CAS-checked release).
- Runs the simply_couch test suite against live Couchbase: 378/432 applicable
  examples green (CouchDB-mechanic specs tagged :couchdb_only and excluded).
- Remaining: ancestry (tree) + embedded_in reverse-lookups (recursive/embedded
  N1QL) and a few pagination/lifecycle edges.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 13:58:47 -05:00