Skip to content

json+struct: padding bytes and no C code#3440

Draft
petrelharp wants to merge 3 commits intotskit-dev:mainfrom
petrelharp:json-struct-no-c-code
Draft

json+struct: padding bytes and no C code#3440
petrelharp wants to merge 3 commits intotskit-dev:mainfrom
petrelharp:json-struct-no-c-code

Conversation

@petrelharp
Copy link
Contributor

@petrelharp petrelharp commented Mar 20, 2026

This differs from #3437 in that:

  • it removes all C code from tskit
  • it adds some documentation for the json+struct codec

My intention is that we deal with the python and C code separately, so this supercedes #3437. My proposal for the C side of things is in #3439.

)
json_bytes = encoded[start : start + jlen]
blob_bytes = encoded[start + jlen : start + jlen + blen]
blob_bytes = encoded[start + jlen : start + jlen + blen + padding_length]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@benjeffery says in the other PR:

Don't you need the padding at the start? I think the test isn't catching this as its payload is 27, so it's padding is zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol yes - in my defense, I was planning to go adjust that test to include metadata of different lengths, so presumably I would have got this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.90%. Comparing base (afaf3b9) to head (169f2ae).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3440      +/-   ##
==========================================
- Coverage   91.92%   91.90%   -0.02%     
==========================================
  Files          37       37              
  Lines       32153    32095      -58     
  Branches     5143     5135       -8     
==========================================
- Hits        29556    29498      -58     
  Misses       2264     2264              
  Partials      333      333              
Flag Coverage Δ
C 82.64% <ø> (-0.07%) ⬇️
c-python 77.54% <ø> (+0.19%) ⬆️
python-tests 96.40% <100.00%> (+<0.01%) ⬆️
python-tests-no-jit 33.21% <0.00%> (-0.01%) ⬇️

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

Components Coverage Δ
Python API 98.69% <100.00%> (+<0.01%) ⬆️
Python C interface 91.23% <ø> (ø)
C library 88.82% <ø> (-0.04%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petrelharp
Copy link
Contributor Author

The codecov failure here is fine: it's just because we've reduced the number of covered lines in c/tskit/core.c: there's no new uncovered lines.

padding bytes in json+struct codec
@petrelharp petrelharp force-pushed the json-struct-no-c-code branch from 5363644 to 3d0f794 Compare March 21, 2026 15:23
@petrelharp petrelharp requested a review from benjeffery March 22, 2026 16:44
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.

2 participants