这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@tolgaozen
Copy link
Member

@tolgaozen tolgaozen commented Nov 13, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced validation error messages to include contextual information for improved troubleshooting.
  • Chores

    • Version updated to v1.5.1 across API and core components.

@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2025

Walkthrough

This PR updates the API version from v1.5.0 to v1.5.1 across documentation, configuration, and source files, and enhances error logging in the validation command to include contextual query strings and formatted error messages.

Changes

Cohort / File(s) Summary
Version bump
docs/api-reference/apidocs.swagger.json, docs/api-reference/openapiv2/apidocs.swagger.json, internal/info.go, proto/base/v1/openapi.proto
Updated API metadata version from v1.5.0 to v1.5.1 across OpenAPI/Swagger documentation, protobuf configuration, and internal version constant.
Enhanced validation logging
pkg/cmd/validate.go
Replaced plain error additions with enriched logging that prefixes errors with contextual query strings and formatted validation errors. Early construction of loggable query strings (subject/permission/entity triplets) reused across error paths for improved error context and debugging.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

The bulk of this PR consists of homogeneous version updates (4 files with repetitive version string replacements), which is straightforward. The logging enhancements in pkg/cmd/validate.go introduce structured error context but maintain existing control flow, adding moderate density but not substantial complexity.

  • pkg/cmd/validate.go: Review the enriched logging logic to ensure query string construction is correct and error formatting is consistent across all validation branches.
  • Version consistency: Verify that all four version strings (Swagger JSONs, proto, and Go constant) are consistently updated to v1.5.1.

Possibly related PRs

  • #2588: Performs the same version-bump changes to API/version strings in docs, proto, and internal files.
  • #2560: Modifies the same API version strings in docs/api-reference Swagger JSON, internal/info.go, and proto/base/v1/openapi.proto.
  • #2267: Updates API/version strings across the same files (Swagger JSON, openapi proto, and internal Version constant).

Poem

🐰 A version hop from five-zero-nought
To five-oh-one, as progress wrought,
With logging trails now rich and clear,
Each query whispers context near! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: updating the version to v1.5.1 across API documentation and internal configuration files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update/api-version-to-v1.5.1

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
internal/info.go (1)

26-26: Bumped Version constant to v1.5.1 — approved.
No layout impact on the banner. Consider centralizing version to a single source (e.g., ldflags from git tag) to eliminate manual edits.

Option A: Inject at build time

  • go build -ldflags "-X github.com/Permify/permify/internal.Version=v1.5.1"

Option B: Generate docs from proto and read version from there during release.

docs/api-reference/openapiv2/apidocs.swagger.json (1)

6-6: OpenAPI (v2) info.version set to v1.5.1 — approved.
Suggest adding a CI guard to fail if versions differ across proto/info/docs.

Add a job running:

#!/bin/bash
set -euo pipefail
errs=0
rg -n --hidden -S '\bv1\.5\.0\b' -g '!**/vendor/**' -g '!**/node_modules/**' && errs=1 || true
# ensure all declared versions equal
want=$(rg -nP 'Version\s*=\s*"([^"]+)"' -o -r '$1' internal/info.go)
rg -nP '"version":\s*"([^"]+)"' docs/api-reference/**/apidocs.swagger.json | awk -F'"' -v want="$want" '$4!=want{print; exit 1}' || true
exit $errs
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bfa9308 and f47659f.

⛔ Files ignored due to path filters (1)
  • pkg/pb/base/v1/openapi.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (5)
  • docs/api-reference/apidocs.swagger.json (1 hunks)
  • docs/api-reference/openapiv2/apidocs.swagger.json (1 hunks)
  • internal/info.go (1 hunks)
  • pkg/cmd/validate.go (10 hunks)
  • proto/base/v1/openapi.proto (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
pkg/cmd/validate.go (1)
pkg/tuple/tuple.go (3)
  • EAR (185-212)
  • SubjectToString (73-84)
  • EntityToString (68-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Scan Container for Vulnerabilities
  • GitHub Check: Analyze (go)
  • GitHub Check: Test with Coverage
  • GitHub Check: Test with Coverage
🔇 Additional comments (7)
proto/base/v1/openapi.proto (1)

12-12: Version bump confirmed; generated artifacts are tracked—verify regeneration step.

The sweep for leftover v1.5.0 strings is clean (only legitimate Go dependency versions found). Generated proto bindings and OpenAPI/Swagger specs are properly committed to the repo (pkg/pb/base/v1/openapi.pb.go, docs/api-reference/openapi.json, docs/api-reference/apidocs.swagger.json) with buf.gen.yaml configured to regenerate them.

Confirm that you ran buf generate after updating the proto version to v1.5.1 to ensure all downstream artifacts reflect the change.

docs/api-reference/apidocs.swagger.json (1)

6-6: Version consistency verified — but file is currently hand-edited.

All three sources match v1.5.1:

  • proto/base/v1/openapi.proto line 11: version: "v1.5.1"
  • internal/info.go line 26: Version = "v1.5.1"
  • docs/api-reference/apidocs.swagger.json line 6: "version": "v1.5.1"

However, git history shows the swagger JSON file is manually maintained (commits reference "update API docs"), not auto-generated. No build scripts or CI/CD automation for swagger generation were found. Ensure this manual maintenance approach is intentional and establish a sustainable process (e.g., auto-generation during build) to prevent future version divergence.

pkg/cmd/validate.go (5)

245-245: LGTM: Consistent error formatting applied.

The application of validationError() to conversion error messages improves consistency across the validation output.

Also applies to: 253-253, 267-267


279-311: LGTM: Enhanced error context for permission checks.

Constructing the query string early and including it in both error and success messages significantly improves debugging context. The query is safely built after all components are validated, and the enhanced error messages for depth and check failures will make troubleshooting easier.


336-336: LGTM: Entity filter logging enhanced with query context.

The same pattern applied to entity filters improves consistency and debugging capability. The early query construction and inclusion of depth validation with contextual error messages aligns well with the checks section.

Also applies to: 352-352, 358-392


415-415: LGTM: Subject filter logging enhanced with query context.

The subject filter section now mirrors the improvements in checks and entity filters, completing the consistent enhancement of error logging across all validation scenarios.

Also applies to: 424-424, 430-464


279-464: Consider PR scope: Are these logging enhancements related to the version update?

The PR title indicates this is a version update to v1.5.1, but this file only contains error logging enhancements. While these improvements are valuable and well-implemented, they appear unrelated to a version bump. Consider whether:

  1. These enhancements should be in a separate PR focused on improving validation error reporting
  2. The PR description should mention these logging improvements as additional changes
  3. This is intentional bundling of minor improvements with the version update

This doesn't block the changes, but clarity on the PR scope would be helpful for reviewers and future reference.

@tolgaozen tolgaozen merged commit 2159746 into master Nov 13, 2025
13 of 15 checks passed
@tolgaozen tolgaozen deleted the update/api-version-to-v1.5.1 branch November 13, 2025 14:53
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