stitchยถ

Walks the per-source detail rows for each tracked app and projects them into the canonical apps table. Inputs are heterogeneous (Installomator labels, Homebrew Cask JSON, AutoPkg recipes, Jamf App Installers metadata, Mac App Store entries); outputs are normalized fields the public catalog serves. For the conceptual overview see Stitching.

async stitch_catalog(session: AsyncSession) tuple[int, int, int, int, int, int, int, int][source]ยถ

Run the stitch process. Builds unified apps rows from ingested Installomator labels, Homebrew Cask records, Mac App Store metadata, AutoPkg recipe-index entries, and Jamf App Installers catalog rows.

Phases:

  1. Installomator-led. For each label, try to match a Cask (token or artifact app-name), a MAS record (by packageID), any AutoPkg recipes (by normalized display name), and any JAI catalog row (by normalized display name). Upsert one apps row per label. Sources land in canonical ordering [installomator, homebrew_cask, autopkg, jamf_app_installer, mas] regardless of which combination is present.

  2. Cask-only. Walk Casks not claimed in phase 1. Cask records donโ€™t expose bundle_id, so no MAS join is attempted, but AutoPkg + JAI name matching is still attempted.

  3. MAS-only with merge-on-collision. Walk MAS records not joined in phase 1. Slug derived from MAS trackName via _slugify(). If the slug collides with an existing phase-1 or phase-2 row, merge the MAS payload into that row via _attach_mas_to_existing_app() rather than skipping (Microsoft Office + Apple Pro Suite are typical collision cases). Otherwise create a new MAS-only row. AutoPkg + JAI name matching still applies for newly-created rows.

AutoPkg and JAI never create new apps. Both are coverage indicators attached to existing apps when their normalized name matches the appโ€™s display name.

Parameters:

session (sqlalchemy.ext.asyncio.AsyncSession) โ€“ Async SQLAlchemy session bound to the target DB.

Returns:

(installomator_apps, cask_only_apps, both_sources, mas_only_apps, mas_merged_apps, autopkg_attached_apps, jai_attached_apps, failed).

  • installomator_apps is the count of apps with an Installomator source

  • cask_only_apps is the count of apps with only a Cask source

  • both_sources is the subset of installomator_apps that also matched a Cask

  • mas_only_apps is the count of newly-created MAS-only rows from phase 3

  • mas_merged_apps is the count of MAS records merged into an existing row via slug collision in phase 3

  • autopkg_attached_apps is the count of apps with one or more AutoPkg recipes attached (across all phases)

  • jai_attached_apps is the count of apps with a JAI catalog row attached (across all phases)

  • failed is the count of records that raised an unexpected error

Return type:

tuple[int, int, int, int, int, int, int, int]