Skip to content

chore: Upgrade db to use new modusGraph [DRAFT] #899

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matthewmcneely
Copy link
Member

Description

This is a DRAFT PR.

This is a first cut at upgrading the db folder to use the new modusGraph API. At the moment, I've only reworked the AgentState class to serve as a point of discussion.

Discussion Points:

  1. Will we be moving away from the Neon/Postgres instances in production? If so, I can refactor even further.
  2. I've made the modusGraph::Client the single access point to interacting with modusGraph regardless of whether you're working with a file://-based local db or a dgraph://-based cluster. It might be nice to refactor all the "initdb" stuff to just keep a handle to the Client and operate without all the if useModusDB() tests everywhere (if Postgres will be removed).
  3. Another improvement that might be nice is to add lifecycle-functions to the stateful classes themselves, e.g.,
func (a *AgentState) Upsert(ctx context.Context) error {
	client, err := GetClient()
	if err != nil {
		return err
	}
	return client.Upsert(ctx, a)
}

The db/agentstate_test.go file has a lifecycle test of AgentState using the new mg API. Another test file, modusdb_test.go has some of the higher level API functions covered.

Checklist

All PRs should check the following boxes:

  • I have given this PR a title using the
    Conventional Commits syntax, leading with fix:,
    feat:, chore:, ci:, etc.
    • The title should also be used for the commit message when the PR is squashed and merged.
  • I have formatted and linted my code with Trunk, per the instructions in
    the contributing guide.

If the PR includes a code change, then also check the following boxes. (If not, then delete the
next section.)

  • I have added an entry to the CHANGELOG.md file.
    • Add to the "UNRELEASED" section at the top of the file, creating one if it doesn't yet exist.
    • Be sure to include the link to this PR, and please sort the section numerically by PR number.
  • I have manually tested the new or modified code, and it appears to behave correctly.
  • I have added or updated unit tests where appropriate, if applicable.

@matthewmcneely matthewmcneely force-pushed the matthewmcneely/upgrade-modusgraph branch from 0d5ba29 to 20535de Compare June 24, 2025 20:39
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