Skip to content

Conversation

@Knerio
Copy link
Member

@Knerio Knerio commented Dec 15, 2025

close #777

@github-actions
Copy link

github-actions bot commented Dec 15, 2025

GitLab Pipeline Action

General information

Link to pipeline: https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2218652311

Status: Passed
Duration: 5 minutes

Job summaries

rspec: [ee]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/12461495003/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2218652311/test_report
Finished in 21.78 seconds (files took 10.62 seconds to load)
1305 examples, 0 failures
Line Coverage: 91.59% (4432 / 4839)
[TEST PROF INFO] Time spent in factories: 00:11.676 (41.98% of total time)

rspec: [ce]

Coverage report available at https://code0-tech.gitlab.io/-/development/sagittarius/-/jobs/12461494993/artifacts/tmp/coverage/index.html
Test summary available at https://gitlab.com/code0-tech/development/sagittarius/-/pipelines/2218652311/test_report
Finished in 20.78 seconds (files took 13.01 seconds to load)
1258 examples, 0 failures
Line Coverage: 91.03% (4264 / 4684)
[TEST PROF INFO] Time spent in factories: 00:11.430 (41.16% of total time)

rubocop

723 files inspected, no offenses detected

Copy link
Contributor

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 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 slug column to the namespace_projects table 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.

Comment on lines +6 to +7
add_column :namespace_projects, :slug, :text, null: false
add_index :namespace_projects, :slug, unique: true
Copy link
Member

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.

Suggested change
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

@Knerio Knerio requested a review from Taucher2003 December 15, 2025 21:49
@Knerio Knerio force-pushed the 777-add-slug-for-projects branch from 1beea7a to d9d9fc7 Compare December 16, 2025 16:03
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.

Add slug for projects

3 participants