-
Notifications
You must be signed in to change notification settings - Fork 0
Add slug to namespace projects #778
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
base: main
Are you sure you want to change the base?
Conversation
618632f to
81ff3cc
Compare
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2218652311 Status: Passed Job summariesrspec: [ee]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/12461495003/artifacts/tmp/coverage/index.html rspec: [ce]Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/12461494993/artifacts/tmp/coverage/index.html rubocop723 files inspected, no offenses detected |
There was a problem hiding this 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 a slug field to namespace projects to support URL-based identification of flows, particularly for HTTP flows. The slug is used as a URL path component to identify and route to project flows.
- Adds a required
slugcolumn to thenamespace_projectstable with uniqueness constraint - Implements automatic slug generation with collision handling when not explicitly provided
- Exposes slug via GraphQL API for both creation and updates
- Updates HTTP flow URL generation to include project slug as a path prefix
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| db/migrate/20251215200029_add_slug_to_projects.rb | Adds slug column and unique index to namespace_projects table |
| db/structure.sql | Updates schema to reflect slug column addition |
| db/schema_migrations/20251215200029 | Migration checksum for tracking |
| db/fixtures/development/06_namespace_projects.rb | Adds slug to development fixture data |
| app/models/namespace_project.rb | Adds slug validations (presence, uniqueness, format, length) |
| app/models/flow.rb | Updates to_grpc method to prepend project slug to HTTP flow URLs |
| app/services/namespaces/projects/create_service.rb | Implements automatic slug generation with collision retry logic |
| app/graphql/types/namespace_project_type.rb | Exposes slug field in GraphQL type |
| app/graphql/mutations/namespaces/projects/create.rb | Adds optional slug argument to create mutation |
| app/graphql/mutations/namespaces/projects/update.rb | Adds optional slug argument to update mutation |
| spec/models/namespace_project_spec.rb | Adds validation specs for slug field |
| spec/factories/namespace_projects.rb | Updates factory to auto-generate slug from name |
| spec/services/namespaces/projects/create_service_spec.rb | Adds tests for slug generation and collision handling |
| spec/requests/graphql/mutation/namespace/projects/create_mutation_spec.rb | Updates audit event expectations to include slug |
| spec/graphql/types/namespace_project_type_spec.rb | Adds slug to expected GraphQL fields |
| spec/models/flow_spec.rb | Updates flow tests to verify slug inclusion in HTTP URLs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| add_column :namespace_projects, :slug, :text, null: false | ||
| add_index :namespace_projects, :slug, unique: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it doesn't make a big difference, we can also define the index directly in add_column (not native rails, added by ZeroTrack)
Also, we should add the limit on database level as well.
| add_column :namespace_projects, :slug, :text, null: false | |
| add_index :namespace_projects, :slug, unique: true | |
| add_column :namespace_projects, :slug, :text, null: false, unique: true, limit: 50 |
1beea7a to
d9d9fc7
Compare
close #777