ref(symcache): Make parsing backwards-compatible#947
Conversation
This puts in some indirection to make it so that old symcache versions remain parseable, even if the on-disk format changes. For the two currently supported versions, 7 and 8, this is massive overkill because they only differ in how string lengths are serialized to the string table. The intention is to enable us to add data to the format without having to throw out every old symcache immediately.
There was a problem hiding this comment.
I haven't reviewed this properly, but why is there a raw:v7 but no raw:v8?
There was a problem hiding this comment.
Because v7 and v8 use the same on-disk structure. I could duplicate it but they would literally be character-for-character identical. I think I need to document this better.
|
If the only difference between V7 and V8 is how it reads strings, I think there's a lot of potential to remove code duplication if you make trait Dialect {
fn get_string<'data>() -> &'data str;
}
struct V7;
impl Dialect for V7 {
fn get_string<'data>() -> &'data str {
...
}
}
struct SymCache<D = V7> {
_d: PhantomData<D>,
}
impl<D: Dialect> SymCache<D> {
fn do_something(&self) {
let s = D::get_string();
}
}
type SymCacheV8 = SymCacheV7<V8>; |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fbfa9b2. Configure here.
|
@jjbayer I implemented your suggestion about deduplication and it's a substantial improvement. |

This puts in some indirection to make it so that old symcache versions remain parseable, even if the on-disk format changes. For the two currently supported versions, 7 and 8, this is massive overkill because they only differ in how string lengths are serialized to the string table. The intention is to enable us to add data to the format without having to throw out every old symcache immediately.