Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Opt-in fixture export splitting by DocType to reduce merge conflicts | GoodFirstPicks

Opt-in fixture export splitting by DocType to reduce merge conflicts

frappe/frappe 0 comments 13d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeTest focusedFrappe / ERPNextPython

Why this is a good first issue

The issue proposes a feature to reduce merge conflicts by splitting fixture exports by DocType.

AI Summary

The issue addresses frequent Git merge conflicts caused by fixture exports being dumped into a single JSON file. The proposed solution introduces an opt-in mechanism to split these exports into directories grouped by DocType, requiring changes to fixture handling logic and ensuring backward compatibility. While the requirements are somewhat clear, the implementation involves cross-cutting changes and handling file-to-folder transitions.

Issue Description

Fix: Reduce Git Merge Conflicts in Fixture Exports by Splitting Records per DocType

Problem

In team environments, bench export-fixtures dumps Custom Field (and Property Setter, etc.) records into a single large JSON file. Because records are added in database insertion order, two developers touching different DocTypes often produce conflicting line positions in the same file — even when their changes are logically independent.

This leads to frequent and unnecessary Git merge conflicts.


Proposed Solution

Introduce an opt-in mechanism to split fixture exports into a directory structure, where records are grouped by their parent DocType (dt).

Opt-in via hooks.py

fixture_split_by_dt = True

This ensures zero breaking changes for existing apps.

Directory Structure

Before:

fixtures/
    custom_field.json

After:

fixtures/
    custom_field/
        sales_order.json
        customer.json

Automatic Fallback

If a DocType does not have a dt field, it falls back to the original single-file export.

Improved Determinism

Updated default ordering in export_json to:

order_by="name asc"

This ensures consistent fixture exports across environments.


Changes

frappe/utils/fixtures.py

  • Added export_json_split_by_dt
  • Added _post_process_fixture_docs helper (extracted from export_json)
  • Updated import_fixtures to support directory-based fixtures
  • Added stale artifact cleanup logic (handles file ↔ folder transitions)

frappe/core/doctype/data_import/data_import.py

  • Refactored export_json to use shared helper
  • Applied deterministic ordering (name asc)

Tests

  • test_fixture_split_by_dt
  • test_fixture_split_fallback_no_dt_field

How to Test

  1. Add to your app's hooks.py:

    fixture_split_by_dt = True
    
  2. Run:

    bench --site [site] export-fixtures
    
  3. Verify fixtures/ now c

GitHub Labels

feature-request

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • cross-cutting changes
  • file ↔ folder transitions
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes