MemberJunction / MemberJunction/MJ

mj sync push --dry-run reports every record as "Would update"

Open
#4,529 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TSQL
Stars
29
Forks
6
Avg merge
2d 1h
Merged PRs (30d)
323

Description

**Describe the bug**

`mj sync push --dry-run` reports every record as an update. It printed `[DRY RUN] Would update` for all 186 records and summarised `Updated 186 / Unchanged 0`, two minutes after a real push of the same directory against the same database had found `Unchanged 164`.

A dry run is how you check what a push would do before letting it write. If it claims every record changes, it cannot be used for that, and a real change is indistinguishable from the noise.

**To Reproduce**

1. Point the CLI at a database and push a metadata directory so it is fully in sync: `mj sync push --dir= --ci`
2. Immediately run the same push as a dry run: `mj sync push --dir= --ci --dry-run`
3. Compare the two summaries.

Observed, with the BizApps Common metadata directory against a SQL Server database (MJ 6.1.0-edge.6):

Real push:

```
Created 6 Updated 16
Deleted 0 Unchanged 164
Total 186 records
```

Dry run, two minutes later, nothing changed in between:

```
Created 0 Updated 186
Deleted 0 Unchanged 0
Total 186 records
```

Every record was listed individually as `[DRY RUN] Would update MJ: Applications record`, and so on.

**Expected behavior**

The dry run reports the same counts the equivalent real push would: with the directory already in sync, `Unchanged 186`.

**Additional context**

Not verified, but the shape suggests the dry-run path skips the change detection the real push does and reports "would update" for anything it would touch.

Possibly related: #4530 — a real push right after a `pull` also reports every record as updated, while the push after that reports them unchanged. Both look like change detection disagreeing with what is already on disk, but they have different triggers, so they are filed separately.

Found while testing metadata-sync fixes (#4460, #4461). Not a regression from those: it reproduces on `next` without them.

Contributor guide

Open the contributing guide

Research direction

Start at the `mj sync push` CLI entry point and reproduce the real push followed by the equivalent `--dry-run` command against the same directory and database. Trace where change detection feeds the dry-run summary; done means an in-sync directory reports the same counts in both modes, including `Unchanged 186` rather than marking every record for update.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
cli, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.