Skip to content

[Fixes #14788][5.1.x] Replace creates a duplicate layer when the dataset has no ModelSchema - #14814

Merged
etj merged 3 commits into
5.1.xfrom
14794-51x-fix_modelschema
Dec 3, 2026
Merged

etj merged 3 commits into
5.1.xfrom
14794-51x-fix_modelschema

Conversation

@etj

@etj etj commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #14794
Fixes #14788

Checklist

Reviewing is a process done by project maintainers, mostly on a volunteer basis. We try to keep the overhead as small as possible and appreciate if you help us to do so by completing the following items. Feel free to ask in a comment if you have troubles with any of them.

For all pull requests:

  • Confirm you have read the contribution guidelines
  • You have sent a Contribution Licence Agreement (CLA) as necessary (not required for small changes, e.g., fixing typos in the documentation)
  • Make sure the first PR targets the master branch, eventual backports will be managed later. This can be ignored if the PR is fixing an issue that only happens in a specific branch, but not in newer ones.

The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):

  • There is a ticket in https://github.com/GeoNode/geonode/issues describing the issue/improvement/feature (a notable exemption is, changes not visible to end-users)
  • The issue connected to the PR must have Labels and Milestone assigned
  • PR for bug fixes and small new features are presented as a single commit
  • PR title must be in the form "[Fixes #<issue_number>] Title of the PR"
  • New unit tests have been added covering the changes, unless there is an explanation on why the tests are not necessary/implemented

Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.

@cla-bot cla-bot Bot added the cla-signed CLA Bot: community license agreement signed label Dec 3, 2026
Copilot AI balanced review requested due to automatic review settings December 3, 2026 13:21
@etj etj self-assigned this Dec 3, 2026
@etj
etj requested a review from nrjadkry December 3, 2026 13:22
@etj etj added this to the 5.1.2 milestone Dec 3, 2026
@etj etj linked an issue Dec 3, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Geometry-free CSV uploads can bypass the overwrite guard for raster targets, creating a PostGIS table instead of rejecting the incompatible replacement.

1 open issue
What changed in this PR

Backports #14794 to 5.1.x to fix dataset replacement creating duplicate layers when a ModelSchema is missing.

Changes:

  • Creates missing schemas against the existing dataset table.
  • Prevents failed replacements from dropping existing tables.
  • Adds regression tests for replacement targeting and failure cleanup.
File Description
geonode/​upload/​tests/​unit/​test_task.py Tests error-callback cleanup for uploads and replacements.
geonode/​upload/​handlers/​common/​vector.py Repairs replacement targeting and protects existing tables.
geonode/​upload/​handlers/​common/​tests_vector.py Tests schema reuse, replacement validation, and failure cleanup.
geonode/​upload/​celery_tasks.py Skips destructive cleanup for failed replacements.

Review effort: Balanced

@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.09524% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (5.1.x@e224129). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             5.1.x   #14814   +/-   ##
========================================
  Coverage         ?   76.16%           
========================================
  Files            ?     1000           
  Lines            ?    64040           
  Branches         ?     8839           
========================================
  Hits             ?    48774           
  Misses           ?    13352           
  Partials         ?     1914           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@etj
etj merged commit 6f53374 into 5.1.x Dec 3, 2026
15 checks passed
@etj
etj deleted the 14794-51x-fix_modelschema branch December 3, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed CLA Bot: community license agreement signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace creates a duplicate layer when the dataset has no ModelSchema

4 participants