Files
dify/.github/workflows/builder-safe-execution-tests.yml
T

1751 lines
306 KiB
YAML

name: Builder safe execution
on:
push:
branches: [build/dify-builder]
paths:
- 'api/core/dify_builder/**'
- 'api/services/dify_builder/**'
- 'api/services/app_generate_service.py'
- 'api/tasks/workflow_execute_task.py'
- 'api/tasks/app_generate/workflow_execute_task.py'
- 'api/services/credentials/**'
- 'api/repositories/credentials/**'
- 'api/services/workflow_service.py'
- 'api/services/workflow_generator_service.py'
- 'api/controllers/console/app/workflow.py'
- 'api/services/data_migration/import_service.py'
- 'api/events/event_handlers/delete_tool_parameters_cache_when_sync_draft_workflow.py'
- 'api/tests/unit_tests/events/event_handlers/test_delete_tool_parameters_cache_when_sync_draft_workflow.py'
- 'api/tests/unit_tests/services/test_draft_tool_admission.py'
- 'api/tests/unit_tests/repositories/credentials/test_query_repository.py'
- 'api/pyproject.toml'
- 'api/uv.lock'
- 'api/core/app/**'
- 'api/core/workflow/**'
- 'api/services/workflow_runtime/**'
- 'api/services/workflow_generation/**'
- 'api/core/repositories/**'
- 'api/models/dify_builder*.py'
- 'api/services/agent/access_service.py'
- 'api/services/agent/workspace_service.py'
- 'api/tests/unit_tests/services/agent/test_workspace_service.py'
- 'api/tests/unit_tests/controllers/inner_api/test_agent_*.py'
- 'api/tests/unit_tests/controllers/inner_api/knowledge/test_retrieval.py'
- 'api/controllers/inner_api/agent/**'
- 'api/controllers/inner_api/knowledge/retrieval.py'
- 'api/services/entities/agent_llm_inner.py'
- 'api/services/entities/agent_tool_inner.py'
- 'api/services/entities/knowledge_retrieval_inner.py'
- 'dify-agent/**'
- 'api/migrations/versions/*builder*'
- 'api/migrations/versions/*native*'
- 'api/tests/**/dify_builder/**'
- 'api/tests/**/test_builder*'
- 'api/tests/fixtures/workflow/builder_restricted/**'
- '.github/workflows/builder-safe-execution-tests.yml'
- '.github/scripts/builder-confirmed-tool-units.py'
# Confirmed Tool owners: controllers, Tool/OAuth/plugin, config, credentials, worker and sweeper.
- 'api/controllers/console/dify_builder*.py'
- 'api/controllers/console/wraps.py'
- 'api/core/tools/**'
- 'api/core/plugin/**'
- 'api/core/helper/credential_utils.py'
- 'api/core/helper/encrypter.py'
- 'api/core/helper/provider_cache.py'
- 'api/core/helper/provider_encryption.py'
- 'api/configs/**'
- 'api/models/account.py'
- 'api/models/tools.py'
- 'api/models/workflow.py'
- 'api/services/tools/**'
- 'api/services/plugin/**'
- 'api/libs/key_providers/**'
- 'api/libs/rsa.py'
- 'api/extensions/ext_celery.py'
- 'api/extensions/ext_redis.py'
- 'api/tasks/dify_builder_advance_task.py'
- 'api/schedule/dify_builder_reconcile_task.py'
- 'api/tests/e2e_tests/containers/conftest.py'
workflow_dispatch:
inputs:
contract_codegen:
description: Generate API contracts only, returning reviewed outputs as artifacts
type: boolean
default: false
test_scope:
description: Select a focused lane; all always runs on build branch pushes
type: choice
options:
[
all,
native-agent,
native-catalog,
native-continuation,
native-console,
native-dispatch,
native-postgres,
]
default: all
permissions:
contents: read
concurrency:
group: builder-safe-execution-${{ github.ref }}
cancel-in-progress: true
jobs:
native-migration-dialects:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-postgres'))
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Real PostgreSQL and MySQL evidence protections
run: >-
uv run --project api --no-sync pytest --no-cov -q
api/tests/test_containers_integration_tests/migrations/test_builder_native_migration_dialects.py
--junitxml=builder-migration-dialects.xml
- name: Require both real dialect cases
if: always()
run: |
python - <<'PY'
import xml.etree.ElementTree as ET
cases = list(ET.parse("builder-migration-dialects.xml").getroot().iter("testcase"))
expected = {
"test_native_migrations_preserve_checks_and_evidence_on_both_databases[postgresql]",
"test_native_migrations_preserve_checks_and_evidence_on_both_databases[mysql]",
}
assert len(cases) == 2
assert {case.get("name") for case in cases} == expected
assert all(case.find(tag) is None for case in cases for tag in ("skipped", "failure", "error"))
PY
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-migration-dialects
path: builder-migration-dialects.xml
native-postgres:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-postgres'))
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
STORAGE_TYPE: opendal
OPENDAL_SCHEME: fs
OPENDAL_FS_ROOT: /tmp/dify-builder-storage
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Real native persistence, PostgreSQL races and migration gate
shell: bash
run: |
set -o pipefail
timeout --kill-after=30s 45m uv run --project api --no-sync python -u - <<'PY' 2>&1 | tee builder-safe-execution.log
import xml.etree.ElementTree as ElementTree
from pathlib import Path
import pytest
JUNIT = "builder-safe-execution.xml"
# Every required case, per module and test function, with its exact collected count.
# The run is not accepted if a module or case is missing, skipped/xfailed or unexpected.
EXPECTED = {
"test_builder_restricted_native": {
"test_actual_native_port_to_persistence": 3,
"test_real_native_result_missing_proof_is_unknown": 4,
"test_composed_prelaunch_refusals_have_no_native_id": 6,
"test_composed_worker_reload_trace_race_refuses": 1,
"test_composed_effective_default_binding": 1,
"test_async_node_saves_without_delivery_stay_unknown": 1,
"test_ordinary_native_scalar_execution_remains_ordinary": 1,
"test_composed_class_replacement_refuses_before_native_validation": 1,
"test_composed_http_retry_receipts_and_recorder_poison": 2,
"test_composed_canonical_seal_replay_cannot_upgrade_or_change": 1,
"test_composed_template_exact_outputs_are_sealed_native_sql_success": 6,
"test_composed_renamed_template_and_multi_template_chain": 1,
"test_composed_http_body_to_template_remains_sealed_simulation": 1,
"test_composed_unsafe_template_refuses_without_native_allocation": 5,
"test_composed_template_cumulative_output_overflow_is_native_failure": 1,
"test_composed_template_text_without_complete_sql_proof_cannot_publish": 4,
"test_composed_template_seal_replay_rejects_changed_output": 1,
"test_composed_template_normal_workflow_citation_defaults_are_preserved": 1,
"test_composed_citation_display_change_invalidates_reserved_template_context": 2,
},
"test_builder_json_tool_native": {
"test_json_native_port_worker_graphon_run_and_end_seal": 4,
"test_json_seal_refuses_cross_owner_and_corrupt_native_proof": 8,
"test_concurrent_json_launch_claim_dispatches_at_most_once": 1,
"test_json_caller_explicit_read_session_closes_before_native_spawn": 1,
"test_json_native_end_matches_tool_and_start_selectors_exactly": 4,
"test_json_first_seal_requires_single_trusted_completed_observation": 7,
"test_json_unknown_first_seal_cannot_upgrade_after_receipt_repair": 1,
"test_json_optional_graph_plugin_identifier_seals_without_saved_graph_rewrite": 2,
"test_json_supplied_mismatched_graph_plugin_identifier_refuses_before_allocation": 1,
"test_json_constant_only_graph_without_start_inputs_seals_native_completion": 1,
"test_serverless_json_native_owned_prepare_run_and_seal": 1,
"test_native_editor_metadata_serverless_json_prepare_run_and_seal": 1,
},
"test_workflow_empty_draft": {
"test_postgres_empty_save_state_transition": 20,
"test_postgres_empty_draft_confirmation_is_scoped_to_full_owner_chain": 4,
"test_postgres_trusted_internal_empty_sync_remains_supported": 2,
},
"test_builder_execution_policy_persistence": {
"test_postgres_duplicate_claim_has_one_winner": 1,
"test_postgres_append_race_preserves_both_receipts": 1,
"test_postgres_append_seal_and_duplicate_seal_are_serialized": 1,
"test_real_postgres_execution_migration_upgrade_downgrade": 1,
"test_real_postgres_forward_merge_preserves_both_branches": 1,
"test_postgres_context_owner_replay_is_rejected": 7,
},
"test_builder_real_call_consent_persistence": {
"test_postgres_identical_prepare_collision_has_one_row": 1,
"test_postgres_simultaneous_execute_commits_exactly_one_launch": 1,
"test_postgres_execute_with_colliding_keys_has_one_winner": 1,
"test_postgres_reservation_and_unrelated_commit_cannot_both_advance": 1,
"test_postgres_stale_session_cas_rolls_back_every_reservation_write": 1,
"test_postgres_simultaneous_tool_claims_have_one_winner_and_survive_restart": 1,
"test_postgres_simultaneous_phase_claims_spend_once": 2,
"test_postgres_expiry_boundary_blocks_the_grant_claim": 1,
"test_postgres_spend_blocked_on_row_lock_across_expiry_is_refused": 2,
"test_postgres_refresh_cas_never_overwrites_same_timestamp_rotation": 1,
"test_postgres_concurrent_client_change_never_admits_a_stale_business_claim": 1,
"test_race_tables_are_built_by_the_actual_migrations": 1,
"test_real_postgres_consent_migration_upgrade_downgrade": 1,
},
"test_builder_agent_terminal_scan": {
"test_terminal_scan_accepts_native_uuid_test_input_ids": 1,
"test_terminal_scan_ignores_non_uuid_builder_input_references": 1,
},
"test_builder_confirmed_tool_native": {
"test_confirmed_native_run_reads_once_without_refresh": 1,
"test_confirmed_native_run_refreshes_once_then_reads": 1,
"test_cache_invalidation_failure_after_refresh_cas_stays_unknown_without_business": 1,
"test_restricted_default_run_has_zero_decrypt_refresh_or_invoke": 1,
"test_ordinary_native_gmail_workflow_stays_ordinary": 1,
"test_published_native_gmail_workflow_runs_the_published_graph": 1,
"test_changes_after_reservation_are_denied_without_effects": 9,
"test_postgres_tool_claim_has_one_winner": 1,
"test_duplicate_native_launches_create_one_run": 1,
"test_host_report_transfer_is_bounded_and_the_host_reaped": 3,
"test_refresh_cas_conflict_keeps_the_rotation_and_blocks_business": 1,
"test_partial_stream_is_unknown": 1,
"test_native_success_with_text_only_result_is_unknown": 1,
"test_expiry_blocks_a_new_phase": 1,
"test_completion_of_a_dispatched_phase_after_expiry_is_recorded": 1,
"test_crash_after_refresh_claim_before_persistence_settles_unknown_once": 1,
"test_crash_after_business_claim_before_transport_settles_unknown_once": 1,
"test_same_token_worker_deliveries_activate_once": 1,
"test_agent_setup_failure_settles_the_grant_without_spend": 1,
"test_transient_settlement_failure_is_repaired_by_the_terminal_scan": 1,
"test_terminal_repair_never_settles_a_fresh_live_reservation": 1,
"test_completed_grant_replays_and_receipts_stay_durable": 1,
"test_held_lease_duplicates_never_enqueue_twice": 1,
"test_held_lease_replay_refuses_another_actor_and_a_changed_scope": 1,
"test_dispatch_coordinator_metadata_read_runs_outside_sql": 1,
"test_stale_recovery_sweep_never_settles_a_fresh_reservation": 1,
"test_dispatched_recovery_survives_a_paused_old_sweep": 1,
"test_non_oauth_prepare_has_no_grant_or_sensitive_effect": 2,
"test_non_oauth_change_after_reservation_is_refused_before_claim": 2,
"test_legacy_non_oauth_native_selection_refuses_before_sensitive_effects": 2,
"test_authenticated_request_wrappers_reserve_replay_and_refuse_outside_sql": 2,
"test_authenticated_enabled_rbac_denial_has_no_reservation": 2,
"test_actual_authentication_refusal_precedes_real_call_work": 2,
"test_authenticated_enabled_rbac_maintainer_bypass_keeps_bounded_sql": 1,
"test_authenticated_enabled_rbac_bound_agent_app_is_not_plain_app": 2,
},
}
EXPECTED["test_builder_task_controls"] = {
"test_stop_commits_before_old_worker_actual_draft_write": 2,
"test_old_worker_draft_commit_before_stop_is_retained": 2,
"test_resumed_generation_rejects_old_worker_even_at_current_revision": 2,
"test_late_worker_session_cas_cannot_overwrite_durable_stop": 1,
"test_control_receipt_replay_survives_resume_without_new_commit": 1,
"test_simultaneous_same_stop_identity_commits_one_durable_projection": 1,
}
class ImmediateFailureReport:
def pytest_runtest_logreport(self, report: pytest.TestReport) -> None:
if report.failed:
print(f"\nFAILED {report.nodeid} [{report.when}]", flush=True)
print(report.longreprtext, flush=True)
for heading, content in report.sections:
print(f"\n{heading}\n{content}", flush=True)
def completeness() -> list[str]:
"""Collected cases from the JUnit report checked against EXPECTED; returns the problems."""
if not Path(JUNIT).is_file():
return [f"{JUNIT} was not written"]
cases: dict[tuple[str, str], str] = {}
for case in ElementTree.parse(JUNIT).getroot().iter("testcase"):
module = (case.get("classname") or "").rsplit(".", 1)[-1]
if case.find("skipped") is not None:
status = "skipped"
elif case.find("failure") is not None or case.find("error") is not None:
status = "failed"
else:
status = "passed"
key = (module, case.get("name") or "")
if cases.get(key) in (None, "passed"):
cases[key] = status
problems = []
for module, functions in EXPECTED.items():
statuses = [status for (name, _case), status in cases.items() if name == module]
print(
f"COLLECTED {module}: {len(statuses)} cases, {statuses.count('passed')} passed, "
f"{statuses.count('failed')} failed, {statuses.count('skipped')} skipped",
flush=True,
)
for function, count in functions.items():
found = [
status
for (name, case_name), status in cases.items()
if name == module and case_name.split("[", 1)[0] == function
]
if len(found) != count:
problems.append(f"{module}::{function} collected {len(found)} of {count}")
if "skipped" in found:
problems.append(f"{module}::{function} skipped {found.count('skipped')}")
for module, case_name in sorted(cases):
if case_name.split("[", 1)[0] not in EXPECTED.get(module, {}):
problems.append(f"unexpected case {module}::{case_name}")
print(f"COLLECTED total: {len(cases)} cases", flush=True)
return problems
code = pytest.main(
[
"-p",
"no:benchmark",
"--no-cov",
"-vv",
"-rA",
"--tb=long",
"--timeout=360",
"--timeout-method=thread",
"-o",
"faulthandler_timeout=120",
"api/tests/e2e_tests/containers/core/workflow/test_builder_restricted_native.py",
"api/tests/e2e_tests/containers/core/workflow/test_builder_json_tool_native.py",
"api/tests/e2e_tests/containers/core/workflow/test_builder_execution_policy_persistence.py",
"api/tests/e2e_tests/containers/core/workflow/test_builder_real_call_consent_persistence.py",
"api/tests/e2e_tests/containers/services/test_workflow_empty_draft.py",
"api/tests/e2e_tests/containers/core/workflow/test_builder_confirmed_tool_native.py",
"api/tests/e2e_tests/containers/core/workflow/test_builder_agent_terminal_scan.py",
"api/tests/e2e_tests/containers/core/workflow/test_builder_task_controls.py",
f"--junitxml={JUNIT}",
],
plugins=[ImmediateFailureReport()],
)
problems = completeness()
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-safe-execution-native-postgres
path: |
builder-safe-execution.xml
builder-safe-execution.log
confirmed-tool-units:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-catalog'))
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Confirmed Tool units on the integrated Python runtime
shell: bash
run: |
set -o pipefail
uv run --project api --no-sync python -u - < .github/scripts/builder-confirmed-tool-units.py 2>&1 | tee builder-confirmed-tool-units.log
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-confirmed-tool-units
path: |
builder-confirmed-tool-units.xml
builder-confirmed-tool-units.log
native-continuation:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-continuation'))
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
STORAGE_TYPE: opendal
OPENDAL_SCHEME: fs
OPENDAL_FS_ROOT: /tmp/dify-builder-continuation-storage
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Native continuation durability on real PostgreSQL and protected storage
shell: bash
run: |
set -o pipefail
cat > "$RUNNER_TEMP/builder_native_continuation_runner.py" <<'PY'
if __name__ == "__main__":
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.e2e_tests.containers.core.workflow.test_builder_native_continuation': {'test_checkpoint_real_encrypted_storage_roundtrip_and_snapshot': 1, 'test_missing_checkpoint_ack_never_reports_resumable_waiting': 1, 'test_fake_checkpoint_and_cross_invocation_reference_rejected': 1, 'test_result_owner_digest_and_completed_effect_replay': 1, 'test_resume_double_submit_same_generation_and_single_worker_claim': 1, 'test_enqueue_ack_loss_republishes_same_dispatch': 1, 'test_crash_after_worker_claim_is_unknown_never_new_effect': 1, 'test_pending_resolution_requires_actual_owner_completion': 2, 'test_cancellation_stops_tree_and_projects_claimed_unknown': 1, 'test_expiry_and_foreign_actor_fail_resume': 1, 'test_production_dispatch_without_native_collaborator_fails_closed': 1, 'test_child_input_owner_and_unique_identity_and_completion_wakeup': 1, 'test_revision_drift_fix_does_not_mutate_old_run': 1, 'test_actual_membership_revocation_stops_resume': 1, 'test_real_process_resume_and_worker_claim_race': 1, 'test_checkpoint_sql_commit_failure_never_acknowledges_wait': 1, 'test_checkpoint_readback_corruption_never_acknowledges_wait': 1, 'test_claim_recovery_requires_native_fencing_proof': 1, 'test_child_wait_requires_committed_child_and_parent_checkpoints': 1, 'test_cancellation_of_unclaimed_dispatch_never_launches': 1, 'test_migration_keeps_checkpoint_and_payload_evidence_immutable': 1, 'test_native_runtime_uses_same_checkpoint_and_terminal_stops_new_effects': 1, 'test_cancel_cleanup_reconciles_actual_native_evidence': 1, 'test_resume_rechecks_checkpoint_before_consuming_generation': 2, 'test_resumed_child_can_checkpoint_a_second_native_wait': 1, 'test_unknown_root_quarantines_active_child_tree': 1, 'test_returned_unknown_root_quarantines_descendants': 1, 'test_unknown_child_does_not_wake_parent_or_leave_grandchild_active': 1, 'test_current_membership_required_before_private_decrypt': 16, 'test_actual_child_app_permission_checked_before_decrypt': 4, 'test_spent_result_write_survives_membership_revocation_but_read_does_not': 1, 'test_invocation_read_owner_is_sql_immutable': 10, 'test_legacy_null_owner_fails_closed_without_decrypt': 1, 'test_invocation_read_owner_must_be_paired': 1, 'test_child_dispatch_recovery_requires_controlling_ancestor_fence': 2, 'test_child_claim_rechecks_unknown_ancestor_even_with_stale_active_delivery': 1, 'test_terminal_child_dispatch_stays_terminal_after_ancestor_recovery': 2, 'test_child_terminal_settlement_while_recovery_proof_is_held': 3}}
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_pause': {'test_host_barrier_returns_only_real_committed_wait_category': 3, 'test_host_barrier_survives_two_real_pause_generations': 1, 'test_host_barrier_owner_failure_never_returns_waiting': 4, 'test_host_journal_real_completed_result_replays_without_second_claim': 1, 'test_host_journal_real_unknown_result_never_becomes_replayable': 1, 'test_host_journal_refuses_foreign_private_input_before_effect': 3}})
EXPECTED['tests.e2e_tests.containers.core.workflow.test_builder_native_continuation'].update({'test_node_inputs_real_storage_idempotence_conflict_and_cursor_zero_result': 3, 'test_node_inputs_real_sql_authority_drift_never_acknowledges': 15, 'test_node_inputs_running_child_survives_unrelated_real_resume': 3, 'test_node_inputs_real_sql_ack_rollback_returns_no_reference': 1, 'test_node_inputs_storage_and_key_io_are_outside_root_write_transaction': 1})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_http_binding': {'test_real_http_snapshot_and_equal_install_preserve_other_entries': 1, 'test_real_http_conflict_is_immutable_and_concurrent_merge_preserves_entries': 1, 'test_real_http_opaque_wait_disclosure_and_known_destructive_never_auto_grants': 1, 'test_real_http_current_config_drift_stops_before_dispatch': 2, 'test_real_http_input_ack_and_external_work_stay_outside_install_writer': 1, 'test_real_http_unrelated_scope_advance_retains_invocation_generation': 1, 'test_real_http_foreign_actor_and_local_generation_drift_refuse_input_and_binding': 1, 'test_real_http_qualified_same_workflow_child_uses_local_generation_and_ancestor_authority': 1, 'test_real_http_one_accounting_unit_and_native_correlation_spent_once': 2, 'test_real_identical_http_occurrences_require_independent_guarded_one_call_confirmations': 1}, 'tests.e2e_tests.containers.core.workflow.test_builder_native_approval_scope': {'test_operation_confirmations_are_separate_immutable_single_calls_under_root_limit': 1, 'test_unknown_operation_cannot_redispatch_using_another_operation_grant': 1, 'test_legacy_batch_digest_and_exhaustion_keep_one_immutable_grant': 1, 'test_denial_cannot_be_bypassed_by_decision_replay': 2, 'test_concurrent_guarded_decisions_and_claims_serialize_once': 1, 'test_current_scope_metadata_drift_rejects_decision_and_physical_claim': 2, 'test_guarded_decision_rechecks_current_owner_and_generation': 2}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_dispatch_fence': {'test_active_private_reason_does_not_publish_a_waiting_receipt': 1, 'test_completed_result_replay_survives_later_running_fence': 1, 'test_concurrent_generation_claim_has_one_owner_and_retains_exact_evidence': 1, 'test_enqueue_keeps_fence_and_exclusive_claim_opens_only_acknowledged_reason': 1, 'test_exclusive_parent_claim_reopens_only_checkpoint_represented_descendant_reasons': 1, 'test_foreign_invocation_fence_and_ancestor_work_never_inherit_pending_identity': 1, 'test_history_allows_fresh_pending_then_first_new_fence_replaces_only_old_evidence': 1, 'test_lost_fence_commit_ack_never_returns_acceptance_or_a_wait_receipt': 1, 'test_malformed_saved_resolution_or_unknown_never_reopens_queued_fence': 4, 'test_pause_rejects_omitting_a_late_real_fence_member': 1, 'test_real_existing_nested_child_lookup_revalidates_parent_app_and_protected_input': 12, 'test_real_explicit_recovery_preserves_source_and_refuses_later_fence_evidence_loss': 2, 'test_real_pending_creation_and_fence_use_child_local_generation_after_unrelated_root_resume': 3, 'test_real_protected_child_approval_local_zero_shared_one_and_stale_local_rejection': 2, 'test_real_root_lock_orders_fence_against_reservation_or_physical_claim': 2, 'test_reserved_permit_losing_fence_race_is_not_refunded_or_physically_consumed': 1, 'test_running_fence_coalesces_exact_real_category_without_new_operation_or_spend': 3}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_continuation': {'test_checkpoint_real_encrypted_storage_roundtrip_and_snapshot': 1, 'test_missing_checkpoint_ack_never_reports_resumable_waiting': 1, 'test_fake_checkpoint_and_cross_invocation_reference_rejected': 1, 'test_result_owner_digest_and_completed_effect_replay': 1, 'test_node_inputs_real_storage_idempotence_conflict_and_cursor_zero_result': 3, 'test_node_inputs_real_sql_authority_drift_never_acknowledges': 15, 'test_node_inputs_running_child_survives_unrelated_real_resume': 3, 'test_node_inputs_real_sql_ack_rollback_returns_no_reference': 1, 'test_node_inputs_storage_and_key_io_are_outside_root_write_transaction': 1, 'test_resume_double_submit_same_generation_and_single_worker_claim': 1, 'test_enqueue_ack_loss_republishes_same_dispatch': 1, 'test_crash_after_worker_claim_is_unknown_never_new_effect': 1, 'test_pending_resolution_requires_actual_owner_completion': 2, 'test_cancellation_stops_tree_and_projects_claimed_unknown': 1, 'test_expiry_and_foreign_actor_fail_resume': 1, 'test_production_dispatch_without_native_collaborator_fails_closed': 1, 'test_child_input_owner_and_unique_identity_and_completion_wakeup': 1, 'test_revision_drift_fix_does_not_mutate_old_run': 1, 'test_actual_membership_revocation_stops_resume': 1, 'test_real_process_resume_and_worker_claim_race': 1, 'test_checkpoint_sql_commit_failure_never_acknowledges_wait': 1, 'test_checkpoint_readback_corruption_never_acknowledges_wait': 1, 'test_claim_recovery_requires_native_fencing_proof': 1, 'test_child_wait_requires_committed_child_and_parent_checkpoints': 1, 'test_terminal_child_with_unresolved_form_commits_without_parent_dispatch': 1, 'test_cancellation_of_unclaimed_dispatch_never_launches': 1, 'test_migration_keeps_checkpoint_and_payload_evidence_immutable': 1, 'test_native_runtime_uses_same_checkpoint_and_terminal_stops_new_effects': 1, 'test_cancel_cleanup_reconciles_actual_native_evidence': 1, 'test_resume_rechecks_checkpoint_before_consuming_generation': 2, 'test_resumed_child_can_checkpoint_a_second_native_wait': 1, 'test_unknown_root_quarantines_active_child_tree': 1, 'test_returned_unknown_root_quarantines_descendants': 1, 'test_unknown_child_does_not_wake_parent_or_leave_grandchild_active': 1, 'test_current_membership_required_before_private_decrypt': 16, 'test_actual_child_app_permission_checked_before_decrypt': 4, 'test_spent_result_write_survives_membership_revocation_but_read_does_not': 1, 'test_invocation_read_owner_is_sql_immutable': 10, 'test_legacy_null_owner_fails_closed_without_decrypt': 1, 'test_invocation_read_owner_must_be_paired': 1, 'test_child_dispatch_recovery_requires_controlling_ancestor_fence': 2, 'test_child_claim_rechecks_unknown_ancestor_even_with_stale_active_delivery': 1, 'test_terminal_child_dispatch_stays_terminal_after_ancestor_recovery': 2, 'test_child_terminal_settlement_while_recovery_proof_is_held': 3}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_host_capacity': {'test_real_initial_outbox_retries_and_single_claim_have_no_fake_continuation': 1, 'test_real_app_lock_allows_only_one_of_two_queued_requests_from_distinct_sessions_and_actors': 1, 'test_real_native_capacity_is_not_global_across_apps': 1, 'test_real_acquired_unclean_root_retains_slot_even_after_expiry_or_terminal_projection': 4, 'test_real_exact_cleanup_releases_once_and_missing_physical_port_proof_does_not': 1, 'test_real_resume_recovery_requires_cleanup_ack_and_new_exact_lifetime_for_same_sql_ids': 1, 'test_real_unrepresented_form_pending_prevents_initial_enqueue': 1, 'test_real_initial_enqueue_lost_commit_ack_retry_keeps_one_actual_outbox': 1, 'test_malformed_acquired_dispatch_tenant_cannot_disappear_through_owner_join': 3, 'test_valid_other_tenant_acquisition_is_not_borrowed_or_counted': 1, 'test_real_never_acquired_cancellation_seals_and_stays_complete_under_reconcile': 2, 'test_real_acquired_cancellation_still_requires_exact_physical_verifier': 3}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_stop_sealing': {'test_real_stop_commit_seals_authority_but_retains_acquisition_and_cleanup': 1, 'test_real_stop_rejects_orphan_dispatch_without_mutating_authority_or_outbox': 3, 'test_real_stopped_or_unknown_evidence_can_finalize_after_authority_seal': 2, 'test_real_seal_rejects_late_success_without_changing_acquisition': 1, 'test_real_stop_can_close_authority_after_membership_revocation': 1, 'test_real_stop_lost_commit_ack_never_replays_as_acceptance': 1}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_claimed_resume_checkpoint': {'test_actual_claimed_checkpoint_ref_is_acknowledged_and_metadata_only': 1, 'test_explicit_recovery_reclaims_same_dispatch_and_keeps_authentic_checkpoint': 1, 'test_child_local_claim_survives_unrelated_shared_scope_advance': 1, 'test_generation_zero_claim_has_no_resume_checkpoint_authority': 1, 'test_actual_current_owner_or_claim_drift_refuses_without_projection': 12}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_observation_history': {'test_actual_owner_or_legacy_content_refuses_before_cache': 3, 'test_foreign_upload_owner_refuses_before_actual_storage_read': 1, 'test_projected_save_fresh_bound_same_run_reload_including_real_offload': 1, 'test_initial_current_profile_observation_reads_real_sql_and_protected_object': 2}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_agent_associations': {'test_real_encrypted_association_checkpoint_roundtrip_preserves_nonempty_private_relations': 1, 'test_real_immutable_agent_selection_refuses_without_new_private_write': 2, 'test_real_current_workspace_retirement_blocks_selected_checkpoint_read': 1, 'test_real_post_commit_ack_loss_reuses_private_object_without_rewrite': 1, 'test_real_second_node_occurrence_cannot_share_temporary_single_workspace': 1}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_native_runtime': {'test_actual_api_cancel_initial_outbox_before_delivery_is_logically_settled': 2, 'test_actual_cancel_through_consumed_source_owner_does_not_ack_live_resumed_owner': 1, 'test_actual_same_run_http_wait_checkpoint_cleanup_claimed_resume_and_duplicate': 3, 'test_real_resume_writer_refuses_wait_cleanup_before_source_finalize_then_same_command_succeeds': 1, 'test_actual_initial_run_null_outputs_survive_first_native_node_persistence': 1, 'test_real_cancel_after_wait_cleanup_before_source_finalize_preserves_unknown': 1, 'test_actual_settled_wait_completed_source_cancel_is_clean_and_preserves_native_pause': 1, 'test_actual_known_stop_settles_sql_cleanup_and_finalizes_exact_source': 2, 'test_actual_denied_pending_cannot_borrow_stop_settlement_for_resume': 1}})
EXPECTED.update({'tests.e2e_tests.containers.core.workflow.test_builder_agent_continuation': {'test_real_pg_encrypted_claim_lost_ack_is_discovery_never_second_authority': 1, 'test_real_pg_concurrent_initial_reservation_has_one_local_post_owner': 1, 'test_real_pg_mutation_during_crypto_storage_prevents_config_ack': 4, 'test_real_pg_callback_same_run_idempotent_foreign_run_conflicts_after_readback': 1, 'test_real_pg_initial_claim_io_cannot_restamp_older_composed_definition': 4}})
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.e2e_tests.containers.core.workflow.test_builder_agent_create_recovery': {'test_postgres_concurrent_reservations_allow_exactly_one_create': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.e2e_tests.containers.core.workflow.test_builder_agent_operations': {'test_actual_sql_approval_dispatch_and_result_replay_once': 1,
'test_confirmed_admission_uses_original_key_and_preallocated_parent_run': 1,
'test_confirmed_deferred_calls_have_distinct_pending_and_one_c03_snapshot': 1,
'test_physical_timeout_is_unknown_and_cannot_dispatch_again': 1},
'tests.e2e_tests.containers.core.workflow.test_builder_native_agent_associations': {'test_real_current_workspace_retirement_blocks_selected_checkpoint_read': 1,
'test_real_encrypted_association_checkpoint_roundtrip_preserves_nonempty_private_relations': 1,
'test_real_immutable_agent_selection_refuses_without_new_private_write': 2,
'test_real_post_commit_ack_loss_reuses_private_object_without_rewrite': 1,
'test_real_queued_agent_checkpoint_is_readable_before_single_dispatch_claim': 1,
'test_real_second_node_occurrence_cannot_share_temporary_single_workspace': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
# Confirmed blank Home: collected required-field, isolated-owner and real SQL restore cases.
for module, functions in {'tests.e2e_tests.containers.core.workflow.test_builder_native_agent_associations': {'test_real_normal_blank_home_prepare_and_generation_one_checkpoint_read': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
# Candidate 3: actual PostgreSQL collection adds cases without dropping old guards.
EXPECTED.setdefault('tests.e2e_tests.containers.core.workflow.test_builder_agent_operations', {}).update({'test_confirmed_deferred_calls_have_distinct_pending_and_one_c03_snapshot': 2})
EXPECTED.setdefault('tests.e2e_tests.containers.core.workflow.test_builder_native_agent_associations', {}).update({'test_real_normal_blank_home_prepare_and_generation_one_checkpoint_read': 14,
'test_real_unmarked_profiles_keep_raw_revision_and_immutable_private_scope': 2})
# Async config receipts: source-audited exact PostgreSQL case inventory.
for module, functions in {'tests.e2e_tests.containers.core.workflow.test_builder_agent_operations': {'test_actual_sql_approval_dispatch_and_result_replay_once': 1,
'test_cancellation_during_final_ack_decryption_refuses_url_admission': 1,
'test_completed_ack_exception_is_exclusive_to_original_shell_run': 5,
'test_completed_async_ack_allows_second_declared_config_read_without_dispatch': 1,
'test_completed_shell_config_read_refuses_uncertain_or_foreign_authority': 15,
'test_confirmed_admission_uses_original_key_and_preallocated_parent_run': 1,
'test_confirmed_deferred_calls_have_distinct_pending_and_one_c03_snapshot': 2,
'test_existing_live_shell_config_read_survives_later_approval_wait': 14,
'test_noncompleted_outcome_never_unlocks_config_read': 3,
'test_physical_timeout_is_unknown_and_cannot_dispatch_again': 1,
'test_receipt_failure_preserves_known_completed_ack_and_refuses_config_read': 2}}.items():
EXPECTED.setdefault(module, {}).update(functions)
REPORT = "builder-native-continuation.xml"
code = pytest.main(['api/tests/e2e_tests/containers/core/workflow/test_builder_agent_operations.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_agent_create_recovery.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_agent_continuation.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_continuation.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_pause.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_http_binding.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_approval_scope.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_dispatch_fence.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_host_capacity.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_stop_sealing.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_claimed_resume_checkpoint.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_observation_history.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_agent_associations.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_runtime.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-native-continuation.xml', '-p', 'no:benchmark', '--no-cov', '--timeout=360', '--timeout-method=thread'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
uv run --project api --no-sync python -u "$RUNNER_TEMP/builder_native_continuation_runner.py" 2>&1 | tee builder-native-continuation.log
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-native-continuation
path: |
builder-native-continuation.xml
builder-native-continuation.log
native-dispatch:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-dispatch'))
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
STORAGE_TYPE: opendal
OPENDAL_SCHEME: fs
OPENDAL_FS_ROOT: /tmp/dify-builder-dispatch-storage
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Durable native physical dispatch claims on real PostgreSQL
shell: bash
run: |
set -o pipefail
cat > "$RUNNER_TEMP/builder_native_dispatch_runner.py" <<'PY'
if __name__ == "__main__":
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.unit_tests.services.dify_builder.native_testing.test_dispatch_claims': {'test_missing_dispatch_evidence_stops_before_authority_lookup': 3, 'test_in_process_dto_bypass_is_revalidated_before_authority_lookup': 6}, 'tests.e2e_tests.containers.core.workflow.test_builder_native_dispatch_claims': {'test_inert_validation_does_not_consume_and_owner_claim_commits_before_io': 1, 'test_two_processes_consume_one_owned_permit_once': 1, 'test_lost_claim_response_and_restarted_process_cannot_dispatch': 1, 'test_rollback_before_claim_commit_invokes_no_io': 1, 'test_owner_mismatch_leaves_no_claim_or_io': 5, 'test_intent_mismatch_leaves_no_claim_or_io': 8, 'test_permit_mismatch_leaves_no_claim_or_io': 4, 'test_current_authority_failure_leaves_no_claim_or_io': 7, 'test_blocked_ancestor_prevents_child_claim': 3, 'test_settlement_cannot_replay_physical_io': 4, 'test_claim_rows_are_unique_append_only_and_block_destructive_downgrade': 1, 'test_concurrent_downgrade_cannot_erase_a_successfully_committed_claim': 1}}
REPORT = "builder-native-dispatch.xml"
code = pytest.main(['api/tests/unit_tests/services/dify_builder/native_testing/test_dispatch_claims.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_native_dispatch_claims.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-native-dispatch.xml', '-p', 'no:benchmark', '--no-cov', '--timeout=360', '--timeout-method=thread'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
uv run --project api --no-sync python -u "$RUNNER_TEMP/builder_native_dispatch_runner.py" 2>&1 | tee builder-native-dispatch.log
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-native-dispatch
path: |
builder-native-dispatch.xml
builder-native-dispatch.log
native-console:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-console'))
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
STORAGE_TYPE: opendal
OPENDAL_SCHEME: fs
OPENDAL_FS_ROOT: /tmp/dify-builder-continuation-storage
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Signed native Console API on real PostgreSQL
shell: bash
run: |
set -o pipefail
cat > "$RUNNER_TEMP/builder_native_console_runner.py" <<'PY'
if __name__ == "__main__":
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.e2e_tests.containers.core.workflow.test_builder_native_console_api': {'test_native_console_unauthenticated_is_rejected': 1, 'test_native_console_invalid_csrf_is_rejected': 1, 'test_decision_cannot_replace_effect_parameters': 1, 'test_protected_checkpoint_roundtrip_disclosure_and_same_key_receipt': 1, 'test_same_key_different_decision_conflicts_without_dispatch': 1, 'test_stale_scope_and_version_cannot_approve': 2, 'test_current_resource_rotation_cannot_approve': 1, 'test_frozen_two_call_proposal_cannot_authorize_third_call': 1, 'test_cross_session_request_is_not_visible': 1, 'test_old_checkpoint_without_full_intent_fails_closed': 2, 'test_current_test_run_permission_is_required': 1, 'test_actual_child_permission_revocation_blocks_root_public_receipt': 1, 'test_generation_changes_after_protected_read_cannot_write_grant': 1, 'test_auth_start_persists_compiled_context_and_replays_without_second_admission': 1, 'test_cancel_without_cleanup_ack_reports_cancelling': 1, 'test_cleanup_ack_cannot_erase_unknown_dispatched_effect': 1, 'test_resume_reuses_same_durable_dispatch': 1, 'test_approval_cannot_replace_configuration_or_native_form': 2, 'test_expired_frozen_proposal_cannot_approve': 1, 'test_final_child_authority_refresh_precedes_decision_write': 2, 'test_concurrent_decisions_return_canonical_saved_receipt': 2}}
EXPECTED['tests.e2e_tests.containers.core.workflow.test_builder_native_console_api'].update({
'test_public_decision_refresh_and_readiness_never_dispatch': 1,
'test_expired_saved_decision_stays_frozen_but_cannot_resume': 1,
})
EXPECTED['tests.e2e_tests.containers.core.workflow.test_builder_test_action_api'] = {'test_confirm_and_refresh_use_only_existing_session_action_transport': 1, 'test_action_transport_rejects_foreign_scope_without_dispatch': 1, 'test_action_transport_still_requires_console_login_and_csrf': 1, 'test_native_resume_through_choice_reuses_one_durable_dispatch': 1, 'test_native_cancel_through_choice_does_not_claim_external_rollback': 1, 'test_action_controls_complete_real_graphon_run_without_repeated_http': 3}
EXPECTED['tests.e2e_tests.containers.core.workflow.test_builder_test_action_api']['test_expired_current_test_remains_readonly_and_cannot_continue'] = 3
REPORT = "builder-native-console.xml"
code = pytest.main(['api/tests/e2e_tests/containers/core/workflow/test_builder_native_console_api.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_test_action_api.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-native-console.xml', '-p', 'no:benchmark', '--no-cov', '--timeout=360', '--timeout-method=thread'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
uv run --project api --no-sync python -u "$RUNNER_TEMP/builder_native_console_runner.py" 2>&1 | tee builder-native-console.log
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-native-console
path: |
builder-native-console.xml
builder-native-console.log
native-agent-binding:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-catalog'))
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
STORAGE_TYPE: opendal
OPENDAL_SCHEME: fs
OPENDAL_FS_ROOT: /tmp/dify-builder-agent-storage
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Native Agent catalog and atomic bindings on real PostgreSQL
shell: bash
run: |
set -o pipefail
uv run --project api --no-sync python -u - <<'PY' 2>&1 | tee builder-native-agent-binding.log
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.e2e_tests.containers.services.test_builder_agent_binding': {'test_real_catalog_filters_publication_tenant_and_actor_before_pagination': 1, 'test_draft_graph_and_native_binding_rollback_together': 1, 'test_publication_pointer_cannot_change_between_prepare_and_native_sync': 1}}
EXPECTED['tests.e2e_tests.containers.core.workflow.test_builder_agent_workspace'] = {'test_postgres_concurrent_prepare_reserves_one_identity': 1, 'test_postgres_ambiguous_allocation_only_inspects_same_scope': 2, 'test_postgres_cancel_or_drift_after_allocation_never_activates': 2, 'test_postgres_cross_tenant_and_snapshot_reject_before_physical_io': 1, 'test_postgres_terminal_retirement_settles_and_quarantines_cleanup': 1}
REPORT = "builder-native-agent-binding.xml"
code = pytest.main(['api/tests/e2e_tests/containers/services/test_builder_agent_binding.py', 'api/tests/e2e_tests/containers/core/workflow/test_builder_agent_workspace.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-native-agent-binding.xml', '-p', 'no:benchmark', '--no-cov', '--timeout=360', '--timeout-method=thread'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-native-agent-binding
path: |
builder-native-agent-binding.xml
builder-native-agent-binding.log
native-agent-protocol:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all' || inputs.test_scope == 'native-agent'))
runs-on: ubuntu-24.04
timeout-minutes: 30
services:
redis:
image: redis:6-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
env:
DIFY_AGENT_NATIVE_TEST_REDIS_URL: redis://127.0.0.1:6379/15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: dify-agent/uv.lock
- run: uv sync --directory dify-agent --locked --extra server --dev
- name: Native Agent protocol and real Redis continuation
working-directory: dify-agent
shell: bash
run: |
set -o pipefail
uv run --no-sync --extra server python -u - <<'PY' 2>&1 | tee builder-native-agent.log
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.local.dify_agent.protocol.test_native_testing': {'test_reference_exact_wire_and_no_authority_fields': 1, 'test_wait_reason_survives_wire_roundtrip': 3, 'test_continue_cannot_supply_decisions_or_execution_arguments': 1, 'test_mode_and_reference_must_agree': 4, 'test_all_features_are_required': 1, 'test_http_rejects_before_scheduler_or_any_execution_boundary': 1, 'test_client_refreshes_capabilities_and_never_falls_back': 1, 'test_client_maps_unavailable_capability_endpoint_to_stable_error': 3, 'test_executable_wire_rejects_non_finite_or_non_json_arguments': 5, 'test_exact_decision_wire_contract': 4, 'test_invalid_checkpoint_does_not_enter_public_status_or_events': 1, 'test_ordinary_client_wire_remains_compatible_with_frozen_old_server': 2}, 'tests.local.dify_agent.runtime.test_native_continuation': {'test_stage_checkpoint_preserves_reason_without_faking_tool_history': 3, 'test_real_native_deferral_checkpoint_and_resume_without_reissuing_call': 2, 'test_denied_or_changed_native_arguments_never_become_model_feedback': 1, 'test_direct_runner_rejects_marked_test_before_module_loading': 1, 'test_scheduler_rejects_native_before_persistence': 1, 'test_runner_commits_wait_instead_of_success_and_persistence_failure_is_not_resumable': 2, 'test_scheduler_restores_only_matching_pinned_snapshot_before_scheduling': 1, 'test_scheduler_resume_keeps_run_and_claim_after_lost_acknowledgement': 2, 'test_api_owner_denial_stops_waiting_run_instead_of_returning_model_feedback': 1, 'test_continuation_cannot_relabel_pending_approval_as_external_result': 1, 'test_duplicate_before_start_cas_does_not_block_unrelated_admission_or_shutdown': 1}, 'tests.local.dify_agent.storage.test_native_continuation_store': {'test_persistence_failure_cannot_publish_waiting': 1, 'test_mismatched_waiting_event_rejected_before_redis': 1, 'test_real_redis_atomic_claim_restart_stale_generation_and_cancellation': 1, 'test_real_redis_result_store_owner_bound_and_restart': 1}}
EXPECTED['tests.local.dify_agent.runtime.test_native_effects'] = {'test_waiting_preserves_typed_payload_and_never_invokes': 3,
'test_recorded_result_and_denial_never_invoke': 1,
'test_success_stores_protected_result_before_receipt': 1,
'test_ambiguous_io_closes_as_unknown_without_retry': 1,
'test_opaque_call_discloses_uncertainty': 1,
'test_real_sdk_pre_tool_boundary_checkpoints_wait_before_handler': 3,
'test_actual_tool_layer_defers_with_final_arguments_before_transport': 8,
'test_sdk_permit_is_spent_once_and_result_can_replay_without_handler': 1,
'test_eager_knowledge_waits_before_http_and_cache_write': 1,
'test_config_pull_waits_before_shell_io': 1,
'test_shell_native_tool_waits_before_session_access': 4,
'test_bootstrap_waits_before_runtime_resource_access': 1,
'test_actual_model_client_waits_before_http': 1,
'test_marked_runner_requires_real_effect_owner_before_loading': 1,
'test_actual_direct_plugin_claim_precedes_one_daemon_request': 2,
'test_private_policy_http_preserves_discriminants_and_typed_arguments': 1,
'test_missing_shell_lineage_stops_before_effect_reservation': 1,
'test_session_typed_json_guard_precedes_authorization_and_dispatch': 10,
'test_direct_plugin_typed_json_guard_precedes_materialize_claim_and_dispatch': 5,
'test_direct_plugin_target_guard_precedes_materialize_claim_and_dispatch': 1}
EXPECTED.update({'tests.local.dify_agent.runtime.test_native_continuation': {'test_stage_checkpoint_preserves_reason_without_faking_tool_history': 3, 'test_real_native_deferral_checkpoint_and_resume_without_reissuing_call': 2, 'test_denied_or_changed_native_arguments_never_become_model_feedback': 1, 'test_direct_runner_rejects_marked_test_before_module_loading': 1, 'test_scheduler_rejects_native_before_persistence': 1, 'test_runner_commits_wait_instead_of_success_and_persistence_failure_is_not_resumable': 2, 'test_scheduler_restores_only_matching_pinned_snapshot_before_scheduling': 1, 'test_scheduler_resume_keeps_run_and_claim_after_lost_acknowledgement': 2, 'test_api_owner_denial_stops_waiting_run_instead_of_returning_model_feedback': 1, 'test_continuation_cannot_relabel_pending_approval_as_external_result': 1, 'test_duplicate_before_start_cas_does_not_block_unrelated_admission_or_shutdown': 1, 'test_private_protocol_move_preserves_runtime_capture_and_wire_contract': 1}, 'tests.local.dify_agent.protocol.test_native_checkpoint_readback': {'test_read_request_preserves_backend_generation_and_selected_event': 1, 'test_noncanonical_or_zero_event_selectors_refuse': 11, 'test_request_does_not_coerce_or_accept_caller_proof': 4, 'test_checkpoint_data_models_remain_runtime_compatible': 1}, 'tests.local.dify_agent.server.test_native_checkpoint_readback': {'test_authenticated_real_app_reader_preserves_selected_private_bytes': 1, 'test_real_app_authentication_precedes_any_private_store_read': 2, 'test_anonymous_migration_keeps_private_reader_absent': 1, 'test_request_bounds_and_validation_do_not_echo_body_or_read_store': 2, 'test_storage_reply_cannot_override_selected_run_wait_or_generation': 6, 'test_private_checkpoint_must_match_complete_selected_owner': 5, 'test_real_selected_event_must_match_checkpoint_without_decode_leaks': 8, 'test_missing_or_oversized_storage_refuses_without_checkpoint_decode': 3, 'test_private_wait_does_not_coerce_corrupt_internal_state': 3, 'test_embedded_event_id_cannot_be_replaced_by_selected_stream_id': 1, 'test_private_route_normalizes_store_failures_without_history': 3}, 'tests.local.dify_agent.storage.test_native_continuation_store': {'test_mismatched_waiting_event_rejected_before_redis': 1, 'test_persistence_failure_cannot_publish_waiting': 1, 'test_real_redis_atomic_claim_restart_stale_generation_and_cancellation': 1, 'test_real_redis_atomic_read_race_never_mixes_wait_and_execution_generation': 2, 'test_real_redis_lost_wait_ack_discovers_exact_committed_event_without_republish': 1, 'test_real_redis_result_store_owner_bound_and_restart': 1, 'test_real_redis_selected_checkpoint_ack_and_fresh_process_read': 2, 'test_real_redis_selected_checkpoint_refuses_actual_changed_or_unavailable_state': 10, 'test_real_redis_initial_identity_persists_before_prepare_and_private_read_survives_restart': 1}})
EXPECTED.update({'tests.local.dify_agent.protocol.test_initial_preparation': {'test_parent_is_pure_canonical_and_marked_request_requires_exact_parent': 1, 'test_ordinary_serialization_remains_old_server_compatible': 1, 'test_digest_covers_only_executable_material_and_callback_has_no_authority_fields': 1, 'test_sdk_identity_read_is_bounded_exact_and_once': 5, 'test_api_prepare_adapter_is_bounded_once_and_checks_digest': 5, 'test_async_sdk_identity_stream_has_same_exact_owner_and_byte_cap': 3, 'test_protected_config_adapter_checks_current_parent_digest_and_actual_byte_cap': 5}, 'tests.local.dify_agent.server.test_initial_identity': {'test_identity_is_private_persisted_metadata_and_not_public_response': 1, 'test_bearer_precedes_body_and_store': 3, 'test_oversize_and_authority_fields_stop_before_store': 1, 'test_scheduler_persists_exact_actual_identity_before_callback_and_schedules_zero_on_denial': 1}})
EXPECTED.update({'tests.local.dify_agent.adapters.native_testing.test_producers': {'test_direct_producers_preserve_wire_and_results_on_strict_routes': 3, 'test_policy_preparation_and_control_callbacks_all_use_bound_strict_transport': 1, 'test_llm_layer_strict_transport_keeps_stream_usage_and_checks_actual_deps_run': 1}, 'tests.local.dify_agent.adapters.native_testing.test_transport': {'test_request_stream_and_prebuilt_send_ignore_all_body_markers': 1, 'test_missing_binding_and_detached_task_after_owner_exit_refuse_locally': 1, 'test_destination_method_and_signed_url_do_not_acquire_authority': 10, 'test_supplied_auth_selection_or_legacy_headers_refuse': 5, 'test_redirect_never_forwards_authority_even_with_follow_redirects_requested': 1, 'test_cached_prebuilt_request_uses_current_binding_but_caller_mismatch_refuses': 1, 'test_concurrent_scopes_nested_misuse_exception_and_cancellation_do_not_leak': 1, 'test_daemon_transport_refuses_native_without_effect_markers_and_after_exit': 1, 'test_inherited_send_waiting_for_body_cannot_dispatch_after_owner_exit': 1}, 'tests.local.dify_agent.layers.dify_plugin.test_layers': {'test_model_assembly_reads_config_reference_and_borrows_shared_client': 1,
'test_native_plugin_tool_converts_file_inputs': 2,
'test_native_plugin_tool_prepares_schema_merges_hidden_parameters_and_decodes_stream': 1,
'test_tools_with_different_package_bindings_do_not_share_a_daemon_client': 2}, 'tests.local.dify_agent.layers.knowledge.test_layer': {'test_eager_results_are_in_user_role_and_cache_uses_current_config': 1, 'test_generated_query_native_tool_preserves_local_validation_and_retry_policy': 3, 'test_nonretryable_eager_failure_leaves_previous_cache_for_retry': 1, 'test_retryable_eager_failure_is_saved_as_user_observation': 1}, 'tests.local.dify_agent.runtime.test_run_transport': {'test_scheduled_ordinary_runs_use_actual_persisted_identity_with_concurrent_shared_client': 1, 'test_initial_native_preparation_and_runner_have_separate_persisted_scopes': 1, 'test_restore_uses_persisted_old_generation_then_execution_rereads_after_start_cas': 1, 'test_scheduler_refuses_changed_readback_before_any_native_callback_or_send': 4, 'test_scheduler_itself_cannot_install_native_owner_with_legacy_authority': 2, 'test_actual_scheduler_finally_revokes_inherited_detached_runner_task': 2}, 'tests.local.dify_agent.server.test_app': {'test_create_app_authenticates_control_plane_routes': 4, 'test_create_app_wires_authenticated_agent_stub_connection_route': 1, 'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1, 'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1, 'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1, 'test_create_app_lifecycle_owns_agent_observability_instance': 1, 'test_create_app_defaults_agent_observability_to_disabled': 1, 'test_create_app_passes_settings_to_server_observability': 1, 'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1, 'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2, 'test_create_app_native_owner_injection_and_truthful_capabilities': 1, 'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1}, 'tests.local.dify_agent.server.test_runtime_transport': {'test_existing_inner_key_selects_legacy_composition_and_absence_selects_strict': 1, 'test_native_owner_is_refused_while_legacy_authority_remains_or_bearer_missing': 3, 'test_unconfigured_ordinary_control_composition_has_no_outbound_business_authority': 1, 'test_actual_lifespan_daemon_owner_and_generic_direct_client_refuse_native': 1}})
EXPECTED.update({'tests.local.dify_agent.agent_stub.server.test_runtime_admission': {'test_config_query_duplicate_or_extra_refuses': 3,
'test_confirmed_stub_durable_reader_requires_exact_active_identity': 1,
'test_confirmed_stub_token_preserves_claimed_envelope_and_config_get_forwards_it': 1,
'test_connect_and_delegated_download_require_same_admitted_owner': 1,
'test_context_mutation_during_live_read_refuses': 1,
'test_direct_authentication_preserves_runtime_admission': 2,
'test_expiry_during_final_live_read_refuses': 1,
'test_invalid_owner_refuses_before_send': 5,
'test_issuance_requires_actual_run_and_keeps_legacy_unselected': 1,
'test_live_ordinary_config_get_uses_final_owner_and_direct_injection_refuses': 1,
'test_native_claims_refuse_before_reader_or_issuance': 1,
'test_post_body_liveness_loss_and_detached_scope_refuse': 1,
'test_prompt_bridge_never_uses_legacy_authority_for_runtime_principal': 2,
'test_runtime_token_cannot_enter_explicit_legacy_service': 1,
'test_six_config_routes_only_accept_their_method': 6,
'test_skill_alias_refuses_before_httpx_normalization': 5,
'test_standalone_strict_refuses_valid_runtime_token_without_live_store': 1,
'test_strict_file_upload_uses_signed_context_and_final_header': 1,
'test_strict_timeout_preserves_public_error': 2}, 'tests.integration.dify_agent.storage.test_active_stub_identity': {'test_active_stub_atomic_selection': 12}})
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.local.dify_agent.client.test_run_recovery': {'test_lookup_after_lost_create_ack_is_one_read_post_with_no_create_retry': 2,
'test_lookup_errors_never_fall_back_to_create': 3},
'tests.local.dify_agent.protocol.test_run_recovery': {'test_fingerprint_binds_metadata_and_snapshot_but_not_key_or_object_order': 1,
'test_lookup_refuses_unbounded_or_configuration_payload': 5},
'tests.local.dify_agent.runtime.test_confirmed_continuation_owner': {'test_confirmed_profile_requires_bounded_create_identity': 1,
'test_confirmed_profile_requires_create_recovery_capability_before_post': 1,
'test_confirmed_profile_requires_only_implemented_features_and_old_default_is_strict': 1,
'test_confirmed_scheduler_keeps_ordinary_legacy_services_and_uses_strict_run_client': 1,
'test_confirmed_sdk_negotiates_implemented_profile_and_sends_one_create': 2,
'test_ordinary_legacy_run_keeps_its_existing_unbound_transport_scope': 1,
'test_real_sdk_confirmed_owner_wait_restore_and_exact_single_dispatch': 10},
'tests.local.dify_agent.runtime.test_native_lost_ack': {'test_lost_ack_uses_canonical_result_only_for_transport_exception': 10,
'test_wrapped_http_io_can_recover_but_foreign_receipt_cannot': 1},
'tests.local.dify_agent.runtime.test_run_recovery': {'test_existing_keyed_record_is_never_scheduled_even_after_worker_loss': 1},
'tests.local.dify_agent.server.test_app': {'test_confirmed_owner_is_composed_without_withdrawing_ordinary_keys': 1,
'test_create_app_authenticates_control_plane_routes': 4,
'test_create_app_defaults_agent_observability_to_disabled': 1,
'test_create_app_lifecycle_owns_agent_observability_instance': 1,
'test_create_app_native_owner_injection_and_truthful_capabilities': 1,
'test_create_app_passes_settings_to_server_observability': 1,
'test_create_app_wires_authenticated_agent_stub_connection_route': 1,
'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1,
'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2,
'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1,
'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1},
'tests.local.dify_agent.server.test_identity_profile': {'test_confirmed_identity_profile_is_explicit_and_cannot_describe_ordinary_run': 1,
'test_real_redis_authenticated_endpoint_sdk_preserves_saved_profile': 2},
'tests.local.dify_agent.server.test_run_recovery': {'test_lookup_has_same_bearer_and_returns_only_acceptance_with_no_store': 1,
'test_lookup_missing_conflict_invalid_and_anonymous_mode_never_dispatch': 1,
'test_lookup_rejects_oversized_and_malformed_private_bodies_with_bounded_errors': 1,
'test_lookup_rejects_private_extra_input_without_echo_or_store_access': 1},
'tests.local.dify_agent.storage.test_run_recovery': {'test_real_redis_keyed_claim_lookup_conflict_expiry_and_corrupt_state': 1,
'test_real_redis_two_schedulers_and_lost_set_ack_do_not_replay': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
# Preparation's bounded metadata wait and connection loss must never replay a callback.
EXPECTED['tests.local.dify_agent.protocol.test_initial_preparation'].update({
'test_prepare_callback_accepts_real_delayed_metadata_without_replay': 1,
'test_prepare_callback_connection_failure_is_single_attempt': 1,
})
# Confirmed Agent ownership: exact counts from real pytest collection.
for module, functions in {
'tests.local.dify_agent.server.test_app': {
'test_confirmed_stub_uses_strict_owner_alongside_legacy_ordinary_services': 1,
},
'tests.local.dify_agent.agent_stub.server.test_runtime_admission': {
'test_confirmed_stub_token_preserves_claimed_envelope_and_config_get_forwards_it': 1,
'test_confirmed_stub_durable_reader_requires_exact_active_identity': 1,
},
'tests.integration.dify_agent.storage.test_active_stub_identity': {
'test_confirmed_active_stub_atomic_selection': 5,
},
'tests.local.dify_agent.runtime.test_confirmed_continuation_owner': {
'test_confirmed_shell_claim_precedes_io_and_lost_claim_does_not_invoke': 3,
'test_confirmed_preparation_wait_restore_uses_ledger_without_duplicate_io': 2,
'test_confirmed_scheduler_advances_restored_shell_owner_generation_and_rejects_foreign_identity': 1,
'test_confirmed_wrap_run_stage_consumes_restored_decision_once': 10,
},
}.items():
EXPECTED.setdefault(module, {}).update(functions)
# This protocol pass independently collects the shared control-plane app tests.
EXPECTED['tests.local.dify_agent.server.test_app'].update({
'test_create_app_authenticates_control_plane_routes': 5,
'test_keep_alive_is_absent_without_configured_control_plane_auth': 1,
})
# Async shell receipts/status: exact source-audited functions and parameter counts.
for module, functions in {'tests.local.dify_agent.layers.shell.test_layer': {'test_agent_stub_token_omits_workspace_session_identity': 1,
'test_confirmed_shell_exit_keeps_jobs_without_unapproved_cleanup': 1,
'test_native_required_stub_env_refuses_even_when_unconfigured': 1,
'test_native_stub_refuses_before_job_creation': 2,
'test_redact_output_applies_per_agent_config_patterns': 1,
'test_redact_output_applies_server_level_patterns': 1,
'test_redact_output_skips_short_jwe_values': 1,
'test_run_remote_script_complete_passes_config_env_values_to_shellctl_env': 1,
'test_run_remote_script_complete_returns_incomplete_reason_for_output_limit': 1,
'test_run_remote_script_complete_returns_incomplete_reason_for_timeout': 1,
'test_run_remote_script_complete_uses_agent_specific_home_and_workspace_cwd': 1,
'test_run_remote_script_complete_uses_read_output_before_wait_and_deletes_job': 1,
'test_run_remote_script_uses_agent_specific_home_and_workspace_cwd': 1,
'test_shell_input_returns_error_observation_and_logs_unexpected_exception': 1,
'test_shell_input_returns_provider_timeout_error_observation_with_job_id_and_no_unexpected_logging': 1,
'test_shell_interrupt_logs_unexpected_tail_failure_but_still_succeeds': 1,
'test_shell_interrupt_returns_error_observation_and_logs_unexpected_exception': 1,
'test_shell_interrupt_returns_provider_request_error_observation_with_job_id_and_no_unexpected_logging': 1,
'test_shell_interrupt_succeeds_when_tail_lookup_fails': 1,
'test_shell_layer_hooks_and_tools_fail_clearly_outside_active_resource_context': 1,
'test_shell_layer_rejects_untracked_job_ids_without_provider_calls': 1,
'test_shell_layer_tools_map_inputs_and_maintain_offsets_with_tail_end': 1,
'test_shell_layer_uses_sandbox_layout_for_home_and_workspace_cwd': 1,
'test_shell_prefix_prompt_describes_workspace_as_temp_space': 1,
'test_shell_run_formats_large_non_truncated_output_without_tail_lookup': 1,
'test_shell_run_issues_one_jwe_and_redaction_does_not_issue_another': 1,
'test_shell_run_keeps_original_offset_when_tail_lookup_fails_for_truncated_output': 1,
'test_shell_run_propagates_cancelled_error': 1,
'test_shell_run_returns_error_observation_and_logs_unexpected_exception': 1,
'test_shell_run_returns_provider_timeout_error_observation_without_unexpected_logging': 1,
'test_shell_runtime_state_validates_offset_keys': 1,
'test_shell_wait_returns_error_observation_and_logs_unexpected_exception': 1,
'test_shell_wait_returns_provider_request_error_observation_with_job_id_and_no_unexpected_logging': 1,
'test_strict_shell_checks_actual_deps_run_before_token_issuance': 1,
'test_structured_receipt_uses_actual_lease_before_rendering_and_does_not_leak': 2,
'test_two_running_jobs_redact_and_clean_up_their_own_jwes_independently': 1},
'tests.local.dify_agent.protocol.test_shell_job_receipt': {'test_shell_job_receipt_and_old_payload_wire': 1},
'tests.local.dify_agent.runtime.test_native_effects': {'test_actual_direct_plugin_claim_precedes_one_daemon_request': 2,
'test_actual_model_client_waits_before_http': 1,
'test_actual_tool_layer_defers_with_final_arguments_before_transport': 8,
'test_ambiguous_io_closes_as_unknown_without_retry': 1,
'test_bootstrap_waits_before_runtime_resource_access': 1,
'test_config_pull_waits_before_shell_io': 1,
'test_direct_plugin_target_guard_precedes_materialize_claim_and_dispatch': 1,
'test_direct_plugin_typed_json_guard_precedes_materialize_claim_and_dispatch': 5,
'test_eager_knowledge_waits_before_http_and_cache_write': 1,
'test_marked_runner_requires_real_effect_owner_before_loading': 1,
'test_missing_shell_lineage_stops_before_effect_reservation': 1,
'test_opaque_call_discloses_uncertainty': 1,
'test_private_policy_http_preserves_discriminants_and_typed_arguments': 1,
'test_real_sdk_pre_tool_boundary_checkpoints_wait_before_handler': 3,
'test_recorded_result_and_denial_never_invoke': 1,
'test_sdk_permit_is_spent_once_and_result_can_replay_without_handler': 1,
'test_session_typed_json_guard_precedes_authorization_and_dispatch': 10,
'test_shell_native_tool_waits_before_session_access': 4,
'test_shell_receipt_nested_dispatch_and_cancellation_are_invocation_local': 1,
'test_success_stores_protected_result_before_receipt': 1,
'test_waiting_preserves_typed_payload_and_never_invokes': 3},
'tests.local.dify_agent.server.test_app': {'test_anonymous_mode_does_not_mount_job_status': 1,
'test_confirmed_owner_is_composed_without_withdrawing_ordinary_keys': 1,
'test_confirmed_stub_uses_strict_owner_alongside_legacy_ordinary_services': 1,
'test_create_app_authenticates_control_plane_routes': 6,
'test_create_app_defaults_agent_observability_to_disabled': 1,
'test_create_app_lifecycle_owns_agent_observability_instance': 1,
'test_create_app_native_owner_injection_and_truthful_capabilities': 1,
'test_create_app_passes_settings_to_server_observability': 1,
'test_create_app_wires_authenticated_agent_stub_connection_route': 1,
'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1,
'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_keep_alive_is_absent_without_configured_control_plane_auth': 1,
'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2,
'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1,
'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1},
'tests.local.dify_agent.server.test_binding_job_status': {'test_invalid_job_selection_never_echoes_private_input': 1,
'test_status_real_http_only_get_and_strips_private_fields': 14,
'test_status_real_http_timeout_refuses': 1,
'test_status_unsupported_and_transport_failure_refuse_without_acquire': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
REPORT = "builder-native-agent.xml"
code = pytest.main(['tests/local/dify_agent/protocol/test_shell_job_receipt.py', 'tests/local/dify_agent/server/test_binding_job_status.py', 'tests/local/dify_agent/layers/shell/test_layer.py', 'tests/local/dify_agent/client/test_run_recovery.py', 'tests/local/dify_agent/protocol/test_run_recovery.py', 'tests/local/dify_agent/runtime/test_confirmed_continuation_owner.py', 'tests/local/dify_agent/runtime/test_native_lost_ack.py', 'tests/local/dify_agent/runtime/test_run_recovery.py', 'tests/local/dify_agent/server/test_identity_profile.py', 'tests/local/dify_agent/server/test_run_recovery.py', 'tests/local/dify_agent/storage/test_run_recovery.py', 'tests/local/dify_agent/agent_stub/server/test_runtime_admission.py', 'tests/integration/dify_agent/storage/test_active_stub_identity.py', 'tests/local/dify_agent/adapters/native_testing/test_producers.py', 'tests/local/dify_agent/adapters/native_testing/test_transport.py', 'tests/local/dify_agent/layers/dify_plugin/test_layers.py', 'tests/local/dify_agent/layers/knowledge/test_layer.py', 'tests/local/dify_agent/runtime/test_run_transport.py', 'tests/local/dify_agent/server/test_app.py', 'tests/local/dify_agent/server/test_runtime_transport.py', 'tests/local/dify_agent/protocol/test_initial_preparation.py', 'tests/local/dify_agent/server/test_initial_identity.py', 'tests/local/dify_agent/protocol/test_native_testing.py', 'tests/local/dify_agent/runtime/test_native_continuation.py', 'tests/local/dify_agent/storage/test_native_continuation_store.py', 'tests/local/dify_agent/runtime/test_native_effects.py', 'tests/local/dify_agent/protocol/test_native_checkpoint_readback.py', 'tests/local/dify_agent/server/test_native_checkpoint_readback.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-native-agent.xml'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
- name: Ordinary Agent compatibility and default-dependency package
working-directory: dify-agent
shell: bash
run: |
set -o pipefail
uv run --no-sync --extra server python -u - <<'PY' 2>&1 | tee builder-agent-regressions.log
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.local.dify_agent.protocol.test_protocol_schemas': {'test_run_event_adapter_round_trips_typed_variants': 1, 'test_run_failed_event_error_type_is_optional_and_round_trips': 1, 'test_non_success_terminal_event_round_trips_optional_snapshot': 2, 'test_pydantic_ai_event_data_uses_agent_stream_event_model': 1, 'test_create_run_request_rejects_old_compositor_payload_and_model_layer_id_is_public': 1, 'test_protocol_package_no_longer_exports_execution_context_dto': 1, 'test_run_succeeded_event_data_requires_output': 1, 'test_run_succeeded_event_round_trips_explicit_json_null_output': 1, 'test_run_succeeded_event_round_trips_usage': 1, 'test_run_failed_event_round_trips_usage': 1, 'test_run_cancelled_event_round_trips_usage': 1, 'test_run_succeeded_event_round_trips_complete_pricing_usage': 1, 'test_create_run_request_rejects_removed_top_level_execution_context': 1, 'test_create_run_request_rejects_removed_top_level_purpose': 1, 'test_removed_non_terminal_payload_events_are_rejected': 2}, 'tests.local.dify_agent.protocol.test_working_environment': {'test_execution_binding_request_uses_opaque_backend_refs': 1, 'test_execution_binding_request_accepts_missing_or_null_home_snapshot_ref': 1, 'test_execution_binding_request_rejects_empty_home_snapshot_ref': 1, 'test_destroy_workspace_requires_workspace_ref': 1, 'test_snapshot_and_file_requests_locate_binding_directly': 1, 'test_binding_file_read_preview_uses_bounded_default_and_limit': 1}, 'tests.local.dify_agent.runtime.test_runner': {'test_bad_configuration_prevents_resource_acquisition': 1,
'test_bootstrap_failure_retries_and_success_is_not_repeated': 1,
'test_cancellation_during_remote_observation_deletes_job_and_releases_lease': 1,
'test_empty_current_user_content_fails_before_model_io': 2,
'test_failure_saves_user_history_and_classified_event': 1,
'test_invalid_output_schema_fails_before_resource_and_model_io': 1,
'test_knowledge_user_context_is_captured_in_history_and_restored_cache': 2,
'test_legacy_ask_human_pause_accepts_first_new_user_turn': 2,
'test_native_run_restores_conversation_but_uses_current_instructions': 1,
'test_native_structured_output_uses_output_module': 2,
'test_quality_report_follows_final_run_event': 2,
'test_run_started_store_failure_finalizes_run_as_failed': 1,
'test_timeout_releases_resource_and_preserves_snapshot': 1}, 'tests.local.dify_agent.runtime.test_run_scheduler': {'test_default_runner_factory_passes_runtime_limits_to_runner': 1, 'test_default_runner_factory_passes_agent_observability_instance': 1, 'test_create_run_starts_background_task_and_returns_running': 1, 'test_shutdown_marks_unfinished_runs_failed_and_appends_event': 1, 'test_shutdown_failure_finalization_yields_to_concurrent_cancellation_intent': 1, 'test_cancellation_observer_failure_stops_runner_and_finalizes_failed': 1, 'test_cancellation_observer_failure_finalizes_concurrent_intent_after_runner_exit': 1, 'test_non_owner_cancel_run_stops_owner_task_and_persists_cancelled_terminal': 1, 'test_pre_enter_cancellation_does_not_copy_input_session_snapshot': 1, 'test_cancel_run_does_not_override_successful_terminal': 1, 'test_cancelled_terminal_survives_shutdown_while_runner_cleanup_is_pending': 1, 'test_failure_and_cancellation_keep_the_first_terminal': 2, 'test_shutdown_grace_allows_runner_first_completion_and_reaps_children': 1, 'test_shutdown_does_not_append_failed_after_success_wins': 1, 'test_cancel_run_rejects_finished_run': 1, 'test_create_run_accepts_blank_prompt_and_runner_fails_asynchronously': 1, 'test_create_run_accepts_invalid_output_schema_and_runner_fails_asynchronously': 1, 'test_create_run_rejects_after_shutdown_starts': 1, 'test_create_run_rejects_invalid_request_after_shutdown_without_persisting': 1, 'test_shutdown_waits_for_in_flight_create_to_register_before_cancelling': 1}, 'tests.local.dify_agent.storage.test_redis_run_store': {'test_append_event_keeps_only_the_configured_number_of_entries': 1,
'test_append_event_serializes_typed_event_without_id_and_expires_run_keys': 1,
'test_create_run_writes_running_record_without_job_queue_and_with_retention': 1,
'test_event_reads_raise_when_run_record_is_missing': 1,
'test_finalize_cancellation_maps_eval_result_and_arguments': 1,
'test_finalize_failed_run_maps_eval_result_and_arguments': 1,
'test_get_events_pages_strictly_after_cursor_within_limit': 1,
'test_get_events_round_trips_run_succeeded_output_and_session_snapshot': 1,
'test_get_events_without_stream_returns_empty_page_without_blocking': 2,
'test_get_run_accepts_legacy_record_without_error_type': 1,
'test_iter_events_does_not_replay_terminal_event_at_cursor': 3,
'test_iter_events_ends_after_live_terminal_event': 3,
'test_iter_events_ends_after_replaying_terminal_event': 3,
'test_rejects_non_positive_run_storage_bounds': 2,
'test_request_cancellation_maps_eval_result_and_arguments': 1,
'test_request_cancellation_raises_when_record_is_missing': 1,
'test_wait_for_cancellation_ignores_public_events': 1,
'test_wait_for_cancellation_reads_existing_intent_from_stream_start': 1}, 'tests.local.dify_agent.server.test_runs_routes': {'test_get_run_status_returns_failure_type': 1, 'test_create_run_accepts_effectively_blank_user_prompt_list': 1, 'test_create_run_returns_running_from_scheduler': 1, 'test_cancel_run_endpoint_returns_scheduler_result': 1, 'test_cancel_run_endpoint_maps_conflict': 1, 'test_cancel_run_endpoint_maps_missing_run': 1, 'test_create_run_accepts_valid_full_plugin_graph': 1, 'test_create_run_rejects_removed_layer_exit_signal_request': 1, 'test_create_run_accepts_closed_session_snapshot_request': 1, 'test_create_run_returns_503_when_scheduler_is_stopping': 1, 'test_create_run_does_not_map_infrastructure_failure_to_422': 1}, 'tests.local.dify_agent.server.test_app': {'test_create_app_authenticates_control_plane_routes': 4, 'test_create_app_wires_authenticated_agent_stub_connection_route': 1, 'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1, 'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1, 'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1, 'test_create_app_lifecycle_owns_agent_observability_instance': 1, 'test_create_app_defaults_agent_observability_to_disabled': 1, 'test_create_app_passes_settings_to_server_observability': 1, 'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1, 'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2, 'test_create_app_native_owner_injection_and_truthful_capabilities': 1, 'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1}, 'tests.local.dify_agent.client.test_client': {'test_sse_decoder_accepts_function_tool_result_part_alias': 1, 'test_function_tool_result_payload_normalization_supports_old_part_schema': 1, 'test_sync_methods_parse_protocol_dtos_and_send_create_request_dto': 1, 'test_async_methods_and_wait_run_parse_protocol_dtos': 1, 'test_cancel_run_and_wait_sync_resumes_after_cursor_and_returns_cancelled_snapshot': 1, 'test_cancel_run_and_wait_sync_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_cancel_run_and_wait_async_returns_cancelled_terminal': 1, 'test_cancel_run_and_wait_async_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_sync_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_async_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_sync_execution_binding_client_uses_private_binding_routes': 1, 'test_sync_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_async_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_home_snapshot_client_maps_sync_validation_and_async_http_errors': 1, 'test_sync_download_binding_file_rejects_missing_reference': 1, 'test_sync_binding_file_methods_map_invalid_json_to_validation_error': 1, 'test_error_mapping_and_create_run_input_validation': 1, 'test_http_timeout_maps_to_client_timeout_error': 1, 'test_create_run_is_not_retried_after_timeout': 1, 'test_sync_sse_parser_supports_comments_multiline_data_and_id_fill': 1, 'test_sync_sse_parser_preserves_unicode_line_separators': 3, 'test_stream_events_stops_after_terminal_event': 1, 'test_stream_events_stops_after_cancelled_terminal_event': 1, 'test_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_stream_events_reconnects_from_latest_event_id': 1, 'test_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_events_raises_when_reconnects_are_exhausted': 1, 'test_stream_events_default_reconnect_budget_is_finite': 1, 'test_stream_events_enforces_total_timeout_before_connecting': 1, 'test_stream_events_observes_caller_stop_on_heartbeat': 1, 'test_malformed_sse_frame_does_not_reconnect': 1, 'test_async_stream_events_yields_terminal_event': 1, 'test_async_stream_events_enforces_total_timeout_before_connecting': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_async_stream_events_reconnects_from_latest_event_after_transport_error': 1, 'test_async_stream_events_reconnects_after_eof_before_terminal': 1, 'test_async_sse_parser_preserves_unicode_line_separators': 1, 'test_async_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_timeout_can_reconnect_until_terminal': 1}, 'tests.local.dify_agent.test_client_safe_exports': {'test_client_public_exports_work_with_default_dependencies_only': 1}}
EXPECTED.update({'tests.local.dify_agent.client.test_client': {'test_sse_decoder_accepts_function_tool_result_part_alias': 1, 'test_function_tool_result_payload_normalization_supports_old_part_schema': 1, 'test_sync_methods_parse_protocol_dtos_and_send_create_request_dto': 1, 'test_async_methods_and_wait_run_parse_protocol_dtos': 1, 'test_cancel_run_and_wait_sync_resumes_after_cursor_and_returns_cancelled_snapshot': 1, 'test_cancel_run_and_wait_sync_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_cancel_run_and_wait_async_returns_cancelled_terminal': 1, 'test_cancel_run_and_wait_async_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_sync_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_async_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_sync_execution_binding_client_uses_private_binding_routes': 1, 'test_sync_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_async_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_home_snapshot_client_maps_sync_validation_and_async_http_errors': 1, 'test_sync_download_binding_file_rejects_missing_reference': 1, 'test_sync_binding_file_methods_map_invalid_json_to_validation_error': 1, 'test_error_mapping_and_create_run_input_validation': 1, 'test_http_timeout_maps_to_client_timeout_error': 1, 'test_create_run_is_not_retried_after_timeout': 1, 'test_sync_sse_parser_supports_comments_multiline_data_and_id_fill': 1, 'test_sync_sse_parser_preserves_unicode_line_separators': 3, 'test_stream_events_stops_after_terminal_event': 1, 'test_stream_events_stops_after_cancelled_terminal_event': 1, 'test_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_stream_events_reconnects_from_latest_event_id': 1, 'test_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_events_raises_when_reconnects_are_exhausted': 1, 'test_stream_events_default_reconnect_budget_is_finite': 1, 'test_stream_events_enforces_total_timeout_before_connecting': 1, 'test_stream_events_observes_caller_stop_on_heartbeat': 1, 'test_malformed_sse_frame_does_not_reconnect': 1, 'test_async_stream_events_yields_terminal_event': 1, 'test_async_stream_events_enforces_total_timeout_before_connecting': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_async_stream_events_reconnects_from_latest_event_after_transport_error': 1, 'test_async_stream_events_reconnects_after_eof_before_terminal': 1, 'test_async_sse_parser_preserves_unicode_line_separators': 1, 'test_async_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_timeout_can_reconnect_until_terminal': 1, 'test_private_checkpoint_read_sends_exact_selection_once_and_preserves_types': 2, 'test_private_checkpoint_client_refuses_without_retry_or_history_leak': 20, 'test_private_checkpoint_stream_bound_counts_actual_bytes_without_content_length': 2, 'test_private_checkpoint_never_follows_transport_redirects': 2, 'test_private_checkpoint_invalid_copied_request_refuses_without_serializer_warning': 1}, 'tests.local.dify_agent.server.test_auth.TestBearerTokenAuthDisabled': {'test_no_header_passes_when_token_unconfigured': 1, 'test_any_header_passes_when_token_unconfigured': 1}, 'tests.local.dify_agent.server.test_auth.TestBearerTokenAuthEnabled': {'test_missing_header_returns_401': 1, 'test_invalid_scheme_returns_401': 1, 'test_wrong_token_returns_401': 1, 'test_correct_token_passes': 1}})
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.local.dify_agent.server.test_app': {'test_confirmed_owner_is_composed_without_withdrawing_ordinary_keys': 1,
'test_create_app_authenticates_control_plane_routes': 4,
'test_create_app_defaults_agent_observability_to_disabled': 1,
'test_create_app_lifecycle_owns_agent_observability_instance': 1,
'test_create_app_native_owner_injection_and_truthful_capabilities': 1,
'test_create_app_passes_settings_to_server_observability': 1,
'test_create_app_wires_authenticated_agent_stub_connection_route': 1,
'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1,
'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2,
'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1,
'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
EXPECTED['tests.local.dify_agent.server.test_app'].update({
'test_confirmed_stub_uses_strict_owner_alongside_legacy_ordinary_services': 1,
})
# ENG-1240: additive waiting-binding health transport inventory.
for module, functions in {'tests.local.dify_agent.server.test_app': {'test_keep_alive_is_absent_without_configured_control_plane_auth': 1, 'test_create_app_authenticates_control_plane_routes': 5}, 'tests.local.dify_agent.client.test_client': {'test_sync_keep_alive_client_uses_typed_private_route_once': 1, 'test_async_keep_alive_client_uses_typed_private_route_once': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
# Exact source/collection additions after main and async receipt integration.
for module, functions in {'tests.local.dify_agent.server.test_app': {'test_anonymous_mode_does_not_mount_job_status': 1,
'test_create_app_authenticates_control_plane_routes': 6}}.items():
EXPECTED.setdefault(module, {}).update(functions)
REPORT = "builder-agent-regressions.xml"
code = pytest.main(['tests/local/dify_agent/protocol/test_protocol_schemas.py', 'tests/local/dify_agent/protocol/test_working_environment.py', 'tests/local/dify_agent/runtime/test_runner.py', 'tests/local/dify_agent/runtime/test_run_scheduler.py', 'tests/local/dify_agent/storage/test_redis_run_store.py', 'tests/local/dify_agent/server/test_runs_routes.py', 'tests/local/dify_agent/server/test_app.py', 'tests/local/dify_agent/client/test_client.py', 'tests/local/dify_agent/test_client_safe_exports.py', 'tests/local/dify_agent/server/test_auth.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-agent-regressions.xml'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
- name: Isolated Agent workspace and affected ordinary runtime regressions
working-directory: dify-agent
shell: bash
run: |
set -o pipefail
uv run --no-sync --extra server python -u - <<'PY' 2>&1 | tee builder-agent-workspace-regressions.log
import xml.etree.ElementTree as ElementTree
from collections import Counter
from pathlib import Path
import pytest
EXPECTED = {'tests.local.dify_agent.runtime_backend.test_e2b': {'test_e2b_sdk_create_disables_public_traffic_and_preserves_lifecycle': 2, 'test_e2b_sdk_create_maps_provider_capacity_exhaustion': 1, 'test_e2b_connect_does_not_repeat_failed_sdk_call': 2, 'test_e2b_initial_pause_failure_compensates_without_repeating_sdk_call': 2, 'test_e2b_destroy_does_not_repeat_failed_sdk_call': 2, 'test_e2b_snapshot_delete_does_not_repeat_failed_sdk_call': 2, 'test_e2b_connect_does_not_reset_sdk_timeout_budget': 1, 'test_e2b_connect_does_not_retry_non_transport_failures': 4, 'test_e2b_create_and_snapshot_create_are_not_retried': 2, 'test_e2b_create_maps_capacity_exhaustion_without_retry': 1, 'test_e2b_file_initialization_is_one_shot_and_compensates_on_failure': 3, 'test_e2b_binding_uses_default_template_or_exact_snapshot_and_couples_refs': 1, 'test_e2b_rejects_shared_workspace_and_binding_only_destroy': 1, 'test_e2b_binding_create_kills_sandbox_when_initialization_fails': 1, 'test_e2b_binding_create_preserves_primary_error_when_compensation_kill_fails': 1, 'test_e2b_binding_create_fails_closed_after_sdk_pause_timeout': 1, 'test_e2b_missing_explicit_snapshot_does_not_fall_back_to_template': 1, 'test_e2b_checkpoint_uses_exact_source_runtime': 1, 'test_e2b_release_warns_without_raising_for_cleanup_failures': 3, 'test_e2b_release_closes_and_logs_failed_sdk_pause_once': 1, 'test_e2b_release_does_not_reset_sdk_pause_timeout_budget': 1, 'test_e2b_release_does_not_swallow_base_exceptions': 2, 'test_e2b_release_preserves_close_base_exception_when_pause_also_raises': 1, 'test_e2b_acquire_retries_transient_shellctl_failures_until_ready': 1, 'test_e2b_acquire_fails_closed_without_traffic_token': 2, 'test_e2b_acquire_treats_missing_home_or_workspace_as_binding_lost': 2, 'test_e2b_acquire_closes_transport_and_pauses_after_readiness_retries_exhausted': 1, 'test_e2b_acquire_does_not_retry_shellctl_4xx_and_preserves_error_when_pause_fails': 1, 'test_e2b_acquire_preserves_health_failure_when_close_and_pause_fail': 1, 'test_create_task_cancellation_during_initialization_kills_sandbox': 1, 'test_acquire_task_cancellation_during_health_closes_transport_and_pauses': 1, 'test_release_task_cancellation_attempts_pause_once_and_preserves_original_cancel': 1, 'test_acquire_primary_health_error_survives_task_cancel_during_compensation': 1}, 'tests.local.dify_agent.runtime_backend.test_e2b_sdk': {'test_sdk_lifecycle_preserves_private_traffic_and_memory_resume': 1, 'test_sdk_kill_lifecycle_omits_pause_memory_mode': 1, 'test_sdk_preserves_already_paused_and_absent_resource_results': 1, 'test_sdk_recovers_transient_create_responses': 2, 'test_resource_creates_are_not_replayed_after_bad_gateway': 6, 'test_sdk_replays_idempotent_lifecycle_after_bad_gateway': 2, 'test_destroy_exhausts_one_sdk_retry_budget': 2, 'test_destroy_does_not_repeat_sdk_exhausted_network_retries': 3, 'test_sdk_does_not_retry_terminal_or_over_budget_responses': 4, 'test_resource_creates_are_not_replayed_after_request_interruption': 8, 'test_sdk_replays_idempotent_connect_after_network_error': 3, 'test_destroy_does_not_restart_timeout_budget': 1}, 'tests.local.dify_agent.runtime_backend.test_enterprise_backend': {'test_enterprise_acquire_exposes_canonical_layout_through_gateway_proxy': 1, 'test_enterprise_acquire_maps_proxy_failures_and_closes_transport': 2, 'test_enterprise_acquire_treats_missing_runtime_directories_as_lost': 1, 'test_enterprise_binding_create_deletes_new_sandbox_when_layout_setup_fails': 1, 'test_enterprise_binding_does_not_delete_a_sandbox_it_never_created': 1, 'test_enterprise_binding_rejects_shared_workspace_before_gateway_call': 1, 'test_enterprise_binding_sends_the_snapshot_ref_and_still_clears_workspace': 1, 'test_enterprise_default_binding_creates_gateway_sandbox_and_layout': 1, 'test_enterprise_destroy_encodes_binding_ref_as_one_path_segment': 1, 'test_enterprise_destroy_is_authenticated_and_idempotent': 2, 'test_enterprise_destroy_propagates_gateway_failure': 1, 'test_enterprise_destroy_validates_coupled_workspace_before_gateway_call': 1, 'test_enterprise_gateway_errors_carry_the_kratos_reason': 1, 'test_enterprise_gateway_errors_survive_a_non_json_body': 1, 'test_enterprise_release_rejects_foreign_runtime_lease': 1, 'test_enterprise_snapshot_create_maps_other_gateway_failures': 1, 'test_enterprise_snapshot_create_maps_the_size_limit_to_too_large': 1, 'test_enterprise_snapshot_create_posts_to_the_lease_sandbox': 1, 'test_enterprise_snapshot_create_rejects_a_foreign_lease': 1, 'test_enterprise_snapshot_create_rejects_a_reply_without_a_ref': 1, 'test_enterprise_snapshot_delete_keeps_ref_slashes_and_escapes_the_rest': 1, 'test_enterprise_snapshot_delete_propagates_gateway_failures': 2, 'test_enterprise_snapshot_delete_treats_absent_snapshot_as_success': 2}, 'tests.local.dify_agent.runtime_backend.test_leases': {'test_runtime_lease_body_error_survives_release_error': 1, 'test_runtime_lease_release_error_propagates_after_successful_body': 1}, 'tests.local.dify_agent.runtime_backend.test_local': {'test_local_binding_create_materializes_home_and_new_workspace': 1, 'test_local_binding_create_uses_empty_default_home_without_snapshot_access': 1, 'test_local_binding_bootstraps_custom_roots_from_common_root': 1, 'test_local_binding_separates_root_workspace_from_home_control_scope': 1, 'test_local_binding_create_failure_removes_partial_home_and_workspace': 1, 'test_local_binding_acquire_scopes_commands_to_materialized_home_and_workspace': 1, 'test_local_snapshot_checkpoint_copies_only_materialized_home': 1, 'test_local_binding_destroy_removes_home_and_requested_workspace': 1, 'test_local_snapshot_delete_removes_snapshot_directory': 1, 'test_local_snapshot_delete_preserves_shellctl_error_when_close_fails': 1, 'test_local_binding_destroy_preserves_shellctl_error_when_close_fails': 1, 'test_native_scope_transport_create_inspect_destroy_and_ephemeral_handle': 1, 'test_native_scope_transport_never_recreates_or_redirects_lost_owner': 3, 'test_native_scope_transport_rejects_wrong_generation': 1}, 'tests.local.dify_agent.runtime_backend.test_native_test_scope': {'test_native_creation_uses_supervisor_not_ordinary_control_jobs': 1, 'test_native_creation_without_enforcing_supervisor_fails_before_control_io': 1, 'test_shell_saves_job_identity_and_reconnects_without_replay': 1, 'test_marked_runtime_requires_stored_lineage_before_scope_acquire': 1, 'test_native_missing_job_is_terminal_control_not_retryable_model_text': 1, 'test_unqualified_backend_stops_before_provider_access': 3, 'test_reconcile_only_inspects_reserved_scope_even_when_missing': 1, 'test_wait_keeps_jobs_and_offsets_until_checkpoint_capture': 1, 'test_reconnected_input_cannot_substitute_response_job_identity': 1, 'test_native_job_refs_survive_layer_snapshot_and_reconnect_without_run': 1, 'test_native_legacy_state_without_job_identity_never_sends_stdin': 1, 'test_lost_job_never_substitutes_another_process': 1, 'test_actual_native_create_router_requires_configured_service_auth': 4, 'test_actual_ordinary_router_remains_compatible_without_token': 1, 'test_existing_native_binding_cannot_downgrade_when_service_auth_removed': 3, 'test_native_home_export_is_refused_before_acquisition_even_with_auth': 1, 'test_ordinary_binding_wire_preserves_old_backend_contract': 1, 'test_native_download_refuses_before_stub_token_acquire_or_upload': 4, 'test_ordinary_download_with_configured_stub_still_uploads_once': 2, 'test_empty_native_job_refs_preserve_legacy_shell_state_wire': 1, 'test_strict_runless_download_refuses_without_owner_before_issuance_or_io': 2}, 'tests.local.dify_agent.runtime_backend.test_openshell': {'test_openshell_binding_create_initializes_layout_then_stops': 1, 'test_openshell_binding_create_materializes_snapshot_without_fallback': 1, 'test_openshell_binding_create_rejects_shared_workspace': 1, 'test_openshell_binding_create_deletes_sandbox_when_initialization_fails': 1, 'test_openshell_acquire_bootstraps_shellctl_and_opens_tunnel': 1, 'test_openshell_acquire_maps_missing_sandbox_to_binding_lost': 1, 'test_openshell_acquire_cleans_up_when_bootstrap_fails': 1, 'test_openshell_release_leaves_other_leases_open': 1, 'test_openshell_release_does_not_require_existing_sandbox': 1, 'test_openshell_release_closes_both_resources_on_error': 3, 'test_openshell_release_preserves_cancellation_and_closes_resources': 2, 'test_openshell_release_rejects_foreign_lease': 1, 'test_openshell_destroy_requires_workspace_destruction_and_is_idempotent': 1, 'test_openshell_snapshot_copies_home_to_shared_volume': 1, 'test_openshell_snapshot_failure_removes_partial_copy': 1, 'test_openshell_snapshot_rejects_foreign_lease': 1, 'test_openshell_snapshot_delete_uses_short_lived_maintenance_sandbox': 1, 'test_openshell_snapshot_delete_still_removes_maintenance_sandbox_on_failure': 1, 'test_openshell_snapshot_refs_must_be_safe_path_segments': 1, 'test_openshell_binding_create_rejects_unsafe_binding_id': 1, 'test_openshell_acquire_maps_missing_layout_to_binding_lost': 1, 'test_openshell_sdk_exec_script_sends_script_via_stdin_not_argv': 1, 'test_openshell_sdk_create_sends_enforced_egress_allowlist': 1, 'test_ssh_session_token_supplier_renews_ahead_of_expiry': 1, 'test_ssh_session_token_supplier_keeps_token_without_expiry': 1, 'test_ssh_session_token_supplier_fails_closed_when_renewal_fails': 1}, 'tests.local.dify_agent.runtime_backend.test_openshell_tunnel': {'test_tunnel_opens_one_stream_per_connection_and_pipes_bytes': 1, 'test_tunnel_handles_concurrent_connections': 1, 'test_tunnel_close_is_idempotent_and_rejects_new_connections': 1, 'test_tunnel_half_close_still_delivers_remaining_bytes': 1, 'test_tunnel_stream_error_closes_the_client_connection': 1, 'test_tunnel_open_twice_is_an_error': 1}, 'tests.local.dify_agent.runtime_backend.test_profile': {'test_e2b_backend_rejects_active_timeout_above_platform_limit': 1, 'test_e2b_backend_requires_api_key': 1, 'test_e2b_backend_uses_prepared_dify_template_and_one_hour_lease_by_default': 1, 'test_local_backend_passes_configured_roots_to_drivers': 1, 'test_local_backend_reads_token_aliases': 2, 'test_local_backend_rejects_relative_roots': 1, 'test_local_backend_requires_nonblank_auth_token': 3, 'test_local_backend_requires_shellctl_endpoint': 1, 'test_local_backend_uses_root_workspace_directory_by_default': 1, 'test_native_scope_configuration_preserves_ordinary_driver': 1, 'test_native_scope_endpoint_never_defaults_to_ordinary': 1, 'test_native_scope_endpoint_requires_separate_authentication': 1, 'test_openshell_backend_parses_egress_allow_into_control_plane': 1, 'test_openshell_backend_rejects_empty_driver_config_object': 1, 'test_openshell_backend_rejects_invalid_driver_config_json': 1, 'test_openshell_backend_rejects_malformed_egress_allow': 6, 'test_openshell_backend_rejects_relative_shared_mount_path': 1, 'test_openshell_backend_requires_gateway_endpoint_and_driver_config': 1, 'test_openshell_backend_requires_paired_tls_client_material': 1, 'test_openshell_backend_requires_shellctl_auth_token': 1, 'test_openshell_backend_wires_shared_deployment_config_into_both_drivers': 1}, 'tests.local.dify_agent.runtime_backend.test_shellctl_backend': {'test_owned_transport_is_closed_exactly_once': 1, 'test_owned_transport_closes_when_client_close_fails_without_double_close': 1, 'test_owned_transport_closes_when_client_construction_fails': 1, 'test_control_command_success_is_preserved_when_delete_fails': 1, 'test_control_command_error_is_preserved_when_delete_also_fails': 1}, 'tests.local.dify_agent.layers.config.test_layer': {'test_first_pull_failure_retries_then_current_config_refreshes_without_repull': 1}, 'tests.local.dify_agent.layers.dify_core_tools.test_client': {'test_core_tools_client_marks_retryable_http_failures': 1,
'test_core_tools_client_marks_transport_failures_retryable': 2,
'test_core_tools_client_posts_inner_api_request': 2,
'test_core_tools_client_raises_invalid_response_for_malformed_success_body': 1,
'test_core_tools_client_validates_execution_context_prerequisites_separately': 1}, 'tests.local.dify_agent.layers.dify_core_tools.test_configs': {'test_dify_core_tools_package_exports_client_safe_config_symbols_only': 1, 'test_dify_core_tools_layer_config_accepts_supported_provider_types': 1, 'test_dify_core_tool_config_rejects_unsupported_provider_types': 1}, 'tests.local.dify_agent.layers.dify_core_tools.test_layer': {'test_native_tool_preserves_schema_invocation_and_observations': 7}, 'tests.local.dify_agent.layers.dify_plugin.test_configs': {'test_dify_plugin_package_exports_client_safe_config_symbols_only': 1, 'test_dify_plugin_llm_config_discards_legacy_credentials': 1, 'test_dify_plugin_llm_config_rejects_old_provider_field': 1, 'test_dify_plugin_llm_config_rejects_non_positive_context_window': 1, 'test_dify_plugin_tools_layer_config_accepts_prepared_parameters_and_schema': 1, 'test_dify_plugin_tool_parameter_accepts_api_tool_parameter_dump_shape': 1, 'test_dify_plugin_tool_parameter_accepts_api_tool_parameter_attributes': 1, 'test_dify_plugin_tool_config_rejects_non_json_runtime_parameters': 1, 'test_dify_plugin_tool_config_rejects_non_json_schema_values': 1, 'test_dify_plugin_tool_config_rejects_strict_flag': 1, 'test_dify_plugin_tool_config_requires_explicit_credential_type': 1}, 'tests.local.dify_agent.layers.dify_plugin.test_layers': {'test_model_assembly_reads_config_reference_and_borrows_shared_client': 1,
'test_native_plugin_tool_converts_file_inputs': 2,
'test_native_plugin_tool_prepares_schema_merges_hidden_parameters_and_decodes_stream': 1,
'test_tools_with_different_package_bindings_do_not_share_a_daemon_client': 2}, 'tests.local.dify_agent.layers.execution_context.test_configs': {'test_execution_context_package_exports_client_safe_config_symbols_only': 1, 'test_execution_context_accepts_real_invoke_from_user_from_and_agent_mode': 1, 'test_execution_context_rejects_legacy_agent_mode_in_invoke_from': 1, 'test_execution_context_layer_config_forbids_runtime_settings_and_unknown_fields': 1}, 'tests.local.dify_agent.layers.knowledge.test_client': {'test_knowledge_client_posts_inner_api_request_with_static_controls': 1, 'test_knowledge_client_marks_retryable_http_failures': 1, 'test_knowledge_client_marks_non_retryable_http_failures': 1, 'test_knowledge_client_rejects_malformed_success_response': 1, 'test_knowledge_client_marks_transport_failures_retryable': 2, 'test_knowledge_client_treats_invalid_url_errors_as_non_retryable_configuration_error': 1}, 'tests.local.dify_agent.layers.knowledge.test_configs': {'test_knowledge_base_config_accepts_valid_multiple_mode': 1, 'test_knowledge_base_config_rejects_invalid_inputs': 10, 'test_knowledge_base_config_rejects_observation_limit_smaller_than_result_limit': 1}, 'tests.local.dify_agent.layers.knowledge.test_layer': {'test_eager_results_are_in_user_role_and_cache_uses_current_config': 1, 'test_generated_query_native_tool_preserves_local_validation_and_retry_policy': 3, 'test_nonretryable_eager_failure_leaves_previous_cache_for_retry': 1, 'test_retryable_eager_failure_is_saved_as_user_observation': 1}, 'tests.local.dify_agent.layers.output.test_configs': {'test_output_package_exports_client_safe_config_symbols_only': 1, 'test_output_layer_config_accepts_valid_object_schema_without_public_tool_name': 1, 'test_output_layer_config_rejects_non_object_top_level_json_schema': 1, 'test_output_layer_config_rejects_invalid_input': 2, 'test_output_layer_builds_validated_output_contract_for_object_schema': 1, 'test_output_layer_object_contract_rejects_invalid_output': 4, 'test_output_layer_rejects_non_defs_local_ref_in_direct_object_schema': 1, 'test_output_layer_keeps_local_defs_ref_working_in_direct_object_schema': 1, 'test_output_layer_rejects_recursive_json_schema_during_contract_build': 1, 'test_output_layer_rejects_invalid_json_schema_during_contract_build': 1, 'test_output_layer_rejects_remote_ref_during_contract_build': 1, 'test_output_layer_allows_literal_dollar_ref_values_under_const_and_examples': 1}, 'tests.local.dify_agent.layers.shell.test_configs': {'test_shell_package_exports_client_safe_config_symbols_only': 1, 'test_shell_layer_config_defaults_and_forbids_unknown_fields': 1, 'test_shell_layer_config_accepts_agent_soul_shell_settings': 1, 'test_shell_layer_config_rejects_invalid_env_names': 1}, 'tests.local.dify_agent.layers.shell.test_layer': {'test_shell_prefix_prompt_describes_workspace_as_temp_space': 1, 'test_shell_layer_uses_sandbox_layout_for_home_and_workspace_cwd': 1, 'test_shell_layer_tools_map_inputs_and_maintain_offsets_with_tail_end': 1, 'test_shell_run_keeps_original_offset_when_tail_lookup_fails_for_truncated_output': 1, 'test_shell_run_formats_large_non_truncated_output_without_tail_lookup': 1, 'test_shell_interrupt_succeeds_when_tail_lookup_fails': 1, 'test_shell_run_returns_provider_timeout_error_observation_without_unexpected_logging': 1, 'test_shell_wait_returns_provider_request_error_observation_with_job_id_and_no_unexpected_logging': 1, 'test_shell_input_returns_provider_timeout_error_observation_with_job_id_and_no_unexpected_logging': 1, 'test_shell_interrupt_returns_provider_request_error_observation_with_job_id_and_no_unexpected_logging': 1, 'test_shell_run_returns_error_observation_and_logs_unexpected_exception': 1, 'test_shell_wait_returns_error_observation_and_logs_unexpected_exception': 1, 'test_shell_input_returns_error_observation_and_logs_unexpected_exception': 1, 'test_shell_interrupt_returns_error_observation_and_logs_unexpected_exception': 1, 'test_shell_interrupt_logs_unexpected_tail_failure_but_still_succeeds': 1, 'test_agent_stub_token_omits_workspace_session_identity': 1, 'test_shell_run_propagates_cancelled_error': 1, 'test_run_remote_script_complete_uses_read_output_before_wait_and_deletes_job': 1, 'test_run_remote_script_complete_uses_agent_specific_home_and_workspace_cwd': 1, 'test_run_remote_script_complete_passes_config_env_values_to_shellctl_env': 1, 'test_run_remote_script_uses_agent_specific_home_and_workspace_cwd': 1, 'test_run_remote_script_complete_returns_incomplete_reason_for_output_limit': 1, 'test_run_remote_script_complete_returns_incomplete_reason_for_timeout': 1, 'test_shell_layer_rejects_untracked_job_ids_without_provider_calls': 1, 'test_shell_layer_hooks_and_tools_fail_clearly_outside_active_resource_context': 1, 'test_shell_runtime_state_validates_offset_keys': 1, 'test_shell_run_issues_one_jwe_and_redaction_does_not_issue_another': 1, 'test_two_running_jobs_redact_and_clean_up_their_own_jwes_independently': 1, 'test_redact_output_applies_server_level_patterns': 1, 'test_redact_output_applies_per_agent_config_patterns': 1, 'test_redact_output_skips_short_jwe_values': 1, 'test_native_stub_refuses_before_job_creation': 2, 'test_native_required_stub_env_refuses_even_when_unconfigured': 1, 'test_strict_shell_checks_actual_deps_run_before_token_issuance': 1}, 'tests.local.dify_agent.layers.shell.test_output_text': {'test_normalized_output_text_includes_marker_and_log_guidance': 1, 'test_normalized_output_text_avoids_duplicate_tail_for_short_output': 1, 'test_normalized_output_text_can_force_middle_truncation_when_head_matches_tail': 1, 'test_utf8_helpers_do_not_split_multibyte_characters': 1, 'test_normalized_output_text_omits_log_guidance_without_output_path': 1, 'test_normalized_output_text_can_use_custom_truncation_message': 1}, 'tests.local.dify_agent.layers.user_prompt.test_layer': {'test_user_prompt_layer_injects_file_locators': 4, 'test_user_prompt_layer_rejects_invalid_locators': 9, 'test_user_prompt_layer_preserves_text_without_locators': 1, 'test_user_prompt_layer_restores_image_url_content': 1, 'test_user_prompt_layer_restores_inline_binary_content': 1, 'test_user_prompt_file_requires_exactly_one_transport': 2}, 'tests.local.dify_agent.server.test_execution_bindings': {'test_execution_binding_service_forwards_final_contract': 1, 'test_execution_binding_route_reports_capacity_exhaustion_as_429': 1}, 'tests.local.dify_agent.server.test_home_snapshots': {'test_home_snapshot_service_checkpoints_exact_binding': 1, 'test_snapshot_checkpoint_releases_binding_when_create_fails': 1}, 'tests.local.dify_agent.server.test_app': {'test_create_app_authenticates_control_plane_routes': 4, 'test_create_app_wires_authenticated_agent_stub_connection_route': 1, 'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1, 'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1, 'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1, 'test_create_app_lifecycle_owns_agent_observability_instance': 1, 'test_create_app_defaults_agent_observability_to_disabled': 1, 'test_create_app_passes_settings_to_server_observability': 1, 'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1, 'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2, 'test_create_app_native_owner_injection_and_truthful_capabilities': 1, 'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1}, 'tests.local.dify_agent.server.test_binding_files': {'test_resolve_binding_path_supports_workspace_home_absolute_and_parent_paths': 1, 'test_list_and_read_use_commands_with_consistent_binding_paths_and_release_leases': 1, 'test_real_list_script_caps_1001_entries_at_1000': 1, 'test_real_read_script_handles_boundary_truncation_and_binary': 1, 'test_real_read_script_handles_utf8_truncation_at_multibyte_boundary': 1, 'test_real_browse_script_output_over_command_cap_normalizes_to_unavailable': 1, 'test_browse_preserves_binding_file_error_and_releases_lease': 2, 'test_missing_path_is_classified_when_transport_only_captures_stdout': 2, 'test_browse_maps_malformed_backend_response_to_unavailable_and_releases_lease': 2, 'test_download_rejects_each_missing_identity_before_token_or_lease': 2, 'test_download_rejects_missing_configuration_before_acquiring_lease': 1, 'test_download_shell_quotes_resolved_path_and_returns_only_reference_inside_lease': 1, 'test_download_normalizes_cli_failures_and_releases_lease': 5, 'test_download_command_timeout_releases_lease_and_returns_download_failed': 1, 'test_download_maps_only_shell_provider_timeout_to_download_failed_and_cleans_up': 3, 'test_download_cancellation_releases_lease': 1, 'test_download_maps_binding_acquire_errors': 2, 'test_binding_file_route_preserves_structured_error_status_and_code': 2, 'test_list_and_read_route_validation_returns_structured_400_without_calling_service': 2, 'test_list_route_redacts_unexpected_field_value_from_validation_error': 1, 'test_download_route_validation_returns_422_without_calling_service': 1, 'test_read_route_accepts_preview_size_limit': 1, 'test_binding_file_validation_override_preserves_openapi_request_schemas': 1}, 'tests.local.dify_agent.runtime.test_native_continuation': {'test_stage_checkpoint_preserves_reason_without_faking_tool_history': 3, 'test_real_native_deferral_checkpoint_and_resume_without_reissuing_call': 2, 'test_denied_or_changed_native_arguments_never_become_model_feedback': 1, 'test_direct_runner_rejects_marked_test_before_module_loading': 1, 'test_scheduler_rejects_native_before_persistence': 1, 'test_runner_commits_wait_instead_of_success_and_persistence_failure_is_not_resumable': 2, 'test_scheduler_restores_only_matching_pinned_snapshot_before_scheduling': 1, 'test_scheduler_resume_keeps_run_and_claim_after_lost_acknowledgement': 2, 'test_api_owner_denial_stops_waiting_run_instead_of_returning_model_feedback': 1, 'test_continuation_cannot_relabel_pending_approval_as_external_result': 1, 'test_duplicate_before_start_cas_does_not_block_unrelated_admission_or_shutdown': 1}, 'tests.local.dify_agent.runtime.test_runner': {'test_bad_configuration_prevents_resource_acquisition': 1,
'test_bootstrap_failure_retries_and_success_is_not_repeated': 1,
'test_cancellation_during_remote_observation_deletes_job_and_releases_lease': 1,
'test_empty_current_user_content_fails_before_model_io': 2,
'test_failure_saves_user_history_and_classified_event': 1,
'test_invalid_output_schema_fails_before_resource_and_model_io': 1,
'test_knowledge_user_context_is_captured_in_history_and_restored_cache': 2,
'test_legacy_ask_human_pause_accepts_first_new_user_turn': 2,
'test_native_run_restores_conversation_but_uses_current_instructions': 1,
'test_native_structured_output_uses_output_module': 2,
'test_quality_report_follows_final_run_event': 2,
'test_run_started_store_failure_finalizes_run_as_failed': 1,
'test_timeout_releases_resource_and_preserves_snapshot': 1}, 'tests.local.dify_agent.client.test_client': {'test_sse_decoder_accepts_function_tool_result_part_alias': 1, 'test_function_tool_result_payload_normalization_supports_old_part_schema': 1, 'test_sync_methods_parse_protocol_dtos_and_send_create_request_dto': 1, 'test_async_methods_and_wait_run_parse_protocol_dtos': 1, 'test_cancel_run_and_wait_sync_resumes_after_cursor_and_returns_cancelled_snapshot': 1, 'test_cancel_run_and_wait_sync_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_cancel_run_and_wait_async_returns_cancelled_terminal': 1, 'test_cancel_run_and_wait_async_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_sync_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_async_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_sync_execution_binding_client_uses_private_binding_routes': 1, 'test_sync_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_async_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_home_snapshot_client_maps_sync_validation_and_async_http_errors': 1, 'test_sync_download_binding_file_rejects_missing_reference': 1, 'test_sync_binding_file_methods_map_invalid_json_to_validation_error': 1, 'test_error_mapping_and_create_run_input_validation': 1, 'test_http_timeout_maps_to_client_timeout_error': 1, 'test_create_run_is_not_retried_after_timeout': 1, 'test_sync_sse_parser_supports_comments_multiline_data_and_id_fill': 1, 'test_sync_sse_parser_preserves_unicode_line_separators': 3, 'test_stream_events_stops_after_terminal_event': 1, 'test_stream_events_stops_after_cancelled_terminal_event': 1, 'test_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_stream_events_reconnects_from_latest_event_id': 1, 'test_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_events_raises_when_reconnects_are_exhausted': 1, 'test_stream_events_default_reconnect_budget_is_finite': 1, 'test_stream_events_enforces_total_timeout_before_connecting': 1, 'test_stream_events_observes_caller_stop_on_heartbeat': 1, 'test_malformed_sse_frame_does_not_reconnect': 1, 'test_async_stream_events_yields_terminal_event': 1, 'test_async_stream_events_enforces_total_timeout_before_connecting': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_async_stream_events_reconnects_from_latest_event_after_transport_error': 1, 'test_async_stream_events_reconnects_after_eof_before_terminal': 1, 'test_async_sse_parser_preserves_unicode_line_separators': 1, 'test_async_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_timeout_can_reconnect_until_terminal': 1}}
EXPECTED.update({'tests.local.dify_agent.client.test_client': {'test_sse_decoder_accepts_function_tool_result_part_alias': 1, 'test_function_tool_result_payload_normalization_supports_old_part_schema': 1, 'test_sync_methods_parse_protocol_dtos_and_send_create_request_dto': 1, 'test_async_methods_and_wait_run_parse_protocol_dtos': 1, 'test_cancel_run_and_wait_sync_resumes_after_cursor_and_returns_cancelled_snapshot': 1, 'test_cancel_run_and_wait_sync_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_cancel_run_and_wait_async_returns_cancelled_terminal': 1, 'test_cancel_run_and_wait_async_replays_when_cursor_already_points_to_cancelled_event': 1, 'test_sync_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_async_binding_file_methods_post_dtos_and_parse_responses': 1, 'test_sync_execution_binding_client_uses_private_binding_routes': 1, 'test_sync_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_async_home_snapshot_client_parses_checkpoint_and_delete': 1, 'test_home_snapshot_client_maps_sync_validation_and_async_http_errors': 1, 'test_sync_download_binding_file_rejects_missing_reference': 1, 'test_sync_binding_file_methods_map_invalid_json_to_validation_error': 1, 'test_error_mapping_and_create_run_input_validation': 1, 'test_http_timeout_maps_to_client_timeout_error': 1, 'test_create_run_is_not_retried_after_timeout': 1, 'test_sync_sse_parser_supports_comments_multiline_data_and_id_fill': 1, 'test_sync_sse_parser_preserves_unicode_line_separators': 3, 'test_stream_events_stops_after_terminal_event': 1, 'test_stream_events_stops_after_cancelled_terminal_event': 1, 'test_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_stream_events_reconnects_from_latest_event_id': 1, 'test_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_events_raises_when_reconnects_are_exhausted': 1, 'test_stream_events_default_reconnect_budget_is_finite': 1, 'test_stream_events_enforces_total_timeout_before_connecting': 1, 'test_stream_events_observes_caller_stop_on_heartbeat': 1, 'test_malformed_sse_frame_does_not_reconnect': 1, 'test_async_stream_events_yields_terminal_event': 1, 'test_async_stream_events_enforces_total_timeout_before_connecting': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_when_until_terminal_is_false': 1, 'test_async_stream_events_does_not_reconnect_after_terminal_transport_error': 1, 'test_async_stream_events_reconnects_from_latest_event_after_transport_error': 1, 'test_async_stream_events_reconnects_after_eof_before_terminal': 1, 'test_async_sse_parser_preserves_unicode_line_separators': 1, 'test_async_stream_events_reconnects_after_http_5xx_response': 1, 'test_stream_timeout_can_reconnect_until_terminal': 1, 'test_private_checkpoint_read_sends_exact_selection_once_and_preserves_types': 2, 'test_private_checkpoint_client_refuses_without_retry_or_history_leak': 20, 'test_private_checkpoint_stream_bound_counts_actual_bytes_without_content_length': 2, 'test_private_checkpoint_never_follows_transport_redirects': 2, 'test_private_checkpoint_invalid_copied_request_refuses_without_serializer_warning': 1}, 'tests.local.dify_agent.runtime.test_native_continuation': {'test_stage_checkpoint_preserves_reason_without_faking_tool_history': 3, 'test_real_native_deferral_checkpoint_and_resume_without_reissuing_call': 2, 'test_denied_or_changed_native_arguments_never_become_model_feedback': 1, 'test_direct_runner_rejects_marked_test_before_module_loading': 1, 'test_scheduler_rejects_native_before_persistence': 1, 'test_runner_commits_wait_instead_of_success_and_persistence_failure_is_not_resumable': 2, 'test_scheduler_restores_only_matching_pinned_snapshot_before_scheduling': 1, 'test_scheduler_resume_keeps_run_and_claim_after_lost_acknowledgement': 2, 'test_api_owner_denial_stops_waiting_run_instead_of_returning_model_feedback': 1, 'test_continuation_cannot_relabel_pending_approval_as_external_result': 1, 'test_duplicate_before_start_cas_does_not_block_unrelated_admission_or_shutdown': 1, 'test_private_protocol_move_preserves_runtime_capture_and_wire_contract': 1}})
EXPECTED['tests.local.dify_agent.layers.dify_core_tools.test_layer'].update({'test_api_payload_validation_error_is_not_relabelled_as_preparation_error': 6, 'test_core_native_early_refusal_precedes_file_preparation_and_io': 1, 'test_invalid_ordinary_file_stops_before_api_invocation': 3, 'test_non_plugin_core_arguments_remain_unprepared': 5, 'test_ordinary_plugin_canonical_file_uses_current_run_download_owner': 3, 'test_ordinary_plugin_preparation_preserves_precedence_schema_and_observation': 2, 'test_ordinary_plugin_sandbox_path_reuses_shell_stub_upload_then_download': 1, 'test_ordinary_remote_files_require_no_shell_or_download': 3, 'test_plugin_file_current_run_missing_refuses_without_legacy_fallback': 1, 'test_shared_direct_select_preparation_currently_loses_multiple_metadata': 2})
EXPECTED['tests.local.dify_agent.runtime.test_modules'] = {'test_all_registered_modules_export_native_components': 1, 'test_core_plugin_required_hidden_parameters_rejected_before_io': 2, 'test_core_shell_reference_is_validated_before_io': 2, 'test_duplicate_removed_legacy_slots_are_rejected': 1, 'test_invalid_legacy_state_is_rejected': 3, 'test_invalid_module_or_reference_is_rejected_before_io': 4, 'test_legacy_snapshot_conversion_preserves_only_retained_state': 1, 'test_native_sequential_tools_commit_json_state_without_lost_updates': 1, 'test_one_module_registered_twice_has_independent_json_and_fresh_instances': 1, 'test_snapshot_uses_current_config_and_drops_removed_optional_slots': 1, 'test_state_requires_explicit_json_writeback': 1}
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.local.dify_agent.server.test_app': {'test_confirmed_owner_is_composed_without_withdrawing_ordinary_keys': 1,
'test_create_app_authenticates_control_plane_routes': 4,
'test_create_app_defaults_agent_observability_to_disabled': 1,
'test_create_app_lifecycle_owns_agent_observability_instance': 1,
'test_create_app_native_owner_injection_and_truthful_capabilities': 1,
'test_create_app_passes_settings_to_server_observability': 1,
'test_create_app_wires_authenticated_agent_stub_connection_route': 1,
'test_create_app_wires_authenticated_agent_stub_file_upload_route': 1,
'test_create_dify_api_inner_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_create_plugin_daemon_http_client_uses_generic_outbound_httpx_construction_args': 1,
'test_optional_metering_never_starts_a_collector_or_blocks_runtime_startup': 2,
'test_server_settings_use_generic_outbound_http_args_for_shared_clients': 1,
'test_strict_embedded_stub_borrows_lifespan_reader_and_client': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
for module, functions in {
'tests.local.dify_agent.runtime_backend.test_native_test_scope': {
'test_confirmed_runtime_borrows_ordinary_binding_only_after_owner_validation': 1,
},
'tests.local.dify_agent.layers.shell.test_layer': {
'test_confirmed_shell_exit_keeps_jobs_without_unapproved_cleanup': 1,
},
'tests.local.dify_agent.server.test_app': {
'test_confirmed_stub_uses_strict_owner_alongside_legacy_ordinary_services': 1,
},
}.items():
EXPECTED.setdefault(module, {}).update(functions)
# ENG-1240: additive waiting-binding health transport inventory.
for module, functions in {'tests.local.dify_agent.runtime_backend.test_enterprise_backend': {'test_enterprise_idle_binding_is_lost_after_six_minutes_without_health': 1, 'test_enterprise_keep_alive_preserves_same_binding_across_approval_wait': 1, 'test_enterprise_keep_alive_is_one_health_read_and_closes_without_transport_retry': 3, 'test_enterprise_keep_alive_malformed_health_is_private_and_closed': 1, 'test_enterprise_keep_alive_cancellation_propagates_and_closes_transport': 1}, 'tests.local.dify_agent.server.test_execution_bindings': {'test_keep_alive_unsupported_backend_returns_false_without_operations': 1, 'test_keep_alive_real_unsupported_backends_never_open_transport': 3, 'test_keep_alive_sdk_route_actual_health_wire_is_fixed_and_private': 5, 'test_keep_alive_validation_does_not_echo_private_input': 2}, 'tests.local.dify_agent.server.test_app': {'test_keep_alive_is_absent_without_configured_control_plane_auth': 1, 'test_create_app_authenticates_control_plane_routes': 5}, 'tests.local.dify_agent.client.test_client': {'test_sync_keep_alive_client_uses_typed_private_route_once': 1, 'test_async_keep_alive_client_uses_typed_private_route_once': 1}}.items():
EXPECTED.setdefault(module, {}).update(functions)
# Exact source/collection additions after main and async receipt integration.
for module, functions in {'tests.local.dify_agent.layers.dify_core_tools.test_tracing': {'test_handled_failure_marks_only_its_native_tool_span': 6,
'test_successful_observation_is_not_classified_by_its_text': 1,
'test_uninstrumented_tool_failure_does_not_mark_an_unrelated_ambient_span': 3},
'tests.local.dify_agent.layers.shell.test_layer': {'test_structured_receipt_uses_actual_lease_before_rendering_and_does_not_leak': 2},
'tests.local.dify_agent.runtime_backend.test_local': {'test_local_binding_create_failure_preserves_existing_stdout': 1,
'test_local_binding_create_failure_without_stdout_keeps_job_diagnostics': 2},
'tests.local.dify_agent.server.test_app': {'test_anonymous_mode_does_not_mount_job_status': 1,
'test_create_app_authenticates_control_plane_routes': 6}}.items():
EXPECTED.setdefault(module, {}).update(functions)
REPORT = "builder-agent-workspace-regressions.xml"
code = pytest.main(['tests/local/dify_agent/runtime_backend', 'tests/local/dify_agent/layers', 'tests/local/dify_agent/server/test_binding_files.py', 'tests/local/dify_agent/server/test_execution_bindings.py', 'tests/local/dify_agent/server/test_home_snapshots.py', 'tests/local/dify_agent/server/test_app.py', 'tests/local/dify_agent/runtime/test_runner.py', 'tests/local/dify_agent/runtime/test_native_continuation.py', 'tests/local/dify_agent/client/test_client.py', 'tests/local/dify_agent/runtime/test_modules.py', '-vv', '-rA', '--tb=long', '--junitxml=builder-agent-workspace-regressions.xml'])
problems = []
identities = set()
actual = {module: Counter() for module in EXPECTED}
if not Path(REPORT).is_file():
problems.append("JUnit report missing")
else:
for case in ElementTree.parse(REPORT).getroot().iter("testcase"):
classname, name = case.get("classname") or "", case.get("name") or ""
identity = (classname, name)
if identity in identities:
problems.append(f"duplicate case {classname}::{name}")
identities.add(identity)
module = classname.removeprefix("api.")
if module not in EXPECTED:
problems.append(f"unexpected module {classname}::{name}")
else:
actual[module][name.split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("failure", "error", "skipped")):
problems.append(f"nonpassing case {classname}::{name}")
for module, functions in EXPECTED.items():
print(f"COLLECTED {module}: {sum(actual[module].values())} cases", flush=True)
if dict(actual[module]) != functions:
problems.append(f"case inventory mismatch {module}: {dict(actual[module])!r}")
print(f"COLLECTED total: {len(identities)} unique cases", flush=True)
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or (1 if problems else 0))
PY
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-native-agent
path: |
dify-agent/builder-native-agent.xml
dify-agent/builder-native-agent.log
dify-agent/builder-agent-regressions.xml
dify-agent/builder-agent-regressions.log
dify-agent/builder-agent-workspace-regressions.xml
dify-agent/builder-agent-workspace-regressions.log
api-contract-codegen:
if: github.event_name == 'workflow_dispatch' && inputs.contract_codegen
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- uses: ./.github/actions/setup-web
- name: Generate normal API docs and contracts
shell: bash
run: |
set -o pipefail
mkdir -p builder-api-contracts
git rev-parse HEAD > builder-api-contracts/source-commit.txt
(
cd api
uv run --no-sync dev/generate_swagger_markdown_docs.py --swagger-dir ../packages/contracts/openapi --markdown-dir openapi/markdown --keep-swagger-json
) 2>&1 | tee builder-api-contracts/docs.log
pnpm --dir packages/contracts gen-api-contract 2>&1 | tee builder-api-contracts/codegen.log
git diff --binary -- api/openapi/markdown packages/contracts/generated/api > builder-api-contracts/generated.patch
git diff --stat -- api/openapi/markdown packages/contracts/generated/api > builder-api-contracts/diff-stat.txt
git diff --check -- api/openapi/markdown packages/contracts/generated/api
- name: Check generated contracts
shell: bash
run: |
set -o pipefail
pnpm --dir packages/contracts type-check 2>&1 | tee builder-api-contracts/type-check.log
- name: Check Builder contract consumers
shell: bash
working-directory: web
run: |
set -o pipefail
vp test run --project unit app/components/workflow-app/components/dify-builder 2>&1 | tee ../builder-api-contracts/builder-consumer-tests.log
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-api-contracts
path: builder-api-contracts/
native-testing-foundation:
if: github.event_name != 'workflow_dispatch' || (!inputs.contract_codegen && (inputs.test_scope == 'all'))
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
STORAGE_TYPE: opendal
OPENDAL_SCHEME: fs
OPENDAL_FS_ROOT: /tmp/dify-builder-native-storage
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: api/uv.lock
- run: uv sync --project api --dev --locked
- name: Native contracts and authorization units
shell: bash
run: |
set -o pipefail
uv run --project api --no-sync python -u - <<'PY' 2>&1 | tee builder-native-foundation-units.log
import xml.etree.ElementTree as ET
from collections import Counter
from pathlib import Path
import pytest
files = ['api/tests/unit_tests/services/dify_builder/native_testing/test_contracts.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_runtime_contracts.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_authorization.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_lifecycle.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_context_binding.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_runtime_bridge.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_native_execution.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_public_contracts.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_pending_intents.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_pending_decision_guard.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_api_service.py', 'api/tests/unit_tests/controllers/console/test_builder_native_testing_routes.py']
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_operation_journal.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_checkpoint_bridge.py']
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_control.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_call_adapter.py']
physical_owner_baseline_expected = {path.removeprefix("api/").removesuffix(".py").replace("/", ".") for path in files}; files += ['api/tests/unit_tests/core/helper/code_executor', 'api/tests/unit_tests/services/code_execution/test_transport.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_http_adapter.py', 'api/tests/unit_tests/core/helper/test_ssrf_proxy.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_node_inputs.py', 'api/tests/unit_tests/libs/test_sensitive_http_telemetry.py', 'api/tests/unit_tests/extensions/test_ext_request_logging.py', 'api/tests/unit_tests/extensions/otel', 'api/tests/unit_tests/core/logging']
new_expected = {'tests.unit_tests.controllers.console.test_builder_native_testing_routes': {'test_native_route_requires_csrf': 1,
'test_native_route_requires_signed_login': 1,
'test_native_routes_reject_invalid_payload_before_composition': 4,
'test_native_sse_reconnect_skips_unchanged_public_snapshot': 1,
'test_native_sse_snapshot_has_reconnect_cursor_and_no_private_payload': 1},
'tests.unit_tests.services.dify_builder.native_testing.test_api_service': {'test_missing_qualification_refuses_start_before_admission': 1},
'tests.unit_tests.services.dify_builder.native_testing.test_context_binding': {'test_agent_apply_undo_refusal_preserves_bindings_and_allows_next_apply': 1,
'test_agent_selection_uses_exact_confirmed_opaque_identity': 1,
'test_compiled_admission_recheck_rejects_local_changes_without_writing': 4,
'test_compiler_reads_actual_owner_snapshot_and_finalizes_digest': 1,
'test_loaded_ref_must_exactly_match_requested_ref': 1,
'test_marker_roundtrip_does_not_extend_legacy_policy_union': 1,
'test_native_graph_prepares_every_agent_with_one_binding_owner': 1,
'test_native_graph_refuses_unselected_agent_before_sync': 1,
'test_owner_rejection_is_sanitized': 3,
'test_real_apply_persists_confirmed_agent_graph_and_binding_together': 1,
'test_reload_preserves_typed_inputs_and_isolates_mutable_snapshot': 1,
'test_required_scope_never_falls_back_to_ordinary': 1,
'test_restore_refuses_native_agent_state_before_graph_sync': 2,
'test_unknown_policy_never_reaches_owner': 1,
'test_unmarked_ordinary_run_does_not_load_native_state': 1},
'tests.unit_tests.services.dify_builder.native_testing.test_native_execution': {'test_admitted_native_gateway_releases_existing_rate_limit': 4,
'test_generator_refuses_missing_native_scope_before_file_or_config_work': 1,
'test_in_process_worker_refusal_terminates_native_queue_without_ordinary_setup': 2,
'test_native_owner_calls_existing_generator_with_reserved_id_and_server_actor': 1,
'test_ordinary_resume_cannot_rebuild_trace_for_native_marked_entity': 1,
'test_owner_cannot_replace_reserved_run_identity': 1,
'test_resume_checks_generation_before_native_owner': 1,
'test_resume_reloads_state_each_time': 1,
'test_run_uses_reloaded_typed_snapshot_and_exact_native_run_id': 1,
'test_worker_rejects_marker_before_payload_logger_or_ordinary_runner': 1},
'tests.unit_tests.services.dify_builder.native_testing.test_pending_decision_guard': {'test_guard_rejects_changed_generation_checkpoint_key_intent_scope_and_owner': 1},
'tests.unit_tests.services.dify_builder.native_testing.test_pending_intents': {'test_checkpoint_preserves_typed_frozen_intent_without_using_result_slot': 1,
'test_checkpoint_proposals_require_complete_matching_intent_and_unique_key': 1,
'test_checkpoint_refuses_repeated_operation_identity_across_journals': 1,
'test_journal_refuses_duplicate_intents': 1,
'test_journal_refuses_foreign_or_unclaimed_intent_key': 3,
'test_old_checkpoint_journal_reads_with_empty_intents': 1},
'tests.unit_tests.services.dify_builder.native_testing.test_public_contracts': {'test_decision_cannot_replace_parameters_or_expand_grant': 6,
'test_each_public_command_roundtrips_only_its_contract': 1,
'test_public_ids_use_shared_strict_utf8_bounds': 4,
'test_public_receipt_has_no_private_execution_fields': 1,
'test_start_rejects_caller_authority': 8,
'test_start_version_is_strict_bounded_integer': 5},
'tests.unit_tests.services.dify_builder.native_testing.test_runtime_bridge': {'test_factory_preserves_bridge_on_runtime_clone_and_checks_owners': 1,
'test_marked_factory_requires_bridge_before_eager_model_setup': 1,
'test_missing_occurrence_fails_before_collaborator_construction': 1,
'test_native_factory_constructs_real_registered_start_with_explicit_occurrence': 1,
'test_occurrence_and_root_budget_are_passed_to_explicit_bundle': 1,
'test_unmarked_factory_cannot_accept_native_bridge': 1}}
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_operation_journal': {'test_iteration_and_child_identity_survive_delivery_restart': 1, 'test_completed_replay_rechecks_c02_and_reads_private_result_after_restart': 1, 'test_typed_intent_sequence_conflict_refuses_before_authorization': 3, 'test_input_typed_digest_and_owner_ref_are_checked_before_authorization': 1, 'test_unknown_pending_or_incomplete_stream_is_never_a_replayable_result': 3, 'test_only_contiguous_completed_prefix_can_advance_and_finish_checks_old_suffix': 1, 'test_snapshot_isolated_from_caller_mutation_and_parallel_frames': 1, 'test_restore_rejects_malformed_or_stale_checkpoint_without_authorization': 8, 'test_two_pause_generations_preserve_ordered_journals': 1, 'test_owner_revocation_and_result_read_failure_never_publish_result': 1, 'test_unbound_cursor_can_reopen_same_identity_without_creating_input_material': 1, 'test_unknown_recheck_of_saved_result_cannot_advance_or_finish': 1, 'test_result_ref_conflict_and_generation_drift_never_expose_cached_replay': 1, 'test_null_and_closed_stream_material_replay_without_type_coercion': 1, 'test_restore_generation_change_during_private_reads_is_atomic': 1, 'test_same_slot_unknown_recheck_invalidates_delivery_completed_prefix': 1, 'test_c02_generation_change_never_exposes_decision_or_completion': 2, 'test_same_generation_c02_permit_is_returned_without_replay_or_completion': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_checkpoint_bridge': {'test_two_generation_wait_receipt_preserves_owner_category_and_exact_private_state': 3, 'test_storage_encryption_readback_or_sql_ack_failure_never_reaches_pause': 6, 'test_lifecycle_refusal_propagates_without_creating_a_waiting_outcome': 4, 'test_lifecycle_commit_exception_is_not_masked_as_durable_wait': 1}})
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_control': {'test_actual_iteration_child_restore_and_container_resume_forward_native_algorithm': 1, 'test_actual_parallel_stop_or_unknown_has_priority_after_native_pause_is_observed': 2, 'test_actual_parallel_waits_retain_both_distinct_pending_ids_and_native_bindings': 1, 'test_authorized_decisions_preserve_object_identity': 2, 'test_foreign_native_base_exception_propagates_by_exact_identity': 3, 'test_independent_simultaneous_contexts_share_classes_but_never_host_ownership': 1, 'test_malformed_decision_is_private_stop_before_any_dispatch': 5, 'test_malformed_decision_never_logs_serializer_input_values': 1, 'test_malformed_owner_ref_is_rejected_without_warnings_or_canary_in_exception': 1, 'test_marked_class_cache_preserves_all_current_mappings_without_instance_context': 1, 'test_mismatched_control_ref_is_nonresumable_before_sink_or_dispatch': 1, 'test_missing_native_execution_id_is_rejected_before_node_or_sink': 1, 'test_native_wait_bypasses_retry_default_and_failure_branch': 9, 'test_opt_in_rejects_non_boolean_marker_and_missing_trusted_sink': 1, 'test_ordinary_business_failure_keeps_native_retry_and_default_semantics': 3, 'test_sink_refusal_or_failure_is_nonresumable_abort_without_fallback': 12, 'test_stop_preserves_typed_reason_without_disclosing_it_in_diagnostics': 1, 'test_stop_records_owner_then_aborts_without_native_failure_policy': 3, 'test_wait_crosses_ordinary_exception_conversion_with_exact_context': 3}, 'tests.unit_tests.services.dify_builder.native_testing.test_call_adapter': {'test_callback_failure_records_unknown_once_and_never_replays': 3, 'test_changed_ordered_intent_is_refused_without_repeated_dispatch': 1, 'test_claim_ack_ambiguity_never_retries_claim_or_dispatches_or_settles': 1, 'test_claim_commit_lost_ack_retains_spent_claim_without_io_or_settlement': 1, 'test_complete_scalar_stores_before_settlement_then_replays_current_authority': 9, 'test_completion_ack_failure_never_attempts_contradictory_unknown_settlement': 2, 'test_completion_recheck_cannot_emit_new_wait_or_success_without_recorded_authority': 2, 'test_current_recorded_result_private_read_failure_never_dispatches': 1, 'test_duplicate_delivery_while_claimed_never_issues_another_physical_call': 1, 'test_forced_duplicate_permit_is_refused_by_one_shot_claim_without_settlement': 1, 'test_foreign_ref_is_refused_before_authorization_and_dispatch': 1, 'test_generation_change_across_owner_boundaries_never_returns_success': 5, 'test_generation_drift_after_claim_is_truthfully_not_dispatched': 1, 'test_generator_is_not_consumed_or_treated_as_scalar_completion': 1, 'test_invalid_result_budget_is_refused_before_any_effect': 6, 'test_known_claim_refusal_preserves_reason_without_io_or_settlement': 3, 'test_late_completed_receipt_survives_conflicting_unknown_attempt': 1, 'test_lost_completion_ack_can_only_replay_after_current_c02_and_protected_read': 1, 'test_non_json_or_non_finite_callback_result_is_unknown_and_never_stored': 6, 'test_owner_drift_during_storage_stops_without_completion': 1, 'test_postcompletion_protected_read_failure_never_overwrites_completed_outcome': 1, 'test_replay_returns_isolated_mutable_value_from_protected_storage': 1, 'test_result_at_exact_utf8_byte_budget_completes': 1, 'test_same_occurrence_cursor_replacement_during_callback_is_not_completion_authority': 1, 'test_saved_result_reference_never_overrides_current_denial': 1, 'test_stop_never_claims_dispatches_or_settles': 3, 'test_store_failure_after_dispatch_records_unknown_once_without_retry': 1, 'test_two_operations_complete_in_order_and_replay_null_without_fabricated_prefix': 1, 'test_unbound_or_missing_occurrence_never_opens_or_mints_input': 1, 'test_unknown_settlement_failure_is_contained_without_second_settlement': 1, 'test_utf8_result_size_bound_is_enforced_before_storage': 1, 'test_wait_preserves_category_and_never_claims_dispatches_or_settles': 3}, 'tests.unit_tests.services.dify_builder.native_testing.test_operation_journal': {'test_c02_generation_change_never_exposes_decision_or_completion': 2, 'test_completed_replay_rechecks_c02_and_reads_private_result_after_restart': 1, 'test_input_typed_digest_and_owner_ref_are_checked_before_authorization': 1, 'test_iteration_and_child_identity_survive_delivery_restart': 1, 'test_null_and_closed_stream_material_replay_without_type_coercion': 1, 'test_only_contiguous_completed_prefix_can_advance_and_finish_checks_old_suffix': 1, 'test_owner_revocation_and_result_read_failure_never_publish_result': 1, 'test_resolve_cursor_rejects_missing_or_untrusted_delivery_without_authorizing': 6, 'test_resolve_cursor_returns_only_existing_bound_current_issued_key_without_authorizing': 1, 'test_resolve_cursor_returns_replacement_identity_for_same_occurrence_only_after_input_and_key_prepare': 1, 'test_restore_generation_change_during_private_reads_is_atomic': 1, 'test_restore_rejects_malformed_or_stale_checkpoint_without_authorization': 8, 'test_result_ref_conflict_and_generation_drift_never_expose_cached_replay': 1, 'test_same_generation_c02_permit_is_returned_without_replay_or_completion': 1, 'test_same_slot_unknown_recheck_invalidates_delivery_completed_prefix': 1, 'test_snapshot_isolated_from_caller_mutation_and_parallel_frames': 1, 'test_two_pause_generations_preserve_ordered_journals': 1, 'test_typed_intent_sequence_conflict_refuses_before_authorization': 3, 'test_unbound_cursor_can_reopen_same_identity_without_creating_input_material': 1, 'test_unknown_pending_or_incomplete_stream_is_never_a_replayable_result': 3, 'test_unknown_recheck_of_saved_result_cannot_advance_or_finish': 1}})
new_expected.update({'tests.unit_tests.core.helper.code_executor.javascript.test_javascript_transformer': {'test_get_runner_script': 1}, 'tests.unit_tests.core.helper.code_executor.jinja2.test_jinja2_formatter': {'test_format_returns_empty_string_when_result_missing': 1, 'test_format_returns_result_value_as_string': 1}, 'tests.unit_tests.core.helper.code_executor.jinja2.test_jinja2_transformer.TestJinja2TransformCallerSandbox': {'test_blocks_unsafe_template': 4, 'test_renders_safe_template': 1, 'test_scripts_use_sandboxed_environment': 1}, 'tests.unit_tests.core.helper.code_executor.python3.test_python3_transformer': {'test_get_runner_script': 1, 'test_inputs_placeholder_inside_user_code_is_preserved': 1}, 'tests.unit_tests.core.helper.code_executor.test_code_executor': {'test_concurrent_injected_transports_do_not_cross_scopes': 1, 'test_execute_code_raises_for_non_200_status': 1, 'test_execute_code_raises_service_unavailable_for_503': 1, 'test_execute_code_raises_when_client_post_fails': 1, 'test_execute_code_raises_when_response_contains_runtime_error': 1, 'test_execute_code_raises_when_response_json_is_invalid': 1, 'test_execute_code_raises_when_sandbox_returns_error_code': 1, 'test_execute_code_returns_stdout_on_success': 1, 'test_execute_workflow_code_template_raises_for_unsupported_language': 1, 'test_execute_workflow_code_template_uses_transformer': 1, 'test_injected_execute_code_uses_exact_payload_without_ordinary_resolution': 3, 'test_injected_private_control_base_exception_propagates_unchanged': 1, 'test_injected_transport_does_not_bypass_unsupported_language': 1, 'test_injected_workflow_runs_actual_transformer_roundtrip': 3}, 'tests.unit_tests.core.helper.code_executor.test_code_node_provider': {'test_get_default_config_contains_expected_shape': 1, 'test_is_accept_language': 1}, 'tests.unit_tests.core.helper.code_executor.test_template_transformer': {'test_assemble_runner_script_embeds_code_and_inputs': 1, 'test_serialize_code_encodes_to_base64': 1, 'test_serialize_inputs_encodes_payload': 1, 'test_transform_caller_returns_runner_and_empty_preload': 1, 'test_transform_response_parses_json_result_and_converts_scientific_notation': 1, 'test_transform_response_raises_for_invalid_json': 1, 'test_transform_response_raises_for_missing_result_tag': 1, 'test_transform_response_raises_for_non_dict_result': 1, 'test_transform_response_raises_for_non_string_keys': 1, 'test_transform_response_raises_for_unexpected_errors': 1}, 'tests.unit_tests.services.code_execution.test_transport': {'test_core_error_and_response_exports_preserve_identity': 1, 'test_ordinary_empty_stdout_returns_empty_string': 3, 'test_ordinary_factory_retains_tls_and_pool_limits': 1, 'test_ordinary_failures_preserve_error_type_and_message': 6, 'test_ordinary_json_parse_retains_exception_cause': 1, 'test_ordinary_malformed_shape_retains_existing_failure_boundary': 3, 'test_ordinary_request_retains_url_credentials_network_and_timeouts': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_http_adapter': {'test_actual_httpx_info_query_canary_suppressed_on_call_and_replay_but_ordinary_unchanged': 1, 'test_actual_native_http_node_cannot_convert_wait_to_retry_default_or_fail_branch': 3, 'test_actual_ssrf_rejection_is_unknown_after_dispatch_and_not_retried': 1, 'test_actual_ssrf_request_error_diagnostics_do_not_emit_request_secrets': 1, 'test_admitted_budgets_require_exact_finite_integers': 6, 'test_ambient_pooled_client_cookie_never_enters_physical_request': 1, 'test_attestation_substitution_and_invalid_intent_fail_before_claim': 4, 'test_context_rechecks_after_claim_and_fails_closed_without_transport': 1, 'test_cross_origin_domain_cookie_does_not_forward_or_reappear_from_pool': 1, 'test_declared_length_truncated_response_is_unknown': 1, 'test_frozen_snapshot_and_binding_never_expose_or_mutate_secret_values': 1, 'test_http_owner_suppresses_real_global_httpx_instrumentation_only_during_physical_io': 1, 'test_invalid_recorded_raw_headers_stop_unknown_without_resending': 4, 'test_multipart_preserved_body_redirect_replay_ignores_random_wire_boundary': 1, 'test_multiple_domain_cookies_are_cleared_for_cross_origin_redirect_and_replay': 2, 'test_native_executor_prepares_typed_json_query_and_header_before_attestation': 1, 'test_nonstandard_http_status_preserves_actual_native_response_semantics': 3, 'test_post_timeout_never_retries_and_retains_dispatch': 1, 'test_protocol_methods_use_actual_ssrf_owner_without_retry': 6, 'test_ready_check_is_repeated_for_redirect_metadata_before_new_claim': 1, 'test_real_in_container_loopback_canary_counts_allowed_then_denied': 1, 'test_real_ssrf_scalar_roundtrip_preserves_response_and_replays_without_dispatch': 1, 'test_redirect_budget_does_not_dispatch_extra_hop': 1, 'test_redirect_compatibility_with_actual_locked_httpx': 15, 'test_redirect_hops_have_separate_authority_and_native_method_semantics': 5, 'test_redirect_to_new_host_waits_after_first_response_and_replays_first_hop': 1, 'test_repeated_set_cookie_fields_follow_locked_httpx_on_first_call_and_protected_replay': 4, 'test_response_uncertainty_closes_once_stays_unknown_and_never_resends': 4, 'test_retry_option_refused_before_preparation_or_dispatch': 5, 'test_same_origin_chain_cookie_is_preserved_over_more_than_one_redirect': 1, 'test_same_origin_redirect_preserves_actual_set_cookie_semantics': 1, 'test_scalar_contains_raw_transport_exception_before_outer_manual_span': 3, 'test_storage_or_completion_ack_uncertainty_never_resends': 2, 'test_successful_owned_stream_closes_once_and_current_denial_blocks_replay': 1, 'test_unadmitted_or_nonfinite_material_refused_before_intent': 8, 'test_unready_telemetry_stops_before_metadata_claim_or_dispatch': 5, 'test_wait_before_transport_is_private_and_has_no_dispatch': 3}, 'tests.unit_tests.core.helper.test_ssrf_proxy': {'test_allow_redirects_converted_to_follow_redirects': 1,
'test_buffer_response_rejects_encoded_response_before_decoding': 1,
'test_buffer_response_rejects_identity_response_exceeding_byte_limit': 1,
'test_buffer_response_returns_response_within_decoded_byte_limit': 1,
'test_build_ssrf_client_passes_ssl_verify_to_proxy_mount_transports': 1,
'test_follow_redirects_not_set_when_not_specified': 1,
'test_follow_redirects_passed_to_request': 1,
'test_follow_redirects_takes_precedence_over_allow_redirects': 1,
'test_force_list_response_returns_when_retries_disabled': 1,
'test_graphon_ssrf_proxy_wraps_module_requests': 6,
'test_host_header_preservation_case_insensitive': 3,
'test_host_header_preservation_with_user_header': 1,
'test_non_squid_403_is_not_treated_as_ssrf_block': 1,
'test_request_can_return_an_open_stream_the_caller_closes': 1,
'test_retry_exceed_max_retries': 1,
'test_retry_exhaustion_preserves_the_last_request_error': 1,
'test_returns_first_host_header_when_duplicates': 1,
'test_returns_host_header_from_multiple_headers': 1,
'test_returns_host_header_lowercase': 1,
'test_returns_host_header_mixed_case': 1,
'test_returns_host_header_uppercase': 1,
'test_returns_none_when_headers_is_empty': 1,
'test_returns_none_when_headers_is_none': 1,
'test_returns_none_when_host_header_not_present': 1,
'test_sensitive_force_list_warnings_preserve_ordinary_retry_behavior': 2,
'test_sensitive_request_errors_have_fixed_warnings_and_ordinary_diagnostics_are_preserved': 2,
'test_squid_401_via_header_also_triggers_actionable_error': 1,
'test_squid_block_raises_actionable_tool_ssrf_error': 1,
'test_squid_block_with_internal_10_x_url_mentions_allowlist': 1,
'test_ssrf_proxy_exposes_expected_error_types': 1,
'test_successful_request': 1,
'test_to_graphon_http_response_preserves_httpx_response_fields': 1}, 'tests.unit_tests.core.helper.test_ssrf_proxy.TestGetUserProvidedHostHeader': {'test_returns_first_host_header_when_duplicates': 1, 'test_returns_host_header_from_multiple_headers': 1, 'test_returns_host_header_lowercase': 1, 'test_returns_host_header_mixed_case': 1, 'test_returns_host_header_uppercase': 1, 'test_returns_none_when_headers_is_empty': 1, 'test_returns_none_when_headers_is_none': 1, 'test_returns_none_when_host_header_not_present': 1}, 'tests.unit_tests.core.helper.test_ssrf_proxy.TestFollowRedirectsParameter': {'test_allow_redirects_converted_to_follow_redirects': 1, 'test_follow_redirects_not_set_when_not_specified': 1, 'test_follow_redirects_passed_to_request': 1, 'test_follow_redirects_takes_precedence_over_allow_redirects': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_node_inputs': {'test_current_authority_drift_never_acknowledges': 39, 'test_equal_inputs_under_different_native_ids_remain_independent': 1, 'test_failed_storage_or_ack_never_returns_reference_or_leaks_inputs': 5, 'test_generation_must_be_exact_current_integer_before_storage': 6, 'test_invalid_identity_fails_before_private_storage': 7, 'test_invalid_typed_json_has_no_storage_or_secret_diagnostics': 6, 'test_malformed_constructed_ref_has_no_warnings_or_authority_access': 1, 'test_repeat_is_idempotent_but_typed_change_conflicts': 4, 'test_running_branch_retains_generation_after_unrelated_scope_resume': 3, 'test_typed_inputs_roundtrip_in_independent_namespace': 7}, 'tests.unit_tests.libs.test_sensitive_http_telemetry': {'test_actual_enabled_httpx_global_instrumentation_preserves_only_ordinary_spans': 1, 'test_concurrent_ordinary_thread_keeps_httpx_logs': 1, 'test_concurrent_ordinary_thread_keeps_real_auto_instrumented_span': 1, 'test_context_rechecks_configuration_after_preclaim_readiness': 1, 'test_current_httpx_info_really_persists_full_query': 1, 'test_existing_exception_logging_handler_filters_sensitive_parent_span_events': 1, 'test_guard_blocks_real_httpx_query_and_exception_in_console_and_file': 2, 'test_guard_never_changes_logger_configuration': 1, 'test_known_lower_http_logger_bypass_refuses': 10, 'test_nested_context_restores_after_exception_and_baseexception': 3, 'test_unready_configuration_refuses_before_transport': 3}, 'tests.unit_tests.extensions.test_ext_request_logging': {'test_info_access_log_includes_method_path_status_duration_trace_id': 1,
'test_info_access_log_uses_dash_without_start_timestamp': 1,
'test_is_content_type_json': 1,
'test_json_request': 1,
'test_json_request_with_empty_body': 1,
'test_json_request_with_invalid_json_as_body': 2,
'test_json_response': 1,
'test_logging_should_be_skipped_if_level_is_above_debug': 1,
'test_non_json_request': 1,
'test_non_json_response': 1,
'test_receiver_should_be_called_if_enabled': 1,
'test_receiver_should_not_be_invoked_if_configuration_is_disabled': 1,
'test_when_request_logging_disabled': 1,
'test_when_request_logging_enabled': 1}, 'tests.unit_tests.extensions.test_ext_request_logging.TestRequestLoggingExtension': {'test_receiver_should_be_called_if_enabled': 1, 'test_receiver_should_not_be_invoked_if_configuration_is_disabled': 1}, 'tests.unit_tests.extensions.test_ext_request_logging.TestLoggingLevel': {'test_logging_should_be_skipped_if_level_is_above_debug': 1}, 'tests.unit_tests.extensions.test_ext_request_logging.TestRequestReceiverLogging': {'test_json_request': 1, 'test_json_request_with_empty_body': 1, 'test_json_request_with_invalid_json_as_body': 1, 'test_non_json_request': 1}, 'tests.unit_tests.extensions.test_ext_request_logging.TestResponseReceiverLogging': {'test_json_request_with_invalid_json_as_body': 1, 'test_json_response': 1, 'test_non_json_response': 1}, 'tests.unit_tests.extensions.test_ext_request_logging.TestResponseUnmodified': {'test_when_request_logging_disabled': 1, 'test_when_request_logging_enabled': 1}, 'tests.unit_tests.extensions.test_ext_request_logging.TestRequestFinishedInfoAccessLine': {'test_info_access_log_includes_method_path_status_duration_trace_id': 1, 'test_info_access_log_uses_dash_without_start_timestamp': 1}, 'tests.unit_tests.extensions.otel.decorators.handlers.test_generate_handler.TestAppGenerateHandler': {'test_all_span_attributes_set_correctly': 1, 'test_compatible_with_real_function_signature': 1}, 'tests.unit_tests.extensions.otel.decorators.handlers.test_workflow_app_runner_handler.TestWorkflowAppRunnerHandler': {'test_all_span_attributes_set_correctly': 1, 'test_handler_structure_dependencies': 1}, 'tests.unit_tests.extensions.otel.decorators.test_base.TestTraceSpanDecorator': {'test_decorated_function_executes_normally': 1, 'test_decorator_with_args_and_kwargs': 1}, 'tests.unit_tests.extensions.otel.decorators.test_base.TestTraceSpanWithMemoryExporter': {'test_exception_is_recorded_in_span': 1, 'test_span_is_created_and_exported': 1, 'test_span_name_matches_function': 1, 'test_span_status_is_error_on_exception': 1, 'test_span_status_is_ok_on_success': 1}, 'tests.unit_tests.extensions.otel.decorators.test_handler.TestSpanHandlerExtractArguments': {'test_extract_arguments_handles_self': 1, 'test_extract_arguments_returns_none_on_error': 1, 'test_extract_arguments_with_defaults': 1, 'test_extract_keyword_arguments': 1, 'test_extract_mixed_arguments': 1, 'test_extract_positional_arguments': 1, 'test_signature_caching': 1}, 'tests.unit_tests.extensions.otel.decorators.test_handler.TestSpanHandlerWrapper': {'test_wrapper_creates_span': 1, 'test_wrapper_passes_arguments_correctly': 1, 'test_wrapper_re_raises_exception': 1, 'test_wrapper_records_exception_on_error': 1, 'test_wrapper_sets_span_kind_internal': 1, 'test_wrapper_sets_status_error_on_exception': 1, 'test_wrapper_sets_status_ok_on_success': 1, 'test_wrapper_with_memory_exporter': 1}, 'tests.unit_tests.extensions.otel.test_celery_sqlcommenter.TestBuildCelerySqlcommenterTags': {'test_handles_task_without_request': 1, 'test_includes_celery_retries_when_nonzero': 1, 'test_includes_framework_and_task_name': 1, 'test_includes_routing_key_from_delivery_info': 1, 'test_includes_traceparent_when_available': 1, 'test_omits_celery_retries_when_zero': 1}, 'tests.unit_tests.extensions.otel.test_celery_sqlcommenter.TestTaskPrerunPostrunHandlers': {'test_postrun_skips_when_no_token': 1, 'test_prerun_sets_context_postrun_detaches': 1, 'test_prerun_skips_when_no_task': 1}, 'tests.unit_tests.extensions.otel.test_context': {'test_propagate_context_captures_context_when_wrapped': 1, 'test_propagate_context_detaches_context_after_exception': 1, 'test_propagate_context_preserves_function_metadata': 1}, 'tests.unit_tests.extensions.test_ext_otel': {'test_duplicate_teardown_does_not_log_detach_failure': 1}, 'tests.unit_tests.core.workflow.nodes.knowledge_retrieval.test_retrieval': {'test_knowledge_retrieval_creates_a_child_otel_span': 1, 'test_multiple_retrieve_preserves_otel_context_in_dataset_thread': 1, 'test_retriever_thread_exception_emits_skip_event_when_requested': 1, 'test_retriever_thread_exception_sets_error_span_and_is_collected': 1}, 'tests.unit_tests.extensions.otel.test_runtime': {'test_on_user_loaded_does_not_write_to_non_recording_span': 1, 'test_on_user_loaded_ignores_ended_sdk_span': 1, 'test_on_user_loaded_sets_attributes_on_recording_span': 1}, 'tests.unit_tests.core.logging.test_context.TestLoggingContext': {'test_clear_resets_context': 1, 'test_clear_resets_identity_context': 1, 'test_context_isolation': 1, 'test_default_values_are_empty': 1, 'test_identity_context_is_copied_as_primitive_values': 1, 'test_init_clears_existing_identity_context': 1, 'test_init_creates_request_id': 1, 'test_init_creates_trace_id': 1, 'test_multiple_inits_create_different_ids': 1, 'test_set_identity_context': 1, 'test_set_identity_context_replaces_all_fields': 1, 'test_trace_id_derived_from_request_id': 1}, 'tests.unit_tests.core.logging.test_filters.TestTraceContextFilter': {'test_filter_always_returns_true': 1, 'test_otel_context_exception': 1, 'test_otel_context_invalid_ids': 2, 'test_otel_context_span_none': 1, 'test_sets_empty_trace_id_without_context': 1, 'test_sets_trace_id_from_context': 1, 'test_sets_trace_id_from_otel_when_available': 1}, 'tests.unit_tests.core.logging.test_filters.TestIdentityContextFilter': {'test_does_not_trigger_flask_login_request_loader': 1, 'test_ended_otel_span_warning_does_not_trigger_request_loader': 1, 'test_filter_always_returns_true': 1, 'test_sets_empty_identity_without_request_context': 1, 'test_uses_explicit_identity_context_without_flask_context': 1}, 'tests.unit_tests.core.logging.test_structured_formatter.TestStructuredJSONFormatter': {'test_attributes_included': 1, 'test_basic_log_format': 1, 'test_error_with_stack_trace': 1, 'test_fallback_for_non_serializable_attributes': 1, 'test_identity_context_included': 1, 'test_message_with_args': 1, 'test_no_identity_when_empty': 1, 'test_no_stack_trace_for_info': 1, 'test_severity_mapping': 1, 'test_timestamp_format': 1, 'test_trace_context_included': 1}, 'tests.unit_tests.core.helper.test_trace_id_helper.TestGetSpanIdFromOtelContext': {'test_returns_none_on_exception': 1, 'test_returns_none_without_span': 1, 'test_returns_span_id_when_available': 1}, 'tests.unit_tests.core.helper.test_trace_id_helper.TestGenerateTraceparentHeader': {'test_generates_hex_only_values': 1, 'test_generates_valid_format': 1, 'test_uses_otel_context_when_available': 1}, 'tests.unit_tests.core.helper.test_trace_id_helper.TestParseTraceparentHeader': {'test_parses_valid_traceparent': 1, 'test_returns_none_for_empty_string': 1, 'test_returns_none_for_invalid_format': 1}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_http_binding.py']
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_dispatch_fence.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_runtime_bridge': {'test_actual_engine_equal_inputs_distinct_occurrences_restore_retry_and_fresh_clone': 2, 'test_association_rejects_foreign_or_changed_identity_without_context_read': 7, 'test_attach_rejects_foreign_control_composition_with_same_native_class_and_runtime': 2, 'test_bound_node_getter_rejects_attached_identity_drift_without_context_read': 5, 'test_bound_node_getter_requires_attachment_and_public_binding_without_context_read': 1, 'test_constructor_adapter_cannot_replace_attached_identity_or_control_owner': 6, 'test_constructor_argument_mapping_cannot_replace_control_dependencies': 1, 'test_constructor_effect_attempt_is_refused_before_any_context_read': 1, 'test_effect_rechecks_attached_identity_after_private_context_read': 4, 'test_effect_revalidates_full_private_context_each_time': 1, 'test_factory_preserves_bridge_on_runtime_clone_and_checks_owners': 1, 'test_marked_factory_requires_bridge_before_eager_model_setup': 1, 'test_missing_deferred_collaborator_never_uses_ordinary_fallback': 2, 'test_native_factory_constructs_real_registered_start_without_resolving_occurrence': 1, 'test_preparation_and_constructor_cannot_open_context_or_bound_occurrence': 1, 'test_preparation_public_expected_identity_cannot_be_replaced': 4, 'test_preparation_requires_exact_owner_ref_and_explicit_control_dependencies': 1, 'test_real_factory_http_effect_uses_public_binding_and_marked_control': 2, 'test_unmarked_factory_cannot_accept_native_bridge': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_http_binding': {'test_actual_node_mutation_refuses_before_input_ack': 1, 'test_actual_node_typed_input_ack_precedes_journal_and_install': 1, 'test_actual_wait_exports_one_call_proposal_from_scope_expiry': 1, 'test_concrete_prebound_entry_has_zero_protected_io': 1, 'test_concrete_producer_and_deferred_entry_exist_without_factory_activation': 1, 'test_current_classification_does_not_echo_stored_flags': 1, 'test_current_registry_replacement_cannot_keep_pinned_http_qualification': 1, 'test_deferred_actual_response_cap_refuses_without_truncated_success': 1, 'test_deferred_zero_redirect_cap_never_sends_second_destination': 1, 'test_disclosure_only_validated_origin_typed_lengths_and_opaque_notice': 1, 'test_identical_graph_revision_in_another_workflow_is_a_different_qualification': 1, 'test_identical_request_native_occurrences_have_independent_http_confirmation_scopes': 1, 'test_ignored_none_body_file_selector_is_still_outside_qualified_resource': 1, 'test_known_destructive_binding_retains_existing_hard_denial': 1, 'test_literal_empty_text_and_scalar_json_keep_actual_native_semantics': 4, 'test_offline_native_attestation_keeps_json_types_and_refuses_tamper': 1, 'test_profile_has_explicit_shared_accounting_and_caps': 1, 'test_qualified_http_manifest_selects_operation_consent_and_rejects_legacy_projection': 1, 'test_real_deferred_native_scalar_http_complete_then_same_key_replay': 1, 'test_real_deferred_native_wait_keeps_private_journal_and_zero_dispatch': 1, 'test_resource_projection_is_real_versioned_metadata_without_literals': 1, 'test_strict_file_collaborator_never_synthesizes_empty_file_outputs': 1, 'test_unqualified_variants_refuse_before_native_preparation': 7}, 'tests.unit_tests.services.dify_builder.native_testing.test_authorization': {'test_binding_rejects_resource_capability_key_and_typed_parameter_forgery': 4, 'test_client_effect_cannot_select_approval_scope': 1, 'test_current_server_scope_classification_drift_is_rejected': 2, 'test_forged_code_kind_cannot_use_task_approval': 1, 'test_known_destructive_classification_remains_forbidden_in_each_scope': 2, 'test_legacy_batch_scope_keeps_captured_digest_and_ignores_occurrence': 2, 'test_malformed_server_scope_is_rejected_at_c02_binding_boundary': 14, 'test_operation_scope_binds_each_actual_key_component': 3, 'test_operation_scope_preserves_typed_parameters_and_excludes_transport_correlations': 1, 'test_reservation_profile_is_immutable_after_creation': 1, 'test_reservation_rejects_forged_identity_expiry_and_inflated_budget': 1, 'test_serialized_revision_never_reads_resolved_secret_variables': 1, 'test_task_grant_requires_all_isolation_conditions': 4, 'test_valid_binding_does_not_autogrant_external_read': 1}})
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_control': {'test_actual_iteration_child_restore_and_container_resume_forward_native_algorithm': 1, 'test_actual_native_worker_observation_covers_sink_and_finishes': 3, 'test_actual_parallel_stop_or_unknown_has_priority_after_native_pause_is_observed': 2, 'test_actual_parallel_waits_retain_both_distinct_pending_ids_and_native_bindings': 1, 'test_actual_restored_iteration_observes_resume_and_child_runtime_instances': 1, 'test_authorized_decisions_preserve_object_identity': 2, 'test_blocked_native_renderer_callback_remains_owned_until_actual_release': 1, 'test_blocked_sink_callback_remains_owned_until_actual_release': 1, 'test_foreign_native_base_exception_propagates_by_exact_identity': 3, 'test_independent_simultaneous_contexts_share_classes_but_never_host_ownership': 1, 'test_malformed_decision_is_private_stop_before_any_dispatch': 5, 'test_malformed_decision_never_logs_serializer_input_values': 1, 'test_malformed_owner_ref_is_rejected_without_warnings_or_canary_in_exception': 1, 'test_marked_class_cache_preserves_all_current_mappings_without_instance_context': 1, 'test_mismatched_control_ref_is_nonresumable_before_sink_or_dispatch': 1, 'test_missing_native_execution_id_is_rejected_before_node_or_sink': 1, 'test_native_wait_bypasses_retry_default_and_failure_branch': 9, 'test_node_observation_is_lazy_bound_and_finally_safe_on_close': 1, 'test_observed_ordinary_native_failure_remains_failed_and_never_waits': 2, 'test_observer_cannot_suppress_or_replace_foreign_delegate_exception': 6, 'test_observer_exit_failure_after_emitted_pause_never_leaves_resumable_owner': 1, 'test_observer_failure_is_private_sticky_unknown_and_aborts': 6, 'test_opt_in_rejects_non_boolean_marker_and_missing_trusted_sink': 1, 'test_ordinary_business_failure_keeps_native_retry_and_default_semantics': 3, 'test_resume_container_is_lazy_and_owned_through_blocked_exit_callback': 1, 'test_resume_container_observer_failure_aborts_without_resumable_acceptance': 2, 'test_sink_refusal_or_failure_is_nonresumable_abort_without_fallback': 12, 'test_stop_preserves_typed_reason_without_disclosing_it_in_diagnostics': 1, 'test_stop_records_owner_then_aborts_without_native_failure_policy': 3, 'test_unbound_node_never_enters_observation': 1, 'test_unmarked_native_node_keeps_ordinary_behavior_without_observation': 1, 'test_wait_crosses_ordinary_exception_conversion_with_exact_context': 3}, 'tests.unit_tests.services.dify_builder.native_testing.test_dispatch_fence': {'test_active_unfenced_lineage_allows_dispatch_without_requiring_global_generation_equality': 1, 'test_approval_pending_uses_actual_local_generation_after_shared_scope_advance': 1, 'test_child_cannot_coalesce_an_ancestor_pending_id_as_its_own_wait': 1, 'test_child_creation_checks_fence_before_protected_input_or_resolver_work': 1, 'test_closed_self_or_ancestor_refuses_fresh_dispatch': 12, 'test_coalesced_native_wait_still_validates_requested_pending_owner': 1, 'test_existing_c02_coalesces_fenced_sibling_before_any_operation_write': 1, 'test_existing_nested_child_lookup_requires_actual_parent_private_authority': 12, 'test_fence_never_coalesces_foreign_stale_or_invalid_pending_row': 6, 'test_fence_pending_acknowledges_after_commit_without_changing_running_state': 3, 'test_generation_claim_requires_actual_saved_configuration_resolution': 2, 'test_incomplete_or_revoked_lineage_never_authorizes_dispatch': 7, 'test_inconsistent_reason_ids_or_unacknowledged_current_rows_never_open_dispatch': 6, 'test_malformed_or_missing_fence_membership_fails_closed': 3, 'test_native_pending_owner_uses_local_generation_after_shared_scope_advance': 2, 'test_pause_cannot_discard_a_late_running_fence': 1, 'test_retained_acknowledged_historical_ids_do_not_coalesce_or_close_admission': 1, 'test_same_invocation_fence_preserves_real_pending_identity_and_category': 3}})
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_dispatch_fence': {'test_active_unfenced_lineage_allows_dispatch_without_requiring_global_generation_equality': 1, 'test_approval_pending_uses_actual_local_generation_after_shared_scope_advance': 1, 'test_child_cannot_coalesce_an_ancestor_pending_id_as_its_own_wait': 1, 'test_child_creation_checks_fence_before_protected_input_or_resolver_work': 1, 'test_closed_self_or_ancestor_refuses_fresh_dispatch': 12, 'test_coalesced_native_wait_still_validates_requested_pending_owner': 1, 'test_existing_c02_coalesces_fenced_sibling_before_any_operation_write': 1, 'test_existing_nested_child_lookup_requires_actual_parent_private_authority': 12, 'test_fence_never_coalesces_foreign_stale_or_invalid_pending_row': 6, 'test_fence_pending_acknowledges_after_commit_without_changing_running_state': 3, 'test_generation_claim_requires_actual_saved_configuration_resolution': 2, 'test_incomplete_or_revoked_lineage_never_authorizes_dispatch': 7, 'test_inconsistent_reason_ids_or_unacknowledged_current_rows_never_open_dispatch': 6, 'test_malformed_or_missing_fence_membership_fails_closed': 3, 'test_native_pending_owner_uses_local_generation_after_shared_scope_advance': 2, 'test_pause_cannot_discard_a_late_running_fence': 1, 'test_physical_claim_validates_permit_then_preserves_ancestor_refusal': 9, 'test_retained_acknowledged_historical_ids_do_not_coalesce_or_close_admission': 1, 'test_same_invocation_fence_preserves_real_pending_identity_and_category': 3, 'test_terminal_child_settlement_without_resolution_owner_commits_and_keeps_parent_waiting': 2, 'test_waiting_immutable_denial_is_negative_evidence_without_fresh_admission': 4}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_observation_privacy.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_host_lifetime.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_host_capacity.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_observation_privacy': {'test_qualification_and_graph_copy_do_not_modify_protected_context': 1, 'test_real_result_echo_and_retry_history_are_redacted_with_independent_observers': 1, 'test_graph_events_retain_types_counts_and_safe_correlations': 8, 'test_node_event_content_never_survives_projection': 7, 'test_real_container_events_keep_iteration_steps_and_independent_content': 2, 'test_values_preserve_typed_shape_only_and_none': 1, 'test_unsupported_values_refuse_without_rendering_contents': 5, 'test_deep_or_cyclic_values_refuse_safely': 1, 'test_errors_never_render_exceptions_and_only_keep_finite_known_kinds': 1, 'test_invalid_contexts_and_descriptor_drift_refuse_without_content': 10, 'test_actual_server_profile_is_required_and_drift_refuses': 1, 'test_policy_snapshots_context_against_later_mutation': 1, 'test_unknown_event_subclass_or_unowned_identity_refuses': 1, 'test_human_input_is_not_reported_as_a_qualified_native_wait': 1, 'test_only_explicit_native_execution_limits_layer_is_structurally_qualified': 1, 'test_native_edge_identity_is_distinct_from_editor_identity_and_missing_editor_ids': 1, 'test_unchecked_native_event_shapes_refuse_with_fixed_reason': 4, 'test_original_runtime_outputs_and_variable_selection_survive_diagnostic_mutation': 1, 'test_unsupported_value_after_display_cutoff_is_still_refused': 1, 'test_large_private_content_projects_to_bounded_shape': 1, 'test_missing_nonempty_file_or_unknown_metadata_objects_do_not_pass': 1, 'test_unchecked_result_field_types_refuse_before_native_validation': 6, 'test_unchecked_event_scalar_types_cannot_be_hidden_as_valid_evidence': 3, 'test_unchecked_context_and_profile_refuse_without_serialization_warnings': 2, 'test_qualification_never_renders_unknown_context_objects': 1, 'test_unchecked_profile_limits_require_actual_strict_integer_counters': 2, 'test_container_internal_node_identity_is_preserved': 3, 'test_fix1_retry_metadata_retains_native_correlation_counts_and_secrecy': 1, 'test_fix1_container_metadata_retains_native_length_correlation_and_independence': 6, 'test_fix1_retry_safe_metadata_fields_reject_malformed_types_and_bounds': 9, 'test_fix1_container_lengths_reject_malformed_counters': 10, 'test_fix1_container_approved_metadata_uses_same_finite_validation': 2, 'test_fix1_official_iteration_length_zero_and_finite_counter_boundary': 2, 'test_existing_scalar_control_schemas_accept_exact_empty_http_manifest': 2, 'test_empty_http_manifest_keeps_schema_owner_and_privacy_refusals': 12}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_lifetime': {'test_actual_native_boundary_keeps_scope_across_generator_yield_and_real_close': 2, 'test_ambiguous_acknowledgement_stays_unknown_after_complete_physical_cleanup': 1, 'test_child_unknown_outcome_does_not_replace_actual_subtree_cleanup_evidence': 1, 'test_cleaned_payloads_collect_while_compact_verifier_is_retained': 1, 'test_consumed_ancestor_blocks_late_tracking_while_child_cleanup_remains_possible': 1, 'test_control_does_not_wait_for_blocked_permission_and_refuses_late_callback': 1, 'test_control_record_requires_actual_active_node_and_exact_execution': 1, 'test_control_registration_stays_unblocked_while_coordinator_joins': 1, 'test_descendant_completion_wakes_waiting_ancestor_promptly': 4, 'test_descendant_late_activity_invalidates_ancestor_sample': 8, 'test_disposed_registry_drops_compact_tombstones_and_stays_permanently_closed': 1, 'test_distinct_call_tickets_and_active_callback_remain_owned_until_real_return': 1, 'test_finally_callback_is_not_exit_and_late_cleanup_preserves_unknown': 1, 'test_first_coordinator_arrival_after_deadline_is_conservatively_unknown': 1, 'test_foreign_generation_and_reacquired_same_identity_cannot_consume_current': 1, 'test_foreign_runtime_node_is_refused_and_self_join_never_blocks': 1, 'test_full_lifetime_identity_cannot_be_replaced_after_activation': 1, 'test_inert_or_missing_ownership_never_establishes_cleanup': 1, 'test_late_node_and_call_tracking_survives_control_without_reopening_physical_entry': 1, 'test_late_owned_activity_invalidates_an_earlier_in_time_quiet_sample': 2, 'test_missing_finally_is_not_equivalent_to_joined_thread': 1, 'test_one_shared_deadline_across_actual_threads_and_slow_precontrol_work': 1, 'test_open_stream_retains_actual_ticket_until_owner_closes': 1, 'test_owned_dispatcher_observation_and_ordinary_work_are_independent': 1, 'test_real_native_scope_retains_node_runtime_execution_thread_through_closure': 2, 'test_registration_refusal_prevents_start_and_unstarted_false_is_not_proof': 1, 'test_registry_scope_and_disposal_never_evict_incomplete_ownership': 1, 'test_repeated_clean_acquisitions_do_not_retain_full_history_and_keep_monotonicity': 1, 'test_retired_child_proof_requires_that_exact_child_to_remain_current': 2, 'test_start_failure_is_explicit_and_cleanup_is_exactly_once': 1, 'test_stream_close_failure_is_ambiguous_even_when_thread_exits': 1, 'test_unaccounted_child_prevents_parent_cleanup_until_actual_child_settles': 1, 'test_unknown_live_payload_is_retained_until_actual_late_cleanup': 1, 'test_unregistered_ticket_cannot_enter_a_physical_callback': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_capacity': {'test_an_old_capacity_lifetime_cannot_claim_same_sql_ids_again_after_cleanup': 1, 'test_boolean_cleanup_result_is_not_actual_trusted_none_success': 1, 'test_capacity_commits_initial_claim_after_private_io_and_app_then_request': 1, 'test_capacity_requires_actual_cleanup_verifier': 1, 'test_cleanup_is_once_exact_current_lifetime_outside_writer_and_releases_only_after_proof': 1, 'test_composed_recovery_refuses_unclean_history_before_requeue': 1, 'test_delayed_claim_rechecks_lifetime_after_app_lock': 1, 'test_initial_claim_cannot_borrow_resume_or_prior_pending_authority': 3, 'test_initial_enqueue_is_real_acknowledged_idempotent_outbox_not_a_checkpoint': 1, 'test_initial_enqueue_rechecks_actual_context_and_sql_inputs_before_outbox': 4, 'test_initial_generation_claim_uses_acknowledged_context_without_fake_checkpoint': 1, 'test_never_acquired_cancel_finishes_and_reconcile_does_not_repeat': 2, 'test_preclaim_cancel_refuses_uncertain_history_without_calling_physical_verifier': 5, 'test_runtime_cancel_ids_do_not_release_composed_capacity_without_verifier': 1, 'test_transaction_local_c03_ports_are_explicit': 4, 'test_transaction_local_finalize_cannot_mutate_another_requests_claim': 1, 'test_transaction_local_outcome_cannot_attach_a_foreign_private_result': 1, 'test_transaction_local_wait_finalization_requires_actual_c03_ack': 1, 'test_unclean_existing_root_holds_capacity_across_sessions_and_terminal_status': 6}, 'tests.unit_tests.libs.test_sensitive_http_telemetry': {'test_actual_enabled_httpx_global_instrumentation_preserves_only_ordinary_spans': 1, 'test_additional_native_logger_bypass_refuses_without_changing_http_default': 6, 'test_additional_protected_routes_drop_scoped_exception_and_restore_ordinary_logs': 1, 'test_additional_route_is_rechecked_at_context_entry': 1, 'test_concurrent_ordinary_thread_keeps_httpx_logs': 1, 'test_concurrent_ordinary_thread_keeps_real_auto_instrumented_span': 1, 'test_context_rechecks_configuration_after_preclaim_readiness': 1, 'test_current_httpx_info_really_persists_full_query': 1, 'test_existing_exception_logging_handler_filters_sensitive_parent_span_events': 1, 'test_guard_blocks_real_httpx_query_and_exception_in_console_and_file': 2, 'test_guard_never_changes_logger_configuration': 1, 'test_known_lower_http_logger_bypass_refuses': 10, 'test_nested_context_restores_after_exception_and_baseexception': 3, 'test_unready_configuration_refuses_before_transport': 3}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_observation_persistence.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_stop_sealing.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_host_execution.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_host_generation_wiring.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_observation_persistence': {'test_actual_layer_projects_before_caches_serializer_and_full_offload': 1, 'test_async_generator_callback_object_is_not_a_synchronous_host_latch': 1, 'test_business_node_failure_is_preserved_without_marking_observation_failed': 1, 'test_concurrent_failures_notify_actual_callback_before_any_refusal_completes': 1, 'test_failed_callback_is_safe_and_cannot_restore_success': 1, 'test_failed_guard_cannot_be_cleared_by_graph_lifecycle_hooks': 1, 'test_guard_requires_actual_policy_and_callback_before_any_projection': 1, 'test_guarded_initial_inputs_never_enter_ordinary_special_value_serializer': 1, 'test_late_trace_owner_cannot_enqueue_after_marked_construction': 1, 'test_marked_native_node_pause_retains_pause_semantics_with_no_raw_process_data': 1, 'test_native_resumption_refuses_before_old_row_load_or_cache_and_run_save': 1, 'test_nonempty_graph_event_keeps_ordinary_output_selection_over_live_runtime': 1, 'test_ordinary_real_persistence_preserves_content_and_exceptions_without_guard': 1, 'test_ordinary_resumption_still_uses_existing_loaded_domain_rows': 1, 'test_policy_subclasses_cannot_replace_the_exact_server_policy': 1, 'test_projection_failure_is_sticky_notifies_host_and_never_saves_raw_fallback': 1, 'test_reentrant_failure_callback_observes_sticky_fact_without_deadlock': 1, 'test_repository_failures_latch_guard_and_surface_only_fixed_safe_error': 3, 'test_retry_history_is_projected_before_real_save_upload_and_keeps_safe_metadata': 1, 'test_run_id_and_initial_system_values_never_render_unknown_objects': 1, 'test_runtime_fallback_is_projected_without_changing_operational_outputs': 5, 'test_trace_owner_is_refused_before_marked_persistence_or_enqueues': 1, 'test_two_actual_observers_have_independent_diagnostic_caches': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_stop_sealing': {'test_lost_stop_commit_ack_is_not_retried_into_acceptance': 1, 'test_sealed_request_cannot_be_finalized_as_completed_or_resumable_wait': 2, 'test_stop_rejects_foreign_or_malformed_control_without_mutation': 5, 'test_stop_rejects_incomplete_or_foreign_tree_before_authority_changes': 4, 'test_stop_rejects_orphan_dispatch_before_any_authority_or_outbox_mutation': 3, 'test_stop_seals_authority_after_commit_without_claiming_physical_cleanup': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_execution': {'test_actual_native_resume_container_scope_is_retained_across_its_yield': 1, 'test_actual_prepared_timeout_snapshot_contributes_to_max_sum_and_fixed_deadline': 1, 'test_ambiguous_fence_never_retries_or_accepts': 2, 'test_command_wrapper_delegates_actual_channel_and_retains_polling_dispatcher': 1, 'test_control_arms_before_stuck_admission_and_refuses_late_physical_entry': 2, 'test_elapsed_ordinary_work_has_no_deadline_and_independent_work_keeps_running': 1, 'test_engine_retains_actual_entry_filter_runtime_channel_and_rejects_rebind': 1, 'test_first_engine_binding_rejects_foreign_filter_and_actual_runtime': 1, 'test_first_real_native_hook_is_owned_before_later_start_hook_blocks': 1, 'test_foreign_boundary_owner_node_cannot_be_adopted_by_launch': 1, 'test_generation_binds_exact_actual_instances_and_refuses_rebinding_or_foreign_run': 1, 'test_late_common_wait_and_completed_replay_reach_real_adapter_and_journal': 1, 'test_late_fence_acknowledgement_never_restores_control_acceptance': 2, 'test_launch_identity_is_not_replaceable_and_retirement_requires_real_cleanup': 1, 'test_launch_requires_exact_context_and_mandatory_durable_stop_port': 1, 'test_launch_retirement_releases_layer_and_real_control_traceback_payloads': 1, 'test_mandatory_stop_owner_and_exact_resolved_context_are_required': 1, 'test_nonfinite_or_nonpositive_http_baseline_is_refused': 6, 'test_owned_start_refusal_and_actual_start_exception_are_retained': 1, 'test_prepared_http_requires_finite_actual_tuple_and_rejects_same_operation_drift': 1, 'test_real_producer_registration_retains_exact_instance_without_fabricating_proposals': 1, 'test_registered_callback_releases_admission_mutex_before_real_io': 1, 'test_result_storage_keeps_ticket_and_capacity_owned_after_callback_returns': 1, 'test_scalar_completion_replays_real_journal_without_extra_claim_or_key': 1, 'test_typed_control_is_accepted_only_after_exact_durable_port_ack': 2, 'test_worker_finally_callback_never_substitutes_for_actual_thread_exit': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_generation_wiring': {'test_actual_runner_passes_same_host_filter_runtime_and_wrapped_combined_channel': 1, 'test_entry_installs_actual_host_layer_first_and_disables_raw_observers': 1, 'test_generation_bound_before_actual_thread_and_stream_never_joins_it': 1, 'test_marked_generate_refuses_foreign_runtime_owner_before_worker': 1, 'test_marked_generate_refuses_missing_host_before_constructing_worker': 1, 'test_marked_injected_raw_observer_is_refused_before_worker': 1, 'test_marked_non_stream_response_refuses_without_ordinary_join': 1, 'test_native_guardrails_bind_actual_release_without_ordinary_early_exit': 2, 'test_native_stream_close_requests_host_without_concurrent_source_close': 1, 'test_ordinary_none_path_still_uses_existing_worker_join': 1, 'test_owned_worker_preserves_bound_entity_and_reports_finally_on_actual_thread': 1, 'test_prestart_host_refusal_never_runs_actual_worker': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_lifetime': {'test_actual_late_frame_runtime_tracking_never_reopens_execution_or_quiet_sample': 1, 'test_actual_native_boundary_keeps_scope_across_generator_yield_and_real_close': 2, 'test_ambiguous_acknowledgement_stays_unknown_after_complete_physical_cleanup': 1, 'test_child_unknown_outcome_does_not_replace_actual_subtree_cleanup_evidence': 1, 'test_cleaned_payloads_collect_while_compact_verifier_is_retained': 1, 'test_consumed_ancestor_blocks_late_tracking_while_child_cleanup_remains_possible': 1, 'test_control_does_not_wait_for_blocked_permission_and_refuses_late_callback': 1, 'test_control_record_requires_actual_active_node_and_exact_execution': 1, 'test_control_registration_stays_unblocked_while_coordinator_joins': 1, 'test_descendant_completion_wakes_waiting_ancestor_promptly': 4, 'test_descendant_late_activity_invalidates_ancestor_sample': 8, 'test_disposed_registry_drops_compact_tombstones_and_stays_permanently_closed': 1, 'test_distinct_call_tickets_and_active_callback_remain_owned_until_real_return': 1, 'test_finally_callback_is_not_exit_and_late_cleanup_preserves_unknown': 1, 'test_first_coordinator_arrival_after_deadline_is_conservatively_unknown': 1, 'test_foreign_generation_and_reacquired_same_identity_cannot_consume_current': 1, 'test_foreign_runtime_node_is_refused_and_self_join_never_blocks': 1, 'test_full_lifetime_identity_cannot_be_replaced_after_activation': 1, 'test_inert_or_missing_ownership_never_establishes_cleanup': 1, 'test_late_node_and_call_tracking_survives_control_without_reopening_physical_entry': 1, 'test_late_owned_activity_invalidates_an_earlier_in_time_quiet_sample': 2, 'test_missing_finally_is_not_equivalent_to_joined_thread': 1, 'test_one_shared_deadline_across_actual_threads_and_slow_precontrol_work': 1, 'test_open_stream_retains_actual_ticket_until_owner_closes': 1, 'test_owned_dispatcher_observation_and_ordinary_work_are_independent': 1, 'test_real_native_scope_retains_node_runtime_execution_thread_through_closure': 2, 'test_registration_refusal_prevents_start_and_unstarted_false_is_not_proof': 1, 'test_registry_scope_and_disposal_never_evict_incomplete_ownership': 1, 'test_repeated_clean_acquisitions_do_not_retain_full_history_and_keep_monotonicity': 1, 'test_retired_child_proof_requires_that_exact_child_to_remain_current': 2, 'test_start_failure_is_explicit_and_cleanup_is_exactly_once': 1, 'test_stream_close_failure_is_ambiguous_even_when_thread_exits': 1, 'test_unaccounted_child_prevents_parent_cleanup_until_actual_child_settles': 1, 'test_unknown_live_payload_is_retained_until_actual_late_cleanup': 1, 'test_unregistered_ticket_cannot_enter_a_physical_callback': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_http_binding': {'test_actual_node_mutation_refuses_before_input_ack': 1, 'test_actual_node_typed_input_ack_precedes_journal_and_install': 1, 'test_actual_wait_exports_one_call_proposal_from_scope_expiry': 1, 'test_concrete_prebound_entry_has_zero_protected_io': 1, 'test_concrete_producer_and_deferred_entry_exist_without_factory_activation': 1, 'test_current_classification_does_not_echo_stored_flags': 1, 'test_current_registry_replacement_cannot_keep_pinned_http_qualification': 1, 'test_deferred_actual_response_cap_refuses_without_truncated_success': 1, 'test_deferred_zero_redirect_cap_never_sends_second_destination': 1, 'test_disclosure_only_validated_origin_typed_lengths_and_opaque_notice': 1, 'test_host_seams_factory_exception_has_no_fallback': 1, 'test_host_seams_invalid_factory_owner_has_no_fallback': 3, 'test_host_seams_observer_exception_refuses_before_scalar_authority': 1, 'test_host_seams_observer_refusal_blocks_actual_preparation_before_authority': 1, 'test_host_seams_prepared_observer_requires_actual_none': 5, 'test_host_seams_preserve_typed_controls': 4, 'test_host_seams_use_exact_factory_owners_and_actual_prepared_binding': 1, 'test_identical_graph_revision_in_another_workflow_is_a_different_qualification': 1, 'test_identical_request_native_occurrences_have_independent_http_confirmation_scopes': 1, 'test_ignored_none_body_file_selector_is_still_outside_qualified_resource': 1, 'test_known_destructive_binding_retains_existing_hard_denial': 1, 'test_literal_empty_text_and_scalar_json_keep_actual_native_semantics': 4, 'test_offline_native_attestation_keeps_json_types_and_refuses_tamper': 1, 'test_profile_has_explicit_shared_accounting_and_caps': 1, 'test_qualified_http_manifest_selects_operation_consent_and_rejects_legacy_projection': 1, 'test_real_deferred_native_scalar_http_complete_then_same_key_replay': 1, 'test_real_deferred_native_wait_keeps_private_journal_and_zero_dispatch': 1, 'test_resource_projection_is_real_versioned_metadata_without_literals': 1, 'test_strict_file_collaborator_never_synthesizes_empty_file_outputs': 1, 'test_unqualified_variants_refuse_before_native_preparation': 7}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_execution': {'test_admitted_native_gateway_retains_rate_release_until_host_cleanup': 4, 'test_generator_refuses_missing_native_scope_before_file_or_config_work': 1, 'test_in_process_worker_refusal_terminates_native_queue_without_ordinary_setup': 2, 'test_native_owner_calls_existing_generator_with_reserved_id_and_server_actor': 1, 'test_native_owner_rejects_foreign_host_before_sql_or_generator': 1, 'test_native_owner_requires_explicit_actual_host': 2, 'test_ordinary_resume_cannot_rebuild_trace_for_native_marked_entity': 1, 'test_owner_cannot_replace_reserved_run_identity': 1, 'test_resume_checks_generation_before_native_owner': 1, 'test_resume_reloads_state_each_time': 1, 'test_run_uses_reloaded_typed_snapshot_and_exact_native_run_id': 1, 'test_worker_rejects_marker_before_payload_logger_or_ordinary_runner': 1}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_claimed_resume_checkpoint.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_host_lifetime': {'test_actual_late_frame_runtime_tracking_never_reopens_execution_or_quiet_sample': 1, 'test_actual_native_boundary_keeps_scope_across_generator_yield_and_real_close': 2, 'test_ambiguous_acknowledgement_stays_unknown_after_complete_physical_cleanup': 1, 'test_child_unknown_outcome_does_not_replace_actual_subtree_cleanup_evidence': 1, 'test_cleaned_payloads_collect_while_compact_verifier_is_retained': 1, 'test_consumed_ancestor_blocks_late_tracking_while_child_cleanup_remains_possible': 1, 'test_control_does_not_wait_for_blocked_permission_and_refuses_late_callback': 1, 'test_control_record_requires_actual_active_node_and_exact_execution': 1, 'test_control_registration_stays_unblocked_while_coordinator_joins': 1, 'test_descendant_completion_wakes_waiting_ancestor_promptly': 4, 'test_descendant_late_activity_invalidates_ancestor_sample': 8, 'test_disposed_registry_drops_compact_tombstones_and_stays_permanently_closed': 1, 'test_distinct_call_tickets_and_active_callback_remain_owned_until_real_return': 1, 'test_finally_callback_is_not_exit_and_late_cleanup_preserves_unknown': 1, 'test_first_coordinator_arrival_after_deadline_is_conservatively_unknown': 1, 'test_foreign_generation_and_reacquired_same_identity_cannot_consume_current': 1, 'test_foreign_runtime_node_is_refused_and_self_join_never_blocks': 1, 'test_full_lifetime_identity_cannot_be_replaced_after_activation': 1, 'test_inert_or_missing_ownership_never_establishes_cleanup': 1, 'test_late_node_and_call_tracking_survives_control_without_reopening_physical_entry': 1, 'test_late_owned_activity_invalidates_an_earlier_in_time_quiet_sample': 2, 'test_missing_finally_is_not_equivalent_to_joined_thread': 1, 'test_one_shared_deadline_across_actual_threads_and_slow_precontrol_work': 1, 'test_open_stream_retains_actual_ticket_until_owner_closes': 1, 'test_owned_dispatcher_observation_and_ordinary_work_are_independent': 1, 'test_prestart_confirmation_obeys_consumed_ancestor_guard': 1, 'test_prestart_confirmation_refuses_every_owned_activity_history': 11, 'test_prestart_confirmation_requires_activated_current_closed_acquisition': 1, 'test_prestart_current_orphan_child_prevents_zero_proof_or_late_cleanup': 2, 'test_prestart_expired_or_unknown_outcome_never_reopens_after_clean_consumption': 1, 'test_prestart_in_progress_registered_start_refuses_zero_proof_and_keeps_late_thread_owned': 1, 'test_prestart_late_diagnostic_history_permanently_invalidates_zero_proof': 3, 'test_prestart_orphan_activation_and_cleanup_linearize_on_actual_registry': 2, 'test_prestart_successful_proof_wins_actual_registration_start_race_without_io': 1, 'test_prestart_zero_activity_confirmation_enables_only_exact_once_cleanup': 1, 'test_real_native_scope_retains_node_runtime_execution_thread_through_closure': 2, 'test_registration_refusal_prevents_start_and_unstarted_false_is_not_proof': 1, 'test_registry_scope_and_disposal_never_evict_incomplete_ownership': 1, 'test_repeated_clean_acquisitions_do_not_retain_full_history_and_keep_monotonicity': 1, 'test_retired_child_proof_requires_that_exact_child_to_remain_current': 2, 'test_start_failure_is_explicit_and_cleanup_is_exactly_once': 1, 'test_stream_close_failure_is_ambiguous_even_when_thread_exits': 1, 'test_unaccounted_child_prevents_parent_cleanup_until_actual_child_settles': 1, 'test_unknown_live_payload_is_retained_until_actual_late_cleanup': 1, 'test_unregistered_ticket_cannot_enter_a_physical_callback': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_execution': {'test_actual_native_resume_container_scope_is_retained_across_its_yield': 1, 'test_actual_prepared_timeout_snapshot_contributes_to_max_sum_and_fixed_deadline': 1, 'test_ambiguous_fence_never_retries_or_accepts': 2, 'test_command_wrapper_delegates_actual_channel_and_retains_polling_dispatcher': 1, 'test_control_arms_before_stuck_admission_and_refuses_late_physical_entry': 2, 'test_elapsed_ordinary_work_has_no_deadline_and_independent_work_keeps_running': 1, 'test_engine_retains_actual_entry_filter_runtime_channel_and_rejects_rebind': 1, 'test_first_engine_binding_rejects_foreign_filter_and_actual_runtime': 1, 'test_first_real_native_hook_is_owned_before_later_start_hook_blocks': 1, 'test_foreign_boundary_owner_node_cannot_be_adopted_by_launch': 1, 'test_generation_binds_exact_actual_instances_and_refuses_rebinding_or_foreign_run': 1, 'test_late_common_wait_and_completed_replay_reach_real_adapter_and_journal': 1, 'test_late_fence_acknowledgement_never_restores_control_acceptance': 2, 'test_launch_identity_is_not_replaceable_and_retirement_requires_real_cleanup': 1, 'test_launch_requires_exact_context_and_mandatory_durable_stop_port': 1, 'test_launch_retirement_releases_layer_and_real_control_traceback_payloads': 1, 'test_mandatory_stop_owner_and_exact_resolved_context_are_required': 1, 'test_nonfinite_or_nonpositive_http_baseline_is_refused': 6, 'test_owned_start_refusal_and_actual_start_exception_are_retained': 1, 'test_prepared_http_requires_finite_actual_tuple_and_rejects_same_operation_drift': 1, 'test_prestart_launch_delegate_cannot_certify_bound_actual_native_runtime': 1, 'test_prestart_launch_releases_actual_bound_resource_once_only_after_exact_cleanup': 1, 'test_real_producer_registration_retains_exact_instance_without_fabricating_proposals': 1, 'test_registered_callback_releases_admission_mutex_before_real_io': 1, 'test_result_storage_keeps_ticket_and_capacity_owned_after_callback_returns': 1, 'test_scalar_completion_replays_real_journal_without_extra_claim_or_key': 1, 'test_typed_control_is_accepted_only_after_exact_durable_port_ack': 2, 'test_worker_finally_callback_never_substitutes_for_actual_thread_exit': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_claimed_resume_checkpoint': {'test_actual_permission_port_refusal_precedes_checkpoint_selection': 1, 'test_corrupt_checkpoint_metadata_never_mints_reference': 9, 'test_current_execution_drift_refuses_without_mutation': 10, 'test_foreign_metadata_cannot_supply_claimed_checkpoint': 12, 'test_local_generation_can_lag_shared_scope_and_skip_checkpoint_generation': 1, 'test_missing_acknowledged_owner_metadata_refuses': 4, 'test_only_current_claimed_dispatch_can_supply_checkpoint': 5, 'test_private_authority_snapshot_must_match_current_local_owner': 5, 'test_refuses_initial_or_untyped_generation': 4, 'test_returns_actual_claimed_checkpoint_metadata_without_io_or_mutation': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_operation_journal': {'test_c02_generation_change_never_exposes_decision_or_completion': 2, 'test_claimed_restore_authenticates_older_checkpoint_then_rechecks_c02': 2, 'test_claimed_restore_keeps_ordered_private_validation_atomic': 3, 'test_claimed_restore_rechecks_actual_claim_and_context_after_private_reads': 6, 'test_claimed_restore_requires_actual_lifecycle_and_same_state': 3, 'test_claimed_restore_revalidates_runtime_arguments_and_actual_context': 12, 'test_completed_replay_rechecks_c02_and_reads_private_result_after_restart': 1, 'test_input_typed_digest_and_owner_ref_are_checked_before_authorization': 1, 'test_iteration_and_child_identity_survive_delivery_restart': 1, 'test_null_and_closed_stream_material_replay_without_type_coercion': 1, 'test_only_contiguous_completed_prefix_can_advance_and_finish_checks_old_suffix': 1, 'test_owner_revocation_and_result_read_failure_never_publish_result': 1, 'test_resolve_cursor_rejects_missing_or_untrusted_delivery_without_authorizing': 6, 'test_resolve_cursor_returns_only_existing_bound_current_issued_key_without_authorizing': 1, 'test_resolve_cursor_returns_replacement_identity_for_same_occurrence_only_after_input_and_key_prepare': 1, 'test_restore_generation_change_during_private_reads_is_atomic': 1, 'test_restore_rejects_malformed_or_stale_checkpoint_without_authorization': 8, 'test_result_ref_conflict_and_generation_drift_never_expose_cached_replay': 1, 'test_same_generation_c02_permit_is_returned_without_replay_or_completion': 1, 'test_same_slot_unknown_recheck_invalidates_delivery_completed_prefix': 1, 'test_snapshot_isolated_from_caller_mutation_and_parallel_frames': 1, 'test_two_pause_generations_preserve_ordered_journals': 1, 'test_typed_intent_sequence_conflict_refuses_before_authorization': 3, 'test_unbound_cursor_can_reopen_same_identity_without_creating_input_material': 1, 'test_unknown_pending_or_incomplete_stream_is_never_a_replayable_result': 3, 'test_unknown_recheck_of_saved_result_cannot_advance_or_finish': 1}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_stream_runtime.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_observation_owner.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_host_lifetime': {'test_actual_late_frame_runtime_tracking_never_reopens_execution_or_quiet_sample': 1, 'test_actual_native_boundary_keeps_scope_across_generator_yield_and_real_close': 2, 'test_ambiguous_acknowledgement_stays_unknown_after_complete_physical_cleanup': 1, 'test_child_unknown_outcome_does_not_replace_actual_subtree_cleanup_evidence': 1, 'test_cleaned_payloads_collect_while_compact_verifier_is_retained': 1, 'test_closing_reader_requires_started_worker_and_exact_existing_host_stream': 1, 'test_consumed_ancestor_blocks_late_tracking_while_child_cleanup_remains_possible': 1, 'test_control_does_not_wait_for_blocked_permission_and_refuses_late_callback': 1, 'test_control_record_requires_actual_active_node_and_exact_execution': 1, 'test_control_registration_stays_unblocked_while_coordinator_joins': 1, 'test_descendant_completion_wakes_waiting_ancestor_promptly': 4, 'test_descendant_late_activity_invalidates_ancestor_sample': 8, 'test_disposed_registry_drops_compact_tombstones_and_stays_permanently_closed': 1, 'test_distinct_call_tickets_and_active_callback_remain_owned_until_real_return': 1, 'test_expired_close_reader_can_clean_but_cannot_make_snapshot_ready': 1, 'test_finally_callback_is_not_exit_and_late_cleanup_preserves_unknown': 1, 'test_first_close_wait_has_no_precontrol_deadline_and_unknown_wakes_it': 1, 'test_first_coordinator_arrival_after_deadline_is_conservatively_unknown': 1, 'test_foreign_generation_and_reacquired_same_identity_cannot_consume_current': 1, 'test_foreign_runtime_node_is_refused_and_self_join_never_blocks': 1, 'test_full_lifetime_identity_cannot_be_replaced_after_activation': 1, 'test_inert_or_missing_ownership_never_establishes_cleanup': 1, 'test_late_node_and_call_tracking_survives_control_without_reopening_physical_entry': 1, 'test_late_owned_activity_invalidates_an_earlier_in_time_quiet_sample': 2, 'test_missing_finally_is_not_equivalent_to_joined_thread': 1, 'test_one_shared_deadline_across_actual_threads_and_slow_precontrol_work': 1, 'test_only_single_owned_reader_may_start_after_close_for_existing_drain': 1, 'test_open_stream_retains_actual_ticket_until_owner_closes': 1, 'test_owned_dispatcher_observation_and_ordinary_work_are_independent': 1, 'test_owned_source_reader_start_failure_cannot_certify_source_cleanup': 1, 'test_prestart_confirmation_obeys_consumed_ancestor_guard': 1, 'test_prestart_confirmation_refuses_every_owned_activity_history': 11, 'test_prestart_confirmation_requires_activated_current_closed_acquisition': 1, 'test_prestart_current_orphan_child_prevents_zero_proof_or_late_cleanup': 2, 'test_prestart_expired_or_unknown_outcome_never_reopens_after_clean_consumption': 1, 'test_prestart_in_progress_registered_start_refuses_zero_proof_and_keeps_late_thread_owned': 1, 'test_prestart_late_diagnostic_history_permanently_invalidates_zero_proof': 3, 'test_prestart_orphan_activation_and_cleanup_linearize_on_actual_registry': 2, 'test_prestart_successful_proof_wins_actual_registration_start_race_without_io': 1, 'test_prestart_zero_activity_confirmation_enables_only_exact_once_cleanup': 1, 'test_real_native_scope_retains_node_runtime_execution_thread_through_closure': 2, 'test_registration_refusal_prevents_start_and_unstarted_false_is_not_proof': 1, 'test_registry_scope_and_disposal_never_evict_incomplete_ownership': 1, 'test_repeated_clean_acquisitions_do_not_retain_full_history_and_keep_monotonicity': 1, 'test_retired_child_proof_requires_that_exact_child_to_remain_current': 2, 'test_start_failure_is_explicit_and_cleanup_is_exactly_once': 1, 'test_stream_close_failure_is_ambiguous_even_when_thread_exits': 1, 'test_unaccounted_child_prevents_parent_cleanup_until_actual_child_settles': 1, 'test_unknown_live_payload_is_retained_until_actual_late_cleanup': 1, 'test_unregistered_ticket_cannot_enter_a_physical_callback': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_execution': {'test_actual_native_resume_container_scope_is_retained_across_its_yield': 1, 'test_actual_prepared_timeout_snapshot_contributes_to_max_sum_and_fixed_deadline': 1, 'test_ambiguous_fence_never_retries_or_accepts': 2, 'test_command_wrapper_delegates_actual_channel_and_retains_polling_dispatcher': 1, 'test_control_arms_before_stuck_admission_and_refuses_late_physical_entry': 2, 'test_cross_thread_end_never_closes_active_physical_phase_or_scalar_hook': 2, 'test_elapsed_ordinary_work_has_no_deadline_and_independent_work_keeps_running': 1, 'test_engine_retains_actual_entry_filter_runtime_channel_and_rejects_rebind': 1, 'test_first_engine_binding_rejects_foreign_filter_and_actual_runtime': 1, 'test_first_real_native_hook_is_owned_before_later_start_hook_blocks': 1, 'test_foreign_boundary_owner_node_cannot_be_adopted_by_launch': 1, 'test_generation_binds_exact_actual_instances_and_refuses_rebinding_or_foreign_run': 1, 'test_late_common_wait_and_completed_replay_reach_real_adapter_and_journal': 1, 'test_late_fence_acknowledgement_never_restores_control_acceptance': 2, 'test_launch_identity_is_not_replaceable_and_retirement_requires_real_cleanup': 1, 'test_launch_requires_exact_context_and_mandatory_durable_stop_port': 1, 'test_launch_retirement_releases_layer_and_real_control_traceback_payloads': 1, 'test_mandatory_stop_owner_and_exact_resolved_context_are_required': 1, 'test_nested_pool_lifecycle_events_do_not_attest_root_terminal': 1, 'test_nonfinite_or_nonpositive_http_baseline_is_refused': 6, 'test_owned_start_refusal_and_actual_start_exception_are_retained': 1, 'test_prepared_http_requires_finite_actual_tuple_and_rejects_same_operation_drift': 1, 'test_prestart_launch_delegate_cannot_certify_bound_actual_native_runtime': 1, 'test_prestart_launch_releases_actual_bound_resource_once_only_after_exact_cleanup': 1, 'test_real_producer_registration_retains_exact_instance_without_fabricating_proposals': 1, 'test_registered_callback_releases_admission_mutex_before_real_io': 1, 'test_result_storage_keeps_ticket_and_capacity_owned_after_callback_returns': 1, 'test_root_observation_retains_actual_business_terminal_without_payload': 1, 'test_scalar_completion_replays_real_journal_without_extra_claim_or_key': 1, 'test_snapshot_requires_settlement_and_exact_composed_owners': 1, 'test_typed_control_is_accepted_only_after_exact_durable_port_ack': 2, 'test_worker_finally_callback_never_substitutes_for_actual_thread_exit': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_execution': {'test_admitted_native_gateway_retains_rate_release_until_host_cleanup': 4, 'test_generator_refuses_missing_native_scope_before_file_or_config_work': 1, 'test_in_process_worker_refusal_terminates_native_queue_without_ordinary_setup': 2, 'test_native_owner_calls_existing_generator_with_reserved_id_and_server_actor': 1, 'test_native_owner_rejects_foreign_host_before_sql_or_generator': 1, 'test_native_owner_requires_explicit_actual_host': 2, 'test_native_stream_failed_close_never_acknowledges_or_retries': 2, 'test_native_stream_successful_close_is_acknowledged_once': 1, 'test_ordinary_resume_cannot_rebuild_trace_for_native_marked_entity': 1, 'test_owner_cannot_replace_reserved_run_identity': 1, 'test_resume_checks_generation_before_native_owner': 1, 'test_resume_reloads_state_each_time': 1, 'test_run_uses_reloaded_typed_snapshot_and_exact_native_run_id': 1, 'test_worker_rejects_marker_before_payload_logger_or_ordinary_runner': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_generation_wiring': {'test_actual_runner_passes_same_host_filter_runtime_and_wrapped_combined_channel': 1, 'test_entry_installs_actual_host_layer_first_and_disables_raw_observers': 1, 'test_generation_bound_before_actual_thread_and_stream_never_joins_it': 1, 'test_marked_generate_refuses_foreign_runtime_owner_before_worker': 1, 'test_marked_generate_refuses_missing_host_before_constructing_worker': 1, 'test_marked_injected_raw_observer_is_refused_before_worker': 1, 'test_marked_non_stream_response_refuses_without_ordinary_join': 1, 'test_native_guardrails_bind_actual_release_without_ordinary_early_exit': 2, 'test_native_stream_close_requests_host_without_concurrent_source_close': 1, 'test_ordinary_none_path_still_uses_existing_worker_join': 1, 'test_owned_reader_finalizer_keeps_failed_close_unacknowledged_without_retry': 2, 'test_owned_reader_successful_finalization_is_idempotent': 1, 'test_owned_worker_preserves_bound_entity_and_reports_finally_on_actual_thread': 1, 'test_prestart_host_refusal_never_runs_actual_worker': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_stream_runtime': {'test_actual_persistence_status_disagreement_is_unknown_before_checkpoint': 1, 'test_actual_root_business_terminal_survives_raw_sse_without_payload_callback': 2, 'test_automatic_next_close_failure_then_reader_finalizer_never_allows_cleanup': 1, 'test_blocked_admission_fence_does_not_block_coordinator_quarantine': 1, 'test_blocked_reader_returns_unknown_at_first_deadline_and_retains_for_late_cleanup': 1, 'test_close_before_consume_commits_actual_snapshot_then_cleanup_and_public_wait': 1, 'test_existing_workflow_owner_finally_close_after_retirement_is_inert': 1, 'test_external_close_is_not_natural_drain_or_wait': 1, 'test_failed_capacity_ack_after_physical_consumption_does_not_publish_wait': 1, 'test_foreign_stream_and_repeated_consume_refuse_without_new_reader': 1, 'test_persisted_run_status_disagreement_or_missing_run_cannot_complete': 1, 'test_real_native_partial_business_outcome_and_typed_stop_preserve_routes': 1, 'test_real_owner_failure_never_publishes_wait_and_quarantines': 4, 'test_root_pause_with_late_native_error_is_unknown_before_checkpoint': 1, 'test_slow_native_work_before_first_control_has_no_host_run_timeout': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_observation_owner': {'test_actual_stored_profile_builds_existing_guard_without_writes_or_effects': 1, 'test_persisted_server_metadata_must_qualify_without_profile_fallback': 5, 'test_caller_context_cannot_replace_actual_protected_snapshot': 4, 'test_actual_c03_full_current_owner_chain_is_required': 7, 'test_private_read_boundaries_recheck_current_server_metadata_before_return': 4, 'test_safe_refusal_never_formats_unknown_payload_or_underlying_error': 1, 'test_callback_validation_is_owned_by_existing_guard': 1, 'test_initial_current_profile_observation_preserves_private_snapshot': 2, 'test_initial_current_profile_keeps_owner_active_and_descriptor_guards': 12}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_observation_stream.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_native_observation_wiring.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_observation_stream': {'test_direct_native_error_handler_never_passes_raw_error_to_base': 1, 'test_direct_native_text_handler_rejects_tts_before_publish': 1, 'test_domain_projects_and_retains_independent_canonical_markers': 1, 'test_live_output_read_failure_is_latched_without_raw_exception': 1, 'test_marked_converter_requires_guard_before_input_conversion': 1, 'test_marked_converter_wrong_guard_refuses_before_inputs': 2, 'test_marked_pipeline_requires_guard_before_any_initialization': 1, 'test_marker_is_content_validation_not_caller_authority': 3, 'test_native_finish_reads_live_outputs_without_converter_or_file_routes': 1, 'test_native_no_hitl_or_history_resume': 1, 'test_native_pipeline_refuses_different_queue_guard': 1, 'test_native_pipeline_refuses_unqualified_setup_before_base': 2, 'test_pause_live_fallback_is_safe_without_hitl_resolution': 1, 'test_pipeline_listen_projects_raw_internal_error_before_base': 1, 'test_pipeline_projects_internal_events_and_noops_draft_saver': 1, 'test_pipeline_refuses_tts_trace_and_files_before_actions': 1, 'test_queue_projects_before_base_model_dump_and_direct_publish': 1, 'test_queue_unknown_value_refuses_before_base_serializer': 1, 'test_real_container_queue_and_converter_preserve_counts_without_values': 2, 'test_retry_history_remains_safe_and_idempotent_in_queue_and_converter': 1, 'test_supported_real_queue_dtos_are_fresh_and_safe': 9, 'test_unknown_object_fails_without_rendering_and_latches': 1, 'test_unqualified_queue_classes_refuse_without_serializing': 1, 'test_wrong_node_type_and_unqualified_hitl_fail_before_projection': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_observation_wiring': {'test_host_creates_one_actual_persisted_profile_guard_and_rechecks_current_owner': 1, 'test_untrusted_profile_refuses_guard_and_marks_actual_host_unknown': 1, 'test_native_execution_context_restores_nested_reused_thread_context_and_flask': 1, 'test_public_subclass_snapshot_restore_uses_native_context_without_enabling_resume': 1, 'test_native_exception_exit_restores_ordinary_thread_even_when_guard_fails': 1, 'test_initial_preflight_refuses_unqualified_routes_before_worker': 4, 'test_actual_generate_passes_same_guard_to_queue_and_pipeline_before_worker': 1, 'test_actual_supported_root_loop_parallel_iteration_context_and_dispatcher_canaries': 6, 'test_actual_supported_loop_dispatcher_condition_error_is_protected': 1, 'test_actual_initial_entry_rejects_persisted_profile_before_input_effect': 1, 'test_actual_handle_response_builds_same_guard_pipeline_and_converter': 1, 'test_same_guard_rechecks_exact_state_without_holding_host_lock': 1, 'test_actual_dispatcher_command_reason_and_fetch_exception_protected_before_delegation': 1, 'test_actual_native_worker_adapter_restores_reused_thread_after_exception': 1, 'test_host_retains_unknown_live_dispatcher_logging_lease_until_actual_exit': 1, 'test_actual_worker_replaces_raw_error_before_queue_error_model_and_logging': 3, 'test_initial_host_binds_current_profile_without_native_activity': 2}, 'tests.unit_tests.services.dify_builder.native_testing.test_stream_runtime': {'test_actual_persistence_status_disagreement_is_unknown_before_checkpoint': 1, 'test_actual_root_business_terminal_survives_raw_sse_without_payload_callback': 2, 'test_automatic_next_close_failure_then_reader_finalizer_never_allows_cleanup': 1, 'test_blocked_admission_fence_does_not_block_coordinator_quarantine': 1, 'test_blocked_reader_returns_unknown_at_first_deadline_and_retains_for_late_cleanup': 1, 'test_close_before_consume_commits_actual_snapshot_then_cleanup_and_public_wait': 1, 'test_dispatcher_logging_release_failure_precedes_capacity_ack': 1, 'test_existing_workflow_owner_finally_close_after_retirement_is_inert': 1, 'test_external_close_is_not_natural_drain_or_wait': 1, 'test_failed_capacity_ack_after_physical_consumption_does_not_publish_wait': 1, 'test_foreign_stream_and_repeated_consume_refuse_without_new_reader': 1, 'test_persisted_run_status_disagreement_or_missing_run_cannot_complete': 1, 'test_real_native_partial_business_outcome_and_typed_stop_preserve_routes': 1, 'test_real_owner_failure_never_publishes_wait_and_quarantines': 4, 'test_root_pause_with_late_native_error_is_unknown_before_checkpoint': 1, 'test_slow_native_work_before_first_control_has_no_host_run_timeout': 1}, 'tests.unit_tests.libs.test_sensitive_http_telemetry': {'test_actual_enabled_httpx_global_instrumentation_preserves_only_ordinary_spans': 1, 'test_actual_thread_lease_rejects_live_release_and_preserves_other_threads': 1, 'test_additional_native_logger_bypass_refuses_without_changing_http_default': 6, 'test_additional_protected_routes_drop_scoped_exception_and_restore_ordinary_logs': 1, 'test_additional_route_is_rechecked_at_context_entry': 1, 'test_concurrent_ordinary_thread_keeps_httpx_logs': 1, 'test_concurrent_ordinary_thread_keeps_real_auto_instrumented_span': 1, 'test_context_rechecks_configuration_after_preclaim_readiness': 1, 'test_current_httpx_info_really_persists_full_query': 1, 'test_existing_exception_logging_handler_filters_sensitive_parent_span_events': 1, 'test_guard_blocks_real_httpx_query_and_exception_in_console_and_file': 2, 'test_guard_never_changes_logger_configuration': 1, 'test_known_lower_http_logger_bypass_refuses': 10, 'test_multiple_owned_thread_leases_do_not_remove_each_other_or_protect_new_identity': 1, 'test_nested_context_restores_after_exception_and_baseexception': 3, 'test_thread_lease_drops_before_render_and_retains_unknown_background': 1, 'test_thread_lease_refuses_unready_sinks_before_registration': 2, 'test_unready_configuration_refuses_before_transport': 3}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_observation_repository.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_observation_repository': {'test_actual_repositories_project_before_serializers_and_do_not_mutate_domain': 1, 'test_all_rows_validated_before_cache_and_no_partial_exposure': 1, 'test_bad_offload_or_late_content_never_enters_cache': 7, 'test_binding_idempotence_and_nested_original_context_drift': 1, 'test_binding_refuses_after_cache_or_io_even_when_cache_empty': 1, 'test_binding_rejects_real_repository_owner_mismatch': 4, 'test_bound_run_history_refuses_raw_graph_values_and_owner': 1, 'test_bounded_offload_stream_closes_before_failure_notification': 1, 'test_context_drift_during_offload_refuses_before_cache': 1, 'test_empty_success_error_remains_empty': 1, 'test_foreign_storage_type_refuses_before_load': 1, 'test_history_owner_objects_cannot_spoof_equality_or_get_rendered': 1, 'test_native_actual_truncation_uploads_only_safe_data_then_cache_has_no_second_io': 1, 'test_native_save_execution_data_does_not_mutate_operational_domain': 1, 'test_node_history_checks_actual_run_owner_even_when_node_fields_match': 1, 'test_public_native_run_read_returns_owned_detached_general_status': 1, 'test_public_native_run_read_wrong_id_refuses_before_sql': 1, 'test_raw_existing_process_data_cannot_resurrect_agent_binding': 1, 'test_real_offload_relation_decode_precedes_cache_and_only_loads_once': 1, 'test_retained_history_rejects_foreign_or_raw_rows_before_cache': 9, 'test_safe_nonempty_history_roundtrip_uses_fresh_copies': 1, 'test_safe_retry_history_is_retained_and_foreign_metadata_refuses': 1, 'test_sql_failure_latches_only_fixed_error': 1, 'test_writer_recheck_failure_notifies_guard_only_after_writer_exit': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_execution': {'test_admitted_native_gateway_retains_rate_release_until_host_cleanup': 4, 'test_early_worker_revocation_redis_cleanup_cannot_log_private_payload': 1, 'test_generator_refuses_missing_native_scope_before_file_or_config_work': 1, 'test_in_process_worker_refusal_terminates_native_queue_without_ordinary_setup': 2, 'test_native_owner_calls_existing_generator_with_reserved_id_and_server_actor': 1, 'test_native_owner_rejects_foreign_host_before_sql_or_generator': 1, 'test_native_owner_requires_explicit_actual_host': 2, 'test_native_stream_failed_close_never_acknowledges_or_retries': 2, 'test_native_stream_successful_close_is_acknowledged_once': 1, 'test_ordinary_resume_cannot_rebuild_trace_for_native_marked_entity': 1, 'test_owner_cannot_replace_reserved_run_identity': 1, 'test_resume_checks_generation_before_native_owner': 1, 'test_resume_reloads_state_each_time': 1, 'test_run_uses_reloaded_typed_snapshot_and_exact_native_run_id': 1, 'test_worker_rejects_marker_before_payload_logger_or_ordinary_runner': 1}})
files += ['api/tests/unit_tests/extensions/test_ext_logging.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_observation_repository': {'test_actual_repositories_project_before_serializers_and_do_not_mutate_domain': 1,
'test_all_rows_validated_before_cache_and_no_partial_exposure': 1,
'test_bad_offload_or_late_content_never_enters_cache': 7,
'test_binding_idempotence_and_nested_original_context_drift': 1,
'test_binding_refuses_after_cache_or_io_even_when_cache_empty': 1,
'test_binding_rejects_real_repository_owner_mismatch': 4,
'test_bound_run_history_refuses_raw_graph_values_and_owner': 1,
'test_bounded_offload_stream_closes_before_failure_notification': 1,
'test_context_drift_during_offload_refuses_before_cache': 1,
'test_current_dify_node_execution_preserves_native_diagnostics': 1,
'test_empty_success_error_remains_empty': 1,
'test_first_native_node_accepts_initial_run_after_output_insert_default': 2,
'test_foreign_storage_type_refuses_before_load': 1,
'test_history_owner_objects_cannot_spoof_equality_or_get_rendered': 1,
'test_mutated_timed_native_run_refuses_invalid_duration_before_writes': 4,
'test_native_actual_truncation_uploads_only_safe_data_then_cache_has_no_second_io': 1,
'test_native_graphon_segments_expose_only_bounded_shapes': 11,
'test_native_history_adoption_restores_active_duration_after_entity_json_roundtrip': 1,
'test_native_history_refuses_unmarked_empty_run_outputs': 1,
'test_native_node_absent_metadata_roundtrips_without_mutating_domain': 2,
'test_native_node_non_none_malformed_metadata_refuses_before_write': 3,
'test_native_node_refuses_workflow_tool_source_identity': 4,
'test_native_save_execution_data_does_not_mutate_operational_domain': 1,
'test_native_segment_projection_refuses_untrusted_objects_without_rendering': 2,
'test_node_history_checks_actual_run_owner_even_when_node_fields_match': 1,
'test_public_native_run_read_returns_owned_detached_general_status': 1,
'test_public_native_run_read_wrong_id_refuses_before_sql': 1,
'test_raw_existing_process_data_cannot_resurrect_agent_binding': 1,
'test_real_offload_relation_decode_precedes_cache_and_only_loads_once': 1,
'test_repository_cannot_replace_retained_observer_even_with_same_guard': 2,
'test_retained_history_rejects_foreign_or_raw_rows_before_cache': 9,
'test_safe_nonempty_history_roundtrip_uses_fresh_copies': 1,
'test_safe_retry_history_is_retained_and_foreign_metadata_refuses': 1,
'test_service_binding_requires_exact_guard_before_attaching_observer': 2,
'test_sql_failure_latches_only_fixed_error': 1,
'test_test_owned_telemetry_initializes_and_restores_actual_logging_routes': 3,
'test_timed_native_run_preserves_settled_duration_through_projection_and_owned_history': 3,
'test_unrecognized_timed_run_subclass_still_refuses_before_writes': 1,
'test_writer_recheck_failure_notifies_guard_only_after_writer_exit': 1}, 'tests.unit_tests.extensions.test_ext_logging': {'test_custom_unprotected_sql_sink_still_refuses_after_normal_init': 1, 'test_normal_app_logging_protects_sql_errors_and_preserves_warning_threshold': 1}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_agent_associations.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_agent_associations': {'test_pure_association_preserves_distinct_runs_and_no_effect_cursor': 1, 'test_parent_locator_rejects_untyped_or_noncanonical_identity': 4, 'test_wait_structure_never_accepts_caller_ack_or_cleanup_authority': 7, 'test_checkpoint_association_requires_one_exact_saved_parent_journal': 5, 'test_workspace_ref_remains_same_public_reexport': 1, 'test_agent_contract_imports_are_pure_without_database_flask_or_backend_sdk': 1, 'test_contract_purity_guard_detects_runtime_dependencies': 9, 'test_actual_agent_access_and_publication_guards_precede_private_write': 5, 'test_actual_state_nonempty_bind_wait_final_are_immutable_owned_objects': 1, 'test_stored_parent_input_owner_rejects_before_agent_write': 4, 'test_commit_checkpoint_rejects_unselected_agent_private_material': 4, 'test_read_checkpoint_revalidates_current_agent_private_relations': 6, 'test_second_distinct_occurrence_cannot_silently_reuse_single_workspace': 1, 'test_backend_generation_seven_cp_local_zero_remains_readable_at_local_two_scope_three': 1, 'test_same_logical_key_rejects_changed_agent_material': 4, 'test_lost_post_commit_ack_reuses_existing_selected_checkpoint_without_storage_write': 1, 'test_sql_recheck_after_private_io_refuses_drift_before_ack': 3, 'test_read_checkpoint_rechecks_selected_outer_metadata_after_private_io': 2, 'test_actual_operation_cursor_finish_is_untouched_by_agent_associations': 1, 'test_actual_sql_workspace_backend_reference_cannot_drift': 1, 'test_empty_agent_checkpoint_keeps_legacy_private_payload_and_repeat_identity': 1, 'test_current_local_generation_controls_config_write_without_shared_counter_alias': 1, 'test_missing_actual_workspace_owner_refuses_without_agent_private_write': 1, 'test_agent_run_cannot_alias_workflow_native_run_or_inject_proof_fields': 1, 'test_actual_allocation_owner_parser_rejects_malformed_scope_and_unknown_proof': 2}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_native_runtime.py', 'api/tests/unit_tests/services/workflow_runtime/test_response_converter.py', 'api/tests/unit_tests/services/workflow_runtime/test_response_converter.py', 'api/tests/unit_tests/services/workflow_runtime/test_workflow_pipeline.py', 'api/tests/unit_tests/clients/agent_backend']
new_expected.update({'tests.unit_tests.clients.agent_backend.test_client': {'test_dify_agent_backend_run_client_delegates_sync_methods': 1, 'test_dify_agent_backend_run_client_maps_validation_error': 1, 'test_dify_agent_backend_run_client_maps_http_error': 1, 'test_dify_agent_backend_run_client_maps_timeout_error': 1, 'test_dify_agent_backend_run_client_maps_stream_error': 1}, 'tests.unit_tests.clients.agent_backend.test_event_adapter': {'test_event_adapter_maps_run_started': 1, 'test_event_adapter_maps_pydantic_ai_stream_event': 1, 'test_event_adapter_maps_pydantic_ai_stream_event_agent_message_delta_annotation': 1, 'test_event_adapter_maps_run_succeeded_to_final_output': 1, 'test_event_adapter_maps_run_failed_to_failed_result': 1, 'test_event_adapter_maps_run_cancelled_to_terminal_cancelled': 1}, 'tests.unit_tests.clients.agent_backend.test_factory': {'test_create_agent_backend_client_forwards_authentication': 4, 'test_create_agent_backend_run_client_forwards_stream_read_timeout': 1, 'test_default_agent_backend_clients_forward_authentication': 3}, 'tests.unit_tests.clients.agent_backend.test_fake_client': {'test_fake_client_stream_is_deterministic': 1, 'test_fake_client_stream_honors_cursor': 1, 'test_fake_client_failed_scenario_returns_failed_status_and_event': 1, 'test_fake_client_cancel_run_returns_cancelled_status': 1, 'test_fake_client_success_wait_run_returns_succeeded_status': 1}, 'tests.unit_tests.clients.agent_backend.test_native_checkpoint_readback': {'test_native_wrapper_normalizes_real_http_client_errors': 2, 'test_private_wrapper_redacts_validation_details_from_adapter_errors': 1}, 'tests.unit_tests.clients.agent_backend.test_request_builder': {'test_agent_app_request_builder_adds_knowledge_layer_when_configured': 1,
'test_agent_app_request_builder_adds_shell_layer_when_include_shell': 1,
'test_agent_app_request_builder_emits_multimodal_user_prompt_layer': 1,
'test_agent_app_request_builder_keeps_agent_soul_prompt_for_snapshot_and_draft': 2,
'test_agent_app_request_builder_keeps_build_draft_prompt_when_agent_soul_prompt_is_blank': 1,
'test_agent_app_request_builder_omits_shell_layer_by_default': 1,
'test_agent_app_request_builder_uses_longer_fence_for_build_draft_prompt_body': 1,
'test_agent_app_request_builder_wraps_agent_soul_prompt_for_build_draft': 1,
'test_agent_backend_log_redacts_multimodal_file_transport': 1,
'test_agent_backend_request_does_not_contain_llm_credentials': 1,
'test_context_wire_contract_omits_tracing_for_legacy_runtime': 4,
'test_knowledge_fs_requires_shell_and_can_coexist_with_classic_knowledge': 2,
'test_request_builder_adds_dify_core_tools_layer_when_configured': 1,
'test_request_builder_adds_dify_plugin_tools_layer_when_configured': 1,
'test_request_builder_adds_knowledge_layer_when_configured': 1,
'test_request_builder_forwards_plugin_specific_model_settings_via_extra_body': 1,
'test_request_builder_outputs_dify_agent_create_run_request': 1,
'test_request_builder_rejects_blank_prompts': 1,
'test_request_builder_separates_agent_soul_and_workflow_job_prompt': 1,
'test_request_builder_sets_model_and_output_layer_contract_ids': 1,
'test_response_format_reaches_plugin_parameters_through_real_request_serialization': 12,
'test_workflow_request_builder_adds_shell_layer_when_include_shell': 1,
'test_workflow_request_builder_omits_shell_layer_by_default': 1}, 'tests.unit_tests.services.workflow_runtime.test_response_converter.TestWorkflowResponseConverterCases.TestWorkflowResponseConverterFetchFilesFromVariableValue': {'test_fetch_files_from_variable_value_with_none': 1, 'test_fetch_files_from_variable_value_with_empty_dict': 1, 'test_fetch_files_from_variable_value_with_empty_list': 1, 'test_fetch_files_from_variable_value_with_file_segment': 1, 'test_fetch_files_from_variable_value_with_array_file_segment_single': 1, 'test_fetch_files_from_variable_value_with_array_file_segment_multiple': 1, 'test_fetch_files_from_variable_value_with_array_file_segment_empty': 1, 'test_fetch_files_from_variable_value_with_list_of_file_dicts': 1, 'test_fetch_files_from_variable_value_with_list_of_file_objects': 1, 'test_fetch_files_from_variable_value_with_list_mixed_valid_invalid': 1, 'test_fetch_files_from_variable_value_with_list_nested_structures': 1, 'test_fetch_files_from_variable_value_with_dict_incorrect_identity': 1, 'test_fetch_files_from_variable_value_with_dict_missing_identity': 1, 'test_fetch_files_from_variable_value_with_dict_file_object': 1, 'test_fetch_files_from_variable_value_with_mixed_data_types': 1, 'test_fetch_files_from_variable_value_with_invalid_objects': 1, 'test_fetch_files_from_variable_value_with_string_input': 1, 'test_fetch_files_from_variable_value_with_number_input': 1, 'test_fetch_files_from_variable_value_return_type_is_sequence': 1, 'test_fetch_files_from_variable_value_preserves_file_properties': 1, 'test_fetch_files_from_variable_value_with_complex_nested_scenario': 1}, 'tests.unit_tests.services.workflow_runtime.test_response_converter': {'test_fetch_files_from_variable_value_preserves_file_properties': 1,
'test_fetch_files_from_variable_value_return_type_is_sequence': 1,
'test_fetch_files_from_variable_value_with_array_file_segment_empty': 1,
'test_fetch_files_from_variable_value_with_array_file_segment_multiple': 1,
'test_fetch_files_from_variable_value_with_array_file_segment_single': 1,
'test_fetch_files_from_variable_value_with_complex_nested_scenario': 1,
'test_fetch_files_from_variable_value_with_dict_file_object': 1,
'test_fetch_files_from_variable_value_with_dict_incorrect_identity': 1,
'test_fetch_files_from_variable_value_with_dict_missing_identity': 1,
'test_fetch_files_from_variable_value_with_empty_dict': 1,
'test_fetch_files_from_variable_value_with_empty_list': 1,
'test_fetch_files_from_variable_value_with_file_segment': 1,
'test_fetch_files_from_variable_value_with_invalid_objects': 1,
'test_fetch_files_from_variable_value_with_list_mixed_valid_invalid': 1,
'test_fetch_files_from_variable_value_with_list_nested_structures': 1,
'test_fetch_files_from_variable_value_with_list_of_file_dicts': 1,
'test_fetch_files_from_variable_value_with_list_of_file_objects': 1,
'test_fetch_files_from_variable_value_with_mixed_data_types': 1,
'test_fetch_files_from_variable_value_with_none': 1,
'test_fetch_files_from_variable_value_with_number_input': 1,
'test_fetch_files_from_variable_value_with_string_input': 1,
'test_finish_without_start_raises': 1,
'test_graph_run_paused_event_uses_projected_nodes_for_highlighting': 4,
'test_human_input_form_filled_stream_response_contains_rendered_content': 1,
'test_human_input_form_filled_stream_response_serializes_submitted_data': 1,
'test_human_input_form_timeout_stream_response_contains_timeout_metadata': 1,
'test_iteration_and_loop_nodes_return_none': 1,
'test_node_start_preserves_the_allocated_index_when_events_arrive_out_of_order': 1,
'test_openapi_pause_with_web_app_recipient_sets_token_and_channels': 1,
'test_openapi_pause_without_web_app_recipient_emits_approval_channels': 1,
'test_queue_workflow_paused_event_resolves_variable_select_options': 1,
'test_queue_workflow_paused_event_to_stream_responses': 1,
'test_resumed_node_metadata_and_sequence': 2,
'test_service_api_iteration_events_no_truncation': 1,
'test_service_api_loop_events_no_truncation': 1,
'test_service_api_node_finish_event_no_truncation': 3,
'test_service_api_node_retry_event_no_truncation': 1,
'test_service_api_truncator_no_op_mapping': 1,
'test_truncator_selection_based_on_invoke_from': 5,
'test_web_app_node_finish_event_truncation_works': 1,
'test_web_app_truncator_works_normally': 1,
'test_workflow_node_finish_response_prefers_event_finished_at': 1,
'test_workflow_node_finish_response_uses_truncated_process_data': 1,
'test_workflow_node_finish_response_with_none_process_data': 1,
'test_workflow_node_finish_response_without_truncation': 1,
'test_workflow_node_retry_response_uses_truncated_process_data': 1,
'test_workflow_node_retry_response_without_truncation': 1,
'test_workflow_start_stream_response_carries_initial_reason': 1,
'test_workflow_start_stream_response_carries_resumption_reason': 1,
'test_workflow_tool_detail_hint_in_live_and_saved_traces': 2}, 'tests.unit_tests.services.workflow_runtime.test_workflow_pipeline.TestGenerateTaskPipelineCoreCases.TestWorkflowGenerateTaskPipeline': {'test_to_blocking_response_falls_back_to_human_input_required_when_pause_event_missing': 1, 'test_to_blocking_response_handles_finish': 1, 'test_listen_audio_msg_returns_audio_stream': 1, 'test_handle_ping_event': 1, 'test_handle_error_event': 1, 'test_handle_workflow_started_event_sets_run_id': 1, 'test_handle_node_succeeded_event_saves_output': 1, 'test_handle_workflow_failed_event_yields_error': 1, 'test_handle_text_chunk_event_publishes_tts': 1, 'test_handle_reasoning_chunk_event_emits_on_nonempty': 1, 'test_handle_reasoning_chunk_event_drops_empty_nonfinal': 1, 'test_handle_reasoning_chunk_event_emits_empty_final_marker': 1, 'test_dispatch_event_handles_node_failed': 1, 'test_handle_stop_event_yields_finish': 1, 'test_save_workflow_app_log_created_from': 1, 'test_iteration_loop_and_human_input_handlers': 1, 'test_wrapper_process_stream_response_emits_audio_end': 1, 'test_init_with_end_user_sets_role_and_system_user': 1, 'test_process_returns_stream_and_blocking_variants': 1, 'test_to_blocking_response_handles_error_and_unexpected_end': 1, 'test_to_stream_response_tracks_workflow_run_id': 1, 'test_listen_audio_msg_returns_none_without_publisher': 1, 'test_wrapper_process_stream_response_without_tts': 1, 'test_wrapper_process_stream_response_uses_a_blocking_terminal_read': 1, 'test_wrapper_process_stream_response_does_not_swallow_audio_queue_exceptions': 1, 'test_database_session_rolls_back_on_error': 1, 'test_node_retry_and_started_handlers_cover_none_and_value': 1, 'test_handle_node_exception_event_saves_output': 1, 'test_success_partial_and_pause_handlers': 1, 'test_text_chunk_handler_returns_empty_when_text_missing': 1, 'test_dispatch_event_direct_failed_and_unhandled_paths': 1, 'test_process_stream_response_main_match_paths_and_cleanup': 1, 'test_process_stream_response_break_paths': 1, 'test_save_workflow_app_log_covers_invoke_from_variants': 1, 'test_save_output_for_event_writes_draft_variables': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_capacity': {'test_initial_generation_claim_uses_acknowledged_context_without_fake_checkpoint': 1, 'test_transaction_local_c03_ports_are_explicit': 4, 'test_capacity_requires_actual_cleanup_verifier': 1, 'test_capacity_commits_initial_claim_after_private_io_and_app_then_request': 1, 'test_unclean_existing_root_holds_capacity_across_sessions_and_terminal_status': 6, 'test_cleanup_is_once_exact_current_lifetime_outside_writer_and_releases_only_after_proof': 1, 'test_composed_recovery_refuses_unclean_history_before_requeue': 1, 'test_runtime_cancel_ids_do_not_release_composed_capacity_without_verifier': 1, 'test_transaction_local_finalize_cannot_mutate_another_requests_claim': 1, 'test_initial_enqueue_is_real_acknowledged_idempotent_outbox_not_a_checkpoint': 1, 'test_initial_claim_cannot_borrow_resume_or_prior_pending_authority': 3, 'test_initial_enqueue_rechecks_actual_context_and_sql_inputs_before_outbox': 4, 'test_boolean_cleanup_result_is_not_actual_trusted_none_success': 1, 'test_an_old_capacity_lifetime_cannot_claim_same_sql_ids_again_after_cleanup': 1, 'test_transaction_local_wait_finalization_requires_actual_c03_ack': 1, 'test_transaction_local_outcome_cannot_attach_a_foreign_private_result': 1, 'test_delayed_claim_rechecks_lifetime_after_app_lock': 1, 'test_never_acquired_cancel_finishes_and_reconcile_does_not_repeat': 2, 'test_preclaim_cancel_refuses_uncertain_history_without_calling_physical_verifier': 5}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_execution': {'test_launch_requires_exact_context_and_mandatory_durable_stop_port': 1, 'test_scalar_completion_replays_real_journal_without_extra_claim_or_key': 1, 'test_nonfinite_or_nonpositive_http_baseline_is_refused': 6, 'test_actual_prepared_timeout_snapshot_contributes_to_max_sum_and_fixed_deadline': 1, 'test_typed_control_is_accepted_only_after_exact_durable_port_ack': 2, 'test_ambiguous_fence_never_retries_or_accepts': 2, 'test_registered_callback_releases_admission_mutex_before_real_io': 1, 'test_generation_binds_exact_actual_instances_and_refuses_rebinding_or_foreign_run': 1, 'test_owned_start_refusal_and_actual_start_exception_are_retained': 1, 'test_worker_finally_callback_never_substitutes_for_actual_thread_exit': 1, 'test_command_wrapper_delegates_actual_channel_and_retains_polling_dispatcher': 1, 'test_engine_retains_actual_entry_filter_runtime_channel_and_rejects_rebind': 1, 'test_root_observation_retains_actual_business_terminal_without_payload': 1, 'test_nested_pool_lifecycle_events_do_not_attest_root_terminal': 1, 'test_snapshot_requires_settlement_and_exact_composed_owners': 1, 'test_cross_thread_end_never_closes_active_physical_phase_or_scalar_hook': 2, 'test_first_real_native_hook_is_owned_before_later_start_hook_blocks': 1, 'test_actual_native_resume_container_scope_is_retained_across_its_yield': 1, 'test_launch_identity_is_not_replaceable_and_retirement_requires_real_cleanup': 1, 'test_foreign_boundary_owner_node_cannot_be_adopted_by_launch': 1, 'test_late_fence_acknowledgement_never_restores_control_acceptance': 2, 'test_control_arms_before_stuck_admission_and_refuses_late_physical_entry': 2, 'test_late_common_wait_and_completed_replay_reach_real_adapter_and_journal': 1, 'test_result_storage_keeps_ticket_and_capacity_owned_after_callback_returns': 1, 'test_real_producer_registration_retains_exact_instance_without_fabricating_proposals': 1, 'test_launch_retirement_releases_layer_and_real_control_traceback_payloads': 1, 'test_mandatory_stop_owner_and_exact_resolved_context_are_required': 1, 'test_first_engine_binding_rejects_foreign_filter_and_actual_runtime': 1, 'test_prepared_http_requires_finite_actual_tuple_and_rejects_same_operation_drift': 1, 'test_elapsed_ordinary_work_has_no_deadline_and_independent_work_keeps_running': 1, 'test_prestart_launch_releases_actual_bound_resource_once_only_after_exact_cleanup': 1, 'test_prestart_launch_delegate_cannot_certify_bound_actual_native_runtime': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_host_generation_wiring': {'test_marked_generate_refuses_missing_host_before_constructing_worker': 1, 'test_marked_generate_refuses_foreign_runtime_owner_before_worker': 1, 'test_generation_bound_before_actual_thread_and_stream_never_joins_it': 1, 'test_owned_worker_preserves_bound_entity_and_reports_finally_on_actual_thread': 1, 'test_entry_installs_actual_host_layer_first_and_disables_raw_observers': 1, 'test_ordinary_none_path_still_uses_existing_worker_join': 1, 'test_prestart_host_refusal_never_runs_actual_worker': 1, 'test_native_stream_close_requests_host_without_concurrent_source_close': 1, 'test_owned_reader_finalizer_keeps_failed_close_unacknowledged_without_retry': 2, 'test_owned_reader_successful_finalization_is_idempotent': 1, 'test_native_guardrails_bind_actual_release_without_ordinary_early_exit': 2, 'test_actual_runner_passes_same_host_filter_runtime_and_wrapped_combined_channel': 1, 'test_marked_non_stream_response_refuses_without_ordinary_join': 1, 'test_marked_injected_raw_observer_is_refused_before_worker': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_lifecycle': {'test_pending_resolution_cannot_claim_configuration_without_account': 1, 'test_pending_resolution_cannot_replace_form_answer_with_account': 1, 'test_pending_resolution_never_coerces_client_boolean': 1, 'test_payload_codec_rejects_cross_owner_and_changed_typed_payload': 1, 'test_payload_codec_snapshots_caller_mutation': 1, 'test_controlling_proof_keeps_independently_unknown_and_completed_branches_inactive': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_execution': {'test_native_stream_failed_close_never_acknowledges_or_retries': 2, 'test_native_stream_successful_close_is_acknowledged_once': 1, 'test_run_uses_reloaded_typed_snapshot_and_exact_native_run_id': 1, 'test_resume_checks_generation_before_native_owner': 1, 'test_resume_reloads_state_each_time': 1, 'test_owner_cannot_replace_reserved_run_identity': 1, 'test_generator_refuses_missing_native_scope_before_file_or_config_work': 1, 'test_worker_rejects_marker_before_payload_logger_or_ordinary_runner': 1, 'test_native_owner_calls_existing_generator_with_reserved_id_and_server_actor': 1, 'test_ordinary_resume_cannot_rebuild_trace_for_native_marked_entity': 1, 'test_admitted_native_gateway_retains_rate_release_until_host_cleanup': 4, 'test_in_process_worker_refusal_terminates_native_queue_without_ordinary_setup': 2, 'test_early_worker_revocation_redis_cleanup_cannot_log_private_payload': 1, 'test_native_owner_requires_explicit_actual_host': 2, 'test_native_owner_rejects_foreign_host_before_sql_or_generator': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_runtime': {'test_initial_dispatch_uses_no_checkpoint_and_duplicate_delivery_never_runs_again': 1, 'test_resume_settlement_refuses_committed_wait_before_actual_finalization': 3, 'test_unrestored_host_cannot_authorize_arbitrary_snapshot_or_resume_history': 1, 'test_actual_delivery_capacity_is_bound_before_claim_but_lifetime_stays_inactive': 1, 'test_broker_actor_hint_cannot_replace_persisted_request_owner': 1, 'test_actual_wait_snapshot_restores_exact_objects_journal_and_generation_gap': 2, 'test_actual_stream_cleanup_returns_without_signalling_retired_host': 1, 'test_unknown_joined_owner_can_release_only_actual_dead_dispatcher_lease': 1, 'test_cleanup_only_log_release_refuses_live_dispatcher_and_keeps_original_lease': 1, 'test_resume_history_refuses_fake_host_before_any_repository_cache_or_io': 1, 'test_real_dify_initial_http_wait_and_claimed_resume_keep_same_run': 20, 'test_actual_inactive_retained_delivery_and_missing_cancel_handles_grant_no_cleanup': 1, 'test_actual_activated_startup_failure_consumes_only_original_zero_activity_verifier': 1, 'test_same_worker_reclaims_over_128_closed_consumed_requests_but_keeps_unknown_live': 1, 'test_composed_start_cancel_before_delivery_reconciles_without_physical_acquisition': 1, 'test_consumed_generation_zero_in_other_owner_cannot_ack_live_generation_one': 1, 'test_cancel_original_joined_owner_rechecks_retained_snapshot': 2, 'test_composed_cancel_does_not_upgrade_incomplete_or_noninitial_history': 5, 'test_delivered_unclaimed_cancel_retires_logically_without_consuming_lifetime': 1, 'test_over_128_delivered_unclaimed_logical_cancellations_reclaim_same_worker_slots': 1, 'test_logical_preclaim_retirement_rechecks_proof_and_exact_retained_owners': 5, 'test_cancel_projection_includes_owned_sources': 12, 'test_cancel_projection_reloads_after_outside_writer_cleanup': 3, 'test_cancel_projection_retains_older_unresolved_source': 1, 'test_cancel_projection_never_infers_clean_from_incomplete_source_history': 5, 'test_cancel_projection_repeated_cancel_observes_source_state_change': 1, 'test_get_cancel_interleaving_refreshes_orm_state_and_projects_one_cancellation': 4}, 'tests.unit_tests.services.dify_builder.native_testing.test_observation_stream': {'test_direct_native_error_handler_never_passes_raw_error_to_base': 1, 'test_direct_native_text_handler_rejects_tts_before_publish': 1, 'test_domain_projects_and_retains_independent_canonical_markers': 1, 'test_generic_container_decimal_metadata_stays_refused_without_actual_host': 4, 'test_live_output_read_failure_is_latched_without_raw_exception': 1, 'test_marked_converter_requires_guard_before_input_conversion': 1, 'test_marked_converter_wrong_guard_refuses_before_inputs': 2, 'test_marked_pipeline_requires_guard_before_any_initialization': 1, 'test_marker_is_content_validation_not_caller_authority': 3, 'test_native_finish_reads_live_outputs_without_converter_or_file_routes': 1, 'test_native_no_hitl_or_history_resume': 1, 'test_native_pause_response_reuses_cumulative_settled_duration_after_queue_delay': 1, 'test_native_pipeline_refuses_different_queue_guard': 1, 'test_native_pipeline_refuses_unqualified_setup_before_base': 2, 'test_pause_live_fallback_is_safe_without_hitl_resolution': 1, 'test_pipeline_listen_projects_raw_internal_error_before_base': 1, 'test_pipeline_projects_internal_events_and_noops_draft_saver': 1, 'test_pipeline_refuses_tts_trace_and_files_before_actions': 1, 'test_queue_projects_before_base_model_dump_and_direct_publish': 1, 'test_queue_unknown_value_refuses_before_base_serializer': 1, 'test_real_container_queue_and_converter_preserve_counts_without_values': 2, 'test_resumption_requires_actual_host_not_a_caller_port': 8, 'test_retry_history_remains_safe_and_idempotent_in_queue_and_converter': 1, 'test_supported_real_queue_dtos_are_fresh_and_safe': 9, 'test_unknown_object_fails_without_rendering_and_latches': 1, 'test_unqualified_queue_classes_refuse_without_serializing': 1, 'test_wrong_node_type_and_unqualified_hitl_fail_before_projection': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_stream_runtime': {'test_actual_root_business_terminal_survives_raw_sse_without_payload_callback': 2, 'test_close_before_consume_commits_actual_snapshot_then_cleanup_and_public_wait': 1, 'test_real_owner_failure_never_publishes_wait_and_quarantines': 4, 'test_blocked_reader_returns_unknown_at_first_deadline_and_retains_for_late_cleanup': 1, 'test_root_pause_with_late_native_error_is_unknown_before_checkpoint': 1, 'test_persisted_run_status_disagreement_or_missing_run_cannot_complete': 1, 'test_external_close_is_not_natural_drain_or_wait': 1, 'test_foreign_stream_and_repeated_consume_refuse_without_new_reader': 1, 'test_actual_persistence_status_disagreement_is_unknown_before_checkpoint': 1, 'test_failed_capacity_ack_after_physical_consumption_does_not_publish_wait': 1, 'test_existing_workflow_owner_finally_close_after_retirement_is_inert': 1, 'test_automatic_next_close_failure_then_reader_finalizer_never_allows_cleanup': 1, 'test_real_native_partial_business_outcome_and_typed_stop_preserve_routes': 1, 'test_slow_native_work_before_first_control_has_no_host_run_timeout': 1, 'test_blocked_admission_fence_does_not_block_coordinator_quarantine': 1, 'test_dispatcher_logging_release_failure_precedes_capacity_ack': 1}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_zero_http_admission.py', 'api/tests/unit_tests/services/dify_builder/native_testing/test_native_resume_scheduling.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_zero_http_admission': {'test_owned_zero_http_admission_runs_real_start_end_without_resource_binding': 1, 'test_zero_http_admission_preserves_each_permission_gate': 2, 'test_zero_http_snapshot_preserves_workflow_ownership_refusal': 1, 'test_zero_http_snapshot_preserves_revision_refusal': 1, 'test_zero_http_snapshot_preserves_profile_refusal_before_owner_reads': 1, 'test_declared_http_still_requires_a_real_qualified_resource': 1, 'test_unqualified_http_cannot_be_disguised_as_zero_resources': 1, 'test_duplicate_http_resource_ids_still_refuse': 1, 'test_empty_manifest_does_not_enable_unsupported_native_collaborators': 1}, 'tests.unit_tests.services.dify_builder.native_testing.test_native_resume_scheduling': {'test_actual_http_pause_restore_dispatches_same_waiting_intent_once': 3}})
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_stop_settlement.py']
new_expected.update({'tests.unit_tests.services.dify_builder.native_testing.test_stop_settlement': {'test_stop_waits_for_active_read_and_nested_read_finishes_without_deadlock': 1, 'test_refused_or_unaccepted_ack_cannot_open_evidence_reads': 2}})
files += ['api/tests/unit_tests/services/dify_builder/test_agent_preparation_owner.py', 'api/tests/unit_tests/controllers/inner_api/test_agent_runtime_lineage.py', 'api/tests/unit_tests/services/dify_builder/test_agent_endpoint_lineage.py', 'api/tests/unit_tests/dev/test_generate_swagger_specs.py']
new_expected.update({'tests.unit_tests.services.dify_builder.test_agent_preparation_owner': {'test_claim_observes_first_insertion_under_actual_state_owner': 1, 'test_storage_mutation_invalidates_final_claim': 1, 'test_actual_flask_service_auth_stops_before_preparation_lookup': 4, 'test_backend_identity_is_read_outside_writer_before_bind': 5, 'test_inert_composer_uses_real_layer_dtos_without_model_schema_or_session': 2, 'test_callback_idempotency_and_mutation_recheck': 5, 'test_initial_preparation_uses_bound_uuid_typed_inputs_and_rechecks_every_io': 5, 'test_private_config_read_rechecks_exact_stored_owner_and_resource_relations': 7, 'test_actual_flask_control_caps_and_validation_before_factory': 2, 'test_authenticated_flask_callback_through_real_sdk_readback_is_idempotent_and_conflict_safe': 1, 'test_config_creation_readback_cap_precedes_decryption_and_sql': 1, 'test_current_published_binding_must_match_graph_outputs_and_routes': 4, 'test_composer_to_claim_shell_env_is_reference_only': 14, 'test_composed_definition_receipt_survives_initial_claim_io': 14}, 'tests.unit_tests.controllers.inner_api.test_agent_runtime_lineage': {'test_registered_strict_route_refuses_missing_bearer': 17, 'test_strict_route_rejects_wrong_or_mixed_credentials': 4, 'test_strict_route_rejects_equal_agent_plugin_credentials': 1, 'test_strict_route_requires_complete_bounded_selection': 5, 'test_strict_route_requires_installed_lineage_even_without_markers': 1, 'test_legacy_rejects_explicit_native_envelope': 1, 'test_actual_native_identity_with_all_body_markers_removed_refuses_before_services': 17, 'test_private_read_failure_never_reaches_model_service': 2, 'test_genuine_plugin_and_verified_ordinary_retain_real_knowledge_resource_authorization': 8, 'test_ordinary_private_identity_rejects_native_envelope_before_service': 2, 'test_strict_initial_control_reaches_exact_s1_owner_without_effect_envelope': 2, 'test_blank_agent_credential_never_authenticates': 3, 'test_transport_selection_refuses_noncanonical_or_duplicate_key_json': 4, 'test_duplicate_selection_header_cannot_select_a_run': 1, 'test_legacy_plugin_route_never_accepts_agent_bearer': 1, 'test_runtime_schema_documents_its_distinct_bearer_and_selection': 1, 'test_agent_bearer_refuses_equality_with_existing_enterprise_or_daemon_credential': 2, 'test_runtime_admission_cannot_leak_into_a_later_legacy_request_on_shared_app_context': 1, 'test_control_handler_itself_cannot_consume_a_physical_permit': 1}, 'tests.unit_tests.services.dify_builder.test_agent_endpoint_lineage': {'test_only_positive_actual_ordinary_identity_returns_none': 1, 'test_mismatched_private_or_current_protected_state_refuses': 11, 'test_unknown_native_association_never_returns_ordinary': 1, 'test_native_binding_control_does_not_require_existing_association_or_effect_envelope': 1, 'test_bound_native_effect_resolves_owned_context_without_claiming_permit': 1, 'test_caller_cannot_override_owned_run_or_parent': 3, 'test_resolver_requires_authenticated_principal': 1, 'test_validated_native_context_checks_exact_effect_but_never_spends_permit': 5, 'test_real_s1_config_and_final_resource_recheck_composes_with_lineage': 3, 'test_expired_request_native_context_cannot_taint_later_ordinary_preflight': 1}, 'tests.unit_tests.dev.test_generate_swagger_specs': {'test_apply_runtime_defaults_forces_swagger_routes_on': 1,
'test_checked_in_agent_v2_knowledge_openapi_and_generated_contracts_are_in_sync': 1,
'test_console_file_and_audio_responses_declare_binary_success_and_json_errors': 1,
'test_console_only_export_matches_the_full_export': 1,
'test_console_stdout_export_contains_both_surfaces_without_spec_files': 1,
'test_finalize_openapi_payload_documents_typed_sse_and_json_preflight_errors': 1,
'test_finalize_openapi_payload_only_marks_explicit_binary_responses': 1,
'test_finalize_openapi_payload_preserves_canonical_operation_id': 1,
'test_generate_specs_after_controllers_were_imported_with_swagger_disabled': 1,
'test_generate_specs_document_dify_builder_json_reads_and_typed_sse_operations': 1,
'test_generate_specs_include_agent_v2_knowledge_set_schema_and_query_enums': 1,
'test_generate_specs_include_command_oriented_knowledge_fs_contract': 1,
'test_generate_specs_include_console_contract_shapes_for_schema_migration': 1,
'test_generate_specs_is_idempotent': 1,
'test_generate_specs_match_live_openapi_payloads': 1,
'test_generate_specs_writes_all_openapi_files': 1,
'test_generate_specs_writes_get_operations_without_request_bodies': 1,
'test_generate_specs_writes_openapi_with_resolvable_references_and_null_defaults': 1,
'test_generate_specs_writes_service_api_reference_descriptions': 1,
'test_generate_specs_writes_unique_operation_ids': 1,
'test_generate_specs_writes_web_file_upload_error_codes': 1,
'test_standalone_inline_model_name_includes_list_constraints': 1,
'test_system_features_specs_exclude_backend_only_fields': 1}})
# Code physical cases land in modules other lanes already declared above, so they are
# written into the existing per-module dicts. A top-level new_expected.update() would
# replace those dicts wholesale and drop every entry it did not repeat.
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_runtime_bridge']['test_code_delivery_composes_actual_native_protocol_without_eager_payload'] = 2
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_runtime_bridge']['test_default_delivery_refuses_code_before_protected_payload'] = 1
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_observation_privacy']['test_code_profile_redacts_source_template_values_and_retry_history'] = 2
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_host_capacity']['test_code_cleanup_sql_check_precedes_consume_and_rechecks_inside_writer'] = 1
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_observation_owner']['test_code_stored_profile_requires_current_exact_qualification_owner'] = 1
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_native_runtime']['test_code_capability_requires_explicit_trusted_owner_and_default_stays_http'] = 1
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.unit_tests.clients.agent_backend.test_event_adapter': {'test_event_adapter_maps_pydantic_ai_stream_event': 1,
'test_event_adapter_maps_pydantic_ai_stream_event_agent_message_delta_annotation': 1,
'test_event_adapter_maps_run_cancelled_to_terminal_cancelled': 1,
'test_event_adapter_maps_run_failed_to_failed_result': 1,
'test_event_adapter_maps_run_started': 1,
'test_event_adapter_maps_run_succeeded_to_final_output': 1,
'test_event_adapter_preserves_resumption_generation': 1,
'test_event_adapter_preserves_wait_identity_without_converting_it_to_failure': 1}}.items():
new_expected.setdefault(module, {}).update(functions)
# Confirmed Agent recovery: exact function counts from pytest collection.
for module, functions in {'tests.unit_tests.controllers.inner_api.test_agent_runtime_lineage': {'test_actual_native_identity_with_all_body_markers_removed_refuses_before_services': 20,
'test_agent_bearer_refuses_equality_with_existing_enterprise_or_daemon_credential': 2,
'test_blank_agent_credential_never_authenticates': 3,
'test_control_handler_itself_cannot_consume_a_physical_permit': 1,
'test_duplicate_selection_header_cannot_select_a_run': 1,
'test_genuine_plugin_and_verified_ordinary_retain_real_knowledge_resource_authorization': 8,
'test_legacy_plugin_route_never_accepts_agent_bearer': 1,
'test_legacy_rejects_explicit_native_envelope': 1,
'test_ordinary_private_identity_rejects_native_envelope_before_service': 2,
'test_private_read_failure_never_reaches_model_service': 2,
'test_registered_strict_route_refuses_missing_bearer': 20,
'test_runtime_admission_cannot_leak_into_a_later_legacy_request_on_shared_app_context': 1,
'test_runtime_schema_documents_its_distinct_bearer_and_selection': 1,
'test_strict_initial_control_reaches_exact_s1_owner_without_effect_envelope': 2,
'test_strict_route_rejects_equal_agent_plugin_credentials': 1,
'test_strict_route_rejects_wrong_or_mixed_credentials': 4,
'test_strict_route_requires_complete_bounded_selection': 5,
'test_strict_route_requires_installed_lineage_even_without_markers': 1,
'test_transport_selection_refuses_noncanonical_or_duplicate_key_json': 4}}.items():
new_expected.setdefault(module, {}).update(functions)
# Confirmed blank Home: collected required-field, isolated-owner and real SQL restore cases.
for module, functions in {'tests.unit_tests.services.dify_builder.native_testing.test_agent_associations': {'test_blank_home_never_weakens_required_fields_or_isolated_pins': 4,
'test_normal_blank_home_association_roundtrip_retains_explicit_none': 1,
'test_nullable_normal_home_cannot_enter_isolated_workspace_owner': 2}}.items():
new_expected.setdefault(module, {}).update(functions)
# Candidate 3: confirmed semantic basis and unchanged legacy/isolated revision guards.
new_expected.setdefault('tests.unit_tests.services.dify_builder.native_testing.test_context_binding', {}).update({'test_canvas_basis_never_reinterprets_old_context_or_child_workflow': 2,
'test_canvas_basis_requires_exact_server_profile_and_supported_marker': 2,
'test_confirmed_compiler_rechecks_canvas_basis_without_resolving_secret_values': 5,
'test_confirmed_snapshot_graph_still_refuses_executable_payload_tampering': 1})
# Graphon 0.8 compatibility and retained Agent ownership: exact pytest collection counts.
for module, functions in {
'tests.unit_tests.controllers.console.test_builder_native_testing_routes': {
'test_native_input_binding_requires_signed_login': 1,
'test_native_input_binding_has_only_public_identity': 1,
},
'tests.unit_tests.services.dify_builder.native_testing.test_context_binding': {
'test_unrelated_end_edit_retains_owned_agent_without_new_resource_selection': 1,
'test_unselected_agent_retention_refuses_changed_job_copy_pin_publication_or_access': 5,
'test_retained_hidden_job_metadata_is_rechecked_under_draft_lock': 1,
'test_final_retained_binding_check_locks_and_refreshes_rows_before_sync': 1,
},
'tests.unit_tests.services.code_execution.test_transport': {
'test_legacy_transport_exports_preserve_canonical_client_identity': 1,
},
'tests.unit_tests.services.dify_builder.native_testing.test_http_binding': {
'test_official_container_id_normalization_preserves_http_snapshot_binding': 3,
'test_forged_runtime_container_id_is_http_node_drift': 3,
},
'tests.unit_tests.services.dify_builder.native_testing.test_observation_repository': {
'test_service_binding_requires_exact_guard_before_attaching_observer': 2,
'test_repository_cannot_replace_retained_observer_even_with_same_guard': 2,
},
'tests.unit_tests.services.workflow_runtime.test_response_converter': {
'test_node_start_preserves_the_allocated_index_when_events_arrive_out_of_order': 1,
'test_resumed_node_metadata_and_sequence': 2,
},
'tests.unit_tests.controllers.inner_api.test_agent_runtime_lineage': {
'test_run_bound_claim_route_reaches_shell_owner_only_after_exact_lineage': 1,
'test_registered_resumed_config_read_requires_current_bound_exact_owner': 7,
'test_prepare_intent_refusal_logs_only_bounded_policy_category': 2,
},
}.items():
new_expected.setdefault(module, {}).update(functions)
new_expected.setdefault(
'tests.unit_tests.extensions.otel.decorators.handlers.test_workflow_app_runner_handler', {}
).update({'test_all_span_attributes_set_correctly': 1,
'test_handler_structure_dependencies': 1,
'test_marked_native_driver_does_not_emit_workflow_span': 1,
'test_service_driver_emits_workflow_span': 1})
new_expected.setdefault('tests.unit_tests.controllers.inner_api.test_agent_runtime_lineage', {}).update({'test_expired_runtime_only_admits_existing_result_ack_and_outcome': 4})
new_expected.setdefault('tests.unit_tests.services.dify_builder.test_agent_endpoint_lineage', {}).update({'test_real_s1_config_and_final_resource_recheck_composes_with_lineage': 6})
new_expected.setdefault('tests.unit_tests.services.dify_builder.native_testing.test_node_inputs', {}).update({'test_expired_context_read_for_settlement_preserves_cancelled_and_owner_refusals': 1})
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_agent_associations']['test_expired_projection_keeps_agent_checkpoint_proof_without_writes'] = 1
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_agent_associations']['test_cancellation_metadata_read_ignores_only_expiry'] = 5
# ENG-1321: saved retries/effect admission must respect the durable Task pause.
files += ['api/tests/unit_tests/services/dify_builder/native_testing/test_task_stop_admission.py']
new_expected['tests.unit_tests.services.dify_builder.native_testing.test_task_stop_admission'] = {
'test_saved_unlaunched_start_retry_cannot_enqueue_after_task_stop': 1,
'test_effect_dispatch_claim_is_fenced_after_task_stop_before_native_cancel': 1,
'test_host_capacity_claim_cannot_bypass_paused_task_as_settlement': 1,
'test_task_stop_still_allows_native_cancellation_and_evidence_settlement': 1,
}
files += [
"api/tests/unit_tests/core/helper/code_executor/jinja2/test_jinja2_transformer.py",
"api/tests/unit_tests/core/helper/test_trace_id_helper.py",
"api/tests/unit_tests/extensions/test_ext_otel.py",
"api/tests/unit_tests/core/workflow/nodes/knowledge_retrieval/test_retrieval.py",
]
# Main integration adds exact trace-session and resumption-log cases.
for module, functions in {'tests.unit_tests.core.helper.test_trace_id_helper': {'test_extract_trace_session_id_from_args_for_generator_extras': 1,
'test_extract_trace_session_id_from_args_missing_value_keeps_extras_clean': 1,
'test_extract_trace_session_id_from_args_returns_empty_dict_when_blank_after_trim': 1,
'test_extract_trace_session_id_from_args_returns_empty_dict_when_missing': 1,
'test_extract_trace_session_id_from_args_returns_trimmed_value': 1,
'test_get_trace_session_id_does_not_read_trace_id_or_traceparent': 1,
'test_get_trace_session_id_ignores_invalid_lower_priority_value': 1,
'test_get_trace_session_id_prefers_header_over_query_and_body': 1,
'test_get_trace_session_id_prefers_query_over_body': 1,
'test_get_trace_session_id_reads_body_when_no_higher_priority_input': 1,
'test_get_trace_session_id_rejects_invalid_highest_priority_input': 3},
'tests.unit_tests.core.helper.test_trace_id_helper.TestTraceIdHelper': {'test_extract_external_trace_id_from_args': 3,
'test_extract_parent_trace_context_from_args': 6,
'test_extract_parent_trace_context_rejects_incomplete_typed_context': 1,
'test_extract_parent_trace_context_returns_typed_context': 1,
'test_get_external_trace_id_from_args': 1,
'test_get_external_trace_id_from_header': 1,
'test_get_external_trace_id_from_json': 1,
'test_get_external_trace_id_invalid': 4,
'test_get_external_trace_id_priority': 1,
'test_is_valid_trace_id': 8},
'tests.unit_tests.services.workflow_runtime.test_workflow_pipeline.TestGenerateTaskPipelineCases': {'test_workflow_app_log_saved_only_on_initial_start': 1,
'test_workflow_app_log_skipped_on_resumption_start': 1}}.items():
new_expected.setdefault(module, {}).update(functions)
files = list(dict.fromkeys(files))
new_actual = {module: Counter() for module in new_expected}
expected = {path.removeprefix("api/").removesuffix(".py").replace("/", ".") for path in files}
expected = physical_owner_baseline_expected | set(new_expected)
report = "builder-native-foundation-units.xml"
code = pytest.main([*files, "-p", "no:benchmark", "--no-cov", "-vv", "-rA", f"--junitxml={report}"])
problems = []
seen = set()
modules = set()
if not Path(report).is_file():
problems.append("missing native unit report")
else:
for case in ET.parse(report).getroot().iter("testcase"):
module = (case.get("classname") or "").removeprefix("api.")
identity = (module, case.get("name") or "")
matching = [owner for owner in expected if module == owner or module.startswith(owner + ".")]
trace_module = "tests.unit_tests.core.helper.test_trace_id_helper"
if matching and (module == trace_module or module.startswith(trace_module + ".")):
# Trace module functions and its declared classes have separate exact inventories.
owner = max(matching, key=len)
matching = [owner] if module == owner else []
if not matching or identity in seen:
problems.append(f"unexpected or duplicated native unit case: {identity}")
modules.update(matching)
seen.add(identity)
for owner in matching:
if owner in new_actual:
new_actual[owner][identity[1].split("[", 1)[0]] += 1
if any(case.find(tag) is not None for tag in ("skipped", "failure", "error")):
problems.append(f"nonpassing native unit case: {identity}")
if modules != expected:
problems.append(f"native unit module inventory mismatch: {modules}")
for module, functions in new_expected.items():
if dict(new_actual[module]) != functions:
problems.append(f"native function inventory mismatch: {module}: {dict(new_actual[module])}")
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
print(f"COLLECTED native units: {len(seen)} unique cases", flush=True)
raise SystemExit(int(code) or bool(problems))
PY
- name: Native effect ledger on real PostgreSQL
shell: bash
run: |
set -o pipefail
uv run --project api --no-sync python -u - <<'PY' 2>&1 | tee builder-native-foundation.log
import xml.etree.ElementTree as ET
from pathlib import Path
import pytest
report = "builder-native-foundation.xml"
expected = {'test_duplicate_delivery_does_not_get_second_permit': 1, 'test_unapproved_and_denied_never_dispatch': 1, 'test_forged_binding_never_dispatches': 4, 'test_rotation_and_cross_tenant_reference_fail_closed': 1, 'test_completed_result_replays_and_changed_intent_conflicts': 1, 'test_iteration_quota_is_shared_and_third_occurrence_waits': 1, 'test_two_processes_compete_for_one_dispatch': 1, 'test_crash_after_committed_claim_becomes_unknown': 1, 'test_budget_reference_requires_matching_identity_and_consumes_no_extra_quota': 1, 'test_configuration_and_interaction_are_not_effect_approvals': 1, 'test_sql_checks_reject_overspend_and_invalid_outcome': 1, 'test_native_migration_upgrade_downgrade_reupgrade': 2, 'test_permission_revocation_and_serialized_revision_drift_never_dispatch': 1, 'test_oauth_requires_its_own_bounded_approval': 1, 'test_permit_returns_only_after_commit_and_releases_request_lock': 1, 'test_child_invocation_shares_root_budget': 1, 'test_legacy_request_cannot_enter_native_waiting': 1, 'test_spent_permit_can_settle_after_cancel_without_new_dispatch': 1, 'test_forged_permit_cannot_record_or_resolve_reservation': 1}
code = pytest.main([
"api/tests/e2e_tests/containers/core/workflow/test_builder_native_effect_ledger.py",
"-p", "no:benchmark", "--no-cov", "-vv", "-rA", "--tb=long",
"--timeout=360", "--timeout-method=thread", f"--junitxml={report}",
])
problems = []
actual = {}
identities = set()
expected_module = "tests.e2e_tests.containers.core.workflow.test_builder_native_effect_ledger"
if not Path(report).is_file():
problems.append("missing native foundation report")
else:
for case in ET.parse(report).getroot().iter("testcase"):
module = (case.get("classname") or "").removeprefix("api.")
identity = (module, case.get("name") or "")
if module != expected_module or identity in identities:
problems.append(f"unexpected or duplicated native case: {identity}")
identities.add(identity)
name = identity[1].split("[", 1)[0]
actual[name] = actual.get(name, 0) + 1
if any(case.find(tag) is not None for tag in ("skipped", "failure", "error")):
problems.append(f"nonpassing required native case: {name}")
if actual != expected:
problems.append(f"native case inventory mismatch: {actual}")
for problem in problems:
print(f"COMPLETENESS {problem}", flush=True)
raise SystemExit(int(code) or bool(problems))
PY
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: always()
with:
name: builder-native-foundation
path: |
builder-native-foundation.xml
builder-native-foundation.log
builder-native-foundation-units.xml
builder-native-foundation-units.log