refactor(runtime): route risk commitment through controller

This commit is contained in:
2026-08-25 17:14:07 +08:00
parent 3e80083806
commit 9518e2eac8
2 changed files with 159 additions and 31 deletions
@@ -65,6 +65,7 @@ func _verify_page(company: Dictionary, locale: String, viewport_size: Vector2i)
shell.initial_company_service.company_path = COMPANY_PATH
viewport.add_child(shell)
await _frames(3)
expect(shell.app_services.has_service(&"risk_commitment_page_controller"), "%s AppServices registers Risk Commitment controller" % locale)
shell.settings = settings
shell.setup_draft = settings.duplicate(true)
shell.risk_selected_id = String(company.active_contract.formation.risk_options[1].risk_option_id)
@@ -74,6 +75,8 @@ func _verify_page(company: Dictionary, locale: String, viewport_size: Vector2i)
await _frames(3)
await _capture(shell, "%dx%d-%s-before" % [viewport_size.x, viewport_size.y, locale])
expect(shell.current_screen == "risk_commitment", "%s %s enters commitment page" % [locale, viewport_size])
expect(shell.risk_commitment_view_data.ok and shell.risk_commitment_view_data.page_id == "risk_commitment", "%s controller snapshot reaches RSK-002 View" % locale)
expect(shell.risk_commitment_view_data.consequences.count == 6 and not shell.risk_commitment_view_data.commands.begin_enabled, "%s controller exposes six facts and blocked Begin boundary" % locale)
expect(shell.find_child("RiskCommitmentStaticMaster", true, false) != null, "%s static master is present" % locale)
expect(shell.find_child("RiskFrozenMembers", true, false).get_child_count() == 4, "%s exact four frozen members" % locale)
expect(shell.find_child("RiskConsequenceFact0", true, false) != null and shell.find_child("RiskConsequenceFact5", true, false) != null, "%s six consequence facts" % locale)
@@ -91,6 +94,7 @@ func _verify_page(company: Dictionary, locale: String, viewport_size: Vector2i)
await _touch(acknowledge)
await _capture(shell, "%dx%d-%s-ready" % [viewport_size.x, viewport_size.y, locale])
expect(shell.find_child("RiskCommitmentAcknowledge", true, false).get_meta("confirmed", false), "%s acknowledgement state is explicit" % locale)
expect(shell.risk_commitment_view_data.confirmation.acknowledged and shell.risk_commitment_view_data.commands.begin_enabled, "%s controller refreshes acknowledgement and Begin eligibility" % locale)
begin = shell.find_child("RiskBeginBattle", true, false) as Button
expect(begin != null and not begin.disabled, "%s Begin Battle enables only after acknowledgement" % locale)
await _touch(begin)