Changing the schema for lockfile facts is hard to do safely
#29483 opened on May 6, 2026
Description
Description of the bug:
I'm using lockfile facts heavily for rules_rs and I realized I can change the encoding a bit to help mitigate the lockfile size explosion (related to https://github.com/bazelbuild/bazel/issues/29446). However, it's not clear to me how to do this safely without breaking users. I can certainly write new code to read/write the new format and even gracefully handle the old format + rewrite to new one. But I can't go back in time and make the old code do something reasonable with the new format, which means if a downstream user tries a rules_rs upgrade on a branch (which rewrites their lockfile) and then swaps back to their main branch on the older ruleset version, their previous rules_rs version will fail to parse the new lockfile.
The only idea i've come up with is to use brand-new key names for all facts, but the key names were fairly canonical (the facts about crate foo at version x.y were keyed by foo-x.y). We could do something like append a -v2 suffix to the keynames but that doesn't feel great given the purpose of the change is to minimize bytes used.
See https://bazelbuild.slack.com/archives/C014RARENH0/p1778087918441709 for a bit of discussion
Which category does this issue belong to?
No response
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which operating system are you running Bazel on?
No response
What is the output of bazel info release?
No response
If bazel info release returns development version or (@non-git), tell us how you built Bazel.
No response
What's the output of git remote get-url origin; git rev-parse HEAD ?
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response