Skip to content

fix: don't use openfga/sdk for assertNever#539

Merged
rhamzeh merged 2 commits intomainfrom
fix/do-not-export-fga-sdk
Mar 2, 2026
Merged

fix: don't use openfga/sdk for assertNever#539
rhamzeh merged 2 commits intomainfrom
fix/do-not-export-fga-sdk

Conversation

@jimmyjames
Copy link
Contributor

@jimmyjames jimmyjames commented Feb 19, 2026

Description

What problem is being solved?

#534 introduced a peer dependency on @openfga/sdk by importing assertNever from @openfga/sdk in schema_version.ts , which is then exported from index.ts

Observed failure using @openfga/syntax-transformer: https://github.com/openfga/vscode-ext/actions/runs/22102322207/job/63875359435?pr=453#logs

How is it being solved?

just define assertNever inline

What changes are made to solve it?

just define assertNever inline

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Summary by CodeRabbit

  • Refactor
    • Streamlined internal dependency management by consolidating assertion utilities. No changes to public APIs or user-facing functionality.

Copilot AI review requested due to automatic review settings February 19, 2026 19:42
@jimmyjames jimmyjames requested review from a team as code owners February 19, 2026 19:42
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Removes external runtime dependency by replacing an imported assertNever utility from @openfga/sdk with a locally defined function. Preserves identical assertion behavior without changing public APIs.

Changes

Cohort / File(s) Summary
Internal Assertion Helper
pkg/js/util/schema_version.ts
Replaced runtime import of assertNever with locally defined implementation to eliminate external dependency.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ 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 'fix: don't use openfga/sdk for assertNever' directly and accurately describes the main change: removing the external dependency on @openfga/sdk by replacing the imported assertNever function with a locally defined one.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/do-not-export-fga-sdk

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

@dosubot
Copy link

dosubot bot commented Feb 19, 2026

Related Documentation

Checked 8 published document(s) in 1 knowledge base(s). No updates required.

How did I do? Any feedback?  Join Discord

Copy link

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 removes a runtime import of assertNever from @openfga/sdk to avoid unintentionally introducing a runtime/peer dependency for @openfga/syntax-transformer.

Changes:

  • Replaced @openfga/sdk/dist/utils assertNever import with a locally defined assertNever helper in the schema version utilities.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/js/util/schema_version.ts (1)

21-48: ⚠️ Potential issue | 🟡 Minor

Ensure code passes ESLint and Prettier linting before merge.

The exhaustiveness checks are correct—all three SchemaVersion members (V1_0, V1_1, V1_2) are explicitly handled, and default: assertNever(version) properly enforces TypeScript's exhaustiveness guarantees. assertNever is correctly defined locally and not exported or re-exported through barrel files.

However, per the coding guidelines, files in pkg/js/**/*.ts must use ESLint and Prettier. Verify the code passes both:

  • npm run lint (ESLint rules: double quotes, semicolons, 120-char max line length)
  • npm run format:check (Prettier formatting rules)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/js/util/schema_version.ts` around lines 21 - 48, Run the project linters
and formatters and fix any issues in this file: ensure
pkg/js/util/schema_version.ts conforms to ESLint (double quotes, semicolons,
120-char max) and Prettier rules by running npm run lint and npm run
format:check and applying fixes (or npm run format) as needed; specifically open
the functions isSchemaVersionSupported and checkSchemaVersionSupportsModules and
adjust quoting/semicolon/whitespace/line breaks to satisfy the rules, then
re-run the checks until both pass.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@pkg/js/util/schema_version.ts`:
- Around line 21-48: Run the project linters and formatters and fix any issues
in this file: ensure pkg/js/util/schema_version.ts conforms to ESLint (double
quotes, semicolons, 120-char max) and Prettier rules by running npm run lint and
npm run format:check and applying fixes (or npm run format) as needed;
specifically open the functions isSchemaVersionSupported and
checkSchemaVersionSupportsModules and adjust quoting/semicolon/whitespace/line
breaks to satisfy the rules, then re-run the checks until both pass.

@rhamzeh rhamzeh added this pull request to the merge queue Mar 2, 2026
Merged via the queue into main with commit efc2679 Mar 2, 2026
15 checks passed
@rhamzeh rhamzeh deleted the fix/do-not-export-fga-sdk branch March 2, 2026 17:42
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.

4 participants