Skip to content

Instantly share code, notes, and snippets.

View aaronschachter's full-sized avatar

Aaron Schachter aaronschachter

  • San Francisco, CA
View GitHub Profile
@aaronschachter
aaronschachter / gist:0a03ffd8326a5a4dbb30cedff2c89484
Created June 30, 2026 05:55
Manual testing steps for CMS alt text updater DDA migration (CONT-5978)
# Manual Testing: CMS Alt Text Updater DDA Migration
## What changed
`RecommendationCmsItemAltTextUpdater` now reads via `CMSItemService.getItems` and writes via `CMSItemService.patchItems` instead of the legacy `getCMSItems`/`updateCMSItemPartial` path.
## Automated coverage
- **Unit tests** (`cmsItemAltTextUpdater.test.ts`): cover all field types (ImageRef, MultiImage, RichText node array, RichText HTML), error handling, and patchItems error propagation
- **Integration test** (`cmsItemAltTextUpdater_test.ts`): exercises a real ImageRef field update against both storage layers (Mongo and PG)

CMS Component Usages Orphan Handling - Notes

Roope's RFC: Slack thread | Confluence design note | PR #112752

Context

cms_component_usages is a PG table that indexes which components are used in which RTF field of which CMS item (CMSAUTH-5260). Collection schemas live in Mongo, usages in PG, so they can drift. The most common reads are cross-collection ("where is component X used?"), so read-time filtering via per-result PG-to-Mongo liveness checks is too expensive.

The open decision

@aaronschachter
aaronschachter / handoff.md
Created June 29, 2026 17:02
Aaron PTO Handoff (Jun 30 - Jul 11)

Aaron PTO Handoff (Jun 30 - Jul 11)

Collection Field Groups

Status: Feature complete in beta. Promotion to v2 blocked on flag rollout to 100%.

  • Parent ticket: CONT-2080
  • Flag: CMS_COLLECTION_FIELD_GROUPS
  • Slack: #proj-cms-groupings
  • PM: Jordan Branch
@aaronschachter
aaronschachter / refactor-skip-validation.md
Created June 27, 2026 00:29
Refactor: derive validation skip flags from payload inspection in updateCMSItems

Refactor: Derive validation skip flags from payload inspection in updateCMSItems

Problem

In updateCMSItems.ts, skipUniqueValidation and skipItemRefValidation are coupled. Both read from opts.skipUniqueValidation:

// entrypoints/server/lib/logic/cms/items/updateCMSItems.ts, lines 408-413
skipUniqueValidation:
 isSubsequentPublicationOperation ||

"Duplicate locales provided" Error Investigation

Date: 2026-06-24 Zendesk: #1152735 Triage thread: #triage-build-content First spotted: Aaron flagged during June 17 deploy

Error

BadArgumentError: Invalid argument provided: Duplicate locales provided

@aaronschachter
aaronschachter / cms-pg-null-name-slug-investigation.md
Last active June 17, 2026 05:04
Investigation: How CMS draft-change items end up with null name/slug in PG storage

CMS PG Storage: Apparent Null name/slug During Sitemap Generation

Summary

109,574 errors across 12,062 unique sites in 3 days (June 8-10, 2026), all from sitemap generation during publish:

[sitemap] Failed to get published items for draft changes items
AppError [BadDatabaseStateError]: Expected a non-nullable string
 at intoNonNull (CMSItem.ts:298)

CMSEXT-2034: Sitemap silently drops draft-changes CMS items on PG-backed sites

Bug Summary

getItemsInCollections in entrypoints/server/lib/sitemapUtils.ts builds a draftChangesPublishedItemsQuery to fetch published slugs for draft-changes items. That query is missing name in its returnFields. On PG-backed collections, the CMS storage layer's CMSItem.get name accessor calls intoNonNull, which throws BadDatabaseStateError: Expected a non-nullable string when name is undefined. The error is caught silently and logged as logger.warn, causing all draft-changes items for that collection to be dropped from the sitemap.

Fix: Add {field: {slug: 'name'}, include: true} to the live query's returnFields (PR #111007).

Impact

@aaronschachter
aaronschachter / dda-query-builder-monitoring.md
Created June 9, 2026 21:16
DDA Query Builder Rollout Monitoring - CMSEXT-2041

DDA Query Builder Rollout Monitoring

Merged PRs (2026-06-09)

  • #111065 -- Extract CMS query builder into DDA domain package
  • #111194 -- Gate remaining convertToCMSQueryType callsites behind CMS_DDA_QUERY_BUILDER

Feature flag: ff-cmsext-2041-dda-query-builder (FEATURE_FLAGS.CMS_DDA_QUERY_BUILDER)


@aaronschachter
aaronschachter / cmsext-2030-investigation.md
Last active May 28, 2026 04:02
CMSEXT-2030: SIP slug validation investigation

CMSEXT-2030: SIP Slug Validation Investigation

Item under investigation

  • Item ID: 696102c94181b4eaba29f101
  • Collection ID: 65e89895c5a4b8d764c0d895
  • Slug: learning-and-development-trends
  • Site ID: 65e89895c5a4b8d764c0d710
  • Last successful publish: 2026-05-12T08:10:55.491Z
@aaronschachter
aaronschachter / stale-branch-domain-pruning.md
Last active May 27, 2026 07:09
One-pager: Stale branch domain pruning to reduce SIP latency

Stale Branch Domain Pruning

Problem

Sites with many published branch staging domains accumulate distinct live publications. During Single Item Publish (SIP), writeToAllLive fans out CMS writes to every distinct lastPublicationId across all domains, including branch domains. This scales linearly with the number of distinct publications.

Example: Synthesia (enterprise, localized, custom staging domain) has 8 live publications, including several from branch domains published in April/early May that were never merged or deleted. SIP traces show 43-46s durations, with users experiencing spinning publish buttons, 504 timeouts, and items stuck in "Changes in Draft."

Why this happens