Repository navigation
feat!: API foundation (errors, options, warnings, non_exhaustive) - #26
Merged
Merged
Conversation
…ult types Every decode entry point returns Result and takes ReadOptions. Errors are non_exhaustive with ErrorKind categories. Leniency is one extensible set. Warnings carry accepted conditions on results. Trailer, superblock and slot directory fields become accessors. PageType drops UnknownG and gains PageTrailer::case_variant. Pages yields Result<Page>. The block level and guessing calibration helpers and overflow_prefix are removed. Decode behaviour is unchanged by this commit. Signed-off-by: Nathan Riley <git@nathanriley.com>
Signed-off-by: Nathan Riley <git@nathanriley.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
opensqlanywhere-docs | 2237c92 | Oct 25 2026, 07:44 AM |
This was referenced Oct 25, 2026
A field can be added to a variant such as SlotDirectoryTruncated or LowConfidenceSector without breaking callers that match it with .. Signed-off-by: Nathan Riley <git@nathanriley.com>
Warning::new, on_page and on_sector become public so dependent crates can add warnings of their own. WarningKind::Other is reserved for them. Signed-off-by: Nathan Riley <git@nathanriley.com>
Signed-off-by: Nathan Riley <git@nathanriley.com>
lenient() relaxes exactly KEYSTREAM, DIRECTORY, INTEGRITY and FORMAT, so a flag added later never widens it. Leniency::all() becomes Leniency::every_known() and ReadOptions::widest() is the constructor whose documentation says it widens. Signed-off-by: Nathan Riley <git@nathanriley.com>
…Kind::Usage WrongBufferLength and PageOutOfRange are caller errors, not format errors. Signed-off-by: Nathan Riley <git@nathanriley.com>
Signed-off-by: Nathan Riley <git@nathanriley.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
API foundation for the final major release. It reshapes the public API so the silent-failure fixes stacked on this PR, and later fixes, can land without another break. Decode behaviour is unchanged here; the fix PRs change it.
What it adds:
Erroris#[non_exhaustive]withError::kind() -> ErrorKind(Io, Format, Usage, Integrity, Unsupported, Keystream, Structure) andError::page(). It also carries the variants the fix PRs report. Struct-like variants are#[non_exhaustive]too, so a field can be added without breaking amatch.ReadOptions(strict by default) holding one extensibleLeniencyset (KEYSTREAM,DIRECTORY,INTEGRITY,FORMAT).ReadOptions::lenient()relaxes exactly those four flags, and a flag added later is not added to it.ReadOptions::widest()andLeniency::every_known()widen with each release; their docs say so.Warning/WarningKind: a typed variant for every condition the crate reports.WarningKind::Other(code)is for dependent crates, andWarning::new,on_pageandon_sectorare public so OpenQBW can add its own.DeobfuscatedPage,LearnReport,Row(with anexactflag).PageTrailer,Superblock,SlotDirectory,SlottedPage;PageTrailer::raw()is the offset-neutral escape hatch.#[non_exhaustive]on every public enum and data struct. No Python bindings live in this repo, so there is no exception hierarchy to add here.Review follow-up
Review finding S6 (all four parts) and nits N3 (caller errors get
ErrorKind::Usage) and N4 (README and lib docs) are fixed in separate commits on top of the original two. Each API break is its own commit: struct-variantnon_exhaustive, typedWarningKindplus public constructors, and thelenient()/widest()split.API breaks
Each is listed in the CHANGELOG under Unreleased.
ApModel::learn(&store, &ReadOptions) -> Result<ApModel>;deobfuscate_with_storebecomesApModel::deobfuscate(&store, pn, &opts) -> Result<DeobfuscatedPage>;deobfuscate_with_bvbecomes an associated function over aPage.ApModel::bv_at, block-leveldeobfuscate,recover_bv_for_block,recover_bv_for_page,Default for ApModel(they guess a key silently), andSlottedPage::overflow_prefix(returns the page prelude as record data, silent-failure finding 9).SlottedPage::parse(page, &opts) -> Result<_>;row_bytes()becomesrows() -> Vec<Row>;.directoryand.pagebecome accessors.PageStore::pages()yieldsResult<Page>(finding 18).Page::from_bytesandSuperblock::parsereturnResultand reject any wrong length instead of panicking or truncating.PageTrailer/Superblock/SlotDirectorypublic fields become accessors;SlotDirectory::scan_startandleading_zeroare dropped from the public surface.PageType::UnknownGremoved ('G'isOther(b'G'));PageTypeis#[non_exhaustive].PageTrailer::case_variant()is added instead of putting the case bit in the enum, so== PageType::Extentkeeps working.ErrorandWarningKindare#[non_exhaustive]: match them with...Leniency::all()is renamedLeniency::every_known();ReadOptions::lenient()is a fixed set;ReadOptions::widest()is new.Tests changed
crates/opensqlany/src/ap.rs:deobfuscate_with_store_uses_per_page_bv_not_block_bvbecomesdeobfuscate_uses_per_page_bv_not_block_bv(same assertion on the new API).crates/opensqlany/tests/synthetic.rs: ported to accessors,Resultitems and..in struct-variant patterns. Added tests for error kinds,case_variant, wrong-length buffers,Leniency.Docs-site edits needed (for the release PR; not edited here)
docs/docs/ap-deobfuscation.md: newlearn/deobfuscatesignatures,DeobfuscatedPage,ReadOptions.docs/docs/quickstart-rust.md:sb.format(),pages()items areResult, accessor names.docs/docs/openqbw.md: the architecture description.OpenQBW follow-up
OpenQBW (
opensqlany = "0.2.0") needs to adopt the new signatures when it bumps:ApModel::learn(&store, &opts)?at about 14 CLI sites andopenqbw-py/src/lib.rs;deobfuscate_with_storebecomesdeobfuscate(&store, pn, &opts)?(attribution_schema.rs, attribution_content.rs, systable.rs, sysindex.rs, sysobject.rs);SlottedPage::parse(page, &opts)?,.directory(),.rows()in attribution_schema.rs, attribution_content.rs, transaction_header.rs.PageType::Extentcomparisons are unchanged. UseReadOptions::lenient()or name theLeniencyflags explicitly; do not rely onwidest().Checklist
git commit -s