Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up WithMeta handling #121

Merged
merged 3 commits into from
Sep 7, 2024
Merged

Clean up WithMeta handling #121

merged 3 commits into from
Sep 7, 2024

Conversation

kylewlacy
Copy link
Member

The WithMeta type is used to track the stack trace a recipe was created in TypeScript: since recipe evaluation is lazy, it can be really hard to track this down from just the recipes themselves. This metadata isn't used at all in Brioche today, but the eventual goal is to give better error messages (e.g. when a build fails, we could point to the line in TypeScript where the error occurred)

Turns out, this metadata wasn't properly being deserialized when going from TypeScript to Rust, so it always came back empty. This PR fixes that, and makes a few changes so the WithMeta<_> wrapper type is a bit simpler:

  • Update serde::Deserialize impl on WithMeta<_> to try and deserialize the meta field (serialization still skips it). This also means the type that WithMeta wraps must now deserialize from an object
  • Remove WithMeta for directory entries in the Directory type. Since these are string values (representing recipe hashes), this no longer worked with the deserialization changes to WithMeta

This mechanism was still effectively unused, and it only allowed
metadata one layer deep. It doesn't seem worth it to continue supporting
@kylewlacy kylewlacy merged commit 839cfd6 into main Sep 7, 2024
5 checks passed
@kylewlacy kylewlacy deleted the withmeta-cleanup branch September 7, 2024 04:43
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.

1 participant