Skip to content

129: Refactoring models - #191

Merged
meffmadd merged 6 commits into
mainfrom
129-refactor-models
Sep 30, 2026
Merged

meffmadd merged 6 commits into
mainfrom
129-refactor-models

Conversation

@JaeYeonLee0621

@JaeYeonLee0621 JaeYeonLee0621 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
  1. Split the aqueduct/management/models.py into a management/models/ package
  • models/__ init __.py — re-exports every model/helper
  • models/mixins.py — LimitSet, LimitMixin, ModelExclusionMixin, MCPServerExclusionMixin
  • models/accounts.py — Org, Team, UserGroup, UserProfile, TeamMembership, ServiceAccount, Token
  • models/snippets.py — SnippetType, Snippet
  • models/usage.py — Usage, Request
  • models/files.py — FileObject
  • models/batches.py — default_request_counts, BatchStatus, Batch
  • models/vector_stores.py — VectorStore/VectorStoreFile/VectorStoreFileBatch + status enums
  1. Deleted the old models.py

+) No DB changes → no migration needed.
+) Historical migrations still resolve via the package init.py

@JaeYeonLee0621 JaeYeonLee0621 self-assigned this Sep 15, 2026
@JaeYeonLee0621
JaeYeonLee0621 marked this pull request as ready for review September 15, 2026 09:32

@meffmadd meffmadd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When I planned this I would have just created a single file for each models.Model. I think this is still the simplest solution. Some classes are long anyways and the naming is also straightforward then.

VectorStoreStatus,
)

__all__ = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I generally dislike __all__ because it is always a hassle to update for little gain but if you have a case for it it is fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I kept __all__ here because

  1. Dropping these re-exports would force full paths everywhere and break historical migrations (e.g. management/migrations/0005_file_purpose_update.py).
  2. The "as" re-export (from X import Y as Y) works , but __all__ is the pattern already used (e.g. gateway/views/__init__.py).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ok got it! Keep it as is then.

This comment was marked as resolved.

This comment was marked as resolved.

Comment thread aqueduct/management/models/accounts.py Outdated
raise ValidationError("Associated team does not exist.") from None


class Token(models.Model):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Token should have its own file I think... this file is already very long again.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I created a separate tokens.py file for this model.

@JaeYeonLee0621 JaeYeonLee0621 changed the title 129: refactor models 129: Refactoring models Sep 17, 2026

@meffmadd meffmadd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To make things as simple as possible can you just create a new file for each model with the file having the same name as the class? I think that does make sense here and we do not have to worry about naming.

@JaeYeonLee0621

Copy link
Copy Markdown
Contributor Author

I've applied your comments and moved each model into its own file, named after the class. :)

@meffmadd meffmadd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@meffmadd
meffmadd merged commit 5094b6b into main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants