Skip to content

STC-S Channel minor fixes - #122

Merged
timj merged 9 commits into
masterfrom
u/timj/stcschan-c-fixes
Dec 3, 2026
Merged

timj merged 9 commits into
masterfrom
u/timj/stcschan-c-fixes

Conversation

@timj

@timj timj commented Dec 3, 2026

Copy link
Copy Markdown
Member

No description provided.

timj added 9 commits December 2, 2026 19:03
Generated with AI

Co-Authored-By: SLAC AI
Generated with AI

Co-Authored-By: SLAC AI
ReadSpaceArgs stored the upper limits of a PositionInterval under
DLOLIMIT, over the lower limits, and never wrote DHILIMIT, so
MakeSpaceRegion failed with AST__MPKER for every document containing
one. AST writes a Box or an Interval as a PositionInterval, so it could
not read its own output for those classes. Store the upper limits under
DHILIMIT. test3 in teststcschan.c reads a PositionInterval and reads
back the STC-S written for a Box.

Generated with AI

Co-Authored-By: SLAC AI
GetRegionProps tested Negated before its negated-NullRegion branch, so
the only branch that writes AllSky could never be reached and a negated
NullRegion was written as Not around a NullRegion, which the writer then
refused. Test for the all-sky NullRegion first. test3 reads AllSky and
writes it back, writes a negated NullRegion built directly, writes a
Union built around one, and checks that a negated Circle still goes
through Not and a plain NullRegion is still refused.

Generated with AI

Co-Authored-By: SLAC AI
Read formatted the Unsupported units error from a WordContext and a
buffer pointer that it declared but never initialised; ReadProps had
already consumed the words and freed its own context, so the message
dereferenced whatever the stack held and usually crashed astRead on a
valid document such as Circle ICRS 10 20 1 unit m. Name the unit alone,
as every other error after ReadProps does, and remove the two
declarations. test3 checks the error and its exact message for a Circle
and a PositionInterval, and that arcsec still scales a Circle.

Generated with AI

Co-Authored-By: SLAC AI
…of crashing

GetRegionProps formats the centre, limits, vertices or position of a
Region into a string one axis at a time and stops at the first undefined
value with a warning. It then removed the trailing space from that
string, which is still NULL when the first value was undefined, so
astWrite crashed instead of returning zero. Store each property only
when the string holds a value, as ReadSpaceArgs already does.

Found by the review of the three fixes above: astRead simplifies a
TimeInterval combined with AllSky to an Interval whose spatial bounds
are undefined, and writing that Region crashed. test3 writes such an
Interval built directly and the Region read from that document, and
expects zero objects and the undefined-lower-limit warning.

Generated with AI

Co-Authored-By: SLAC AI
GetRegionProps creates a KeyMap for the properties of a negated Region,
stores a clone of it in the parent KeyMap, and never annulled its own
pointer, so every Not sub-phrase written leaked the KeyMap and its
contents. Annul it once it has been stored, as the compound-Region
branch already does.

Found by the review of the three fixes above: LeakSanitizer reported
the leak from test3's negated Circle write. teststcschan_c now runs
clean with ASAN_OPTIONS=detect_leaks=1; ctest itself runs with leak
detection off, so this has no C assertion.

Generated with AI

Co-Authored-By: SLAC AI
…round-trip an Interval

The check for a PositionInterval with fillfactor and GEOCENTER before
the limits now asserts the Box bounds as well as the fill factor, since
the extra words shifting the limit positions is what could mis-assign
them. An Interval is written and read back alongside the Box, because
the writer handles both classes in the same PositionInterval branch and
the release note names both.

Generated with AI

Co-Authored-By: SLAC AI
Five fragments of one type for one pull request take towncrier's
counter suffix, 122.serialisation.1 to .5; the README now says so.

Generated with AI

Co-Authored-By: SLAC AI
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.50%. Comparing base (9d383cb) to head (d44db84).
⚠️ Report is 10 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/stcschan.c 66.66% 3 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
+ Coverage   65.38%   65.50%   +0.11%     
==========================================
  Files          85       85              
  Lines       98692    98699       +7     
  Branches    33161    33167       +6     
==========================================
+ Hits        64532    64654     +122     
+ Misses      17679    17566     -113     
+ Partials    16481    16479       -2     

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

@timj
timj merged commit 37f52a2 into master Dec 3, 2026
39 checks passed
@timj
timj deleted the u/timj/stcschan-c-fixes branch December 3, 2026 05:20
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