mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-08 22:22:52 +00:00
* test(go): add #1848 Go pipeline + worker-pool benchmark Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * optimize(go-scope-capture): thread captured nodes to kill O(n^2) findNodeAtRange re-walks emitGoScopeCaptures re-derived each match's AST node via findNodeAtRange from the tree root on every query match, giving O(matches x rootChildren) ~ O(n^2) behaviour (the #1848 root cause: a 250-struct generated DAO took ~10.8s, 800 structs ~100s+ — long enough to trip the worker sub-batch idle timeout and get quarantined). Thread the query-captured SyntaxNode (c.node) through a parallel tag->node map and use it directly (or via a bounded local parent walk for the import_declaration ancestor case) instead of re-walking from root. Output is byte-identical (capture fingerprint over the DAO file + all 89 go-* fixtures unchanged; capture_groups=13501). 250 entities: 10835ms -> 114ms (95x). 800 entities: ~100s -> 384ms. Go resolver + scope-resolution suites: 165/165 pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(go-scope-capture): address code-review findings Self-review (ce-code-review) polish on the #1848 fix + benchmark: - benchmark: tighten the scaling guard from timeRatio/fileRatio < 3 to < 1.5. At the 2.5x/2x scale steps, a quadratic regression yields ratio == fileRatio (2.5, 2.0), which < 3 waved through — the guard could not detect the O(n^2) it exists for. Measured O(n) ratios are 0.45/0.59, so < 1.5 has headroom. - benchmark: add a non-gated O(n^2) regression tripwire that calls emitGoScopeCaptures on a 400-struct source directly (no worker, no GITNEXUS_BENCH gate) so the regression is actually guarded in CI. - benchmark: clearTimeout the Promise.race timer in finally (no lingering rejection); set the worker-suite env vars inside the try so finally always restores them. - captures.ts: clarify the isRawMultiAssignTypeBinding comment to name both var-form cases (assertion + call-return). Comment-only. Left as-is: resolveImportNode's defensive range-equality branch — deleting it as dead code would remove the self-documentation of the grammar invariant the threaded-node logic depends on (reviewer tension; a wash). Verified: tsc clean; 165/165 Go resolver + scope tests; new tripwire passes (237ms); scaling suite passes at <1.5; #1848 worker suite still green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(go): golden capture-parity guard for emitGoScopeCaptures (#1848 U1) Pins emitGoScopeCaptures output across all 89 go-* fixtures + a synthetic DAO shape as a committed golden (test/fixtures/go-captures-golden/expected-captures.json), so future drift in the Go scope-capture path fails CI instead of only the coarse perf tripwire. Match-grouped, order-independent sha256 canonicalization; regenerate intentionally with UPDATE_GOLDEN=1. Mirrors test/integration/pipeline-graph-golden.test.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(go): cover func_literal, var-form bindings, single import, generics (#1848 U2) Adds smoke cases for the Go shapes the #1915 captured-node refactor reasons about but no lang-resolution fixture exercised: func_literal under @scope.function (no receiver synthesized), var-form @type-binding.assertion and .call-return (not dropped by isRawMultiAssignTypeBinding), a single unparenthesized import through resolveImportNode, and a generic function declaration. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(go): tighten O(n^2) tripwire budget 10s -> 5s (#1848 U3) The fixed path is ~250ms; a quadratic regression at 400 structs is ~25s. 5s keeps ~20x headroom over the fixed path while tripping a ~20x regression (vs the prior ~40x). Correctness is guarded separately by the U1 golden test, so this stays a pure perf tripwire. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * chore(autofix): apply prettier + eslint fixes via /autofix command * test(go): fail on a missing golden in CI via a pure resolveGoldenAction helper (#1848 U1) Extracts the golden test's missing-file gate into a pure resolveGoldenAction({update,exists,isCI}) -> regenerate|compare|fail helper, so a missing golden no longer self-heals + passes in CI (Codex F2). The rule is unit-tested directly across all combos with no filesystem mutation (can't corrupt the committed golden). CI detection uses a truthy check (!!process.env.CI) so it fires on any runner. Locally a missing golden still regenerates as first-run convenience. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(go): make the golden digest order-sensitive (#1848 U2) Drops the cross-match .sort() in digestCaptures so the digest reflects emission order — a true byte-identical guard that catches a reordering refactor (Codex F1), not just a set-equality check. Safe because emitGoScopeCaptures output is deterministic. Within-match key order stays normalized (a CaptureMatch is a Record). Replaces the order-independence test with an order-sensitivity assertion and regenerates expected-captures.json under the new scheme (all 90 digests). Trade-off: a tree-sitter-go grammar bump that reorders matches now requires a deliberate UPDATE_GOLDEN=1 regen — intentional (a tree-shape change deserves a look). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * test(go): strengthen func_literal smoke case to a positive receiver assertion (#1848 U3) The old case used a closure-only source and only asserted ABSENCE of @type-binding.self, so it would pass even if the method_declaration receiver branch regressed (Codex F3). The fixture now has both a method and a closure, and positively asserts exactly one @type-binding.self from the method (name=u, type=User — the type also confirms *User pointer-stripping) and none from the closure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(test): remove TOCTOU file-system race in golden test + format CodeQL flagged a high-severity 'potential file system race condition': the golden test did fs.existsSync(GOLDEN_FILE) then later writeFileSync/readFileSync on it. Replace the existsSync-then-use with a single race-free read (ENOENT => missing), reusing the read content for the compare path. Behaviour is unchanged (the pure resolveGoldenAction helper still decides regenerate/compare/fail). Also applies prettier formatting to the file (fixes the quality/format check). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Gergo Magyar <abhigyan1.patwari@gmail.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| fixtures | ||
| helpers | ||
| integration | ||
| unit | ||
| utils | ||