Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions lib/engines/hcktest/hcktest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,31 @@ def prepare_tests
@test_list = @tests.update_tests(log: true)
end

def rescue2return
yield
nil
rescue StandardError => e
@project.logger.error("HCKTest encountered an error: (#{e.class}) #{e.message}")
e
end

def auto_run
ResourceScope.open do |scope|
run_studio scope
sleep 5 until @studio.up?

run_tests_without_config
run_tests_with_config

@tests.create_project_package
# Try to export the project package even if some of the steps fail, it can be
# used to simplify the HLK process by reusing the created package and just fixing
# the root cause of the failure without the need to run all other tests
ex1 = rescue2return { run_tests_without_config }
ex2 = rescue2return { run_tests_with_config }

ex3 = rescue2return { @tests.create_project_package }

# Propagate the first exception if any occurred; the most likely other exceptions are just
# consequences of the first one and will be resolved after fixing the first root cause
raise ex1 if ex1
raise ex2 if ex2
raise ex3 if ex3
Comment on lines +294 to +296
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raising the captured exception object later (raise ex1) will report the raise site as the origin in logs/backtraces, obscuring where the failure actually occurred. Since bin/auto_hck logs exception.backtrace, preserve the original backtrace when re-raising (e.g., raise with the stored backtrace) so the fatal log points to the real root cause.

Suggested change
raise ex1 if ex1
raise ex2 if ex2
raise ex3 if ex3
raise ex1, ex1.message, ex1.backtrace if ex1
raise ex2, ex2.message, ex2.backtrace if ex2
raise ex3, ex3.message, ex3.backtrace if ex3

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Emmm, what? Looks like hallucinations.

end
end

Expand Down
Loading