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

fix: recursively collect and apply parameters in closures #229

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

divarvel
Copy link
Collaborator

@divarvel divarvel commented Oct 2, 2024

Datalog parameters are managed lazily: upon building a rule, referenced parameter are collected in a map. Setting them only updates the map, and the actual AST is only updated as needed (such as in Display impls, or when converting to datalog data structures).

Expressions used to be linear, but closures introduced the possibility of recursive expressions, so the code inside closure bodies was ignored both when collecting parameters, and when applying them.

This caused an issue because some parts of the code assume that unbound parameters are handled beforehand, and panic upon encountering them.

Copy link

codspeed-hq bot commented Oct 2, 2024

CodSpeed Performance Report

Merging #229 will not alter performance

Comparing fix-param-substitution-in-closures (35edbd8) with v5 (911ebe4)

Summary

✅ 12 untouched benchmarks

Copy link

codecov bot commented Oct 2, 2024

Codecov Report

Attention: Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.

Project coverage is 68.48%. Comparing base (911ebe4) to head (35edbd8).
Report is 2 commits behind head on v5.

Files with missing lines Patch % Lines
biscuit-auth/src/token/builder.rs 95.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               v5     #229      +/-   ##
==========================================
+ Coverage   68.42%   68.48%   +0.05%     
==========================================
  Files          25       25              
  Lines        5605     5625      +20     
==========================================
+ Hits         3835     3852      +17     
- Misses       1770     1773       +3     

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

@divarvel divarvel force-pushed the fix-param-substitution-in-closures branch from d6d8768 to 6d1c4a9 Compare October 21, 2024 12:16
Datalog parameters are managed lazily: upon building a rule, referenced parameter are collected in a map. Setting them only updates the map, and the actual AST is only updated as needed (such as in Display impls, or when converting to datalog data structures).

Expressions used to be linear, but closures introduced the possibility of recursive expressions, so the code inside closure bodies was ignored both when collecting parameters, and when applying them.

This caused an issue because some parts of the code assume that unbound parameters are handled beforehand, and panic upon encountering them.
@divarvel divarvel force-pushed the fix-param-substitution-in-closures branch from 6d1c4a9 to 35edbd8 Compare October 22, 2024 07:58
@divarvel
Copy link
Collaborator Author

capi support will be extracted to a dedicated crate, so we can ignore the failing build step.

@divarvel divarvel merged commit c2dd7a4 into v5 Oct 22, 2024
6 of 7 checks passed
@divarvel divarvel deleted the fix-param-substitution-in-closures branch October 22, 2024 08:16
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.

2 participants