feat: InMemoryGraphAdapter (MEM-ADAPTER, v10.7.0)#24
Conversation
📝 WalkthroughWalkthroughAdds a new in-memory GraphPersistencePort implementation, a shared adapter validation module, refactors GitGraphAdapter to use the validators, and introduces a conformance test suite plus helpers and tests; package, changelog, and roadmap updated for v10.7.0. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
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. Comment |
Release Preflight
If you tag this commit as |
…perf, format naming (v10.7.0)
|
@coderabbitai review please |
|
✅ Actions performedReview triggered.
|
Release Preflight
If you tag this commit as |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/infrastructure/adapters/InMemoryGraphAdapter.js`:
- Around line 446-475: The _walkLog implementation currently uses BFS which can
produce non-chronological order for DAGs with merge commits; update _walkLog (in
InMemoryGraphAdapter.js) to ensure returned entries are in reverse chronological
order by sorting the collected result by the commit date (commit.date)
descending before returning, or alternatively add a conformance test
(logNodesStream in AdapterConformance.js) that constructs a merge commit DAG and
asserts reverse-chronological ordering to catch mismatches across adapters; pick
one approach—either sort result by date descending in _walkLog or add the
merge-commit test in AdapterConformance.js to validate behavior across adapters.
🧹 Nitpick comments (1)
src/infrastructure/adapters/InMemoryGraphAdapter.js (1)
345-348: Subtle:||vs??forreadRefreturn.Line 347 uses
|| null, which would coerce a stored empty-string value tonull. This is safe becauseupdateRefvalidates the OID (which can't be empty), but it's inconsistent withconfigGet(line 382) which correctly uses?? null. Consider aligning for consistency and resilience against future changes.♻️ Align with `configGet` pattern
async readRef(ref) { validateRef(ref); - return this._refs.get(ref) || null; + return this._refs.get(ref) ?? null; }
|
@coderabbitai review please |
|
✅ Actions performedReview triggered.
|
Release Preflight
If you tag this commit as |
|
@coderabbitai review please |
|
✅ Actions performedReview triggered.
|
|
@coderabbitai review please |
|
✅ Actions performedReview triggered.
|
Summary
InMemoryGraphAdapter: Full in-memory implementation of all 5 ports (Commit, Blob, Tree, Ref, Config) with Git-format SHA-1 hashing. Acceptsauthorandclockinjection for deterministic tests.adapterValidation.js: Extracted shared validation (validateOid,validateRef,validateLimit,validateConfigKey) from GitGraphAdapter — both adapters now use identical rules.createInMemoryRepo()test helper for instant zero-I/O adapter setup.Test plan
npm run lint— cleannpm run test:local— 3277 tests pass (159 files)Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Tests
Chores