@@ -305,36 +305,39 @@ def test_ephemeral_field_can_be_modified(self) -> None:
305305 assert workflow .ephemeral .timed_out is True
306306
307307 def test_ephemeral_field_not_serialized_to_json (self ) -> None :
308- """Test that ephemeral field is excluded from JSON serialization ."""
308+ """Test that ephemeral field is serialized but log_once_flags are excluded ."""
309309 workflow = Workflow (workflow_file = "test.yml" )
310310 workflow .ephemeral .trigger_failed = True
311311 workflow .ephemeral .timed_out = True
312+ workflow .ephemeral .log_once_flags ["test_flag" ] = True
312313
313314 # Serialize to JSON
314315 json_str = workflow .model_dump_json ()
315316 json_data = json .loads (json_str )
316317
317- # Verify ephemeral field is not in JSON
318- assert "ephemeral" not in json_data
319- assert "trigger_failed" not in json_data
320- assert "timed_out" not in json_data
318+ # Verify ephemeral field IS in JSON (except log_once_flags)
319+ assert "ephemeral" in json_data
320+ assert json_data ["ephemeral" ]["trigger_failed" ] is True
321+ assert json_data ["ephemeral" ]["timed_out" ] is True
322+ assert "log_once_flags" not in json_data ["ephemeral" ]
321323
322324 # Verify other fields are present
323325 assert "workflow_file" in json_data
324326 assert json_data ["workflow_file" ] == "test.yml"
325327
326328 def test_ephemeral_field_not_in_model_dump (self ) -> None :
327- """Test that ephemeral field is excluded from model_dump."""
329+ """Test that ephemeral field is in model_dump but log_once_flags are excluded ."""
328330 workflow = Workflow (workflow_file = "test.yml" )
329331 workflow .ephemeral .trigger_failed = True
332+ workflow .ephemeral .log_once_flags ["test_flag" ] = True
330333
331334 # Get dict representation
332335 data = workflow .model_dump ()
333336
334- # Verify ephemeral field is not in dict
335- assert "ephemeral" not in data
336- assert " trigger_failed" not in data
337- assert "timed_out " not in data
337+ # Verify ephemeral field IS in dict (except log_once_flags)
338+ assert "ephemeral" in data
339+ assert data [ "ephemeral" ][ " trigger_failed"] is True
340+ assert "log_once_flags " not in data [ "ephemeral" ]
338341
339342 def test_ephemeral_field_initialized_on_deserialization (self ) -> None :
340343 """Test that ephemeral field is initialized when loading from JSON."""
@@ -348,7 +351,7 @@ def test_ephemeral_field_initialized_on_deserialization(self) -> None:
348351 assert workflow .ephemeral .timed_out is False
349352
350353 def test_release_state_ephemeral_not_serialized (self ) -> None :
351- """Test that ephemeral fields are not serialized in ReleaseState ."""
354+ """Test that ephemeral fields are serialized but log_once_flags are excluded ."""
352355 config = Config (
353356 version = 1 ,
354357 packages = {
@@ -366,19 +369,22 @@ def test_release_state_ephemeral_not_serialized(self) -> None:
366369 # Modify ephemeral fields
367370 state .packages ["test-package" ].build .ephemeral .trigger_failed = True
368371 state .packages ["test-package" ].publish .ephemeral .timed_out = True
372+ state .packages ["test-package" ].build .ephemeral .log_once_flags ["test" ] = True
369373
370374 # Serialize to JSON
371375 json_str = state .model_dump_json ()
372376 json_data = json .loads (json_str )
373377
374- # Verify ephemeral fields are not in JSON
378+ # Verify ephemeral fields ARE in JSON (except log_once_flags)
375379 build_workflow = json_data ["packages" ]["test-package" ]["build" ]
376380 publish_workflow = json_data ["packages" ]["test-package" ]["publish" ]
377381
378- assert "ephemeral" not in build_workflow
379- assert "trigger_failed" not in build_workflow
380- assert "ephemeral" not in publish_workflow
381- assert "timed_out" not in publish_workflow
382+ assert "ephemeral" in build_workflow
383+ assert build_workflow ["ephemeral" ]["trigger_failed" ] is True
384+ assert "log_once_flags" not in build_workflow ["ephemeral" ]
385+ assert "ephemeral" in publish_workflow
386+ assert publish_workflow ["ephemeral" ]["timed_out" ] is True
387+ assert "log_once_flags" not in publish_workflow ["ephemeral" ]
382388
383389
384390class TestReleaseMeta :
@@ -450,7 +456,7 @@ def test_force_rebuild_field_can_be_modified(self) -> None:
450456 assert state .packages ["test-package" ].meta .ephemeral .force_rebuild is True
451457
452458 def test_ephemeral_not_serialized (self ) -> None :
453- """Test that ephemeral field is not serialized to JSON ."""
459+ """Test that ephemeral field is serialized but log_once_flags are excluded ."""
454460 config = Config (
455461 version = 1 ,
456462 packages = {
@@ -465,12 +471,21 @@ def test_ephemeral_not_serialized(self) -> None:
465471
466472 state = ReleaseState .from_config (config )
467473 state .packages ["test-package" ].meta .ephemeral .force_rebuild = True
474+ state .packages ["test-package" ].meta .ephemeral .log_once_flags ["test" ] = True
468475
469476 json_str = state .model_dump_json ()
470477 json_data = json .loads (json_str )
471478
472- assert "ephemeral" not in json_data ["packages" ]["test-package" ]["meta" ]
473- assert "force_rebuild" not in json_data ["packages" ]["test-package" ]["meta" ]
479+ # Ephemeral field IS serialized (except log_once_flags)
480+ assert "ephemeral" in json_data ["packages" ]["test-package" ]["meta" ]
481+ assert (
482+ json_data ["packages" ]["test-package" ]["meta" ]["ephemeral" ]["force_rebuild" ]
483+ is True
484+ )
485+ assert (
486+ "log_once_flags"
487+ not in json_data ["packages" ]["test-package" ]["meta" ]["ephemeral" ]
488+ )
474489
475490
476491class TestStateSyncerWithArgs :
0 commit comments