Skip to content

feat: Add upsert and unique checking in local mode [DRAFT] #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

matthewmcneely
Copy link
Member

Description

This PR adds upsert and unique checking to modusGraph in "local" mode.

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to
    this PR
  • Tests added for new functionality, or regression tests for bug fixes added as applicable

@matthewmcneely matthewmcneely marked this pull request as ready for review June 17, 2025 00:36
@Copilot Copilot AI review requested due to automatic review settings June 17, 2025 00:36
@matthewmcneely matthewmcneely requested a review from a team as a code owner June 17, 2025 00:36
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds upsert functionality and unique field verification for local (file-based) mode, including improvements to client configuration and documentation support. Key changes include:

  • New variadic Upsert method and local-mode support in client.go.
  • Additional tests covering upsert, unique constraints, and embedded object handling.
  • Documentation updates in README and added configuration options (e.g. maxEdgeTraversal).

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
upsert_test.go Added tests for basic and predicate-based upsert operations.
update_test.go Expanded update tests to cover unique constraints and batch update scenarios.
mutate.go Introduced unique verification and recursive upsert support, with improved handling of slice and single object.
internal_test.go Added structural tag tests to ensure proper processing of unique/upsert directives.
insert_test.go Enhanced insertion tests with embedded objects and depth query adjustments.
client.go Updated API design with optional upsert predicates, new client options (maxEdgeTraversal), and local-mode logic.
README.md Revised documentation to reflect local-mode limitations and new upsert features.
Comments suppressed due to low confidence (2)

client.go:258

  • [nitpick] Consider renaming the internal upsert helper function (e.g. to 'localUpsert') to clearly distinguish it from the public Upsert method, reducing potential confusion during maintenance.
func (c client) Upsert(ctx context.Context, obj any, predicates ...string) error {

engine.go:82

  • Please add a comment explaining the rationale for choosing the value 100000 for TypeFilterUidLimit to aid future maintainers.
worker.Config.TypeFilterUidLimit = 100000

@matthewmcneely matthewmcneely enabled auto-merge (squash) June 17, 2025 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant