Skip to content

test(group): fail loud on CI when tree-sitter-kotlin grammar is unavailable#1869

Open
henry201605 wants to merge 1 commit into
abhigyanpatwari:mainfrom
henry201605:chore/kotlin-grammar-ci-sentinel
Open

test(group): fail loud on CI when tree-sitter-kotlin grammar is unavailable#1869
henry201605 wants to merge 1 commit into
abhigyanpatwari:mainfrom
henry201605:chore/kotlin-grammar-ci-sentinel

Conversation

@henry201605
Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1855, addressing the deferred Finding 2 from Claude's review (#1855 (comment)).

The Kotlin Provider tests (#1849) and Consumer tests (#1855) both gate their it() calls behind:

const kotlinAvailable = getPluginForFile('Probe.kt') !== undefined;
const itKotlin = kotlinAvailable ? it : it.skip;

Locally this is intentional — contributors on platforms where the optional tree-sitter-kotlin native binding can't build (or who haven't installed it) shouldn't be blocked by red Kotlin tests.

On CI it's a silent-skip hazard: if the optional dep ever fails to install (npm registry hiccup, build-toolchain drift on a runner image update, ABI bump in tree-sitter-kotlin) all 17+ Kotlin cases would silently skip and CI would still pass green.

Fix

A module-load tripwire that throws only when both conditions hold:

  • process.env.CI is set
  • getPluginForFile('Probe.kt') returns undefined

Mirrors the existing CI tripwire pattern at test/integration/object-literal-owner-resolution.test.ts:55-66, which guards against silent skip on missing dist/parse-worker.js.

The error message states what's missing, what would otherwise happen (silent skip of Provider + Consumer), where to look (optionalDependencies + runner toolchain), and explicitly reassures contributors that local runs are unaffected.

Coverage

This single tripwire protects all Kotlin tests in http-route-extractor.test.ts:

Reverse-validated four states

Scenario Behavior
local + grammar present 60 / 60 pass (unchanged)
local + grammar absent 43 pass + 17 skip (unchanged)
CI=true + grammar present 60 / 60 pass (unchanged)
CI=true + grammar ABSENT tripwire throws with clear error message (was silently green; now hard red)

The "grammar absent" cases were exercised locally by temporarily commenting out Kotlin = _require('tree-sitter-kotlin') in kotlin.ts and running the suite under both env settings.

Local validation

  • http-route-extractor.test.ts — 60 / 60 ✅
  • test/unit/group — 540 / 540 ✅
  • npm run format:check — clean ✅

…ilable

Address Claude's review on PR abhigyanpatwari#1855 (Finding 2).

The Kotlin Provider suite (PR abhigyanpatwari#1849) and Consumer suite (PR abhigyanpatwari#1855)
both gate their `it()` calls behind:

  const kotlinAvailable = getPluginForFile('Probe.kt') !== undefined;
  const itKotlin = kotlinAvailable ? it : it.skip;

Locally this is intentional — contributors on platforms where the
optional `tree-sitter-kotlin` native binding can't build (or who
haven't installed it) shouldn't be blocked by red Kotlin tests.

On CI it's a silent-skip hazard: if the optional dep ever fails to
install (npm registry hiccup, build-toolchain drift on a runner image
update, ABI bump in tree-sitter-kotlin) all 17+ Kotlin cases would
silently skip and CI would still be green. The exact failure mode
flagged in Claude's review on PR abhigyanpatwari#1855 (Finding 2).

Fix: a module-load tripwire that throws ONLY when:
  - process.env.CI is set (local runs are unaffected), AND
  - getPluginForFile('Probe.kt') returns undefined

Mirrors the existing CI tripwire pattern in
`test/integration/object-literal-owner-resolution.test.ts:55-66`,
which guards against silent skip on missing dist/parse-worker.js.

The error message includes:
  - what's missing (tree-sitter-kotlin grammar)
  - what would happen otherwise (silent skip of Provider+Consumer)
  - where to look (optionalDependencies + runner toolchain)
  - explicit local-vs-CI reassurance

Coverage: this single tripwire protects ALL Kotlin tests in this
file — 11 itKotlin (Provider, abhigyanpatwari#1849) + 6 itKotlinConsumer (Consumer,
abhigyanpatwari#1855) — and any future Kotlin tests added under the same gating
pattern.

Reverse-validated four states:
  1. local + grammar present       → 60/60 pass (unchanged)
  2. local + grammar absent        → 43 pass + 17 skip (unchanged)
  3. CI=true + grammar present     → 60/60 pass (unchanged)
  4. CI=true + grammar ABSENT      → tripwire throws with clear msg
                                     (the new behavior — was silently
                                      green before, now hard red)

Local validation:
  - test/unit/group/http-route-extractor.test.ts: 60/60 ✅
  - test/unit/group: 540/540 ✅
  - npm run format:check: clean ✅
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

Someone is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

CI Report

All checks passed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
✅ Tests success unit tests, 3 platforms
✅ E2E success gitnexus-web changes only

Test Results

Tests Passed Failed Skipped Duration
10005 10001 0 4 606s

✅ All 10001 tests passed

4 test(s) skipped — expand for details
  • PHP pipeline benchmark > scales with file count (workers enabled)
  • Ruby pipeline benchmark > scales with file count (workers enabled)
  • Rust pipeline benchmark > scales with file count (workers enabled)
  • buildTypeEnv > known limitations (documented skip tests) > Ruby block parameter: users.each { |user| } — closure param inference, different feature

Code Coverage

Tests

Metric Coverage Covered Base Delta Status
Statements 79.73% 34809/43654 79.48% 📈 +0.2 🟢 ███████████████░░░░░
Branches 68.25% 22183/32499 68% 📈 +0.2 🟢 █████████████░░░░░░░
Functions 84.67% 3602/4254 84.56% 📈 +0.1 🟢 ████████████████░░░░
Lines 83.23% 31354/37668 82.97% 📈 +0.3 🟢 ████████████████░░░░

📋 View full run · Generated by CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant