fix(den): create config object versions on github connector push#2003
Merged
Conversation
The GitHub connector webhook recorded a connector_sync_event but never produced a new config_object_version on push. Three issues: - Discovery was served from a stale cache keyed on branch/ref/repo, so pushes reused the previous sourceRevisionRef and the version guard in materializeGithubImportedObject skipped creating a version. Auto-import now forces a fresh discovery so the latest head revision/files are used. - The auto-import gate required autoImportNewPlugins === true, diverging from getGithubDiscoveryContext defaults; an unset flag now resolves to enabled so already-configured repos re-sync unless explicitly opted out. - Errors from auto-import were swallowed silently; they are now logged and recorded on the sync event (status "failed" with the message). Also link config_object_version.connectorSyncEventId to the triggering sync event, and enrich summary_json with full outcome data (outcome, error, classification, resolved revision, created plugins/marketplace, materialized config objects, and timing). Status is "completed" only when a version is materialized, otherwise "partial".
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
Restore the early return in maybeAutoImportGithubConnectorInstance so a connector instance with autoImportNewPlugins explicitly set to false does not run discovery or materialize config objects. The sync event is recorded with status "ignored". (Reported by cubic.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a user has the GitHub integration connected and a repo configured into a marketplace/plugin/config item, a push to that repo correctly recorded a
connector_sync_eventbut never created a newconfig_object_version. This PR fixes the sync chain and adds rich outcome data to the event.Root cause
The webhook →
enqueueGithubWebhookSync→maybeAutoImportGithubConnectorInstance→applyGithubConnectorDiscovery→materializeGithubImportedObjectchain had three issues:resolveGithubConnectorDiscoveryreturned the cached snapshot wheneverbranch/ref/repomatched — always true across pushes to the same branch — so it reused the previoussourceRevisionRef. The version guardbinding.lastSeenSourceRevisionRef !== input.sourceRevisionRefthen saw an unchanged revision and skipped the version insert.autoImportNewPlugins === true, diverging fromgetGithubDiscoveryContextwhich defaults an unset flag to enabled.catchdiscarded the error with no log and no record, so a failed sync looked identical to a benignqueued.Changes
forceRefreshtoresolveGithubConnectorDiscovery/applyGithubConnectorDiscovery; the webhook auto-import path forces a fresh discovery so the latest head revision and files are fetched → new version created on push.autoImportNewPluginsas enabled (!== false) so already-configured repos re-sync unless explicitly opted out.console.errorthem and recordstatus: "failed"with the message insummary_json.error.config_object_version.connectorSyncEventIdto the triggering sync event (FK existed in schema but was always writtennull).summary_jsonwith full outcome data:outcome,error,classification,resolvedSourceRevisionRef,discoveredPluginCount,createdMarketplace,createdPlugins,materializedConfigObjects(id/type/path/title/versionId), and timing (startedAt/completedAt/durationMs).completedonly when a version is materialized,partialwhen auto-import ran cleanly but produced no version,failedon error,queuedwhen import didn't run.Tests run
pnpm exec tsc --noEmit -p tsconfig.json(den-api) — cleanbun test test/github-webhook.test.ts test/github-discovery.test.ts test/github-connector-app.test.ts— 12 pass / 0 failFiles
ee/apps/den-api/src/routes/org/plugin-system/store.ts