Unverified Commit 479877d6 authored by Luke Sandberg's avatar Luke Sandberg Committed by GitHub

Improve consistency of how Flag typed fields are handled in the macro to more…

Improve consistency of how Flag typed fields are handled in the macro to more structurally prevent bugs like what was fixed in #89228 (#89255)

# Fix inconsistencies in flag handling

## What?
This PR refactors the task flags bitfield implementation to properly separate flags by category (meta vs data) during serialization and deserialization.

It also regularizes the way accessors are generated to try to prevent future bugs like what was fixed in #89228
parent 80ace0fe
......@@ -785,8 +785,6 @@ mod tests {
.aggregated_dirty_containers_mut()
.insert(TaskId::new(50).unwrap(), 2);
// Set flags (persisted)
original.flags.set_immutable(true);
// Set transient flag (should NOT be serialized)
original.flags.set_current_session_clean(true);
......@@ -832,9 +830,10 @@ mod tests {
original.aggregated_dirty_containers()
);
// Verify flags (persisted bits should match)
assert!(!decoded.flags.invalidator());
assert!(decoded.flags.immutable());
// Note: invalidator and immutable are data category flags, not meta
// They should NOT have changed during meta encode/decode
assert!(!decoded.flags.invalidator()); // still default false
assert!(!decoded.flags.immutable()); // still default false
// Transient flag should be preserved (was set to true before decode)
assert!(decoded.flags.current_session_clean());
......@@ -897,6 +896,10 @@ mod tests {
.outdated_output_dependencies_mut()
.insert(TaskId::new(999).unwrap());
// Set data category flags (persisted)
original.flags.set_invalidator(true);
original.flags.set_immutable(true);
// Encode data fields
let mut buffer = turbo_bincode::TurboBincodeBuffer::new();
{
......@@ -943,6 +946,10 @@ mod tests {
// Verify transient fields were NOT decoded
assert!(decoded.outdated_output_dependencies().is_none());
// Verify data category flags were decoded
assert!(decoded.flags.invalidator());
assert!(decoded.flags.immutable());
}
#[test]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment