Skip to content

refactor(api)!: drop the inert config and charset surface - #833

Merged
andiwand merged 1 commit into
mainfrom
refactor/drop-inert-config
Sep 6, 2026
Merged

refactor(api)!: drop the inert config and charset surface#833
andiwand merged 1 commit into
mainfrom
refactor/drop-inert-config

Conversation

@andiwand

@andiwand andiwand commented Sep 6, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

PR 3 of the v7 API plan.
Same premise as #832 — surface that was kept only so existing callers kept
compiling, removed now that a major allows it.

HtmlConfig

Four fields stored a value no view ever read back:

field dead since
background_image_format, background_image_dpi no view renders a background image to a file
no_drm no output carries a restriction to lift
embed_outline an outline is never written

Gone with their java, python, objc and wasm mirrors — including the
@deprecated entries in index.d.ts, so a TypeScript caller finds out at
compile time.

TextFile::charset() and UnknownCharset

charset() was text_encoding_to_string(encoding()) with a nullopt for
unknown. encoding() says the same thing as a TextEncoding and reports
TextEncoding::unknown instead of an empty optional. UnknownCharset goes
too — nothing throws it, because a file whose encoding cannot be named is still
text.

The bindings keep their own charset(). Worth being explicit, because it
looks like an oversight and is not: those accessors are not mirrors of the
removed overload — JNI, python and objc each build the string from
encoding() directly. Removing them would lose the accessor rather than
redirect it, because TextEncoding is not mirrored in any binding. So a
binding-side removal has a prerequisite, which turns out to matter beyond this
PR:

Mirroring TextEncoding (the enum, plus text_encoding_to_string,
text_encoding_by_name, text_encoding_names, text_encoding_is_decodable,
all_text_encodings) is a non-breaking addition, and it is also what PR 7
needs before CsvOptions can be folded into the decode options — CsvOptions
carries a TextEncoding. It becomes its own PR, before 7.

That reordering is the one thing here that was not in the plan when #831 was
written; I will update the plan doc on that branch.

Verified

Library, CLI, JNI + jar, python module and odr_test build clean; 69 python
tests and the 57 *Csv*/*Text*/*Encoding* gtests pass.

Migration

  • config.background_image_*, config.no_drm, config.embed_outline — delete.
  • text_file.charset()text_file.encoding(), comparing against
    TextEncoding::unknown instead of checking the optional. text_encoding_to_string
    gives the old string back if you want it.

Four HtmlConfig fields stored a value no view read: background_image_format
and background_image_dpi, from when a background was rendered to a file;
no_drm, from when the output carried a restriction; embed_outline, from when
one was written. Gone with their java, python, objc and wasm mirrors.

TextFile::charset() went with them - encoding() answers it as a TextEncoding,
and reports unknown where charset() returned nullopt - and so did
UnknownCharset, which nothing has thrown since a file that cannot be named is
still text.

The bindings keep their own charset() accessors: those read encoding() rather
than the removed overload, and are the shape a binding wants until the enum
itself is mirrored.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016hxDa2rev11eLUEJZJ5nmz
@andiwand
andiwand force-pushed the refactor/drop-inert-config branch from fd0e001 to e8293f9 Compare September 6, 2026 12:59
@andiwand
andiwand merged commit 80e3194 into main Sep 6, 2026
23 checks passed
@andiwand
andiwand deleted the refactor/drop-inert-config branch September 6, 2026 13:01
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