Skip to content

Conversation

@tstirrat15
Copy link
Contributor

Description

Part of getting a v1 of Zed out the door. We want to take the opportunity to get rid of some deprecated codepaths, which will keep complexity down in the long term.

Changes

  • Remove zed preview schema compile - it's now just zed schema compile
  • Remove zed watch - it's now just zed relationship watch
  • Remove deprecated revision flag - use the other consistency flags
  • Remove zed permission lookup - it's zed permission lookup-resources
  • Remove deprecated estimated-count flag on bulk-delete - use limit instead

Testing

Review. See that tests still pass.

@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2025

Codecov Report

❌ Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 41.92%. Comparing base (7ed5ab0) to head (e5c14c4).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
internal/commands/permission.go 0.00% 5 Missing ⚠️
internal/commands/relationship.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #562      +/-   ##
==========================================
+ Coverage   39.28%   41.92%   +2.64%     
==========================================
  Files          37       37              
  Lines        5448     4718     -730     
==========================================
- Hits         2140     1978     -162     
+ Misses       3063     2482     -581     
- Partials      245      258      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tstirrat15 tstirrat15 force-pushed the clean-up-deprecations branch from 54f4359 to f54b029 Compare October 12, 2025 15:24
registerConsistencyFlags(checkCmd.Flags())

permissionCmd.AddCommand(checkBulkCmd)
checkBulkCmd.Flags().String("revision", "", "optional revision at which to check")
Copy link
Contributor

@miparnisari miparnisari Oct 14, 2025

Choose a reason for hiding this comment

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

this one wasn't marked as hidden, can we actually remove it?

i also see this

readCmd.Flags().String("revision", "", "optional revision at which to check")
_ = readCmd.Flags().MarkHidden("revision")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would argue yes, as long as we document it

@miparnisari
Copy link
Contributor

miparnisari commented Oct 14, 2025

I wonder if we could take this PR as an opportunity to:

  • have zed permission bulk-check and zed permission check-bulk be an alias for zed permission bulk (will match zed relationship bulk-delete)
  • have zed relationship write be an alias for zed relationship create (will match zed schema write)

This would be in the name of consistency 😄

Copy link
Contributor

@miparnisari miparnisari left a comment

Choose a reason for hiding this comment

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

I ran mage gen:docForPublish and inspected the docs at https://github.com/authzed/zed/blob/main/docs/zed.md. I saw this, can we update it?

zed/internal/cmd/schema.go

Lines 97 to 101 in 57fdb03

Example: `
Write to stdout:
zed preview schema compile root.zed
Write to an output file:
zed preview schema compile root.zed --out compiled.zed

@tstirrat15 tstirrat15 force-pushed the clean-up-deprecations branch from f3e2bb1 to e5c14c4 Compare November 20, 2025 22:38
Copy link
Contributor Author

@tstirrat15 tstirrat15 left a comment

Choose a reason for hiding this comment

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

See comments


relCmd := commands.RegisterRelationshipCmd(rootCmd)

commands.RegisterWatchCmd(rootCmd)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one of the aliases that we removed.

Comment on lines -130 to -131
schemaCompileCmd := registerAdditionalSchemaCmds(schemaCmd)
registerPreviewCmd(rootCmd, schemaCompileCmd)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We no longer pass out the schemaCompileCmd as it's no longer needed as an arg to the preview command.

Comment on lines -13 to -17
schemaCmd := &cobra.Command{
Use: "schema <subcommand>",
Short: "Manage schema for a permissions system",
Deprecated: "please use `zed schema compile`",
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer any commands under this.

schemaCmd.AddCommand(schemaCompileCmd)
schemaCompileCmd.Flags().String("out", "", "output filepath; omitting writes to stdout")

return schemaCompileCmd
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See note about no longer passing things out of this command.

Comment on lines -50 to -51
// Deprecated (hidden) flag.
if revision := cobrautil.MustGetStringExpanded(cmd, "revision"); revision != "" {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now covered by the consistency option; we want to get rid of the old way of doing things.

Short: "Check permissions in bulk exist for resource-permission-subject triplets",
Args: ValidationWrapper(cobra.MinimumNArgs(1)),
RunE: checkBulkCmdFunc,
Aliases: []string{"check-bulk", "bulk-check"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding aliases here.

Comment on lines -109 to -110
lookupCmd := &cobra.Command{
Use: "lookup <type> <permission> <subject:id>",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer using a separate command for lookup. This is covered by lookup-resources.


permissionCmd.AddCommand(expandCmd)
expandCmd.Flags().Bool("json", false, "output as JSON")
expandCmd.Flags().String("revision", "", "optional revision at which to check")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same deal here.

Args: ValidationWrapper(StdinOrExactArgs(3)),
ValidArgsFunction: GetArgs(ResourceID, Permission, SubjectTypeWithOptionalRelation),
RunE: writeRelationshipCmdFunc(v1.RelationshipUpdate_OPERATION_CREATE, os.Stdin),
Aliases: []string{"write"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding zed relationship write as an alias - this is what i always want to write.

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.

5 participants