8000 Decrypt a page by its encryption in one place, and read a TDEF in its steps by dominion525 · Pull Request #134 · dominion525/jetdb · GitHub
[go: up one dir, main page]

Skip to content

Decrypt a page by its encryption in one place, and read a TDEF in its steps - #134

Merged
dominion525 merged 2 commits into
mainfrom
refactor/table-and-file
Oct 25, 2026
Merged

dominion525 merged 2 commits into
mainfrom
refactor/table-and-file

Conversation

@dominion525
Copy link
Copy Markdown
Owner

Summary

  • The decryption of a page by the kind of encryption was the same match of three arms in the opening of a database (page 0) and in read_page. It is now EncryptionState::decrypt_page, which both use, and the verification of the password that makes the state is EncryptionState::verify. Page 0 is read and its version and signature checked in read_page0, and the header read with DbHeader::from_page0.
  • read_table_def reads the header, the columns and the indexes of a TDEF in functions of their own, in the steps its comments name. A column entry, its column numbers (a byte in Jet3, two bytes later) and the values only Jet4 and ACE entries have are read in functions of their own, as are the slots of the columns of an index.
  • A logical index keeps its foreign key as a ForeignKeyReference, which build_index_defs gives as it is rather than copy it field by field.
  • What is read, and the errors and warnings, are unchanged.
  • Functions above the thresholds: 91 → 83. Tests: 1113, as before. parse_column_entry is above them (CC 11), as a straight sequence of the nine reads of a column entry, each of which may fail; FileError's Display is kept as the match of its 21 messages.
Function Before (CC / Cog / SLOC) After, the function of the largest CC
file finish_open_with_password 19 / 4 / 94 8 / 2 / 30
file read_page 12 / 4 / 63 9 / 4 / 27
file open_raw_from_source 10 / 6 / 84 9 / 4 / 41
file find_row 7 / 7 / 56 9 / 7 / 40
table read_table_def 22 / 4 / 92 9 / 2 / 46
table parse_column_entries 19 / 9 / 65 11 / 2 / 41
table parse_index_column_defs 13 / 11 / 41 9 / 1 / 25
table parse_logical_indexes 12 / 1 / 39 8 / 1 / 31
table build_index_defs 4 / 8 / 51 3 / 4 / 26

🤖 Generated with Claude Code

dominion525 and others added 2 commits October 25, 2026 21:32
…s header in functions of their own

- Verify the password and decrypt a page with EncryptionState::verify and decrypt_page, which the opening and read_page share, rather than the same match in each
- Read page 0 and check its version and signature in read_page0, and read the header with DbHeader::from_page0
- Make the errors and the row offsets of find_row with a closure each

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… as a ForeignKeyReference

- Read the header, the columns and the indexes of read_table_def in functions of their own
- Read a column entry, its column numbers and the values only Jet4 and ACE entries have in functions of their own
- Read the slots of the columns of an index in a function of its own
- Read the foreign key of a logical index as a ForeignKeyReference, which build_index_defs gives as it is rather than copy it field by field

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Coverage

For d441dcd.

Filename                       Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
jetdb-cli/src/export.rs            108                11    89.81%           5                 0   100.00%          66                 6    90.91%           0                 0         -
jetdb-cli/src/form.rs              254                24    90.55%          19                 5    73.68%         152                 9    94.08%           0                 0         -
jetdb-cli/src/macro_cmd.rs         151                11    92.72%          11                 2    81.82%          81                 5    93.83%           0                 0         -
jetdb-cli/src/main.rs              864                38    95.60%          70                 2    97.14%         549                25    95.45%           0                 0         -
jetdb-cli/src/prop.rs              308                15    95.13%          33                 2    93.94%         186                10    94.62%           0                 0         -
jetdb-cli/src/query.rs              80                 4    95.00%           5                 0   100.00%          51                 1    98.04%           0                 0         -
jetdb-cli/src/vba.rs                74                 4    94.59%           5                 0   100.00%          47                 1    97.87%           0                 0         -
jetdb-wasm/src/lib.rs             3871                95    97.55%         252                 4    98.41%        2031                22    98.92%           0                 0         -
jetdb/src/catalog.rs               509                14    97.25%          46                 0   100.00%         299                 3    99.00%           0                 0         -
jetdb/src/complex.rs               924                32    96.54%          73                 0   100.00%         605                15    97.52%           0                 0         -
jetdb/src/crypto.rs               2300               112    95.13%         127                10    92.13%        1315                60    95.44%           0                 0         -
jetdb/src/csv.rs                   857                24    97.20%          72                 0   100.00%         486                 6    98.77%           0                 0         -
jetdb/src/data.rs                 4560               179    96.07%         257                 3    98.83%        2564               110    95.71%           0                 0         -
jetdb/src/ddl/access.rs             70                 0   100.00%           7                 0   100.00%          46                 0   100.00%      
AD2C
     0                 0         -
jetdb/src/ddl/mod.rs              2777                 8    99.71%         199                 2    98.99%        1503                 6    99.60%           0                 0         -
jetdb/src/ddl/mysql.rs              70                 0   100.00%           7                 0   100.00%          46                 0   100.00%           0                 0         -
jetdb/src/ddl/postgres.rs           71                 0   100.00%           7                 0   100.00%          46                 0   100.00%           0                 0         -
jetdb/src/ddl/sqlite.rs             69                 0   100.00%           7                 0   100.00%          48                 0   100.00%           0                 0         -
jetdb/src/encoding.rs              284                 0   100.00%          30                 0   100.00%         153                 0   100.00%           0                 0         -
jetdb/src/file.rs                 1915                65    96.61%         117                 0   100.00%         983                18    98.17%           0                 0         -
jetdb/src/form.rs                 3225               150    95.35%         230                10    95.65%        1752                69    96.06%           0                 0         -
jetdb/src/form2000.rs              762                21    97.24%          56                 1    98.21%         402                 4    99.00%           0                 0         -
jetdb/src/format.rs                616                 2    99.68%          45                 0   100.00%         388                 2    99.48%           0                 0         -
jetdb/src/lib.rs                     3                 0   100.00%           1                 0   100.00%           3                 0   100.00%           0                 0         -
jetdb/src/macro_action.rs          299                19    93.65%          27                 3    88.89%         165                24    85.45%           0                 0         -
jetdb/src/macro_def.rs            2350                98    95.83%         179                 9    94.97%        1522                46    96.98%           0                 0         -
jetdb/src/macro_text.rs            783                24    96.93%          49                 2    95.92%         437                20    95.42%           0                 0         -
jetdb/src/map.rs                   416                13    96.88%          27                 0   100.00%         221                 5    97.74%           0                 0         -
jetdb/src/money.rs                 281                 0   100.00%          26                 0   100.00%         186                 0   100.00%           0                 0         -
jetdb/src/prop.rs                 1398                56    95.99%          88                 8    90.91%         735                63    91.43%           0                 0         -
jetdb/src/query.rs                2587                71    97.26%         188                 1    99.47%        1625                35    97.85%           0                 0         -
jetdb/src/relationship.rs          249                26    89.56%          22                 0   100.00%         177                10    94.35%           0                 0         -
jetdb/src/save_as_text.rs          574                27    95.30%          52                 3    94.23%         341                27    92.08%           0                 0         -
jetdb/src/storage.rs               712                31    95.65%          48                 0   100.00%         386                 6    98.45%           0                 0         -
jetdb/src/table.rs                1679                67    96.01%         109                 2    98.17%        1017                18    98.23%           0                 0         -
jetdb/src/timestamp.rs             405                 0   100.00%          44                 0   100.00%         235                 0   100.00%           0                 0         -
jetdb/src/vba.rs                   634                65    89.75%          54                16    70.37%         361                60    83.38%           0                 0         -
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                            37089              1306    96.48%        2594                85    96.72%       21210               686    96.77%           0                 0         -

@dominion525
dominion525 merged commit ef85c64 into main Oct 25, 2026
11 checks passed
@dominion525
dominion525 deleted the refactor/table-and-file branch October 25, 2026 13:34
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

0