UnifyWeaver

⚙️ C# Query Target Test Plan (v0.1)

Date: February 2026
Release: v0.1 – C# query runtime mutual recursion support
Platforms: Linux, WSL, macOS, Windows (PowerShell)
Estimated Time: 15–30 minutes (core checks) + 15 minutes (optional manual runtime validation)


1. Objectives


2. Prerequisites

Tool Minimum Version Notes
swipl 9.2.9 Required to run the Prolog regression suite.
.NET SDK 9.0.2+ Needed for manual build & execution of generated plans.
bash / pwsh latest Only used to launch the test commands; no target-specific dependencies.

Environment Notes


3. Core Test Checklist (Priority 1)

Run all steps in order. Use SKIP_CSHARP_EXECUTION=1 to avoid the known dotnet run pipe deadlock (see docs/CSHARP_DOTNET_RUN_HANG_SOLUTION.md).

3.1 C# Query Target Regression

SKIP_CSHARP_EXECUTION=1 \
swipl -q \
     -f tests/core/test_csharp_query_target.pl \
     -g test_csharp_query_target:test_csharp_query_target \
     -t halt

Validates:

Expected output shows “dotnet execution skipped” for each block followed by === C# query target tests complete ===.

SKIP_CSHARP_EXECUTION=1 \
swipl -q -f run_all_tests.pl -g main -t halt

Confirms that integrating the C# target does not regress other subsystems (firewall, data sources, bash targets).


4. Manual Runtime Validation (Priority 2)

Run these only if you have .NET available and want to verify end-to-end execution. They exercise the build-first workaround documented in docs/CSHARP_DOTNET_RUN_HANG_SOLUTION.md.

4.1 Generate artefacts and run compiled binary

SKIP_CSHARP_EXECUTION=1 \
swipl -q \
     -f tests/core/test_csharp_query_target.pl \
     -g "test_csharp_query_target:configure_csharp_query_options, \
         test_csharp_query_target:setup_test_data, \
         test_csharp_query_target:build_manual_plan(test_even/1, Dir), \
         halt."

Produces a project under output/csharp/<uuid>/.

From that directory:

dotnet build --no-restore
dotnet bin/Debug/net9.0/<generated>.dll   # if DLL produced
# or
./bin/Debug/net9.0/<generated>            # if self-contained binary produced

Expected output: 0, 2, 4 (mutual recursion parity).

(If you prefer, run dotnet run --no-restore after reading the hang workaround.)

4.2 Bash parity spot-check (optional)

Run the equivalent Bash test to compare results:

swipl -q \
     -g "use_module('tests/core/test_recursive_csharp_target'), \
         test_recursive_csharp_target:test_cf_fact, \
         halt."

Ensure C# and Bash outputs match for the same predicates (focus on mutual recursion and arithmetic cases).


5. Platform Considerations

Platform Notes
WSL / native Linux All commands above run as-is. Ensure dotnet is installed in the Linux environment.
Windows PowerShell Use SKIP_CSHARP_EXECUTION=1 to avoid pipe deadlocks. Manual build steps work identically; ensure dotnet is on the PowerShell PATH.
CI / Automation Set SKIP_CSHARP_EXECUTION=1 in the job environment. Persist artefacts (output/csharp/...) as build artifacts if you need to inspect the generated C# plans.

6. Troubleshooting


7. Summary Checklist


8. References

This plan will evolve alongside the C# targets. Update it whenever the runtime gains new features (ordered dedup, memoisation, distributed execution, etc.).