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

feat(air)!: change fold over canon map iterator contents [fixes VM-620] #843

Merged
merged 4 commits into from
Jun 25, 2024

Conversation

raftedproc
Copy link
Contributor

This is to align the spec with the implementation. The spec tells fold iterates over unique(conflicts are resolved with LastWriteWin policy) kv pairs. The implementation violates this delivering all kv pairs together with duplicates.

@raftedproc raftedproc added C-bug category: bug A-execution-engine area: execution engine of AquaVM A-air-interpreter area: air-interpreter labels Jun 14, 2024
@raftedproc raftedproc requested review from monoid and mikevoronov June 14, 2024 08:49
@raftedproc raftedproc self-assigned this Jun 14, 2024
@raftedproc raftedproc changed the title Fix/fold over scm using lww fix()!: fold over scm using lww Jun 14, 2024
true
}
} else {
false
Copy link
Contributor

@monoid monoid Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think complying with filter interface is too much hassle here.
Try to rewrite it with a simple for loop (pushing to a Vec) to see if it shorter and clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced. The suggested approach delivers a smaller nibble for sure.

@monoid
Copy link
Contributor

monoid commented Jun 14, 2024

It worth adding a small tests that just demonstrates specific bit of functionality, e.g. fold_canon_stream_map_duplicate_keys.

@raftedproc
Copy link
Contributor Author

raftedproc commented Jun 17, 2024

It worth adding a small tests that just demonstrates specific bit of functionality, e.g. fold_canon_stream_map_duplicate_keys.

JFYI I altered the existing test to test duplicates iterating with fold over SCM.
Here is the duplicate key.

@raftedproc raftedproc requested a review from monoid June 17, 2024 11:00

for val in canon_stream_map.canon_stream_map.iter().rev() {
if let Some(map_key) = StreamMapKey::from_kvpair_owned(val) {
if met_keys.get(&map_key).is_none() {
Copy link
Contributor

@monoid monoid Jun 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just !met_keys.contains(&map_key).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@raftedproc raftedproc requested a review from monoid June 25, 2024 10:42

for val in canon_stream_map.canon_stream_map.iter().rev() {
if let Some(map_key) = StreamMapKey::from_kvpair_owned(val) {
if !met_keys.contains(&map_key) {
Copy link
Contributor

@monoid monoid Jun 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be slightly more performant with the Entry API (no double hashing and lookup), but I'm not sure it worth it.

Copy link
Contributor

@monoid monoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@fluencebot fluencebot added the e2e Run e2e workflow label Jun 25, 2024
@raftedproc raftedproc changed the title fix()!: fold over scm using lww feat(air)!: change fold over canon map iterator contents [fixes VM-620] Jun 25, 2024
Copy link

linear bot commented Jun 25, 2024

@raftedproc raftedproc merged commit 325cce2 into master Jun 25, 2024
35 of 39 checks passed
@raftedproc raftedproc deleted the fix/fold_over_SCM_using_LWW branch June 25, 2024 12:39
@fluencebot fluencebot mentioned this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-air-interpreter area: air-interpreter A-execution-engine area: execution engine of AquaVM C-bug category: bug e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants