Skip to content

refactor: restructure backend code organization#247

Merged
ravisuhag merged 5 commits intomainfrom
refactor/restructure-codebase
Mar 28, 2026
Merged

refactor: restructure backend code organization#247
ravisuhag merged 5 commits intomainfrom
refactor/restructure-codebase

Conversation

@ravisuhag
Copy link
Copy Markdown
Member

Summary

  • Move handlers to handler/v1beta1/ (from internal/server/v1beta1/)
  • Move interceptors to internal/middleware/ (from pkg/server/interceptor/), rename package to middleware
  • Move store to store/ (from internal/store/)
  • Move telemetry to internal/telemetry/ (from pkg/telemetry/)
  • Extract server config types to internal/config/ package
  • Remove pkg/ directory entirely (unused metrics, statsd packages)
  • Migrate proto generation from PGV to buf protovalidate (connectrpc.com/validate interceptor)
  • Switch buf.gen.yaml to source_relative with proto/gen/ output structure
  • Replace manual ValidateAll() calls with automatic validation interceptor
  • Remove envoyproxy/protoc-gen-validate dependency

Depends on: raystack/proton#460

Test plan

  • go build ./... passes
  • go test ./... passes
  • Verify server starts and serves requests correctly
  • Verify proto validation still works via interceptor

- Move handlers to handler/v1beta1/ (from internal/server/v1beta1/)
- Move interceptors to internal/middleware/ (from pkg/server/interceptor/)
- Move store to store/ (from internal/store/)
- Move telemetry to internal/telemetry/ (from pkg/telemetry/)
- Extract server config to internal/config/ package
- Remove pkg/ directory entirely (metrics, statsd, telemetry)
- Migrate proto generation from PGV to buf protovalidate
- Switch buf.gen.yaml to source_relative with proto/gen/ output
- Replace manual ValidateAll() calls with connectrpc/validate interceptor
- Remove envoyproxy/protoc-gen-validate dependency
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
compass Ready Ready Preview, Comment Mar 28, 2026 5:36am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

Warning

Rate limit exceeded

@ravisuhag has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 40 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 4 minutes and 40 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d24e4693-8b67-4ff3-9fbe-b45c445b7a52

📥 Commits

Reviewing files that changed from the base of the PR and between 8873112 and 5d3a2d0.

⛔ Files ignored due to path filters (5)
  • gen/buf/validate/validate.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • gen/raystack/compass/v1beta1/compassv1beta1connect/service.connect.go is excluded by !**/gen/**
  • gen/raystack/compass/v1beta1/service.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • go.sum is excluded by !**/*.sum
  • proto/compassv1beta1/service.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (144)
  • Makefile
  • buf.gen.yaml
  • cli/assets.go
  • cli/config.go
  • cli/discussions.go
  • cli/lineage.go
  • cli/namespace.go
  • cli/search.go
  • cli/server.go
  • docs/docs/configuration.md
  • docs/docs/guides/telemetry.md
  • docs/docs/reference/configuration.md
  • go.mod
  • handler/asset.go
  • handler/asset_test.go
  • handler/comment.go
  • handler/comment_test.go
  • handler/discussion.go
  • handler/discussion_test.go
  • handler/handler.go
  • handler/lineage.go
  • handler/lineage_test.go
  • handler/mocks/asset_service.go
  • handler/mocks/discussion_service.go
  • handler/mocks/namespace_service.go
  • handler/mocks/star_service.go
  • handler/mocks/tag_service.go
  • handler/mocks/tag_template_service.go
  • handler/mocks/user_service.go
  • handler/namespace.go
  • handler/namespace_test.go
  • handler/option.go
  • handler/search.go
  • handler/search_test.go
  • handler/star.go
  • handler/tag.go
  • handler/tag_template.go
  • handler/tag_template_test.go
  • handler/tag_test.go
  • handler/type.go
  • handler/type_test.go
  • handler/user.go
  • handler/user_test.go
  • internal/client/client.go
  • internal/config/config.example.yaml
  • internal/config/config.go
  • internal/middleware/error_response.go
  • internal/middleware/interceptor.go
  • internal/middleware/logger.go
  • internal/middleware/namespace.go
  • internal/middleware/recovery.go
  • internal/middleware/user.go
  • internal/server/server.go
  • internal/server/v1beta1/option.go
  • internal/telemetry/config.go
  • internal/telemetry/telemetry.go
  • pkg/metrics/newrelic.go
  • pkg/statsd/config.go
  • pkg/statsd/metric.go
  • pkg/statsd/statsd.go
  • proto/compassv1beta1/service.pb.validate.go
  • store/elasticsearch/discovery_repository.go
  • store/elasticsearch/discovery_repository_test.go
  • store/elasticsearch/discovery_search_repository.go
  • store/elasticsearch/discovery_search_repository_test.go
  • store/elasticsearch/es.go
  • store/elasticsearch/es_test.go
  • store/elasticsearch/init_test.go
  • store/elasticsearch/options.go
  • store/elasticsearch/schema.go
  • store/elasticsearch/testdata/search-test-fixture.json
  • store/elasticsearch/testdata/suggest-test-fixture.json
  • store/elasticsearch/testutil/elastic_search.go
  • store/postgres/asset_model.go
  • store/postgres/asset_model_test.go
  • store/postgres/asset_repository.go
  • store/postgres/asset_repository_test.go
  • store/postgres/config.go
  • store/postgres/discussion_comment_repository.go
  • store/postgres/discussion_comment_repository_test.go
  • store/postgres/discussion_model.go
  • store/postgres/discussion_repository.go
  • store/postgres/discussion_repository_test.go
  • store/postgres/errors.go
  • store/postgres/lineage_model.go
  • store/postgres/lineage_repository.go
  • store/postgres/lineage_repository_test.go
  • store/postgres/migrations/000001_create_tags_templates_fields_table.down.sql
  • store/postgres/migrations/000001_create_tags_templates_fields_table.up.sql
  • store/postgres/migrations/000002_create_users_table.down.sql
  • store/postgres/migrations/000002_create_users_table.up.sql
  • store/postgres/migrations/000003_create_assets_table.down.sql
  • store/postgres/migrations/000003_create_assets_table.up.sql
  • store/postgres/migrations/000004_create_stars_table.down.sql
  • store/postgres/migrations/000004_create_stars_table.up.sql
  • store/postgres/migrations/000005_create_assets_versions_table.down.sql
  • store/postgres/migrations/000005_create_assets_versions_table.up.sql
  • store/postgres/migrations/000006_create_lineage_graph_table.down.sql
  • store/postgres/migrations/000006_create_lineage_graph_table.up.sql
  • store/postgres/migrations/000007_create_discussions_table.down.sql
  • store/postgres/migrations/000007_create_discussions_table.up.sql
  • store/postgres/migrations/000008_create_comments_table.down.sql
  • store/postgres/migrations/000008_create_comments_table.up.sql
  • store/postgres/migrations/000009_update_tags_templates_assetid.down.sql
  • store/postgres/migrations/000009_update_tags_templates_assetid.up.sql
  • store/postgres/migrations/000010_drop_assets_idx_urn_type_service.down.sql
  • store/postgres/migrations/000010_drop_assets_idx_urn_type_service.up.sql
  • store/postgres/migrations/000011_create_idx_assets_urn.down.sql
  • store/postgres/migrations/000011_create_idx_assets_urn.up.sql
  • store/postgres/migrations/000012_create_asset_probes_table.down.sql
  • store/postgres/migrations/000012_create_asset_probes_table.up.sql
  • store/postgres/migrations/000013_alter_assets_table.down.sql
  • store/postgres/migrations/000013_alter_assets_table.up.sql
  • store/postgres/migrations/000014_create_namespace_table_and_add_namespace_in_tables.down.sql
  • store/postgres/migrations/000014_create_namespace_table_and_add_namespace_in_tables.up.sql
  • store/postgres/migrations/000015_enable_row_level_security_all_tables.down.sql
  • store/postgres/migrations/000015_enable_row_level_security_all_tables.up.sql
  • store/postgres/migrations/000016_update_assets_versions.down.sql
  • store/postgres/migrations/000016_update_assets_versions.up.sql
  • store/postgres/migrations/000017_add_soft_deletion.down.sql
  • store/postgres/migrations/000017_add_soft_deletion.up.sql
  • store/postgres/migrations/000018_index_asset_probes.down.sql
  • store/postgres/migrations/000018_index_asset_probes.up.sql
  • store/postgres/namespace_model.go
  • store/postgres/namespace_repository.go
  • store/postgres/namespace_repository_test.go
  • store/postgres/postgres.go
  • store/postgres/postgres_test.go
  • store/postgres/star_repository.go
  • store/postgres/star_repository_test.go
  • store/postgres/tag_model.go
  • store/postgres/tag_model_test.go
  • store/postgres/tag_repository.go
  • store/postgres/tag_repository_test.go
  • store/postgres/tag_template_repository.go
  • store/postgres/tag_template_repository_test.go
  • store/postgres/testdata/mock-asset-data.json
  • store/postgres/testdata/mock-probes-data.json
  • store/postgres/user_model.go
  • store/postgres/user_model_test.go
  • store/postgres/user_repository.go
  • store/postgres/user_repository_test.go
  • test/asset_test.go
  • test/helper_test.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Move handler files from handler/v1beta1/ to handler/ and rename
package from handlersv1beta1 to handler.
Remove the proto/ wrapper directory — generated code now lives
directly at gen/ (gen/raystack/compass/v1beta1/, gen/buf/validate/).
- Move config.yaml to internal/config/config.example.yaml
- Flatten test/e2e_test/ to test/
- Update Makefile reference
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 28, 2026

Pull Request Test Coverage Report for Build 23678554517

Details

  • 91 of 6715 (1.36%) changed or added relevant lines in 18 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+7.3%) to 28.265%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/config/config.go 0 1 0.0%
handler/search.go 4 6 66.67%
cli/server.go 0 15 0.0%
internal/server/server.go 0 24 0.0%
gen/raystack/compass/v1beta1/compassv1beta1connect/service.connect.go 0 131 0.0%
gen/buf/validate/validate.pb.go 0 2502 0.0%
gen/raystack/compass/v1beta1/service.pb.go 0 3949 0.0%
Totals Coverage Status
Change from base Build 23676598061: 7.3%
Covered Lines: 5445
Relevant Lines: 19264

💛 - Coveralls

@ravisuhag ravisuhag merged commit 43891e9 into main Mar 28, 2026
5 checks passed
@ravisuhag ravisuhag deleted the refactor/restructure-codebase branch March 28, 2026 05:40
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