zed icon indicating copy to clipboard operation
zed copied to clipboard

Writing schema with prefixes and then writing same schema without prefixes results in no-op

Open tstirrat15 opened this issue 2 months ago • 0 comments

Let's call this the "old" schema:

definition namespace/subscription {
    relation subscriber: namespace/user

    permission is_subscribed = subscriber 
}

definition namespace/user {
}

And this the "new" schema:

definition subscription {
    relation subscriber: user

    permission is_subscribed = subscriber 
}

definition user {
}

Start SpiceDB:

spicedb serve-testing

Write the old schema:

zed schema write old.zed

Write the new schema with tracing enabled:

zed schema write new.zed --log-level=trace

See that the written schema still has the prefixes:

10:50AM TRC writing schema request={"schema":"definition namespace/subscription {\n\trelation subscriber: namespace/user\n\tpermission is_subscribed = subscriber\n}\n\ndefinition namespace/user {}"}

This is due to our rewriting logic, and was part of serverless support. This may be fixed by the refactors in #597, but if it's not we should fix it.

It's an edge case but it's a sharp edge.

tstirrat15 avatar Dec 19 '25 17:12 tstirrat15