Skip to content

Conversation

@aorumbayev
Copy link
Contributor

@aorumbayev aorumbayev commented Nov 11, 2025

Proposed Changes

  • Regenerated algod/indexer/kmd clients with new generator features: model builder now separates wire vs python names, templates emit _block.py/_ledger_state_delta.py, and block/LedgerStateDelta exports are
    injected only when operations require them. (syncing against latest oas spec refinements from @neilcampbell on ts repo).
  • Added canonical LedgerStateDelta model stack plus richer block model handling (binary keys stay as raw bytes, enum/bool decoding fixed, address fields now use addr(...) helpers) so algod/msgpack responses align
    with js-algorand-sdk behavior.
  • Hardened serde core: _expects_text_value drives UTF‑8 decoding only for textual hints, generic map encode/decode supports binary keys, and decode_bytes_base64 is strict again with a dedicated
    decode_bytes_map_key fallback for msgpack maps.
  • Fixes boolean fields within block model and preserves map keys.

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit_algod_client
   client.py79760524%32, 44–64, 74–104, 115–147, 157–177, 191–219, 228–246, 255–273, 283–303, 312–330, 339–357, 369–389, 401–423, 438–467, 478–502, 515–540, 552–576, 585–603, 614–636, 648–670, 680–700, 710–730, 768, 778–798, 808–828, 837–855, 865–885, 894–912, 946, 956–980, 990–1010, 1021–1045, 1057–1083, 1092–1110, 1120–1140, 1149–1167, 1176–1194, 1203–1221, 1231–1257, 1271–1302, 1311–1329, 1338–1356, 1365–1383, 1417, 1457, 1469–1499, 1510–1530, 1540–1560, 1609, 1618–1636, 1648–1680, 1690–1720, 1731–1762, 1789, 1798–1816, 1826–1846, 1859, 1864, 1866, 1871, 1875, 1880, 1937, 1945, 1948–1952
   exceptions.py7357%13–15
src/algokit_algod_client/models
   _block.py1363276%41–43, 51–57, 63–65, 74–80, 84–91, 96, 108–110
   _ledger_state_delta.py2164081%49–53, 65, 69–71, 84–86, 94–95, 99–101, 114–121, 125–135, 139–142
   _serde_helpers.py1397149%18–22, 26, 37, 42, 49–51, 55–65, 69–77, 82, 86, 93, 103–110, 114–123, 132–150, 160, 172, 182
src/algokit_common
   address.py19479%7, 10, 15, 21
src/algokit_common/serde
   _core.py2802990%83, 139, 145, 214, 227, 237, 239, 252, 256, 259–260, 268, 304–305, 319, 324, 344–345, 355–356, 391, 419–420, 441, 447, 456, 462, 471, 477
   _primitives.py732467%5–7, 11–13, 17, 23, 35–37, 41–43, 47–49, 55, 60–61, 122, 126, 128, 130
src/algokit_indexer_client
   client.py56345519%33, 44–62, 79–110, 125–156, 170–198, 213–244, 259–290, 316–380, 391–413, 425–447, 464–501, 517–551, 563–585, 613–683, 695–717, 770–820, 833–858, 883, 886, 889, 905, 922–960, 980–1024, 1059, 1062, 1065, 1068, 1071, 1074, 1080, 1083, 1086, 1089, 1092, 1095, 1098, 1101, 1104, 1107, 1110, 1113, 1116, 1132, 1141–1157, 1160–1167, 1223, 1226–1227, 1231, 1234–1238, 1241–1248, 1251–1256
src/algokit_indexer_client/models
   _serde_helpers.py13910227%18–22, 26, 31, 35–37, 41–51, 55–65, 69–77, 81–88, 93, 103–110, 114–123, 132–150, 159–167, 171–173, 181–184, 192–195
src/algokit_kmd_client
   client.py39525236%32, 75, 85–116, 126–157, 198, 208–239, 249–280, 321, 332–363, 373–404, 414–445, 455–486, 527, 568, 578–609, 637, 651, 692, 702–733, 743–774, 784–815, 825–856, 866–897, 907–938, 947–965, 977–983, 986–990, 994, 997–1000, 1056, 1059–1060, 1064, 1067–1071, 1074–1081, 1084–1089
   exceptions.py7357%13–15
src/algokit_kmd_client/models
   _serde_helpers.py13910227%18–22, 26, 31, 35–37, 41–51, 55–65, 69–77, 81–88, 93, 103–110, 114–123, 132–150, 159–167, 171–173, 181–184, 192–195
src/algokit_transact/codec
   signed.py35586%18, 20, 23, 39, 43
   transaction.py41295%16, 65
src/algokit_transact/models
   app_call.py32220337%67–81, 85–88, 96, 98, 101, 114, 119, 125, 132–144, 148–251, 295–298, 306, 312–314, 326, 330–332, 341, 354–355, 361–362, 366, 369–375, 378–389, 392–396, 399–402, 405–413, 416–426, 429–436
   state_proof.py1052180%95, 103, 118, 124, 131–142, 148–154
src/algokit_transact/ops
   fees.py20195%28
   group.py21290%15, 22
   validate.py209399%60, 74, 76
src/algokit_transact/signing
   multisig.py541965%17, 19, 21, 32–45, 60, 66, 68, 73
   types.py28968%10, 14, 18–24
src/algokit_utils
   _debugging.py1401490%41–43, 46, 55, 63, 82, 86, 95, 109–113, 139
   algorand.py1051487%66–67, 81–82, 112–113, 140–141, 176–177, 321, 344, 360, 379
   config.py782963%23, 30–34, 73–74, 90, 95, 100, 111–116, 140–156
src/algokit_utils/accounts
   account_manager.py2553985%167, 183–184, 211–216, 295–305, 339–344, 391–393, 422, 461, 481–485, 498, 557, 578, 735, 841, 920, 925, 940–941, 964
   kmd_account_manager.py861286%53–59, 104, 108, 134, 172, 179
src/algokit_utils/applications
   abi.py1376850%75, 111, 117, 119, 121, 141–160, 176, 179–185, 201–214, 227–239, 254–265
   app_client.py76522571%136, 144, 331–334, 337, 340, 343, 346, 358–361, 364, 367, 370, 373, 385, 394, 403, 406–468, 481–539, 563–565, 582–585, 593–596, 604–607, 615–618, 626–629, 640–643, 656, 752–755, 789, 801, 813, 825, 837, 852, 867, 877, 887, 897, 907, 917, 954–967, 983, 1000, 1017, 1034, 1055, 1076, 1166, 1222, 1363, 1427–1428, 1477, 1479, 1485, 1538–1546, 1579–1582, 1585–1588, 1609, 1657, 1686, 1720–1722, 1735–1746, 1791, 1808, 1810, 1813, 1817, 1964–1983, 2013, 2026–2028, 2032, 2043–2044, 2072, 2082–2084, 2087–2109, 2119, 2128–2143, 2148–2153
   app_deployer.py2393984%96, 270, 277, 287–292, 295–299, 375–376, 591, 603–617, 629, 634–637, 646, 660, 667, 674, 703, 715–758
   app_factory.py2702790%429, 450, 459, 651, 661, 711, 943, 957–962, 973–974, 1007, 1045, 1063–1064, 1107, 1115–1128
   app_manager.py2231892%258, 279–280, 350–351, 396–401, 433, 457–458, 488, 516–519, 551, 560
src/algokit_utils/applications/app_spec
   arc32.py95892%198–207
   arc56.py5741997%171, 292, 308–309, 379, 399–401, 453, 462, 464, 736, 750, 909, 911, 968, 970–971, 987
src/algokit_utils/assets
   asset_manager.py1281291%282–283, 292, 298–322, 332
src/algokit_utils/clients
   client_manager.py1735171%79–86, 111, 143–145, 205, 216–219, 244, 283, 318–323, 358–360, 393, 414, 435, 480–483, 523–526, 567–570, 607–610, 632–657, 695, 708, 720
   dispenser_api_client.py912078%89, 93, 134–135, 139–142, 190–200, 210–221
src/algokit_utils/errors
   logic_error.py541180%90, 105–121
src/algokit_utils/models
   account.py921584%32, 34, 80–81, 128, 136, 144, 168–175, 188, 196, 209, 217
   amount.py1021783%35, 42, 88, 98, 104, 112, 117–119, 126, 131–133, 140, 147, 160, 166
   state.py41588%61, 65–68
   transaction.py51394%66, 86, 91
src/algokit_utils/transactions
   transaction_composer.py112610691%91, 101–105, 599, 644, 647, 652, 656–667, 699, 736, 816, 823, 845, 884, 981–1010, 1039, 1067–1082, 1087, 1095, 1097, 1099, 1115, 1121, 1159, 1167, 1276, 1326, 1410, 1412–1413, 1806–1807, 1846–1847, 1888, 2101, 2104, 2123, 2128, 2156–2158, 2199–2235, 2242–2249, 2391, 2395, 2528, 2530–2531, 2581–2582
   transaction_creator.py75791%394, 427, 482, 520, 557, 590, 688
   transaction_sender.py1611094%101, 270, 313–314, 712–717, 722–723, 888
TOTAL11426275676% 

Tests Skipped Failures Errors Time
479 0 💤 0 ❌ 0 🔥 1m 39s ⏱️

Copilot finished reviewing on behalf of aorumbayev November 11, 2025 11:47
Copy link

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 refactors msgpack decoding to correctly handle raw bytes and non-string map keys, fixes boolean fields in the block model, and synchronizes API field naming with the latest OpenAPI specification. The changes address data integrity issues when decoding msgpack responses with non-UTF-8 decodable keys and values.

  • Changes msgpack unpacking from raw=False to raw=True to preserve byte data integrity
  • Updates block model to use bytes and int keys for state deltas instead of str keys
  • Corrects API generator to use x-algokit-field-rename for Python field names while preserving wire names

Reviewed Changes

Copilot reviewed 30 out of 31 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/algokit_algod_client/client.py Updates msgpack decoding to use raw=True and adds byte-to-string conversion logic
src/algokit_indexer_client/client.py Updates msgpack decoding to use raw=True and adds byte-to-string conversion logic
src/algokit_kmd_client/client.py Updates msgpack decoding to use raw=True and adds byte-to-string conversion logic
src/algokit_algod_client/models/block.py Changes state delta and state proof tracking keys from str to bytes/int with proper encoders/decoders
src/algokit_algod_client/models/_teal_key_value.py Changes key field from str to bytes with base64 encoding
src/algokit_algod_client/models/_eval_delta_key_value.py Changes key field from str to bytes with base64 encoding
src/algokit_algod_client/models/_pending_transaction_response.py Corrects wire names for app_id and asset_id fields
src/algokit_algod_client/models/_get_block_tx_ids_response_model.py Renames class and field to match operation ID specification
src/algokit_indexer_client/models/_transaction.py Renames fields to created_app_id and created_asset_id
src/algokit_indexer_client/models/_asset.py Renames index field to id_
src/algokit_algod_client/models/_asset.py Renames index field to id_
src/algokit_algod_client/models/_dryrun_source.py Renames app_index field to app_id
src/algokit_algod_client/models/_app_call_logs.py Corrects wire name for app_id field
src/algokit_algod_client/models/_genesis_file_in_json.py Makes timestamp field optional
src/algokit_transact/models/state_proof.py Changes reveals from tuple to dict[int, Reveal] with improved encoding/decoding
src/algokit_algod_client/models/_source_map.py Adds new SourceMap model
src/algokit_algod_client/models/_teal_compile_response_model.py Changes sourcemap from generic dict to SourceMap model
src/algokit_*_client/models/_serde_helpers.py Adds key_encoder/key_decoder parameters to mapping functions, updates TypeVar names
api/oas-generator/src/oas_generator/builder.py Fixes field rename logic to use x-algokit-field-rename for Python names
tests/modules/algod_client/test_block.py Updates test to cover blocks with non-UTF-8 decodable keys
tests/modules/transact/common.py Updates _parse_reveals to return dict instead of tuple

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

@aorumbayev aorumbayev force-pushed the decoupling-api-compat branch from 123f0a4 to ce452e0 Compare November 11, 2025 14:03
@aorumbayev aorumbayev marked this pull request as ready for review November 11, 2025 14:04
@aorumbayev aorumbayev force-pushed the decoupling-api-compat branch 2 times, most recently from 06694b3 to 5be11b0 Compare November 11, 2025 19:24
@aorumbayev aorumbayev requested a review from Copilot November 11, 2025 20:26
Copilot finished reviewing on behalf of aorumbayev November 11, 2025 20:27
Copy link

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

Copilot reviewed 36 out of 37 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

src/algokit_algod_client/models/_block.py:80

  • The boolean check at line 73-74 is problematic because in Python, bool is a subclass of int, so isinstance(key, bool) must be checked before isinstance(key, int). However, the current order is correct. The issue is that this function allows boolean input which seems incorrect for 'local delta index keys' that should be numeric. If booleans are intentionally supported, this should be documented; otherwise, the boolean case should be removed or raise an error.

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

@aorumbayev aorumbayev force-pushed the decoupling-api-compat branch from 5be11b0 to f355782 Compare November 11, 2025 20:33
…s in block model

Improves msgpack decoding in Algod, Indexer and KMD clients by handling byte keys and values. This prevents decoding errors when encountering non-UTF-8 byte sequences.

Additionally, adds decoding for boolean fields in block models to correctly interpret raw values as booleans. This addresses issues with inconsistent data representation.
@aorumbayev aorumbayev force-pushed the decoupling-api-compat branch from f355782 to a1fa8c7 Compare November 11, 2025 21:26
@aorumbayev aorumbayev merged commit df4d688 into decoupling Nov 12, 2025
5 checks passed
@aorumbayev aorumbayev deleted the decoupling-api-compat branch November 12, 2025 10: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.

3 participants