@@ -304,36 +304,39 @@ def test_ephemeral_field_can_be_modified(self) -> None:
304304 assert workflow .ephemeral .timed_out is True
305305
306306 def test_ephemeral_field_not_serialized_to_json (self ) -> None :
307- """Test that ephemeral field is excluded from JSON serialization ."""
307+ """Test that ephemeral field is serialized but log_once_flags are excluded ."""
308308 workflow = Workflow (workflow_file = "test.yml" )
309309 workflow .ephemeral .trigger_failed = True
310310 workflow .ephemeral .timed_out = True
311+ workflow .ephemeral .log_once_flags ["test_flag" ] = True
311312
312313 # Serialize to JSON
313314 json_str = workflow .model_dump_json ()
314315 json_data = json .loads (json_str )
315316
316- # Verify ephemeral field is not in JSON
317- assert "ephemeral" not in json_data
318- assert "trigger_failed" not in json_data
319- assert "timed_out" not in json_data
317+ # Verify ephemeral field IS in JSON (except log_once_flags)
318+ assert "ephemeral" in json_data
319+ assert json_data ["ephemeral" ]["trigger_failed" ] is True
320+ assert json_data ["ephemeral" ]["timed_out" ] is True
321+ assert "log_once_flags" not in json_data ["ephemeral" ]
320322
321323 # Verify other fields are present
322324 assert "workflow_file" in json_data
323325 assert json_data ["workflow_file" ] == "test.yml"
324326
325327 def test_ephemeral_field_not_in_model_dump (self ) -> None :
326- """Test that ephemeral field is excluded from model_dump."""
328+ """Test that ephemeral field is in model_dump but log_once_flags are excluded ."""
327329 workflow = Workflow (workflow_file = "test.yml" )
328330 workflow .ephemeral .trigger_failed = True
331+ workflow .ephemeral .log_once_flags ["test_flag" ] = True
329332
330333 # Get dict representation
331334 data = workflow .model_dump ()
332335
333- # Verify ephemeral field is not in dict
334- assert "ephemeral" not in data
335- assert " trigger_failed" not in data
336- assert "timed_out " not in data
336+ # Verify ephemeral field IS in dict (except log_once_flags)
337+ assert "ephemeral" in data
338+ assert data [ "ephemeral" ][ " trigger_failed"] is True
339+ assert "log_once_flags " not in data [ "ephemeral" ]
337340
338341 def test_ephemeral_field_initialized_on_deserialization (self ) -> None :
339342 """Test that ephemeral field is initialized when loading from JSON."""
@@ -347,7 +350,7 @@ def test_ephemeral_field_initialized_on_deserialization(self) -> None:
347350 assert workflow .ephemeral .timed_out is False
348351
349352 def test_release_state_ephemeral_not_serialized (self ) -> None :
350- """Test that ephemeral fields are not serialized in ReleaseState ."""
353+ """Test that ephemeral fields are serialized but log_once_flags are excluded ."""
351354 config = Config (
352355 version = 1 ,
353356 packages = {
@@ -365,19 +368,22 @@ def test_release_state_ephemeral_not_serialized(self) -> None:
365368 # Modify ephemeral fields
366369 state .packages ["test-package" ].build .ephemeral .trigger_failed = True
367370 state .packages ["test-package" ].publish .ephemeral .timed_out = True
371+ state .packages ["test-package" ].build .ephemeral .log_once_flags ["test" ] = True
368372
369373 # Serialize to JSON
370374 json_str = state .model_dump_json ()
371375 json_data = json .loads (json_str )
372376
373- # Verify ephemeral fields are not in JSON
377+ # Verify ephemeral fields ARE in JSON (except log_once_flags)
374378 build_workflow = json_data ["packages" ]["test-package" ]["build" ]
375379 publish_workflow = json_data ["packages" ]["test-package" ]["publish" ]
376380
377- assert "ephemeral" not in build_workflow
378- assert "trigger_failed" not in build_workflow
379- assert "ephemeral" not in publish_workflow
380- assert "timed_out" not in publish_workflow
381+ assert "ephemeral" in build_workflow
382+ assert build_workflow ["ephemeral" ]["trigger_failed" ] is True
383+ assert "log_once_flags" not in build_workflow ["ephemeral" ]
384+ assert "ephemeral" in publish_workflow
385+ assert publish_workflow ["ephemeral" ]["timed_out" ] is True
386+ assert "log_once_flags" not in publish_workflow ["ephemeral" ]
381387
382388
383389class TestReleaseMeta :
@@ -449,7 +455,7 @@ def test_force_rebuild_field_can_be_modified(self) -> None:
449455 assert state .packages ["test-package" ].meta .ephemeral .force_rebuild is True
450456
451457 def test_ephemeral_not_serialized (self ) -> None :
452- """Test that ephemeral field is not serialized to JSON ."""
458+ """Test that ephemeral field is serialized but log_once_flags are excluded ."""
453459 config = Config (
454460 version = 1 ,
455461 packages = {
@@ -464,12 +470,21 @@ def test_ephemeral_not_serialized(self) -> None:
464470
465471 state = ReleaseState .from_config (config )
466472 state .packages ["test-package" ].meta .ephemeral .force_rebuild = True
473+ state .packages ["test-package" ].meta .ephemeral .log_once_flags ["test" ] = True
467474
468475 json_str = state .model_dump_json ()
469476 json_data = json .loads (json_str )
470477
471- assert "ephemeral" not in json_data ["packages" ]["test-package" ]["meta" ]
472- assert "force_rebuild" not in json_data ["packages" ]["test-package" ]["meta" ]
478+ # Ephemeral field IS serialized (except log_once_flags)
479+ assert "ephemeral" in json_data ["packages" ]["test-package" ]["meta" ]
480+ assert (
481+ json_data ["packages" ]["test-package" ]["meta" ]["ephemeral" ]["force_rebuild" ]
482+ is True
483+ )
484+ assert (
485+ "log_once_flags"
486+ not in json_data ["packages" ]["test-package" ]["meta" ]["ephemeral" ]
487+ )
473488
474489
475490class TestStateSyncerWithArgs :
0 commit comments