refactor mastra to object-based API (v2.0.0)#829
refactor mastra to object-based API (v2.0.0)#829sreedharsreeram wants to merge 5 commits intomainfrom
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | de31895 | Commit Preview URL | Apr 17 2026, 01:49 AM |
How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @Dhravya's task in 1m 33s —— View job Review Complete
Summary: This is a well-executed v2.0.0 refactor moving Mastra integration to an object-based API. One issue found: the Score: 9/10 |
There was a problem hiding this comment.
Overview: Refactors Mastra integration from positional arguments (containerTag, options) to a single object-based API with containerTag and conversationId as required properties.
Issues found: None — this looks good to ship.
Details:
- Clean API migration:
threadId→conversationId, both now required with proper validation - Input validation is thorough (checks empty strings, whitespace)
getEffectiveConversationIdstill supports fallback to Mastra'sRequestContextfor flexibility- Tests comprehensively updated to match new API
- No security concerns, no race conditions, no breaking logic changes
Score: 10/10
This is a well-executed breaking change with good validation and error messages. The object-based API is cleaner and more explicit about required parameters.
66b2183 to
090ad8f
Compare
Confidence Score: 3/5 - Review RecommendedNot safe to merge without review — while this PR successfully unifies the Mastra integration API and adds meaningful eager validation in Key Findings:
Files requiring special attention
|
Confidence Score: 4/5 - Mostly SafeSafe to merge — the refactor cleanly redesigns Key Findings:
Files requiring special attention
|
0658cdd to
83baa43
Compare
Confidence Score: 4/5 - Mostly SafeSafe to merge — this v2.0.0 breaking-change refactor cleanly unifies the API surface of Key Findings:
Files requiring special attention
|
| #### Migration from v1.x to v2.0.0 | ||
|
|
||
| **v1.x (old API with positional parameters):** | ||
| ```typescript |
There was a problem hiding this comment.
I think we can remove it from here, the docs will be updated anyways
| "name": "@supermemory/tools", | ||
| "type": "module", | ||
| "version": "1.4.01", | ||
| "version": "2.0.0", |
There was a problem hiding this comment.
do we need to update to version v2?
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
83baa43 to
56ac4c6
Compare
There was a problem hiding this comment.
Overview: Refactors Mastra integration from positional arguments (containerTag, options) to a single object-based API with containerTag and customId as required properties.
Issues found: None — this looks good to ship.
Details:
- Clean API migration:
threadId→customId, both now required with proper validation - Input validation is thorough (checks empty strings, whitespace)
getEffectiveCustomIdcorrectly prioritizes RequestContext for per-request overrides, falling back to the defaultcustomId— the dead code issue from earlier commits has been fixed- Tests comprehensively updated to match new API
- Version bump to 2.0.0 is appropriate for this breaking change
- No security concerns, no race conditions, no breaking logic changes
Score: 10/10
This is a well-executed breaking change with good validation and error messages. The object-based API is cleaner and more explicit about required parameters.
There was a problem hiding this comment.
Overview: Refactors Mastra integration from positional arguments (containerTag, options) to a single object-based API with containerTag and customId as required properties.
Issues found: None — this looks good to ship.
Details:
- Clean API migration:
threadId→customId, both now required with proper validation - Input validation is thorough (checks empty strings, whitespace)
getEffectiveCustomIdcorrectly prioritizes RequestContext for per-request overrides, falling back to the defaultcustomId— the dead code issue from earlier commits has been fixed- Tests comprehensively updated to match new API
- Version bump to 2.0.0 is appropriate for this breaking change
- No security concerns, no race conditions, no breaking logic changes
Score: 10/10
This is a well-executed breaking change with good validation and error messages. The object-based API is cleaner and more explicit about required parameters.
There was a problem hiding this comment.
Overview: Refactors Mastra integration from positional arguments to a unified object-based API with containerTag and customId as required properties.
Issues found:
- The
addMemorydefault changed from"never"to"always"— this silently enables automatic conversation storage for upgrading users and is inconsistent with OpenAI/Vercel integrations which retain"never".
Details:
- Clean API migration:
threadId→customId, both now required with proper validation - The dead code issue from earlier (where
getEffectiveConversationIdcouldn't be overridden) has been fixed — RequestContext is now checked first (lines 112-118) - Input validation is thorough (checks empty strings, whitespace)
- Version bump to 2.0.0 is appropriate for this breaking change
- Tests comprehensively updated to match new API
Score: 9/10
Well-executed breaking change with good validation and error messages. The only issue is the addMemory default change which should either be reverted to "never" for consistency, or explicitly documented as a breaking behavior change in the migration guide.
| mode: options.mode ?? "profile", | ||
| addMemory: options.addMemory ?? "never", | ||
| threadId: options.threadId, | ||
| addMemory: options.addMemory ?? "always", |
There was a problem hiding this comment.
Breaking behavior change: The default for addMemory changed from "never" to "always".
This means users upgrading from v1.x will have conversations automatically saved to Supermemory without explicit opt-in. This is inconsistent with other integrations:
// OpenAI (middleware.ts:426)
const addMemory = options?.addMemory ?? "never"
// Vercel (index.ts:117)
addMemory: options?.addMemory ?? "never"If this change is intentional, it should be documented in the migration guide. If not, consider reverting to "never" to maintain the opt-in behavior for data storage.
| addMemory: options.addMemory ?? "always", | |
| addMemory: options.addMemory ?? "never", |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|

No description provided.