You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The manifest command now infers the languages of a publication's text when --inspect-html is combined with --infer-a11y=split. The publication's (X)HTML documents are scanned through their guided navigation representation, and the languages declared in them (lang or xml:lang) are listed under language in the inferred accessibility object, as BCP-47 tags ordered by the number of strings found in each language, most used first. Like metadata.language, a single language is written as a string instead of a one-item array
A string is a block of text, or a run of text in another language inside of one (e.g. <i lang="fr">). Text with no declared language is not counted, so nothing is inferred for publications that don't declare any
Tags are normalized (en_us becomes en-US) and keep their region and script, so en and en-US are listed separately. Tags that are not valid are ignored
This inference is never merged into the publication's own metadata: nothing is inferred with --infer-a11y=merged
The manifest command now infers the textual and visual access modes from the content of a publication's (X)HTML documents when --inspect-html is combined with --infer-a11y. textual is inferred when a document contains text, and visual when one contains an image, an inline SVG or a video which is neither decorative (role="presentation" or role="none") nor a cover
Only the documents of the reading order are read, without the navigation document. Image descriptions such as alt are not text, so a publication made of images is not textual. An image with an empty alt is not considered decorative
These access modes are inferred even when the publication declares its own accessMode: the missing ones are added to it with --infer-a11y=merged, or listed in the inferred accessibility object with --infer-a11y=split
Changed
The go-toolkit has been updated to v0.17.1. For the detailed list, refer to the go-toolkit's changelog; the highlights as they apply to the CLI:
Publications are handled more strictly as untrusted input. Crafted ZIP archives can no longer make the CLI allocate gigabytes of memory, and package documents (manifests, OPF, navigation documents, media overlays…) larger than 32 MiB are an error instead of being read whole
Exploded publications no longer serve files outside of their directory through symbolic links, nor named pipes or devices. S3 and GCS publications list every object of their prefix, rather than the first 1000
The access mode inference changes below
The visual access mode is no longer inferred from the images and videos which are only listed in a publication's resources, which made nearly every EPUB with a cover visual. Without --inspect-html, it is now only inferred when the reading order itself contains an image or a video. For most EPUBs, this means that --infer-a11y alone no longer infers visual: combine it with --inspect-html to infer it from the images the documents actually use
With --inspect-html, the references of an image now list the places where it's used as a decorative image ("role": ["presentation"]) or with an empty alt, which were left out before, as well as the SVGs embedding it with an <image> element
With --inspect-html, each (X)HTML document is now converted to its guided navigation representation only once, instead of once for every inspection that reads it
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The change introduces an extraneous .go.old file containing a standalone program under cmd/injector that won’t be built and is likely accidental, creating repository noise that should be removed or properly relocated/documented before approval.
Improves manifest accessibility inference when --inspect-html is enabled by adding document-driven access mode detection and updating supporting tests, documentation, and dependencies.
Changes:
Infer textual/visual access modes by scanning guided navigation output of reading-order (X)HTML documents.
Wire the new inspector into manifest flows and expand tests around access-mode inference and ranged serving.
Update documentation/changelog and bump module dependencies (including github.com/readium/go-toolkit v0.17.1).
File
Description
pkg/serve/api_test.go
Tightens ranged-request test assertions by computing ZIP entry offsets and validating the expected origin byte ranges.
pkg/inspector/access_modes_inspector.go
Adds an inspector that infers textual and visual access modes from guided navigation content with cover/decorative handling.
pkg/inspector/access_modes_inspector_test.go
Introduces unit tests covering access-mode inference rules and edge cases for merged/split behaviors.
internal/cli/manifest.go
Integrates the access mode inspector into manifest with --inspect-html and adjusts guided navigation conversion behavior.
go.sum
Updates dependency checksums to match the module version changes.
go.mod
Bumps and refreshes Go module dependencies, including upgrading github.com/readium/go-toolkit to v0.17.1.
docs/manifest.md
Documents the updated accessibility inference behavior, including access-mode inference when --inspect-html is enabled.
cmd/injector/main.go.old
Adds a standalone legacy .go.old program file under cmd/injector that is not part of the build.
CHANGELOG.MD
Updates the changelog with entries describing the new/changed accessibility inference behavior and dependency upgrade.
Review effort: Balanced Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
An unresolved moderate issue remains where cover resource HREFs are stored without fragment normalization while image comparisons remove fragments, which can cause cover links containing fragments to be missed and misclassified as visual.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Normalize fragment-stripped cover HREFs before classifying visuals
pkg/inspector/access_modes_inspector.go:104
Cover resources are recorded using link.Href.String() as-is, but image objects are compared after stripping fragments (obj.ImgRef.RemoveFragment()). If a manifest’s cover link itself contains a fragment, the cover won’t be recognized and may be incorrectly inferred as visual. Consider normalizing cover HREFs the same way when populating scan.covers.
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
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.
From the changelog:
Added
manifestcommand now infers the languages of a publication's text when--inspect-htmlis combined with--infer-a11y=split. The publication's (X)HTML documents are scanned through their guided navigation representation, and the languages declared in them (langorxml:lang) are listed underlanguagein the inferred accessibility object, as BCP-47 tags ordered by the number of strings found in each language, most used first. Likemetadata.language, a single language is written as a string instead of a one-item array<i lang="fr">). Text with no declared language is not counted, so nothing is inferred for publications that don't declare anyen_usbecomesen-US) and keep their region and script, soenanden-USare listed separately. Tags that are not valid are ignored--infer-a11y=mergedmanifestcommand now infers thetextualandvisualaccess modes from the content of a publication's (X)HTML documents when--inspect-htmlis combined with--infer-a11y.textualis inferred when a document contains text, andvisualwhen one contains an image, an inline SVG or a video which is neither decorative (role="presentation"orrole="none") nor a coveraltare not text, so a publication made of images is nottextual. An image with an emptyaltis not considered decorativeaccessMode: the missing ones are added to it with--infer-a11y=merged, or listed in the inferred accessibility object with--infer-a11y=splitChanged
visualaccess mode is no longer inferred from the images and videos which are only listed in a publication'sresources, which made nearly every EPUB with a covervisual. Without--inspect-html, it is now only inferred when the reading order itself contains an image or a video. For most EPUBs, this means that--infer-a11yalone no longer infersvisual: combine it with--inspect-htmlto infer it from the images the documents actually use--inspect-html, thereferencesof an image now list the places where it's used as a decorative image ("role": ["presentation"]) or with an emptyalt, which were left out before, as well as the SVGs embedding it with an<image>element--inspect-html, each (X)HTML document is now converted to its guided navigation representation only once, instead of once for every inspection that reads it