Skip to content

Standardize delete! and merge!#1212

Merged
Affie merged 6 commits intodevelopfrom
std/merge_delete
Mar 23, 2026
Merged

Standardize delete! and merge!#1212
Affie merged 6 commits intodevelopfrom
std/merge_delete

Conversation

@Affie
Copy link
Member

@Affie Affie commented Mar 23, 2026

Warning

Pinned StructUtils.jl to v2.7.0 because of something breaking in v2.7.1

@Affie Affie added this to the v0.29.0 milestone Mar 23, 2026
@Affie Affie requested a review from Copilot March 23, 2026 09:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates DistributedFactorGraphs.jl to standardize delete!/merge!-style return values (favoring numeric counts and idempotent “0” results), adds/exports several “has*” helpers, and expands the test suite accordingly. It also pins StructUtils to v2.7.0.

Changes:

  • Standardize many delete operations to return 0 on missing targets (instead of throwing) and adjust tests accordingly.
  • Introduce patch/merge-conflict behavior (via patch! and MergeConflictError) and update merge paths (e.g., mergeGraph!, GraphsDFG merge implementations).
  • Add/extend API surface + tests for bloblets, states, and blobstore link merging; pin StructUtils compat to =2.7.0.

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/testBlocks.jl Updates expectations for delete/merge return values; adds extended test blocks for bloblets, states, blobstores.
test/interfaceTests.jl Adds new testsets invoking the new/extended test blocks.
test/iifInterfaceTests.jl Aligns delete semantics in IIF driver tests to new “0 on missing” behavior.
src/services/Tags.jl Changes DFG-level mergeTags!/deleteTags! return values to numeric counts.
src/services/DFGVariable.jl Updates bulk state add counts, state delete to return 0 when missing, and listStates(dfg) to return a Vector.
src/services/Bloblet.jl Adds has*Bloblet wrappers at the DFG service layer.
src/services/AbstractDFG.jl Adds blobstore helpers (getBlobstores, mergeStorelink!, mergeStorelinks!, hasBlobstore), changes bulk merge sums, refactors mergeGraph!, and renames buildSubgraphgetSubgraph (with deprecations elsewhere).
src/serialization/DFGStructStyles.jl Adds TODO note re: StructUtils v2.7 and StaticArrays support.
src/errors.jl Introduces MergeConflictError.
src/entities/DFGVariable.jl Adds patch! for Variable/Summary/Skeleton, and tweaks VariableDFG constructor signature.
src/entities/DFGFactor.jl Adds patch! for Factor-related types and introduces merge-conflict checks.
src/entities/Bloblet.jl Makes bloblet delete idempotent (0 on missing), adjusts bulk operations, and adds hasBloblet.
src/entities/Agent_and_Graph.jl Adds patch/merge behavior for Agent/Graphroot metadata.
src/GraphsDFG/services/GraphsDFG.jl Uses patch! for merges; makes variable/factor/blobentry deletes return 0 when missing.
src/GraphsDFG/GraphsDFG.jl Imports MergeConflictError/patch! and related accessors for updated merge behavior.
src/DistributedFactorGraphs.jl Exports new has*Bloblet functions; changes getObservation from export to public; updates unstable function list (e.g., getSubgraph).
src/Deprecated.jl Moves old graph copy/merge helpers here and adds deprecations (buildSubgraphgetSubgraph).
src/DataBlobs/services/BlobStores.jl Makes blob deletes idempotent (0 on missing/already deleted) and updates tombstone content.
src/DataBlobs/services/BlobEntry.jl Makes deleteBlobentry! idempotent (0 on missing).
Project.toml Pins StructUtils compat to =2.7.0.
Comments suppressed due to low confidence (1)

src/DataBlobs/services/BlobEntry.jl:67

  • deleteBlobentry! now returns 0 when the label is missing, but deleteBlobentries! still returns length(labels) regardless of whether anything was actually deleted. That makes the bulk return value misleading and inconsistent with the updated single-delete semantics; consider summing the per-label results (and using foreach instead of broadcasting if you want to ignore intermediate arrays).
function deleteBlobentry!(node, label::Symbol)
    !haskey(refBlobentries(node), label) && return 0
    pop!(refBlobentries(node), label)
    return 1
end

deleteBlobentry!(node, entry) = deleteBlobentry!(node, getLabel(entry))

function deleteBlobentries!(node, labels::Vector{Symbol})
    deleteBlobentry!.(node, labels)
    return length(labels)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 83.15789% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.01%. Comparing base (f1cea48) to head (464c386).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
src/entities/DFGVariable.jl 63.63% 8 Missing ⚠️
src/entities/Agent_and_Graph.jl 64.70% 6 Missing ⚠️
src/entities/DFGFactor.jl 85.00% 6 Missing ⚠️
src/Deprecated.jl 88.09% 5 Missing ⚠️
src/services/AbstractDFG.jl 90.32% 3 Missing ⚠️
src/errors.jl 33.33% 2 Missing ⚠️
src/DataBlobs/services/BlobEntry.jl 50.00% 1 Missing ⚠️
src/DataBlobs/services/BlobStores.jl 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1212      +/-   ##
===========================================
+ Coverage    72.37%   75.01%   +2.63%     
===========================================
  Files           37       37              
  Lines         2360     2465     +105     
===========================================
+ Hits          1708     1849     +141     
+ Misses         652      616      -36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Affie Affie self-assigned this Mar 23, 2026
@Affie Affie merged commit ddf99a4 into develop Mar 23, 2026
6 checks passed
@Affie Affie deleted the std/merge_delete branch March 23, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

delete! should not error (LabelNotFoundError) if node already deleted merge! should be cascading

2 participants