Skip to content

Loosen linkdim(::AbstractITensorNetwork, ::AbstractEdge) signature#373

Merged
mtfishman merged 1 commit into
mainfrom
mf/linkdim-loosen-edge
May 28, 2026
Merged

Loosen linkdim(::AbstractITensorNetwork, ::AbstractEdge) signature#373
mtfishman merged 1 commit into
mainfrom
mf/linkdim-loosen-edge

Conversation

@mtfishman
Copy link
Copy Markdown
Member

@mtfishman mtfishman commented May 28, 2026

Summary

Drop the where V constraint on linkdim(::AbstractITensorNetwork{V}, ::AbstractEdge{V}). The previous form required the network's vertex-type parameter and the edge's vertex-type parameter to bind to the same V, which fails when the network's V is abstract and the edge's V is a concrete subtype (e.g. an ITensorNetwork{Any} paired with a NamedEdge{Int}). linkinds itself accepts the edge in that case, so the constraint was just blocking dispatch unnecessarily.

@mtfishman mtfishman force-pushed the mf/linkdim-loosen-edge branch from 837fabb to 1fde7ef Compare May 28, 2026 18:58
The previous signature
`linkdim(tn::AbstractITensorNetwork{V}, edge::AbstractEdge{V}) where V`
required the network's vertex-type parameter and the edge's vertex-type
parameter to match exactly. For graphs with abstract V (e.g. the
`NamedGraph{Tuple}` produced by `named_binary_tree`, where vertices are
tuples of varying arity), downstream operations can produce edges whose
V parameter is a strict subtype — for example, `subgraph(g, vs)` where
`vs` came from a Dict's keys and concretized to
`Tuple{Int64, Vararg{Int64}}`. In that situation dispatch failed with
`MethodError` even though `linkinds` itself accepts the edge fine.

Drop the `{V}` constraint so `linkdim` accepts any `AbstractEdge`
alongside any `AbstractITensorNetwork`. Behavior is unchanged for cases
that previously dispatched; previously-failing cases now go through.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman force-pushed the mf/linkdim-loosen-edge branch from 1fde7ef to 9f112b3 Compare May 28, 2026 19:00
@mtfishman mtfishman enabled auto-merge (squash) May 28, 2026 19:05
@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.91%. Comparing base (c0cb74d) to head (9f112b3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #373      +/-   ##
==========================================
+ Coverage   76.87%   76.91%   +0.03%     
==========================================
  Files          58       58              
  Lines        2638     2638              
==========================================
+ Hits         2028     2029       +1     
+ Misses        610      609       -1     
Flag Coverage Δ
docs 51.72% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

mtfishman added a commit to ITensor/ITensorActions that referenced this pull request May 28, 2026
…@v3) (#119)

## Summary

`julia-actions/cache@v3` (introduced via #118) saves caches **on job
failure** by default, where v2 only saved on success. The escape hatch
documented in the v3 release notes is `save-always: false`. This PR sets
that on every `julia-actions/cache@v3` invocation in the reusable
workflows here.

The new v3 default is reasonable for the common case (test-failure
retries reuse the expensive depot install). But when the failure is in
the *setup* itself — a half-installed depot, an aborted `Pkg` precompile
— the broken state is cached, the restore-key prefix matches subsequent
runs, and every retry restores the broken state and fails identically.
Reruns alone can't recover; the cache has to be manually evicted or
expire.

This was hit on
[`ITensor/ITensorNetworks.jl#373`](ITensor/ITensorNetworks.jl#373):
a fresh Windows run failed in `Pkg.test` precompilation (`ChainRulesCore
is required but does not seem to be installed`), the broken state was
cached, and two reruns reproduced the failure verbatim by restoring from
that cache.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mtfishman mtfishman merged commit f32e189 into main May 28, 2026
26 of 32 checks passed
@mtfishman mtfishman deleted the mf/linkdim-loosen-edge branch May 28, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant