Skip to content

[Bug] Uninstall cleanup query uses wrong column name for installation ID #92

@jonathanchang31

Description

@jonathanchang31

Summary

installation.deleted cleanup uses a raw where clause with installationId instead of DB column installation_id:

.where("installationId = :id", { id: String(installationId) })

Because this is a raw SQL fragment, entity property names are not guaranteed to map to snake_case DB columns. Cleanup may fail to match rows.

Impact

High / state integrity:

  • Repos may remain linked to removed installation after uninstall.
  • registered/installation state can drift from GitHub app reality.
  • Future lifecycle events/backfill decisions can run against stale installation linkage.

Repro (conceptual)

  1. Install app for repos (rows have installation_id set).
  2. Trigger installation.deleted.
  3. Observe cleanup query uses installationId in raw where fragment.
  4. Rows may not be cleared due to column-name mismatch.

Expected behavior

Uninstall cleanup should reliably clear all repos by installation_id and set registered=false.

Suggested fix direction

  • Use DB column name in raw fragment:
  • where("installation_id = :id", { id: ... })
  • Or use object-based criteria API to avoid column-name mismatch risk.
  • Add regression test for uninstall cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions