A changelog of all work completed on the Podcast Index batch changes demo.
Created a synthetic mono repo to demonstrate Sourcegraph batch changes capabilities, including both simple string replacements and complex AST-level code transformations.
Prompt: Implement a mono repo structure for a Podcast Index demo with intentionally vulnerable React/Next.js dependencies.
Work Completed:
-
Created root workspace configuration:
package.json- pnpm workspace configpnpm-workspace.yaml- workspace definitiontsconfig.base.json- shared TypeScript config
-
Created
packages/shared-ui(React 19.1.0):Button.tsx- Reusable button component with variantsCard.tsx- Card component with Header/Body/Footer subcomponentsInput.tsx- Input component with label, error, and icon supportindex.ts- Component exports
-
Created
packages/api-service(Next.js 15.1.0, React 19.1.0):app/api/episodes/route.ts- GET endpoint for episodesapp/api/search/route.ts- GET endpoint for searchapp/api/subscribe/route.ts- POST endpoint for subscriptionslib/podcast-data.ts- Mock podcast/episode data and helpers
-
Created
packages/web-app(Next.js 15.1.0, React 19.1.0):app/layout.tsx- Root layout with header navigationapp/page.tsx- Homepage with episode list and searchapp/actions.ts- Server Functions (vulnerable code path)components/EpisodeCard.tsx- Episode display cardcomponents/SearchBar.tsx- Search with live resultscomponents/SubscribeButton.tsx- Subscription modal- Tailwind CSS configuration
-
Created
README.mdwith project documentation
Files Created: 27 files across 3 packages
Prompt: Move all files into batch-changes-demo folder.
Work Completed:
- Created
batch-changes-demo/directory - Moved all root files and
packages/directory into it
Prompt: Add demo for batch changes executing complex rewrite logic, not just simple string replacements.
Work Completed:
-
Added
console.log/error/warncalls throughout the codebase:packages/api-service/app/api/episodes/route.ts- 4 logging callspackages/api-service/app/api/search/route.ts- 3 logging callspackages/api-service/app/api/subscribe/route.ts- 8 logging callspackages/api-service/lib/podcast-data.ts- 12 logging callspackages/web-app/app/actions.ts- 10 logging calls
-
Created structured logger utility:
packages/shared-ui/src/logger.ts- Target format for migration- Documents the transformation with before/after examples
- Exports
logger.debug(),logger.info(),logger.warn(),logger.error()
-
Updated
packages/shared-ui/src/index.tsto export logger -
Updated
README.mdwith:- Demo Scenario 2 documentation
- Explanation of why this is complex (AST-level understanding required)
- Verification commands
Total console. calls added:* 37 (excluding logger.ts internals)
Prompt: Create batch changes following Sourcegraph documentation.
Work Completed:
-
Created
batch-specs/directory -
Created
batch-specs/upgrade-react-nextjs.yaml:- Simple string replacement using
sed - Upgrades
react19.1.0 → 19.1.4 - Upgrades
react-dom19.1.0 → 19.1.4 - Upgrades
next15.1.0 → 15.1.11 - Includes PR template with CVE references
- Simple string replacement using
-
Created
batch-specs/migrate-to-structured-logger.yaml:- Complex AST rewrite using comby
- 7 comby transformation steps for different patterns:
console.log('msg')→logger.info('msg')console.log('msg:', var)→logger.info('msg', { var })console.error(...)→logger.error(...)console.warn(...)→logger.warn(...)
- Shell script step to add missing imports
- Detailed PR template explaining the transformation
-
Updated
README.mdwith:- Batch Specs section with table of specs
- Prerequisites (Sourcegraph CLI installation)
- Preview and apply commands
- Batch spec details with code examples
- Updated structure diagram
batch-changes-demo/
├── batch-specs/
│ ├── migrate-to-structured-logger.yaml # Complex rewrite (comby)
│ └── upgrade-react-nextjs.yaml # Simple replacement (sed)
├── packages/
│ ├── api-service/ # Next.js 15.1.0 API
│ │ ├── app/
│ │ │ ├── api/
│ │ │ │ ├── episodes/route.ts
│ │ │ │ ├── search/route.ts
│ │ │ │ └── subscribe/route.ts
│ │ │ ├── layout.tsx
│ │ │ └── page.tsx
│ │ ├── lib/podcast-data.ts
│ │ ├── next.config.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ ├── shared-ui/ # React 19.1.0 components
│ │ ├── src/
│ │ │ ├── Button.tsx
│ │ │ ├── Card.tsx
│ │ │ ├── index.ts
│ │ │ ├── Input.tsx
│ │ │ └── logger.ts
│ │ ├── package.json
│ │ └── tsconfig.json
│ └── web-app/ # Next.js 15.1.0 frontend
│ ├── app/
│ │ ├── actions.ts
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── components/
│ │ ├── EpisodeCard.tsx
│ │ ├── SearchBar.tsx
│ │ └── SubscribeButton.tsx
│ ├── next.config.ts
│ ├── package.json
│ ├── postcss.config.js
│ ├── tailwind.config.ts
│ └── tsconfig.json
├── package.json
├── pnpm-workspace.yaml
├── tsconfig.base.json
├── prompt-log.md
└── README.md
| Package | Version | Purpose |
|---|---|---|
| react | 19.1.0 | CVE-2025-55182, CVE-2025-55183, CVE-2025-55184, CVE-2025-67779 |
| react-dom | 19.1.0 | Same RSC vulnerabilities |
| next | 15.1.0 | Affected by React RSC vulnerabilities |
- Batch Spec:
upgrade-react-nextjs.yaml - Tool:
sed - Transformation: Version string updates in package.json
- Batch Spec:
migrate-to-structured-logger.yaml - Tool:
comby - Transformation: console.* → structured logger with metadata extraction
# Install dependencies
cd batch-changes-demo && pnpm install
# Run development servers
pnpm dev
# Preview batch changes
src batch preview -f batch-specs/upgrade-react-nextjs.yaml
src batch preview -f batch-specs/migrate-to-structured-logger.yaml
# Verify vulnerable dependencies
find packages -name "package.json" | xargs grep -E '"(react|next)":'
# Count console.* calls (before migration)
grep -r "console\.\(log\|error\|warn\)" packages --include="*.ts" --include="*.tsx" | grep -v logger.ts | wc -l