MemberJunction / MemberJunction/MJ
MetadataSync: push scripts capture AI Prompt Run telemetry (transactional rows) alongside metadata
- Dominant language
- TSQL
- Stars
- 29
- Forks
- 6
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 323
Description
## What happens
`mj sync push` with `formatAsMigration` writes a `MetadataSync_Push_*.sql` script of everything the push executed. When a pushed record triggers an LLM-backed step — an `MJ: Queries` row's field extraction, an `MJ: AI Prompts` row's model run — the script also captures the resulting `spCreateAIPromptRun` / `spUpdateAIPromptRun` calls: 100 KB+ `Messages`/`Result` blobs with hardcoded PromptID / ModelID / VendorID that must exist in every target database.
Seen twice this week in Betty PRs (a query push carried ~600 lines of prompt-run rows; a prompt push carried two). Each had to be stripped by hand before commit, and one reviewer had to explain why a "metadata" migration contained conversation transcripts.
## Proposal
The push log should exclude transactional entities by default — at minimum `MJ: AI Prompt Runs`, `MJ: AI Agent Runs`, `MJ: AI Agent Run Steps`, `MJ: Action Execution Logs` — or, more generally, any entity not in the pushed directory set and not reached through a declared `relatedEntities` link. An `excludeEntitiesFromScript` list in `.mj-sync.json` would cover the rest.
Contributor guide
Research direction
Start at the `mj sync push` path when `formatAsMigration` generates `MetadataSync_Push_*.sql`, and trace how pushed entities and related entities enter the script. Compare the generated calls against the proposed exclusions and `.mj-sync.json` `excludeEntitiesFromScript`; done means transactional AI, agent, and action-log rows are omitted by default while declared pushed or related metadata remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- database, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100