Skip to content

refactor(wcs)!: Drop the WCS keyword table, invalidate the cached WCS on any header write - #126

Merged
icweaver merged 1 commit into
mainfrom
wcs-invalidation
Jul 24, 2026
Merged

icweaver merged 1 commit into
mainfrom
wcs-invalidation

Conversation

@icweaver

@icweaver icweaver commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

setindex! on an AstroImage header key previously consulted a ~250-line WCS_HEADERS_TEMPLATES table (expanded into an exact-match Set) to decide whether to mark the cached WCSTransform stale. Such a filter can't be complete. WCS keywords span Papers I–IV plus legacy conventions, with unbounded axis indices and A–Z alternate-system suffixes, and the table had real holes: the expansion only covered axis indices 1–4 and lowercase alternate suffixes, so e.g. img["CRPIX5"] = 3.0 or img["CRPIX1A"] = 3.0 silently left a stale transform in use.

Now any header write marks the cached WCS stale, and it is lazily re-parsed on the next wcs() access. Re-parsing is cheap and header writes are rare, so the extra invalidations cost effectively nothing, while false negatives are gone by construction. The staleness regression test now covers the previously-missed key classes.

Breaking only in the internal sense: the unexported WCS_HEADERS_TEMPLATES/WCS_HEADERS constants are gone, and cache invalidation is now unconditional rather than keyword-filtered.

Split out from #119

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.95%. Comparing base (bb6bcdf) to head (f52d8c3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
+ Coverage   61.13%   61.95%   +0.82%     
==========================================
  Files           9        9              
  Lines        1078     1062      -16     
==========================================
- Hits          659      658       -1     
+ Misses        419      404      -15     

☔ View full report in Codecov by Harness.
📢 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.

@icweaver icweaver changed the title refactor(wcs)!: Drop the WCS keyword table, invalidate the cached WCC on any header write refactor(wcs)!: Drop the WCS keyword table, invalidate the cached WCS on any header write Jul 24, 2026
@icweaver icweaver changed the title refactor(wcs)!: Drop the WCS keyword table, invalidate the cached WCS on any header write refactor(wcs)!: Drop the WCS keyword table, invalidate the cached WCS on any header write Jul 24, 2026
@icweaver
icweaver merged commit ce21a81 into main Jul 24, 2026
6 of 7 checks passed
@icweaver
icweaver deleted the wcs-invalidation branch July 24, 2026 03:54
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