@@ -1002,7 +1002,106 @@ jobs:
10021002 diff <(jq -S . "$RUNNER_TEMP/proj-facts.json") \
10031003 <(jq -S . "$RUNNER_TEMP/proj-facts-flag.json") \
10041004 || { echo "FAIL: --project flag and positional .csproj emit different OwnIR facts"; exit 1; }
1005- echo "OK: .csproj input resolves to its source set and feeds the core identically (positional == --project, fact-level parity)"
1005+ # the `extract` verb + `--out` long form must resolve to the same facts as the bare form.
1006+ dotnet run --project frontend/roslyn/OwnSharp.Extractor -- \
1007+ extract --project frontend/roslyn/project-input-sample/ProjectInputSample.csproj \
1008+ --out "$RUNNER_TEMP/proj-facts-verb.json"
1009+ diff <(jq -S . "$RUNNER_TEMP/proj-facts.json") \
1010+ <(jq -S . "$RUNNER_TEMP/proj-facts-verb.json") \
1011+ || { echo "FAIL: 'extract --out' verb form disagrees with the bare form"; exit 1; }
1012+ echo "OK: .csproj input resolves to its source set and feeds the core identically (bare == --project == 'extract --out', fact-level parity)"
1013+ # explain: the diagnostic-catalogue CLI surface lives in the core (one checker). Smoke
1014+ # it end-to-end — explain a code, and harvest+explain every code in a real findings file.
1015+ - name : explain command (code + --json harvest)
1016+ run : |
1017+ python -m ownlang explain OWN001 | grep -q "Fix:" \
1018+ || { echo "FAIL: explain OWN001 missing a Fix line"; exit 1; }
1019+ # ownir exits 1 when findings exist (expected — the sample leaks); only 2+ is a real
1020+ # error (bad facts / emit regression). Tolerate 1, surface 2+, so a genuine SARIF
1021+ # generation failure is not masked by a blanket `|| true` (CodeRabbit).
1022+ rc=0; python -m ownlang ownir "$RUNNER_TEMP/proj-facts.json" --format sarif > "$RUNNER_TEMP/proj.sarif" || rc=$?
1023+ [ "$rc" -le 1 ] || { echo "FAIL: SARIF generation errored (rc=$rc)"; exit 1; }
1024+ python -m ownlang explain --json "$RUNNER_TEMP/proj.sarif" | grep -q "OWN001" \
1025+ || { echo "FAIL: explain --json did not harvest OWN001 from the SARIF log"; exit 1; }
1026+ echo "OK: explain answers a code and harvests codes from a real findings/SARIF file"
1027+
1028+ # The OwnTS frontend spike (P-020 Own.React): the SAME OwnIR seam, fed from a
1029+ # React .tsx instead of C#. Two analyses over the one core: (1) a useEffect
1030+ # acquire (timer / subscribe / listener) with no cleanup return is the core's
1031+ # OWN001 — the cross-language leak model; (2) EFF001, a NEW core analysis
1032+ # (ownlang/effects.py) — an IO effect whose dependency identity is unstable
1033+ # (a render-scope object literal) re-fires every render: the effect storm. The
1034+ # frontend emits only facts; the stability verdict is the core's. No dotnet.
1035+ ownts-react-effects :
1036+ name : OwnTS (React useEffect) -> OwnIR -> core
1037+ runs-on : ubuntu-latest
1038+ steps :
1039+ - uses : actions/checkout@v4
1040+ - uses : actions/setup-python@v5
1041+ with :
1042+ python-version : " 3.13"
1043+ - name : Pin the spike (leaky=3xOWN001+EFF001, clean=0, showcase=2xEFF001)
1044+ run : python frontend/ownts/test_ownts.py
1045+ - name : Extract OwnIR facts from a React .tsx and check through the core
1046+ run : |
1047+ python frontend/ownts/ownts.py frontend/ownts/examples/Dashboard.tsx \
1048+ -o "$RUNNER_TEMP/dash.facts.json"
1049+ cat "$RUNNER_TEMP/dash.facts.json"
1050+ out=$(python -m ownlang ownir "$RUNNER_TEMP/dash.facts.json" || true)
1051+ echo "$out"
1052+ echo "$out" | grep -q "Dashboard.tsx" \
1053+ || { echo "FAIL: expected findings located at the .tsx"; exit 1; }
1054+ echo "$out" | grep -q "resource: timer" \
1055+ || { echo "FAIL: expected the setInterval [resource: timer] leak"; exit 1; }
1056+ [ "$(echo "$out" | grep -c 'OWN001')" -eq 3 ] \
1057+ || { echo "FAIL: expected three OWN001 leaks"; exit 1; }
1058+ echo "$out" | grep -q "\[EFF001\].*request storm" \
1059+ || { echo "FAIL: expected the EFF001 effect-storm verdict"; exit 1; }
1060+ # exact finding count (a code-tagged line each), not a substring of "4 finding"
1061+ [ "$(echo "$out" | grep -cE '\[(OWN|EFF|DI)[0-9]{3}\]')" -eq 4 ] \
1062+ || { echo "FAIL: expected 3 OWN001 + 1 EFF001 = 4 findings"; exit 1; }
1063+ - name : EFF001 stability showcase — only provable storms fire (low FP)
1064+ run : |
1065+ python frontend/ownts/ownts.py frontend/ownts/examples/EffectStorm.tsx \
1066+ -o "$RUNNER_TEMP/storm.facts.json"
1067+ storm=$(python -m ownlang ownir "$RUNNER_TEMP/storm.facts.json" || true)
1068+ echo "$storm"
1069+ # the direct object dep and its derived alias fire; memo/ref/call/primitive/no-IO stay silent
1070+ [ "$(echo "$storm" | grep -c '\[EFF001\]')" -eq 2 ] \
1071+ || { echo "FAIL: expected exactly two EFF001 (object dep + derived alias)"; exit 1; }
1072+ echo "$storm" | grep -q "derives from" \
1073+ || { echo "FAIL: expected the derivation (propagation) verdict"; exit 1; }
1074+ - name : Edge cases — partial timer cleanup + nested-scope shadow
1075+ run : |
1076+ python frontend/ownts/ownts.py frontend/ownts/examples/EffectEdges.tsx \
1077+ -o "$RUNNER_TEMP/edges.facts.json"
1078+ edges=$(python -m ownlang ownir "$RUNNER_TEMP/edges.facts.json" || true)
1079+ echo "$edges"
1080+ # only the SECOND, uncleared interval leaks; the memoized dep is not shadowed
1081+ [ "$(echo "$edges" | grep -cE '\[(OWN|EFF|DI)[0-9]{3}\]')" -eq 1 ] \
1082+ || { echo "FAIL: expected exactly one OWN001 (the uncleared timer)"; exit 1; }
1083+ echo "$edges" | grep -q "pollB" \
1084+ || { echo "FAIL: the leak must be the second (uncleared) interval"; exit 1; }
1085+ - name : Parser hardening — string literals, nested dep brackets, listener options
1086+ run : |
1087+ python frontend/ownts/ownts.py frontend/ownts/examples/EffectHardening.tsx \
1088+ -o "$RUNNER_TEMP/hard.facts.json"
1089+ hard=$(python -m ownlang ownir "$RUNNER_TEMP/hard.facts.json" || true)
1090+ echo "$hard"
1091+ # a string with commas/braces does not truncate the body (the timer is cleared);
1092+ # the leak is the options-dropped listener; the object dep fires EFF001 once
1093+ [ "$(echo "$hard" | grep -cE '\[(OWN|EFF|DI)[0-9]{3}\]')" -eq 2 ] \
1094+ || { echo "FAIL: expected one OWN001 (listener) + one EFF001 (object dep)"; exit 1; }
1095+ echo "$hard" | grep -q "scroll" \
1096+ || { echo "FAIL: the leak must be the options-dropped scroll listener"; exit 1; }
1097+ - name : The clean fixture (cleanups + useMemo'd dep) is silent
1098+ run : |
1099+ python frontend/ownts/ownts.py frontend/ownts/examples/DashboardClean.tsx \
1100+ -o "$RUNNER_TEMP/clean.facts.json"
1101+ clean=$(python -m ownlang ownir "$RUNNER_TEMP/clean.facts.json" || true)
1102+ echo "$clean"
1103+ [ "$(echo "$clean" | grep -cE '\[(OWN|EFF|DI)[0-9]{3}\]')" -eq 0 ] \
1104+ || { echo "FAIL: cleaned-up + memoised effects must not fire"; exit 1; }
10061105
10071106 # The distribution surface (Уровень 1): the own-check.sh orchestrator walks a
10081107 # directory of real C# and prints findings in the host-parseable formats the
0 commit comments