feat: add webhook/event handler detection#512
Conversation
|
@TESTPERSONAL is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
CI Report❌ Some checks failed Pipeline Status
Test Results
✅ All 5379 tests passed 92 test(s) skipped — expand for details
Code CoverageTests
📋 View full run · Generated by CI |
Fix pushed: duplicate FROM-TO pairsThe CI failure ( Why this PR is usefulModern web applications are heavily event-driven — Stripe webhooks process payments, BullMQ queues handle background jobs, Supabase Edge Functions respond to database changes, and realtime subscriptions push updates to clients. But today, GitNexus has no visibility into this layer. Routes and tools are tracked, but event handlers are invisible in the knowledge graph. This PR closes that gap by adding Webhook as a first-class node type with detection for:
The |
xkonjin
left a comment
There was a problem hiding this comment.
The feature looks useful, but this PR is touching a pretty fragile chain all at once: parse-worker extraction, pipeline ingestion, schema/DDL, CSV serialization, COPY loading, and the new webhook_map query surface. I do not see any regression tests covering that end-to-end path.
Given how easy it is for graph features like this to partially index without obvious failures, I think this needs at least one fixture-driven test that proves: (1) a webhook is detected, (2) eventTypes survives persistence, and (3) webhook_map can read it back. Without that, a schema/CSV mismatch could ship unnoticed.
|
Pushed
These were hardcoded counts that broke when adding the Webhook node type and webhook_map tool. |
|
Pushed Verified: re-indexing a project with Stripe webhooks now correctly detects the handler at |
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Added: Fixture-driven e2e test for webhook detection (reviewer request)Pushed Part A — Detection (4 tests)
Part B — Persistence + webhook_map readback (7 tests)
Fixture files
Note: Part A tests extractWebhooks logic directly rather than via |
|
Pushed 11 tests covering the full chain: Part A — Detection logic (4 tests):
Part B — Persistence & query (7 tests):
Fixture repo: |
|
Pushed Bug fix:
Code reuse:
Efficiency:
Cleanup:
|
|
@marxo126 can you please ensure CI is green? 🙏 |
|
Fixed CI: guarded Root cause: The webhook integration test imports Fix: Wrapped the message handler registration block in |
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cb6b127 to
36a2a73
Compare
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
36a2a73 to
7097661
Compare
|
Rebased onto latest upstream/main and fixed the CI failure. Root cause: Fix: Moved All 4115 tests pass locally, typecheck clean. |
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
7097661 to
f70c0ec
Compare
|
Rebased onto latest upstream/main (c6ed25d). Typecheck now passes clean — the Dart language support commit that was missing is now in the base. All test failures in CI are pre-existing on upstream/main (python resolver, skills-e2e, cli-e2e). |
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
f70c0ec to
a2ff5bf
Compare
|
Fixed typecheck errors — added missing |
|
@claude Let's run a final review if this PR is production ready and ready to be merged |
|
Claude finished @magyargergo's task in 3m 47s —— View job Final Production-Readiness Review
CI Status✅ All checks passing — 4611/4613 tests pass (2 skipped are pre-existing documented skips). Typecheck clean. SummaryThis is a well-structured, production-quality PR. The core feature chain — detection → pipeline → schema → CSV → COPY → query — is solid and fully covered by the new integration test. Multiple rounds of iteration have addressed the main concerns: duplicate schema entries, test file false-positives, worker thread guard, and LadybugDB concurrency in CI. The reviewer-requested fixture-driven e2e test is present and comprehensive (11 tests). The simplify pass cleaned up real bugs (empty triggers, missing Verdict: ✅ Ready to merge with two minor items below. Issues Found1. 🟡
|
|
@marxo126 can you please look into this? |
|
@claude ultra-think while reviewing this PR and check the performance characteristics and possible implementation gaps and bugs. You must verify them as well! |
|
Claude finished @magyargergo's task in 3m 41s —— View job Deep Performance & Bug Review
Verified Issues🔴 #1 — Webhook detection is silently dead on small reposFile: The // pipeline.ts:804-807
} else {
await processImports(graph, chunkFiles, astCache, ctx, ...);
sequentialChunkPaths.push(chunkPaths);
// extractWebhooks is NEVER called here
}The test suite itself documents this limitation at
Real-world impact: A developer bootstrapping a new project — exactly the scenario where quick feedback is most valuable — with a single Stripe webhook handler will get zero webhook detection. The feature is effectively opt-in for large repos only. 🔴 #2 —
|
| # | Severity | Status | Issue |
|---|---|---|---|
| 1 | 🔴 Critical | New | Webhook detection silent on repos <15 files/<512KB |
| 2 | 🔴 Bug | New | caseRe pollutes eventTypes with non-webhook switch cases |
| 3 | 🟡 Bug | Previously flagged, unaddressed | webhookMap triggers query ignores filters |
| 4 | 🟡 Gap | Previously flagged, unaddressed | Webhook missing from VALID_NODE_LABELS |
| 5 | 🟡 FP Risk | Previously flagged, unaddressed | Generic webhook verify signal too broad |
| 6 | 🟡 Bug | New | Webhook deduplication by name only drops cross-file duplicates |
| 7 | ℹ️ Minor | New | Stale test comment post-simplify |
| 8 | ℹ️ Perf | Minor | lineAt() O(n) and duplicated |
Issues #3 and #4 were flagged in the previous automated review but are still unaddressed. Issues #1, #2, and #6 are newly identified. I'd recommend addressing #1 and #2 before merge as they affect correctness — #1 makes the feature a no-op for small repos, and #2 produces silently wrong data for any real Stripe webhook file with more than one switch statement.
|
@marxo126 can you please look into it? |
|
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
d59b8d0 to
2f53517
Compare
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add Webhook entry to NODE_COLORS and NODE_SIZES in gitnexus-web constants - Run prettier across all packages to fix format CI check - Resolves typecheck-web and format CI failures on PR abhigyanpatwari#512 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Deployment failed with the following error: |
Add Webhook node type and TRIGGERS edge to the knowledge graph. Detects Stripe webhooks, Supabase Edge Functions, Supabase Realtime subscriptions, and generic webhook handlers. Adds webhook_map MCP tool. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Duplicate FROM File TO Webhook and FROM Webhook TO Process entries caused LadybugDB binder exception in CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- NODE_TABLES count: 30 → 31 (added Webhook) - NODE_SCHEMA_QUERIES count: 30 → 31 - SCHEMA_QUERIES count: 32 → 33 - GITNEXUS_TOOLS count: 11 → 12 (added webhook_map) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Test files often mock webhook patterns (e.g., constructEvent in Stripe test mocks), causing false detection. Skip files in test directories. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix bug: trigger query matched Webhook→Webhook but pipeline creates File→Webhook edges — always returned empty results - Add missing ensureInitialized() in webhookMap - Export extractWebhooks so test imports it instead of duplicating 30 lines - Merge duplicate toLowerCase() into single lowerPath variable - Replace substring+split line counting with zero-allocation charCodeAt loop - Fix literal \n in tools.ts description (should be actual newlines) - Remove accidental QUERIES type addition (belongs to ORM PR) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The webhook integration test imports extractWebhooks directly from
parse-worker.ts. When imported outside a worker thread, parentPort is
null and the top-level parentPort!.on('message', ...) crashes with
"Cannot read properties of null (reading 'on')". Wrap the message
handler registration in an `if (parentPort)` guard.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The webhook-detection.test.ts uses withTestLbugDB which opens a LadybugDB connection. Running it in the parallel 'default' project causes file-lock conflicts with other LadybugDB tests on Ubuntu and Windows CI. Move it to the 'lbug-db' project (fileParallelism: false). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
extractWebhooks was only called in the worker thread path (parse-worker.ts). Repos with <15 files or <512KB of source use the sequential fallback, which skipped webhook extraction entirely. Now the sequential post-processing loop calls extractWebhooks for each file, matching the worker path behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add Webhook entry to NODE_COLORS and NODE_SIZES in gitnexus-web constants - Run prettier across all packages to fix format CI check - Resolves typecheck-web and format CI failures on PR abhigyanpatwari#512 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add Webhook to LABEL_BEHAVIOR in registration-table.ts - Remove erroneous typeEnvBindings refs from ParseWorkerResult (uses fileScopeBindings) - Update schema.test.ts counts: NODE_TABLES 31→32, NODE_SCHEMA_QUERIES 31→32, SCHEMA_QUERIES 33→34 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d3a5c36 to
6bae7e0
Compare
|
Please submit a new PR if this is still relevant |
…ebhook_map readback Addresses reviewer xkonjin's request on PR abhigyanpatwari#512 for an end-to-end test proving: 1. extractWebhooks correctly identifies Stripe, edge-function, and realtime patterns 2. Webhook nodes with eventTypes[] survive LadybugDB round-trip 3. webhook_map tool reads back correct data with kind/name filtering Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add Webhook entry to NODE_COLORS and NODE_SIZES in gitnexus-web constants - Run prettier across all packages to fix format CI check - Resolves typecheck-web and format CI failures on PR abhigyanpatwari#512 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
constructEvent+ event type extraction from switch cases)Deno.serveinsupabase/functions/*/index.ts).channel().on('postgres_changes', ...))webhook_mapMCP tool for querying webhook endpoints, event types, and TRIGGERS edgesFiles Changed
src/core/graph/types.tsWebhookNodeLabel,TRIGGERSRelationshipType,kind/eventTypespropertiessrc/core/lbug/schema.tssrc/core/ingestion/workers/parse-worker.tsExtractedWebhookinterface,extractWebhooks()functionsrc/core/ingestion/parsing-processor.tssrc/core/ingestion/pipeline.tssrc/core/lbug/csv-generator.tssrc/core/lbug/lbug-adapter.tssrc/mcp/tools.tswebhook_maptool definitionsrc/mcp/local/local-backend.tswebhookMap()implementation with Cypher queriesTest plan
npm run build)kind: 'stripe'and event types extractedkind: 'edge-function'nodeswebhook_mapMCP tool — verify it returns webhooks and TRIGGERS edges🤖 Generated with Claude Code