Skip to content

Source Model — IIIF: by reference in, standards out, Fichero as a server — Design Spec (#5323)

Milestone: iiif Manual: TBD — a section in “Bringing sources in” that explains opening a collection from a library’s IIIF manifest without copying it, what stays remote and what is cached, and a section in “Sharing” that explains publishing a library as IIIF for other viewers and researchers.

Design-led (Testing Constitution). Status: DRAFT (approved by the maintainer 2026-10-04,

5323; reviewed and extended 2026-11-21 after the owner asked for IIIF import and a IIIF server:

measured on public sources, see “Measured 2026-11-21”; APPROVED status waits on the manual section, a citing test and the answers under Open questions). A slice of the source model: read source-model.md first. It homes the IIIF work that importer.md and #5120 recorded as homeless. Formats-level reading and writing (the georeference extension, W3C annotation shapes) stays in formats-and-training.md and maps-and-georeference.md; this slice owns how a IIIF source lives in a library and how a library is served as IIIF. It is the one IIIF spec: the iPad’s page images (the iPhone and iPad spec’s ios.ipad.page-images-fit-the-screen,

6572), the Preview’s deep zoom (#5031), the export’s manifests (formats-and-training.md,

../export/exporter.md, #6806) and the published site’s tiles (../export/public-site.md, ../export/open-standards-profile.md, #3177) all point here for how pixels are asked for and answered. The earlier design note is ../../architecture/portable-workflows-and-archival-format.md (the archival format is IIIF + W3C annotations); no older plan under agent-work/ holds an IIIF design (searched 2026-11-21).

Intent

Most of the world’s digitised manuscripts, maps and archives are already published through IIIF. A researcher should be able to work on them in Fichero without first downloading the collection: paste a manifest or collection link, and the pages appear in the library at once, drawn from the holding institution’s image server at the size the screen needs. Transcription, segmentation, models, notes and the knowledge graph then work on those pages exactly as on a local scan. The pixels stay where the institution keeps them; what Fichero adds (segments, readings, claims) is Fichero’s.

In the other direction, everything Fichero knows about a source can leave as IIIF: a manifest whose pages point back at the original image service, with Fichero’s segments and readings as W3C annotations on them, so Mirador, the Universal Viewer, Tify or another Fichero can show the work. And a library that is shared can be a IIIF endpoint (images, manifests, annotations and search), so colleagues can read it in any IIIF viewer, and a static export can publish it.

The same endpoint is how Fichero’s own second screens get their pictures. An iPhone, an iPad or a second Mac on a shared library asks the Mac for a page at the size of the pane showing it, and for the visible region when zoomed, so a large scan never crosses the air whole. One way of asking for pixels (a page, a region, a size) serves the Preview on the Mac, the devices, other viewers and the published site.

Prior art / best practices

  • IIIF Image API 3.0 (regions, sizes, info.json, compliance levels 0–2) and Presentation API 3.0 (Collection, Manifest, Canvas, Range, AnnotationPage). Fichero adopts both, reads 2.1 as well (much of the world still publishes 2.1), and writes 3.0.
  • W3C Web Annotation motivations (commenting, tagging, linking, bookmarking, highlighting, assessing) plus IIIF’s own (painting, supplementing), and the Text Granularity extension (page, block, paragraph, line, word, glyph): the agreed way to publish transcription lines and words on a canvas. Transcription is supplementing with a granularity; a person’s highlight stays highlighting, a note commenting, as the export does today.
  • Content Search API 2.0 (search inside a manifest, with hits as annotations) and Content State API 1.0 (a link that opens a viewer on a region of a canvas).
  • Authorization Flow API 2.0 for access-controlled images, and Change Discovery API 1.0 (an activity stream) so harvesters can follow a published library (not in this slice’s behaviours; a later one, once there is a published library to follow).
  • By reference, not by mirror. Arkindex stores a page as a pointer to a IIIF image server and fetches regions on demand; eScriptorium and Transkribus import a manifest by downloading every image. Fichero takes Arkindex’s model, with an explicit, per-source choice to keep a local copy.
  • Servers in the field: Cantaloupe and IIPImage (Image API), Omeka S’s IIIF Server module, and static IIIF (level 0, pre-cut tiles) generated by tools like iiif-tiler. Fichero’s static-site export (#3177) is level 0; a running shared library is level 2.
  • What viewers ask for. OpenSeadragon, Mirador and the Universal Viewer read info.json, then ask for whole-image sizes from its sizes list and for tiles on its tiles grid at its scale factors. A client that keeps to those two lists gets answers a server (and the CDN in front of it) has already made. Fichero’s own clients ask the same way, of the institutions and of the Mac.

What exists today

Checked in the code and run 2026-11-21 (unit tests: 46 passed across tests/unit/importers/test_iiif_*.py, tests/unit/api/test_routes_iiif.py and tests/unit/api/test_iiif_segments_as_annotations.py).

  • Import by reference, as a job. POST /api/iiif/import (api/routes/ingest/iiif.py, import_from_iiif) queues one import-iiif job in Activity (importers/iiif_source.py, start, _run). import_source reads the manifest or collection through the polite fetcher (media/iiif_fetch.py, PoliteFetcher: two requests per host, backoff, Retry-After), Presentation 2 or 3 (importers/iiif_import.py, parse_iiif_url), and writes one page row per canvas, 1,000 to an insert, into a folder that remembers its source (metadata.iiif_source). No image is fetched. Importing again adds only canvases whose id is not in the folder and counts the ones no longer listed. The app has File › Import from IIIF… and the folder’s Inspector section with Refresh (Views/Library/IIIFImport.swift, Models/IIIFImportStore.swift).
  • What that import does not do. Ranges (structures) and annotation pages on a remote canvas are not read. A folder holding the old flat import (a collection’s canvases as sibling pages) is left as it is. Every fetch goes through media/iiif_engine.py::engine_fetcher; a collection imports as a folder of manifest folders.
  • Viewing. The first time a page’s thumbnail or display picture is asked for, db/storage.py::iiif_page_image fetches the whole image once at display size (full/!2200,2200/0/default.jpg) into storage/iiif/, and the thumbnail and display copies are made from it (_resolve_thumbnail_cache_candidate, ensure_display). info.json is never read, a canvas’s thumbnail is never used, no region is ever asked for, and storage/iiif/ is never evicted.
  • Steps. A step on this Mac reading a by-reference page fetches it at 2,400 px on its longer side into storage/iiif-steps/, a cache that drops the least recently used past a share of free disk (iiif_source.py::step_image, _evict; called from workflows/tools/sources.py:: _resolve_abs_path). A read package for a cluster lists Image API services, and the runner fetches them (remote_read/package.py, remote_read/runner.py).
  • The older, downloading paths. importers/iiif_import.py::import_iiif reads a local folder of Presentation 3.0 manifests, collections and W3C AnnotationPages into documents, page text, entities and transcript results (#1646). loaders/iiif_loader.py fetches a remote manifest and downloads each canvas’s image at up to 1,500 px.
  • Serving, dev tier only. api/routes/ingest/iiif.py serves local images through Image API 2.1 (/api/iiif/iiif/{id}/info.json, /{region}/{size}/{rotation}/{quality}.{format}) and a Presentation 3.0 manifest per document (/api/iiif/iiif/manifest/{document_id}), with the working pass’s lines (/api/iiif/iiif/lines/{document_id}) and the person’s annotations as annotation pages. Its prefix is dev tier (api/feature_tiers_generated.py, ROUTE_PREFIX_TIERS['/api/iiif']), so no beta or release build has it, and that includes the import route the File menu calls. What it serves is measured below; much of it is wrong.
  • Export. Parquet, IIIF, W3C annotation and RDF leave through one record stream (export_service.py); the georeference extension is read and written (formats/iiif_georef.py). The static-site export of manifests is designed, not built (#3177).

Measured 2026-11-21

Public sources, from a desk Mac on a home line: one Endangered Archives Programme item of 225 canvases (a Presentation 3 manifest whose images are an Image API 2 service), one printed book from a medical library published both as Presentation 2 and 3 (36 canvases), one manuscript of 224 canvases and one of 99 from two manuscript libraries (both Presentation 2), and three collections. Manifests and collections were fetched whole; images only as samples (three canvases a source, at the sizes below, and three bursts of 24 thumbnails). The engine’s own code ran against them in a scratch test library. The full tables are in the review’s report.

The sources.

EAP item printed book manuscript A manuscript B
Manifest 211 KB, 0.7 s 99–107 KB, 0.3 s 167 KB, 1.0 s 105 KB, 0.9 s
Parse (JSON) 5 ms 1–2 ms 3 ms 2 ms
ETag or Last-Modified on the manifest neither neither neither neither
Canvas size (median) 6,599 × 4,727 2,411 × 3,372 6,132 × 8,176 6,676 × 8,560
Canvases with a thumbnail all all none none
Ranges 0 3 0 1
Canvases naming annotation lists 0 all 0 87 of 99
Level the manifest claims / info.json says 2 / 1 1 / 2 2 / 1 1 / 2
info.json 0.7 KB, 0.6–2.9 s 1.3 KB, 0.2–0.4 s 0.8 KB, 0.6 s 1.2 KB, 0.7–0.9 s
Whole image at !400,400 17–34 KB 106–114 KB 19–25 KB 31–51 KB
at !1024,1024 116–201 KB 163–209 KB 85–136 KB 193–273 KB
at !2200,2200 (today’s first fetch) 153–262 KB, 1,200 px came back 0.7–1.3 MB 0.3–0.6 MB 0.9–1.1 MB
Largest in one request 1,200 px 1.5–3.6 MB at its real size 3.8–6.4 MB at its real size 2.5–2.8 MB, 4,000 px came back
full/max 400 upscaled to 10,000 px, 8–15 MB the real size 4,000 px
A 512 px tile at full resolution 48–87 KB, 1.9–3.9 s 53–105 KB, 0.3–0.5 s 16–46 KB, 0.8–0.9 s 57–60 KB, 0.6–0.7 s
24 thumbnails, one at a time 41 s 6–12 s 20 s 258 s
24 thumbnails, four at a time 8 s 2 s 6 s 84 s
429, 503 or Retry-After seen none none none none

What the table says. A thumbnail-sized request is 8 to 30 times smaller than the display-sized one Fichero makes today. No source gave a manifest validator, so “has it changed” is a hash of the content. The level a manifest claims is wrong as often as right; only info.json is to be believed. Two of four services silently return less than was asked (1,200 px and 4,000 px), and none says so in info.json. max is not safe to ask for: one server refuses it and one answers it with a picture four times the size of the original. Nobody rate-limited a few hundred requests, four at a time; one service takes ten seconds a thumbnail whatever is done, so slow has to look like slow, not like broken.

The engine’s import, as built.

What was done What happened
Import the EAP item (225 canvases) 0.8 s, one request, 225 page rows, 764 KB added to the project (3.4 KB a page), no image fetched
Import it again 0.4 s, one request, nothing added, same folder
Import the Presentation 2 manuscript (224) 1.0 s, one request, pages with service and size
Import a collection of 959 manifests, sample of 3 13 s, 4 requests; 1,629 pages from three manuscripts as siblings in ONE folder
Import a collection of 100 sub-collections, sample of 2 80 s, 103 requests to read two manifests (every sub-collection is fetched first)
First thumbnails of 8 pages 0.7–2.1 s each; each fetched the display size (205 KB a page from the capped server) to make a thumbnail
Display picture, fetched before / not before 0.01 s / 3.1 s
A step’s image, asked at 2,400 px came back 1,200 × 850; nothing notices
Thumbnail of a page not cached, network gone 404, “no recorded file for this page”
Refresh, network gone the job fails after three tries; nothing changed
info.json or a region for a by-reference page 404 (not served)

Fichero’s own IIIF routes, on a synthetic 6,000 × 8,000 scan (26 MB JPEG).

Request Answer
info.json context where @context belongs; @id is /api/iiif/{id}, which does not exist (the routes are under /api/iiif/iiif/)
info.json before / after the display copy exists 6,000 × 8,000 / 1,650 × 2,200: the size a viewer was told changes under it
A 512 px tile at full resolution 0.17 s, every time (the whole image is decoded per request; nothing is kept)
full/200, 0.30 s from the original; 0.02 s once it is cut from the display copy
full/max 22 MB, 0.29 s
full/!400,400, pct:25,25,50,50, ^9000, 500
square/400, not square (the whole image, 400 × 533)
rotation 90 400 × 533: turned, then squeezed back into the unturned shape
A region past the edge padded with black to the size asked, not clipped
Any answer no Cache-Control, no ETag (the storage routes have both)
The manifest canvas 1,650 × 2,200 (the display copy’s size, not the page’s); its own id answers 404
/api/storage/thumbnail, /api/storage/display 768 × 1,024 (119 KB) and 1,650 × 2,200 (1.0 MB): what an iPad is sent today for every pane

The design

A remote page is a page

A IIIF canvas brought in by reference becomes an ordinary page node whose image is a remote rendition: the image service’s base URI, its version and profile, and the canvas size. Everything that draws or reads a page asks the storage layer for pixels at a size and region, never for a file path (the standing “no local paths” rule). For a remote page the storage layer requests exactly that region and size from the service and keeps it in a bounded cache. Thumbnails, the Preview at any zoom, the Reader and the on-image segments all work this way.

Coordinates are always the canvas’s coordinates, so a segment drawn on a remote page stays put whatever resolution was fetched, and an exported annotation lands in the same place in any viewer.

A manifest is a folder; a collection is a folder of folders (2026-11-21)

  • A manifest becomes a folder bound to the manifest’s URL. Its canvases are its pages, in the manifest’s order, each keeping its canvas id, label, size and Image API service.
  • A collection becomes a folder bound to the collection’s URL. Each manifest in it becomes a child folder bound to its own URL, and each nested collection a child folder of folders. A canvas is never a sibling of another manifest’s canvases: two manuscripts that both have a “Front cover” stay two documents, each refreshed, read and exported by itself.
  • The collection appears at once. Listing a collection costs one request (its members carry their id and label). The child folders are made from that list straight away, each marked “not read yet”; the job then reads the manifests one at a time, politely, and a folder the person opens is read first. A collection of a thousand manuscripts is browsable in seconds and complete in minutes, and a stopped job resumes at the first folder not yet read.
  • Ranges are structure. A manifest’s ranges (its table of contents: structures) become sub-folders when they divide the canvases cleanly (every canvas in at most one lowest range); the pages sit in their range, in order, and canvases outside every range stay at the top. When ranges overlap or a canvas sits in several, the pages stay flat and the ranges are kept on the folder as an outline the Inspector lists and the export writes back. Either way the ranges survive the round trip.
  • What is said once is stored once. The manifest’s label, summary, metadata pairs, date, rights, required statement, provider, homepage and “see also” links are kept on the manifest’s folder. A page keeps only what is its own (canvas id, label, size, service, the canvas’s own metadata) and reads the rest from its folder, as it reads its recipe (the cascade). The metadata pairs are kept verbatim, label and value, in the language the source gave; the ones that match a catalogue field (title, date, language, extent, shelfmark, creator) also fill it (cataloguing.md), so the Catalogue table and search see them.
  • Only public https addresses are fetched. Every address a manifest names (a manifest, a collection, an image service, an annotation page) passes one check (media/iiif_engine.py::refusal): https, no credentials in the URL, a name that resolves, and every address it resolves to global (not loopback, private, shared 100.64/10 or unspecified); it is made again on every redirect. A manifest cannot name this Mac or its network as an address. Limit: the connection resolves the host again after the check, so a DNS answer that changes in between is not stopped.

What has to be fetched, and when

Three sizes of the same page, each fetched only when something asks:

  • Thumbnail. What the Items grid and lists show. Fetched at thumbnail size when the cell scrolls into view: the canvas’s own thumbnail when the manifest gives one, else full/!512,512/0/default.jpg from the service. Never the display size: a folder’s grid costs kilobytes a page, not the megabyte a page it costs today.
  • Screen. What the Preview and the Reader show at fit: the pane’s size in pixels, rounded up to the next of a few standing sizes (1,024, 1,600, 2,200 px on the longer side) so two panes of nearly the same size share one fetch. The page before and the page after are fetched at the same size, quietly, while the person reads this one.
  • Detail. What zooming in, a model run or “keep a local copy” needs: more pixels than the screen size holds. Zooming asks for the visible region only, on the service’s own tile grid and scale factors (read once from its info.json), so the answers are ones the institution’s server has already made. A step asks for the whole page at the size it reads.

A service has limits and Fichero keeps to them. Its info.json is read the first time a page needs more than a thumbnail, and kept: the real size of the image, its sizes, its tiles, its maxWidth/maxHeight/maxArea, and its level. A level 0 service is asked only for the sizes and tiles it lists. Where a service answers a size request with a smaller picture than asked (measured: a server that returns 1,200 px whatever larger size is requested), Fichero notices, because it reads the size of what came back, and when a step needs more it asks for the page in a few large regions and joins them. It never upscales and never pretends.

  • Keep a local copy is a per-source choice (a collection, a manifest or a page): it fetches the full image once, stores it as a normal rendition, and from then on the page works offline. It is off by default and says how much it will download before it starts (from the sizes of a few sample images times the page count).
  • Offline. A cached size is always shown, scaled if it is not the one asked for. A remote page with nothing cached shows a placeholder that says it is remote and cannot be reached now; it never shows a blank, and never says the file is missing. A host that did not answer is not asked again for a minute, so a grid of two hundred thumbnails makes one failed request, not six hundred. Importing or refreshing offline fails once, plainly, in Activity, and changes nothing.

One cache, with a cap

Everything fetched from a remote service (thumbnails, screen sizes, regions, step images) lives in one cache under the project’s storage, keyed by the request that fetched it. Its cap is a share of free disk with a floor (ruled 2026-10-04); past the cap the least recently used files go first. Pages kept locally are not in the cache and are never evicted. What a source’s server says about freshness is honoured: a cached file younger than its Cache-Control age is never asked for again, and an older one is revalidated with its ETag or Last-Modified rather than downloaded again.

Polite to the institution

The servers belong to the archives. One fetcher serves the whole engine (viewing, steps, imports), so its limits hold across all of them:

  • at most four requests in flight to one host, and of those at most two for background work (prefetch, a job walking a collection), so the page the person is looking at is never queued behind a crawl;
  • 429 and 503 are obeyed: the Retry-After is waited out and the whole host slows down;
  • failures back off, with jitter; a 4xx other than 408 and 429 is not retried;
  • the User-Agent says it is Fichero and where to read about it;
  • nothing is fetched twice that the cache holds, and nothing is fetched in advance beyond the neighbouring pages.

Running steps on remote pages

  • What is fetched. Only the pages the step reads, at the size it reads them (2,400 px on the longer side unless the step asks otherwise), each once, into the cache. A step on a cluster or a GPU service fetches straight from the institution, never through the Mac (../compute/hpc-runner-acenet.md).
  • What stays remote. The image. After the run the cached copy is ordinary cache: it may be evicted, and the page is still a reference. Nothing is copied into the library unless the person chose to keep a local copy.
  • What is the library’s. The segments (in canvas coordinates, scaled from the size that was read), the readings, the claims.
  • Provenance. Every run on a remote page records what it saw: the Image API request (or the requests, when a page was joined from regions), the size that came back, the service’s validator (ETag or Last-Modified) and a hash of the bytes. Two things follow. A result can always be traced to its pixels. And the standing rule that the same input and model are never run twice holds for remote pages: the input’s identity is the canvas, the request and the validator, so a page whose cached copy was evicted and fetched again is not read again.

IIIF folders: a folder that is a collection, in or out (2026-10-01)

Two kinds of special folder in the library, so IIIF is a place rather than a command:

  • A IIIF source folder is bound to a collection or manifest URL (the British Library’s Endangered Archives Programme, a university’s digital library, another Fichero’s published folder). Its contents are that collection, by reference. It follows the source: canvases the institution adds appear; ones it withdraws are shown as withdrawn (never silently deleted, since a person’s segments and readings hang on them). Work done inside it (segments, readings, claims) is the library’s own, as everywhere.
  • A IIIF published folder is served as a IIIF collection (when the library is shared) and written as one in a static export: its documents as manifests, with their segments and readings as annotations. Moving or copying a document into it publishes it; out of it, unpublishes it. What the rights record withholds stays out.

A folder can be both: a source folder whose work is published back as annotations on the institution’s own canvases.

Like any folder, either can follow its own recipe (source/models-chains-and-projects.md, the cascade): an EAP collection of Persian manuscripts in one folder runs a different reader from the Spanish deeds next to it.

Refreshing: what changed is said (2026-11-21)

Refresh reads the source again and says what it found, in Activity and on the folder:

  • Nothing changed costs one conditional request per manifest and writes nothing. The folder keeps the manifest’s validator and a hash of its content; a 304, or the same hash, ends there.
  • Added canvases appear, in the source’s order. Reordered canvases follow the source. A canvas whose label, size or image service changed is updated in place and listed.
  • Withdrawn canvases are kept and marked withdrawn, with the date; the Items pane shows the mark. If the source lists one again the mark is lifted.
  • A changed image. When a cached image is revalidated and the source’s validator or the bytes differ, the page says its image changed, and segments drawn on the old image are flagged for checking instead of silently sitting on new pixels.
  • Never two. A canvas is matched by its id within its folder. Importing a URL that is already bound refreshes its folder; it never makes a second one.

A million pages without slowing down (2026-10-01)

A IIIF collection by reference can be very large (a national library’s digitised holdings run to millions of canvases), and Fichero should take a million pages without the Mac slowing down. That is possible because by reference a page costs almost nothing locally:

  • What the library stores is small. Per canvas: its identity, its image service, its size, its label and its place in the tree; a few hundred bytes. A million canvases is a few hundred megabytes of rows, not terabytes of images. (Measured 2026-11-21: 3.4 KB a page today, because the manifest’s metadata is copied onto each; iiif.import.metadata-once brings it back.) Importing walks the collection as a background job in the one queue (throttled, resumable, polite to the institution’s server: it respects its rate limits and retries with backoff).
  • No thumbnails are made in advance. A thumbnail is fetched from the image service, at thumbnail size, only when it scrolls into view, and kept in the bounded cache. The Library’s lists and grids load lazily, so a folder of a million pages opens as fast as one of a hundred.
  • Heavy work runs where the compute is, and fetches from the source. A recipe step on a million pages is sent to a cluster (ACENET), a GPU service or a Docker server. That machine fetches each image directly from the institution’s image service, at the size the model needs, never through the Mac; it returns only the results (passes, readings, claims, and the pixels-seen provenance), which land as usual. The Mac only coordinates.
  • Search and the knowledge graph grow with the results, indexed in batches as results land, not page by page.

Honesty about a remote source

  • It can change or vanish. See “Refreshing” above.
  • Rights travel with it. The manifest’s rights, requiredStatement and provider are stored on the source, shown in the Inspector, and carried into every export. A canvas behind IIIF authorization asks for access through the Authorization Flow; Fichero never stores the institution’s credentials, and the access tokens the flow issues are kept for the session only, so no token is ever at rest in the library file.
  • The institution’s text is a reading, not the truth. Transcription annotations in a manifest (supplementing, with text granularity) arrive as a pass whose maker is the publishing institution, like any other imported result. Fichero’s own corrections are new readings, never edits to theirs.

Out

  • Export a manifest. Any folder, document or selection exports as a Presentation 3.0 manifest (or collection). A page that came in by reference points at the original image service, so nothing is re-hosted; a local page points at Fichero’s own service (when shared) or at static tiles (in a static export).
  • What goes with it. Segments become annotations with SVG or box selectors on the canvas, with text granularity (block, line, word, glyph). The counting reading of each segment is its text, with its language and maker. Other readings, notes, editorial facts and claims go as further annotation pages, each labelled, so a viewer can turn them on and off.
  • Round trip. A manifest Fichero exported and then imports again lands where it came from: the same canvases, the same segments, no duplicate pages (the “test per path” rule: export, then import into a fresh library and into the one it came from). Three things make it hold. A by-reference page exports under the institution’s canvas id, so import matches it. A local page exports under an absolute id that carries Fichero’s own document id, so import into the library it came from lands on that document, and into a fresh library makes a by-reference page pointing at the exporting Fichero or the published site. And every exported annotation has a stable id made from its segment and reading, so importing the lines twice makes them once.

Fichero as a IIIF server

A library answers IIIF requests through the engine’s one port, with the accounts and permissions it already has (../transport/library-sharing.md, #5049). There is no second server, no second port and no toggle of its own.

Version 1: pictures for Fichero’s own screens, and manifests any viewer can read.

  • Image API 3.0, level 2, for local pages, answered from the original (or the edited page, where the page has edits), never from the display copy, so info.json gives the page’s real size and that size never changes under a viewer. Regions by pixels and by percentage, square, sizes max, w,, ,h, w,h and !w,h, rotation by 90s, default, color and gray, jpg and png. info.json lists sizes (the standing sizes above) and tiles (512 px, scale factors to the whole image). A request the server does not support is a 400 with a sentence, never a 500. Answers carry an ETag and a Cache-Control. The 2.1 form of the same answers stays for old viewers.
  • Fast enough to feel instant on an iPad. A size at or under a copy the Mac already keeps (the thumbnail, the display copy) is made from that copy, not from a 25 MB original. A tile is cut with a reduced decode where the format allows one, and kept in the same bounded cache. The budgets are in the behaviours.
  • Presentation API 3.0: a document is a manifest, a folder is a manifest (its pages) or a collection (its folders), the library is a collection. Every id is an absolute URL that answers (#6806). A by-reference page’s canvas keeps the institution’s id and image service.
  • Fichero’s own clients ask this way. The iPhone, the iPad and a second Mac ask for a page at the pane’s size (the standing size at or above it), the neighbours at the same size, and the visible tiles when zoomed in (#6572). The Mac’s own Preview asks the same route for tiles when it is magnified past the display copy (#5031). One code path, local socket or network.
  • Remote pages, for the library’s own people. A by-reference page asked for by a signed-in account of the library is answered from the Mac’s cache, fetched from the institution if need be: the iPad on the train sees what the Mac has seen. An anonymous viewer and every exported or published manifest get the institution’s own service, never a copy (the ruling of 2026-10-04 stands for the public; see Open question 6).
  • Access. Only what the asking account may read is served. What the rights record or a permission withholds is absent from manifests and a 404 from the image service (the ruling of 2026-09-28 that a deny hides, not marks). Requests carry the same token every other route takes.

Later, on the same routes.

  • Other people’s viewers. Mirador or the Universal Viewer in a browser cannot send Fichero’s token; opening a shared library to them needs the Authorization Flow on Fichero’s side, or a folder published openly. After version 1.
  • Annotations for other readings, notes and claims as their own labelled pages.
  • Content Search API 2.0 inside a manifest, answered from Fichero’s own search but returned in the API’s own envelope: hits as annotations with text quote and position selectors, in an annotation page.
  • Content State links: “Copy IIIF Link” on a selection gives a link that opens any viewer on that region of that page. The link is the API’s Base64URL-encoded form, and the same form pasted into Fichero opens or imports what it points at.
  • Static publishing, level 0. The static-site export (#3177) writes what the server would have answered, to files: for each page an info.json at level 0 naming exactly the sizes and tiles that were written, those files at the paths the Image API gives them ({id}/full/{w},{h}/0/default.jpg, {id}/{x},{y},{w},{h}/{w},{h}/0/default.jpg), and the same manifests and annotation pages with the site’s address as their base. One builder makes info.json, the tile grid, the manifests and the annotation pages for both; the static writer only loops over what info.json promises. A by-reference page is not tiled: its manifest points at the institution. A library can then be published on any web host with no Fichero running, and what it publishes can be imported by another Fichero by reference.

Trade-offs taken

  • Folders for manifests and ranges, not a flat list with labels. It costs a deeper tree and a refresh that must move pages between sub-folders when ranges change. It buys documents that are the units a person reads, runs recipes on and exports, and no label collisions.
  • Thumbnails without info.json. Asking !512,512 blind saves a request per page (half the traffic of a grid) and works on every level 1 and 2 server measured; a level 0 server answers 4xx and only then is its info.json read. The cost is one wasted request per level 0 page.
  • Standing sizes, not exact ones. Rounding the pane up to 1,024, 1,600 or 2,200 px wastes up to a third of the bytes of an exact fit, and makes every resize of a pane a cache hit.
  • Regions joined on capped servers, not tiles. Four to nine large regions rather than a hundred 256 px tiles: far fewer requests of the institution, at the cost of answers its CDN has probably not cached.
  • Pillow for version 1 of the server, not a tile server inside the app. Everything the app needs ships inside it; Pillow is there already. Reduced decoding and the derivative copies meet the budgets on the measured scan; libvips or a pyramid file format waits until a measurement says they are needed.
  • The Mac answers for remote pages to its own people. It spends the Mac’s cache and the institution’s bandwidth once instead of once per device, and lets a device with no route to the institution read. It is not re-publication: nobody outside the library’s accounts is served.

Behaviors

Tags were set by reading the code and by the runs under “Measured 2026-11-21”. → #NEW-n names an issue the review asks the manager to file (milestone iiif); the number before it is the existing issue the work sits under.

In, by reference: - iiif.import.by-reference — [PARTIAL] (#5324, #5671 → #6932) a pasted manifest or collection link adds its canvases as pages at once, without downloading their images. Built: POST /api/iiif/import and fichero import-iiif --iiif <URL> read Presentation 2 or 3 (measured on both) and keep each canvas’s id, Image API service and size, fetching only manifests (importers/iiif_source.py::import_source, importers/iiif_import.py::parse_iiif_url); File › Import from IIIF… pastes a link (Views/Library/IIIFImport.swift); pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py and fichero/Tests/Unit/general/Models/IIIFImportStoreTests.swift. Not built: reachable outside a dev build (the /api/iiif prefix is dev tier, iiif.serve.release-tier). - iiif.import.as-a-job — [OK] the import is one job in Activity (import-iiif, the network lane) that says how far it is and what it did; pinned by fichero-server/tests/unit/importers/test_iiif_source_5671.py::test_the_import_is_a_job_and_a_bound_folder_refreshes. - iiif.fetch.only-safe-public-urls — [OK] (#5324 → #6921) every address fetched for a IIIF source (manifest, collection, image, annotation page, and each redirect) is https, with no credentials, on a name that resolves only to global addresses; a manifest larger than 64 MB is refused. Built, pinned by fichero-server/tests/unit/importers/test_iiif_fetch_is_safe_and_polite.py: media/iiif_engine.py::safe_get checks every address and redirect, and media/iiif_fetch.py::urllib_get_once refuses a body over 64 MB. - iiif.fetch.polite-per-host — [PARTIAL] (#5671 → #6921) one fetcher serves the engine: at most four requests in flight to a host, at most two of them background work; 429 and 503 slow the whole host for the Retry-After; failures back off with jitter; the User-Agent names Fichero. Built: media/iiif_engine.py::engine_fetcher (one PoliteFetcher for viewing, steps and imports: four per host, backoff, Retry-After, the User-Agent). Not built: the split between what a person is looking at and background work. - iiif.fetch.unreachable-host-is-remembered — [GAP] (#5324 → #6921) a host that did not answer is not asked again for 60 seconds; requests for it in that minute fail at once with the same reason. Today each thumbnail tries three times with a 60 second timeout each. - iiif.import.collection-is-a-tree — [PARTIAL] (#5671 → #6922) a manifest becomes a folder bound to its own URL with its canvases as its pages; a collection becomes a folder whose manifests are child folders and whose collections are child folders of folders. Built: iiif_source.py::import_source makes one folder per collection and manifest, found again by IIIF id on a refresh; pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py::test_a_collection_imports_as_a_folder_of_folders_with_manifest_facts_stored_once. Not built: the two bullets below. Measured before: three manuscripts as 1,629 pages in one folder. - iiif.import.collection-appears-at-once — [GAP] (#5671 → #6922) a collection’s member folders are made from its own list (one request), marked not read yet; the job then reads manifests one at a time, a folder the person opens first; a stopped job resumes at the first folder not read. - iiif.import.sample-reads-only-its-manifests — [BROKEN] (#5671 → #6922) a sample of N manifests fetches the collections on the way to them and those N manifests, nothing else (depth first). Today every sub-collection is fetched before any manifest: measured, 103 requests for a sample of two. - iiif.import.metadata-once — [PARTIAL] (#5325 → #6923) a manifest’s label, summary, metadata pairs, date, rights, required statement, provider, homepage and see-also links are stored once, on its folder; a page stores only its own canvas facts and stays under 600 bytes of metadata. Built (#6922): rights and metadata pairs are on the manifest’s folder only (was 3.1 KB a page); pinned by the test above. Not built (Step 1.3): the other facts on the folder and the 600 byte limit. Pages imported before this keep working: a reader takes the folder’s facts first and the page’s copy when the folder has none. - iiif.import.ranges-are-structure — [GAP] (#5324 → #6924) a manifest’s ranges become sub-folders when every canvas is in at most one lowest range, the pages inside in order and the rest at the top; otherwise the pages stay flat and the ranges are kept on the folder as an outline. Presentation 2 structures and 3 structures both. structures is not read today. - iiif.import.reads-v2-and-v3 — [PARTIAL] (#1646) Presentation 2.1 and 3.0 manifests and collections both import. Built: by reference from a URL, both versions (measured on two Presentation 2 sources and one Presentation 3); a local folder of 3.0 manifests (iiif_import.py::import_iiif). Not built: 2.x (sequences) manifests in the local-folder importer. - iiif.import.their-text-is-a-pass — [PARTIAL] (#1646) a manifest’s transcription annotations arrive as a pass made by the publisher. Built: from a local folder, text arrives as page text. Not built: a remote canvas’s annotation pages are read at all (parse_iiif_url returns none); lines and words with text granularity becoming segments and readings. - iiif.folder.source — [PARTIAL] (#5324, #5671) a folder can be bound to a IIIF collection or manifest URL; its contents are that source by reference, and it follows the source: additions appear, withdrawals are shown as withdrawn, never silently deleted. Built: the folder remembers its source (metadata.iiif_source); POST /api/iiif/folders/{id}/refresh and the Inspector’s Refresh import again, adding new canvases and never making one twice (matched by canvas id); canvases no longer listed are counted and kept; pinned by fichero-server/tests/unit/importers/test_iiif_source_5671.py. Not built: a withdrawn page marked as such; a scheduled refresh. - iiif.refresh.unchanged-costs-one-request — [GAP] (#5671 → #6925) refreshing a manifest that has not changed makes one request (conditional when the source gave a validator) and no write: the folder keeps the validator and a hash of the manifest’s content. Today a refresh parses everything and rewrites the folder; a collection’s refresh fetches every manifest again. - iiif.refresh.changes-are-listed — [GAP] (#5325 → #6925) a refresh says what it found, in the job and on the folder: canvases added, withdrawn (marked, with the date; the mark is lifted if the source lists one again), reordered (the pages follow the source’s order), and changed in label, size or image service (updated in place). Today only added and no-longer-listed are counted. - iiif.rights-travel — [PARTIAL] (#5325 → #6923) the manifest’s rights, required statement and provider are stored, shown in the Inspector and carried into every export. Built: rights and the required statement are stored and written into the page’s exported manifest; pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py. Not built: provider; a single manifest’s folder gets no rights (the wrapping collection has none; measured, iiif_rights: {}); the Inspector reads the folder’s rights as a sentence and the engine stores an object, so nothing is shown (Models/IIIFImportStore.swift::IIIFFolderSource.of); the other exports. - iiif.auth-flow — [GAP] (#5325) a canvas behind IIIF authorization asks for access through the Authorization Flow; credentials are never stored in the library. - iiif.scale.million-pages — [PARTIAL] (#5324, #5671) a collection of a million canvases imports by reference as a throttled, resumable background job that respects the source’s rate limits; the library holds only per-canvas metadata, and opening a folder of a million pages is as fast as one of a hundred. Built: reference rows in batches of 1,000; 30,000 canvases from a fixture with one request; a second import makes nothing; pinned by fichero-server/tests/unit/importers/test_iiif_source_5671.py. Not built: measured at a million; opening a folder of a million pages.

Seeing a remote page: - iiif.view.fetches-what-is-shown — [PARTIAL] (#5324 → #6926) a remote page is drawn from region and size requests for what is on screen, through the bounded cache; no file path is ever involved; local and remote pages answer one storage call (pixels for a page, a region and a size; ruled 2026-10-04). Built: the first look fetches the whole page once at display size (db/storage.py::iiif_page_image); pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py::test_a_page_is_fetched_once_at_display_size_when_it_is_viewed. Not built: the one storage call; any size but the display size; any region. - iiif.view.thumbnail-at-thumbnail-size — [GAP] (#5324 → #6927) a remote page’s thumbnail is fetched at thumbnail size: the canvas’s own thumbnail when it is at least 256 px on its longer side, else full/!512,512/0/default.jpg; the display size is never fetched to make a thumbnail. Today the thumbnail is cut from a display-size fetch: measured, 205 KB a page where 26 KB would do. - iiif.scale.no-advance-thumbnails — [PARTIAL] (#5324) no thumbnail of a remote page is made in advance; it is fetched when it scrolls into view and kept in the bounded cache. Built: import warms no preview (measured: storage empty after an import of 225); pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py. Not built: the cache’s bound (iiif.cache.one-bounded-cache). - iiif.view.screen-size-in-standing-sizes — [GAP] (#5324, #6572 → #6926) the Preview and the Reader ask for a page at the pane’s pixel size rounded up to 1,024, 1,600 or 2,200 px on the longer side, never more than the page has; a pane resized within one standing size fetches nothing. - iiif.view.prefetches-neighbours — [GAP] (#5324 → #6929) while a remote page is shown, the page before and the page after are fetched at the same standing size, as background work, and abandoned if the person moves on before they start. - iiif.view.respects-the-services-limits — [GAP] (#5324 → #6928) a service’s info.json is read once, the first time a page needs more than a thumbnail, and kept with the page’s service: real size, sizes, tiles, the maximums, the level. Fichero asks for explicit sizes, never max or full as a size (measured: one server refuses max, one answers it upscaled to 10,000 px), never more than the real size, and of a level 0 service only what it lists. The size of what came back is read and kept; a service that returns less than asked is remembered as capped at that size. info.json is never read today. - iiif.view.zoom-asks-for-regions — [GAP] (#5324, #5031 → #6928) zooming a remote page past its screen size fetches only the visible region, on the service’s tile grid at the scale factor at or above the zoom, each tile once. - iiif.cache.one-bounded-cache — [PARTIAL] (#5324 → #6926) everything fetched from a remote service is in one cache under the project’s storage, keyed by its request, capped at a share of free disk with a floor (ruled 2026-10-04), least recently used out first; a file younger than the source’s Cache-Control age is not asked for again, an older one is revalidated. Built: the step images’ cache and its eviction (iiif_source.py::_evict, 10 percent of free disk, floor 1 GB). Not built: the viewing cache has no bound (storage/iiif/ is never evicted); two caches, keyed by page, so a second size of a page cannot be kept; freshness. - iiif.offline-is-said — [BROKEN] (#5324 → #6929) a remote page with any size cached shows it, scaled; with nothing cached it answers 503 with the reason remote_unreachable, and the app shows a placeholder that says the page is remote and cannot be reached now. Today the answer is 404 “no recorded file for this page” (measured), which is false, and the cell is blank. - iiif.keep-local-copy — [GAP] (#5324 → #6930) a source (collection, manifest or page) can be kept locally: Fichero says how much it will download (the sizes of five sample images times the page count), then fetches each full image once, politely, as a job, and stores it as a normal rendition; the page then works offline and is never evicted. (The old downloading loader, loaders/iiif_loader.py, is a different path, capped at 1,500 px, and goes when this lands.) - iiif.coords.canvas-space — [PARTIAL] (#5324) segments on a remote page are stored in canvas coordinates and stay put whatever resolution was fetched. Built (b6fd6a8bb): a remote run’s lines are scaled from the fetched size to the canvas on landing; pinned by fichero-server/tests/unit/remote_read/test_read_at_scale_job.py and fichero-server/tests/unit/remote_read/test_reading_at_scale.py. Not built: pinned for segments drawn in the app on a remote page.

Steps on a remote page: - iiif.run.local-step-fetches-its-size — [PARTIAL] (#5671) a step run on this Mac fetches only the remote pages it reads, at the size it reads them, never the whole source in advance. Built: the page is fetched through the Image API at 2,400 px on its longer side, once, into the bounded cache (iiif_source.py::step_image, from workflows/tools/sources.py::_resolve_abs_path); pinned by fichero-server/tests/unit/importers/test_iiif_source_5671.py. Not built: a step asking a size of its own; a failed fetch saying why (the reason is dropped, the step gets an empty path). - iiif.run.assembles-when-capped — [GAP] (#5324 → #6928) when a service returns less than a step asked for and the image has more, the page is fetched as the fewest regions that reach the asked size (2 × 2 at a 1,200 px cap for a 2,400 px read) and joined; the join is what the step reads and what the provenance names. Measured: a step asking 2,400 px of a 6,460 px page was given 1,200 × 850 and read that. - iiif.run.records-pixels-seen — [PARTIAL] (#5324 → #6931) a model run on a remote page records the image request (or requests), the size that came back, the service’s validator and a hash of the bytes in its provenance. Built for remote runs: the runner names the exact Image API request and the size it read as the PAGE file’s imageFilename/imageWidth/imageHeight, kept as the pass’s evidence; pinned by fichero-server/tests/unit/remote_read/test_reading_at_scale.py. Not built: a step on this Mac recording any of it; the validator and the hash anywhere. - iiif.run.same-pixels-are-not-read-twice — [GAP] (#5324 → #6931) for a remote page the input a result is kept against is the canvas, the request and the validator (the bytes’ hash when the source gives no validator), so a page evicted and fetched again is not run again by the same model. - iiif.change-is-detected — [GAP] (#5325 → #6931) when a cached image is revalidated and the validator or the bytes differ, the page says its image changed and the segments drawn on the old image are flagged for checking. - iiif.scale.remote-runs-fetch-from-source — [PARTIAL] (#5324, #5240) a step run on a cluster, GPU service or server fetches each image directly from the source’s image service, never through the Mac, and returns only results with the pixels-seen provenance. Built (3550e833e, b8bf84e53): a read package lists Image API services, not files, and the runner fetches each at the reader’s size; pinned by fichero-server/tests/unit/remote_read/test_reading_at_scale.py. Not built: the runner keeping to a service’s limits (iiif.view.respects-the-services-limits).

Out: - iiif.export.manifest — [PARTIAL] (#5326) a folder, document or selection exports as a Presentation 3.0 manifest or collection. Built: a manifest per document (api/routes/ingest/iiif.py::build_iiif_manifest), dev tier. Not built: a folder as a manifest of its pages, a folder of folders as a collection, a selection. - iiif.export.points-at-original — [PARTIAL] (#5326) a page that came in by reference exports pointing at its original image service; nothing is re-hosted. Built: a by-reference page’s manifest paints the archive’s own image at the canvas’s size with the image service exactly as the archive published it, and carries its rights and required statement (measured on the EAP item); pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py. Not built: a folder or collection export; the static site’s manifests. - iiif.export.segments-as-annotations — [PARTIAL] (#5326) segments export as annotations with selectors and text granularity, carrying the counting reading’s text, language and maker; other readings, notes and claims go as separate, labelled annotation pages. Built: a canvas names an annotation page of its working pass’s lines (GET /api/iiif/iiif/lines/{id}), read through the one page exporter; pinned by fichero-server/tests/unit/api/test_iiif_segments_as_annotations.py. Not built: other readings, notes and claims as their own labelled pages. - iiif.export.ids-are-absolute-and-resolve — [OK] (#5326, #6806) every id in an exported manifest, canvas, annotation page and annotation is an absolute HTTP(S) URI, as Presentation 3.0 requires, and the manifest’s own id is the address it is served at. Today every id is a bare path (/api/iiif/iiif/…, from _iiif_base_url), and the manifest names itself /api/iiif/iiif/{id}/manifest while the route that serves it is /api/iiif/iiif/manifest/{id} (measured again 2026-11-21: its own id answers 404). A served manifest takes its base from the request; one written to a file or a site takes it from where it is published (iiif.publish.static). Built: (#6806; fichero-server/tests/unit/api/test_iiif_export_a_viewer_can_open_6806.py) the served manifest, lines page and local image service take their base from the request, the manifest’s id is the address that answers, and info.json carries an absolute id. Not built: a manifest written to a file or a site. - iiif.export.every-line-with-its-outline — [PARTIAL] (#5326, #6806) the lines page carries every line of the working pass: its outline as an SVG selector when it has one (the box as the xywh fallback), its baseline, and a body only when it has a reading. Today a line with no reading is left out (5 annotations for 33 lines, measured 2026-11-20) and every target is #xywh=; regions and words are not written. Built: (#6806; fichero-server/tests/unit/api/test_iiif_export_a_viewer_can_open_6806.py) every line is an annotation, with an SVG selector when it has an outline and xywh otherwise, its baseline in canvas pixels (a baseline key, not a Web Annotation term), and a body only when it has a reading. Not built: regions and words. - iiif.export.maker-is-the-readings — [OK] (#5326, #6806) an annotation’s creator is who or what made THAT reading. Today it is the pass’s maker for every line (build_lines_annotation_page reads SegmentPass once): lines a person typed say the segmenter made them. Built: (#6806; fichero-server/tests/unit/api/test_iiif_export_a_viewer_can_open_6806.py) each annotation’s creator is the maker of its own reading (a person, or the provider and model); a line with no reading has none. - iiif.export.says-what-it-is — [GAP] (#5326) a local page’s manifest carries the document’s catalogue fields as metadata, its rights and required statement (../source/rights-and-access.md), and a provider; a by-reference page’s manifest also carries the source manifest’s metadata and provider back. Today a local page’s manifest has label and items and nothing else, and a by-reference page’s has no metadata (measured). - iiif.round-trip — [PARTIAL] (#5326, #6806) a manifest exported by Fichero and imported again, into a fresh library or the original one, lands on the same canvases with the same segments and no duplicate pages. Built for pages: a by-reference page’s exported manifest keeps the archive’s canvas id, so importing it again lands on the same pages with none doubled; pinned by fichero-server/tests/unit/importers/test_iiif_by_reference.py (mutation-checked). Not built: the lines coming back as the same segments (import reading an annotation page, matched by the annotation’s id); a local page landing on its own document (its id carries Fichero’s document id); ranges written back.

Server: - iiif.serve.image-api — [PARTIAL] (#5327 → #6933) the engine answers Image API 3.0 at level 2 for local pages: regions full, square, pixels and pct:; sizes max, w,, ,h, w,h, !w,h; rotation 0, 90, 180, 270; default, color, gray; jpg and png; an info.json with @context, an absolute id that answers, sizes (the standing sizes) and tiles (512 px, scale factors to the whole image); the 2.1 form of the same answers for old viewers. Built: pixel regions, full, w,, ,h, w,h, gray, in the 2.1 form, dev tier (api/routes/ingest/iiif.py::_serve_iiif_image, get_image_info). Not built: 3.0; !w,h, pct:, square, a right rotation (measured: 500, 500, not square, squeezed); a valid info.json (context for @context, an @id that answers 404); sizes. - iiif.serve.image-size-is-the-originals — [BROKEN] (#5327 → #6933) info.json gives the size of the page’s original (or of the edited page), regions are cut from it, and that size never changes. Today the image answered from is whichever of the display copy, the thumbnail or the original is found first (_get_image_path): measured, a 6,000 × 8,000 page is 6,000 × 8,000 until its display copy is made and 1,650 × 2,200 after, in info.json and in the manifest’s canvas. - iiif.serve.bad-requests-are-400 — [BROKEN] (#5327 → #6933) a request the Image API does not allow or this server does not support (an unknown region or size form, upscaling without ^, a region outside the image, an unknown format) is a 400 with a sentence; a region partly outside is clipped. Today these are 500, or answered wrongly (a region past the edge is padded with black). - iiif.serve.answers-are-cacheable — [GAP] (#5327 → #6933) every image, info.json and manifest answer carries an ETag and a Cache-Control, and a matching If-None-Match is a 304. None does today (the storage routes do). - iiif.serve.fast-enough-for-a-screen — [GAP] (#6572 → #6934) on the build Mac, for a 48-megapixel JPEG page: a whole-image size at or under the display copy answers in 50 ms or less (it is made from the nearest larger copy the Mac keeps); a 512 px tile answers in 200 ms or less the first time and 20 ms or less again (tiles are kept in the bounded cache; a JPEG is decoded at a reduced scale when the scale factor allows). Measured today: 300 ms for a 200 px picture and 170 ms for every tile, every time. - iiif.serve.presentation — [PARTIAL] (#5327 → #6935) the library tree is served as Presentation 3.0: the library and a folder of folders as collections, a folder of pages and a document as manifests, at /api/iiif/collection/{id} and /api/iiif/manifest/{id}; a by-reference page’s canvas keeps the source’s id and service; the old /api/iiif/iiif/… addresses keep answering. Built: one manifest per document. Not built: folders, collections, the library, the new addresses. - iiif.serve.release-tier — [GAP] (#5327 → #6932) importing from IIIF and the image and presentation routes are in every build that has sharing, not only a dev build (scripts/gen_feature_tiers.py’s source; today '/api/iiif': 'dev'). The menu item is not shown where the route is not. - iiif.serve.only-what-may-be-read — [GAP] (#5327 → #6935) only what the asking account may read is served; withheld material is absent from manifests and a 404 from the image service; the routes take the same token as every other route. - iiif.serve.no-own-toggle — [GAP] (#5327 → #6935) the IIIF server is part of sharing and has no separate switch (sharing and multi-user stay the only two toggles, ../transport/library-sharing.md). - iiif.client.asks-at-screen-size — [GAP] (#6572 → #6936) on an iPhone, an iPad or a second Mac, a page from a shared library is asked for at the pane’s standing size (the thumbnail shows meanwhile), and the neighbouring pages at the same size. Today every pane is sent the 2,200 px display copy (Services/StorageService.swift, GET /api/storage/display/{id}); measured on the public sources, a 1,024 px picture is a fifth of the bytes of a 2,200 px one. - iiif.client.tiles-when-zoomed — [GAP] (#6572, #5031 → #6936) zoomed past the picture it holds, the Preview (on the Mac and on the devices) asks the engine for the visible tiles at the needed scale and draws them over the picture, with no jump and the segments still in register. - iiif.serve.remote-pages-for-own-devices — [PROPOSED] (#5327 → #6937; Open question 6) a by-reference page asked for by a signed-in account of the library is answered through the same image route from the Mac’s cache, fetched from the source if need be; an anonymous viewer and every exported or published manifest get the source’s own service. Today the storage routes already send a device the Mac’s fetched copy, and the image route answers 404 for a by-reference page. - iiif.folder.published — [GAP] (#5327, #3177) a folder can be published as a IIIF collection (served when the library is shared, written in a static export); putting a document in publishes it, taking it out unpublishes it; withheld material stays out. - iiif.publish.static — [GAP] (#3177 → #6938) the static-site export writes, for each local page, a level 0 info.json naming exactly the sizes and tiles written, those files at their Image API paths, and the same manifests and annotation pages with the site’s address as base, all made by the builder the server uses; a by-reference page is not tiled and points at its source. - iiif.serve.search — [GAP] (#5327) Content Search API 2.0 inside a served manifest. - iiif.serve.content-state — [GAP] (#5327) “Copy IIIF Link” on a selection gives a Content State link that opens any viewer on that region.

Acceptance (end to end, on a scratch library)

  1. Import a manifest. Paste a public manifest of a few hundred canvases. Within two seconds a folder named for it holds a page per canvas; one request was made; the project grew by less than 1 KB a page; no image was fetched.
  2. Import a collection. Paste a collection of several manifests. Its folders appear after one request; each fills as its manifest is read; no two manifests share a folder.
  3. Look. Open the folder’s grid: thumbnails arrive at thumbnail size, at most four requests in flight to the host. Open a page: it arrives at the pane’s standing size; the next page is already there when turned to. Zoom in: only the visible region is fetched.
  4. Go offline. Pages seen still show. A page never seen says it is remote and cannot be reached. Refresh fails once, plainly.
  5. Read. Run segment and read on three pages: three images fetched at the step’s size, the results in canvas coordinates, each pass naming the request it saw. Run again: nothing is fetched and nothing is read.
  6. Refresh. Against a changed copy of the manifest (a fixture): one canvas added, one withdrawn, one relabelled; the job says so, the withdrawn page is marked and its segments are intact. Against the unchanged one: one request, no write.
  7. On the iPad. Open the same library from an iPad: a page arrives at the pane’s size, not 2,200 px; zooming fetches tiles; a withheld document is not there.
  8. Round trip. Export the folder as a manifest; import it into a fresh library and into this one: the same canvases, the same lines, nothing doubled.

Build order

Cut 2026-11-21 from the review. Engine before app; each step is one builder step of 25 files or fewer and ships alone. No unit test touches the network: every test reads fixture manifests and info.json files saved under fichero-server/tests/unit/importers/fixtures/iiif/ (trimmed to a handful of canvases from public sources, their addresses rewritten to iiif.archive.example, each with a row in that folder’s PROVENANCE.md) through the fake server the existing tests use (test_iiif_by_reference.py::FakeIIIFServer), which counts every request. The fixtures cover what was met in the field: a Presentation 3 manifest over an Image API 2 service that caps sizes; a Presentation 2 manifest with ranges and annotation lists; a collection of manifests; a collection of collections; a level 0 info.json; a service that upscales max.

Version 1 is Stages 1 to 4. Stage 5 lands with the export work (export-roundtrip). Stage 6 is later.

Stage 1 — Import by reference, done right

Step 1.1 — every IIIF fetch is safe, polite and gives up once (#5324)

  • Behaviours: iiif.fetch.only-safe-public-urls, iiif.fetch.polite-per-host, iiif.fetch.unreachable-host-is-remembered
  • Tests: fichero-server/tests/unit/importers/test_iiif_by_reference.py, test_iiif_fetch_is_safe_and_polite.py (not yet written)
  • Size: M

One fetcher for the engine in media/iiif_fetch.py, handed to storage, steps and imports; the safety check wraps its getter and follows redirects itself. Tests: a manifest naming a loopback image service, a redirect to plain http and a 65 MB body are each refused with a sentence; five requests to one host never run more than four at once and never more than two background; a dead host costs one try a minute.

Step 1.2 — a manifest is a folder, a collection is a folder of folders (#5671)

  • Behaviours: iiif.import.collection-is-a-tree, iiif.import.collection-appears-at-once, iiif.import.sample-reads-only-its-manifests
  • Tests: fichero-server/tests/unit/importers/test_iiif_source_5671.py, test_iiif_collection_is_a_tree.py (not yet written)
  • Depends on: 1.1
  • Size: M

parse_iiif_url yields a tree, depth first; import_source binds each manifest’s folder to its own URL and makes unread member folders from the collection’s list before reading any manifest. A folder that already holds the old flat import is left as it is and refreshed as before. Tests: the collection fixtures give one folder a manifest, no shared parents, a sample of two in two plus-the-path requests, and a restart that reads only what was unread.

Step 1.3 — what a manifest says is stored once and shown (#5325)

  • Behaviours: iiif.import.metadata-once, iiif.rights-travel
  • Tests: fichero-server/tests/unit/importers/test_iiif_by_reference.py, test_iiif_manifest_facts_are_stored_once.py (not yet written), fichero/Tests/Unit/general/Models/IIIFImportStoreTests.swift
  • Depends on: 1.2
  • Size: M

The folder carries label, summary, metadata pairs, date, rights, required statement, provider, homepage and see-also; the page under 600 bytes. The manifest route and the Inspector read the folder first and an old page’s copy second. IIIFFolderSource reads the rights object. Tests: a page row’s metadata size; the Inspector’s sentence from the fixture’s rights; an old-shape page still exports its rights.

Step 1.4 — ranges become structure (#5324)

  • Behaviours: iiif.import.ranges-are-structure
  • Tests: test_iiif_ranges_are_structure.py (not yet written)
  • Depends on: 1.3
  • Size: M

Waits on Open question 7. Tests: clean ranges (2 and 3) become sub-folders in order with the unranged pages at the top; overlapping ranges leave the pages flat and the outline on the folder.

Step 1.5 — a refresh says what changed and costs nothing when nothing did (#5671)

  • Behaviours: iiif.folder.source, iiif.refresh.unchanged-costs-one-request, iiif.refresh.changes-are-listed
  • Tests: fichero-server/tests/unit/importers/test_iiif_source_5671.py, test_iiif_refresh_says_what_changed.py (not yet written), fichero/Tests/Unit/general/Models/IIIFImportStoreTests.swift
  • Depends on: 1.3
  • Size: M

The folder keeps the validator and the content hash; the job’s result lists added, withdrawn, reordered and changed; a withdrawn page carries the mark the Items pane draws. Tests: the unchanged fixture is one request and no save; the changed fixture’s four kinds are each listed and applied; a relisted canvas loses its mark.

Step 1.6 — IIIF is in the builds that have sharing (#5327)

  • Behaviours: iiif.import.by-reference, iiif.serve.release-tier
  • Tests: fichero-server/tests/unit/api/test_routes_iiif.py, test_iiif_routes_are_in_a_released_build.py (not yet written)
  • Depends on: 1.1
  • Size: S

The tier source and its two generated files; the menu item follows the route. Waits on Open question 9 for which tier.

Stage 2 — Seeing a remote page

Step 2.1 — one call for pixels, one bounded cache, standing sizes (#5324)

  • Behaviours: iiif.view.fetches-what-is-shown, iiif.cache.one-bounded-cache, iiif.view.screen-size-in-standing-sizes
  • Tests: fichero-server/tests/unit/importers/test_iiif_by_reference.py, test_page_pixels_one_call.py (not yet written), test_remote_image_cache_is_bounded.py (not yet written)
  • Depends on: 1.1
  • Size: M

db/storage.py gains the call the 2026-10-04 ruling asked for (a page, a region, a size, for local and remote alike); iiif_page_image and step_image become callers of it; storage/iiif/ and storage/iiif-steps/ become one cache keyed by request, with the eviction that exists. Tests: two sizes of one page are two files; past the cap the oldest goes; a fresh file is not asked for again and a stale one is revalidated.

Step 2.2 — thumbnails at thumbnail size (#5324)

  • Behaviours: iiif.view.thumbnail-at-thumbnail-size, iiif.scale.no-advance-thumbnails
  • Tests: fichero-server/tests/unit/importers/test_iiif_by_reference.py, test_remote_thumbnail_is_thumbnail_sized.py (not yet written)
  • Depends on: 2.1
  • Size: S

Tests: a canvas with a thumbnail asks for that address; one without asks !512,512; in neither case is a display-size request made; a level 0 answer of 4xx reads info.json once.

Step 2.3 — a service’s limits are read and kept to; zoom asks for regions (#5324)

  • Behaviours: iiif.view.respects-the-services-limits, iiif.view.zoom-asks-for-regions
  • Tests: test_iiif_service_limits.py (not yet written), test_page_pixels_one_call.py (not yet written)
  • Depends on: 2.1
  • Size: M

Tests, from the info.json fixtures: explicit sizes only, never max; a level 0 service is asked only for listed sizes and tiles; a capped answer is noticed and remembered; a region request lands on the tile grid at the right scale factor.

Step 2.4 — offline is said; the neighbours are ready (#5324)

  • Behaviours: iiif.offline-is-said, iiif.view.prefetches-neighbours
  • Tests: test_remote_page_unreachable_is_said.py (not yet written), RemotePagePlaceholderTests.swift (not yet written)
  • Depends on: 2.1
  • Size: M

The storage routes answer 503 remote_unreachable for a by-reference page with nothing cached, and a scaled cached size otherwise; the app’s image cell shows the placeholder for that reason. Tests: the route’s answer with a dead fetcher; the placeholder’s words; a shown page queues its two neighbours as background fetches.

Step 2.5 — keep a local copy (#5324)

  • Behaviours: iiif.keep-local-copy
  • Tests: test_iiif_keep_a_local_copy.py (not yet written)
  • Depends on: 2.3
  • Size: M

A job that estimates, asks, then fetches; the old downloading loader goes. Waits on Open question 8 for capped services.

Stage 3 — Steps on remote pages

Step 3.1 — a step gets the pixels it asked for (#5671)

  • Behaviours: iiif.run.assembles-when-capped, iiif.run.local-step-fetches-its-size
  • Tests: fichero-server/tests/unit/importers/test_iiif_source_5671.py, test_iiif_capped_service_is_joined.py (not yet written)
  • Depends on: 2.3
  • Size: M

Tests: against the capped fixture a 2,400 px read is four region requests and one joined image of the right size; an uncapped service is one request; a failed fetch names its reason in the step.

Step 3.2 — a run says what it saw, is not repeated, and a changed image is flagged (#5325)

  • Behaviours: iiif.run.records-pixels-seen, iiif.run.same-pixels-are-not-read-twice, iiif.change-is-detected, iiif.coords.canvas-space
  • Tests: fichero-server/tests/unit/remote_read/test_reading_at_scale.py, test_iiif_run_records_what_it_saw.py (not yet written)
  • Depends on: 3.1
  • Size: M

Tests: a local step’s pass names the request, the size, the validator and the hash; evict, fetch and run again reads nothing; a revalidation with different bytes flags the page’s segments; a segment drawn at one fetched size sits in the same canvas place at another.

Step 3.3 — the institution’s text arrives as a pass (#1646)

  • Behaviours: iiif.import.their-text-is-a-pass, iiif.import.reads-v2-and-v3
  • Tests: fichero-server/tests/unit/importers/test_iiif_import.py, test_iiif_their_text_is_a_pass.py (not yet written)
  • Depends on: 1.3
  • Size: M

Annotation pages are fetched only when a page is opened or a step asks, never at import. Tests: the line-granularity fixture becomes one pass of segments and readings made by the publisher; a second read makes nothing; the local-folder importer reads the Presentation 2 fixture.

Stage 4 — Fichero as a IIIF server, version 1

Step 4.1 — Image API 3, level 2, from the original, correctly (#5327)

  • Behaviours: iiif.serve.image-api, iiif.serve.image-size-is-the-originals, iiif.serve.bad-requests-are-400, iiif.serve.answers-are-cacheable
  • Tests: fichero-server/tests/unit/api/test_routes_iiif.py, test_iiif_image_api_3.py (not yet written)
  • Size: M

The request parser and info.json builder move out of the route into media/ so the static writer can call them (Step 6.1). Tests: a table of requests and the exact pixel size of each answer, on a small generated image; info.json validated against the vendored Image API 3 schema; the same size before and after a display copy is made; each bad request’s 400.

Step 4.2 — fast enough for a screen (#6572)

  • Behaviours: iiif.serve.fast-enough-for-a-screen
  • Tests: test_iiif_image_api_3.py (not yet written), test_iiif_serve_budgets.py (not yet written)
  • Depends on: 4.1, 2.1
  • Size: M

Tests: a size at or under the display copy opens the display copy, not the original (counted, not timed); a tile asked twice decodes once; the budgets as a perf test on the build Mac.

Step 4.3 — Presentation 3 for the tree, absolute ids, the library’s own access (#5327)

  • Behaviours: iiif.serve.presentation, iiif.serve.only-what-may-be-read, iiif.serve.no-own-toggle, iiif.export.ids-are-absolute-and-resolve
  • Tests: fichero-server/tests/unit/api/test_routes_iiif.py, test_iiif_presentation_tree.py (not yet written), test_iiif_serves_only_what_may_be_read.py (not yet written)
  • Depends on: 4.1, 1.3
  • Size: M

Tests: every id in a served folder manifest and collection is absolute and answers; the manifest validates against the vendored Presentation 3 schema; a withheld document is absent from the collection and its image is 404 for that account; no route answers without a token when sharing is on.

Step 4.4 — the devices ask at the pane’s size (#6572)

  • Behaviours: iiif.client.asks-at-screen-size
  • Tests: PageImageRequestTests.swift (not yet written), test_iiif_image_api_3.py (not yet written)
  • Depends on: 4.2, 4.3
  • Size: M

StorageService asks the image route for the standing size at or above the pane; the thumbnail shows meanwhile; the neighbours follow. Tests: the size rule (pane to standing size) as a pure function; one request a page turn; the generated client is the only caller.

Step 4.5 — tiles when zoomed, on the Mac and the devices (#5031)

  • Behaviours: iiif.client.tiles-when-zoomed
  • Tests: PreviewTilePlanTests.swift (not yet written)
  • Depends on: 4.4
  • Size: M

Tests: the tile plan (visible rectangle and zoom to tile requests on the grid) as a pure function; segments keep their place when tiles replace the picture.

Step 4.6 — remote pages for the library’s own devices (#5327)

  • Behaviours: iiif.serve.remote-pages-for-own-devices
  • Tests: test_iiif_image_api_3.py (not yet written)
  • Depends on: 4.3, 2.3
  • Size: S

Waits on Open question 6. Tests: a signed-in account gets a by-reference page’s size from the cache; an anonymous request gets 404; the manifest still names the source’s service.

Stage 5 — Out and back

Step 5.1 — the lines page: every line, its outline, its own maker (#6806)

  • Behaviours: iiif.export.every-line-with-its-outline, iiif.export.maker-is-the-readings, iiif.export.segments-as-annotations
  • Tests: fichero-server/tests/unit/api/test_iiif_segments_as_annotations.py
  • Depends on: 4.3
  • Size: M

Step 5.2 — a folder exports as a manifest or collection that says what it is (#5326)

  • Behaviours: iiif.export.manifest, iiif.export.says-what-it-is, iiif.export.points-at-original
  • Tests: fichero-server/tests/unit/importers/test_iiif_by_reference.py, test_iiif_presentation_tree.py (not yet written)
  • Depends on: 4.3
  • Size: M

Step 5.3 — export, import, the same thing (#5326)

  • Behaviours: iiif.round-trip
  • Tests: fichero-server/tests/unit/importers/test_iiif_by_reference.py, test_iiif_round_trip_per_path.py (not yet written)
  • Depends on: 5.1, 5.2, 3.3
  • Size: M

Tests, per path: a by-reference folder and a local folder, each exported and imported into a fresh library and into the one it came from; pages, ranges, lines and readings counted before and after; a second import adds nothing.

Stage 6 — Later

Step 6.1 — static publishing at level 0 from the server’s own builder (#3177)

  • Behaviours: iiif.publish.static, iiif.folder.published
  • Tests: test_static_iiif_level_0.py (not yet written)
  • Depends on: 4.1, 5.2
  • Size: M

Tests: every file info.json promises exists and nothing else does; the written manifest imports by reference from a local file server fixture. Waits on Open question 10.

  • Behaviours: iiif.serve.search, iiif.serve.content-state
  • Tests: test_iiif_content_search_and_state.py (not yet written)
  • Depends on: 4.3
  • Size: M

Step 6.3 — the Authorization Flow, as a client (#5325)

  • Behaviours: iiif.auth-flow
  • Tests: test_iiif_authorization_flow.py (not yet written)
  • Depends on: 2.3
  • Size: M

Step 6.4 — a million pages, measured (#5324)

  • Behaviours: iiif.scale.million-pages, iiif.scale.remote-runs-fetch-from-source
  • Tests: fichero-server/tests/unit/importers/test_iiif_source_5671.py, test_iiif_million_canvases.py (not yet written)
  • Depends on: 1.5, 3.1
  • Size: M

Documentation matrix, preview harness, accessibility identifiers, UX completeness

Filled at approval, from the surfaces this spec settles (see Open questions). Listed here as missing so the gap is visible: none of the four is written yet. [MISSING]

Test matrix

Leg This surface? Pins File
Pure rule (Swift) y pane size to standing size; the tile plan; the folder’s source sentence; the unreachable placeholder fichero/Tests/Unit/general/Models/IIIFImportStoreTests.swift; PageImageRequestTests.swift and PreviewTilePlanTests.swift (not yet written)
Availability (Swift) y File › Import from IIIF… and the folder’s Refresh are reachable fichero/Tests/Unit/general/Models/IIIFImportStoreTests.swift
Backend (pytest) y import, refresh, the pixels call, the cache, the image and presentation routes, access fichero-server/tests/unit/importers/test_iiif_*.py, fichero-server/tests/unit/api/test_routes_iiif.py; test_iiif_image_api_3.py (not yet written)
MCP n
CLI y fichero import-iiif --iiif <URL> fichero-server/tests/unit/importers/test_iiif_by_reference.py
Click-around (XCUITest, Mac) y paste a link, see pages, open one not yet written
iPhone (iOS) y a shared page arrives at the pane’s size not yet written
iPad y the same, and tiles when zoomed not yet written

The round trip is tested per path (export, then import into a fresh library and into the one it came from). Unit tests never touch the network. A separate, hand-run check (not in the gate) repeats “Measured 2026-11-21” against real manifests from at least three institutions (one Presentation 2, one 3, one with a capped image service), a few requests each, before a release that changes how Fichero asks.

Rulings

  • 2026-10-04 (#5323): the spec is approved by the maintainer with its four recommendations. (1) The cache is a share of free disk with a floor, not a fixed cap. (2) A model run keeps the full image of a remote page while the source is in use, evicted with the cache. (3) Remote images are not proxied for viewers of a shared library; the manifest points at the original. (4) One storage call answers for local and remote pages (pixels for a page, a region and a size), and its shape is designed before iiif.import.by-reference is built. Status stays DRAFT: approved by the maintainer 2026-10-04; APPROVED status waits on a Manual: section (it reads TBD), a filled Test matrix and a test that cites this spec.
  • 2026-11-21 (review, owner asked): where the building left the rulings. (1) holds for step images only; the viewing cache has no bound. (3) is not what the code does: the storage routes send any device the Mac’s fetched copy of a remote page; Open question 6 asks the owner to rule again. (4) was not done first: import by reference was built without the one storage call, which is now Step 2.1.

Open questions

For the owner, from the review of 2026-11-21:

  1. Open (#5327): May the Mac answer for remote pages to the library’s own people? The 2026-10-04 ruling says remote images are not proxied to viewers of a shared library. The owner’s request of 2026-11-21 is that the iPhone, the iPad and shared libraries get previews from the Mac. Recommendation: yes for signed-in accounts of the library (the Mac’s cache serves them, as the storage routes already do), no for anonymous viewers and for anything exported or published, which always point at the institution.
  2. Open (#5324): Ranges as sub-folders, or as an outline only? Sub-folders make a manifest’s parts things a person can select, run a recipe on and export; they also change what a “page’s folder” is and make refresh move pages. Recommendation: sub-folders when the ranges divide the canvases cleanly, an outline otherwise.
  3. Open (#5324): Keeping a local copy from a service that caps sizes. One measured service gives 1,200 px a request for 6,500 px pages; full resolution is two dozen region requests a page, a hundred if tiles. Recommendation: say so before starting, default to the largest single request, and offer full resolution as a slower, explicit choice.
  4. Open (#5327): Which builds get IIIF, and when? It is dev tier today, so File › Import from IIIF… works only in the daily build. Recommendation: beta once Stages 1 and 2 are in; release with Stage 4.
  5. Open (#3177): What a published site carries for each local page. Sizes only (a thumbnail, 1,024 and 2,200 px: about a megabyte a page, no deep zoom) or sizes and tiles (deep zoom, about one and a third times the original’s bytes, some 250 files for a 48-megapixel page). Recommendation: sizes by default, tiles as a choice per published folder.
  6. Open (#5671): Does a bound folder refresh by itself? Recommendation: no schedule in version 1; Refresh in the Inspector, and a quiet check when a folder not refreshed for a week is opened (one request when nothing changed).
  7. Open (#5327): Is “Fichero’s own screens, and manifests any viewer can read” enough for version 1 of the server? Mirador in a browser against a shared library needs the Authorization Flow on Fichero’s side or an openly published folder. Recommendation: later.

  8. Open (#5671): Straight to Hugging Face. Should a IIIF source be sent to a training or reading job on Hugging Face directly, with the images fetched there from the source, rather than through this Mac? Out of scope for #5671; it decides whether a remote run’s package may name a Hugging Face destination.

Answered 2026-10-04 by taking each recommendation; see Rulings. Kept for the reasoning.

  1. Answered (maintainer 2026-10-04: IIIF approved as recommended): As the spec recommends. Cache size. A fixed cap (for example 2 GB) with least-recently-used eviction, or a share of free disk? Recommendation: a share of free disk with a floor, because the Air showed how little room a small Mac has.
  2. Answered (maintainer 2026-10-04: IIIF approved as recommended): As the spec recommends. Models on remote pages. Fetch at full resolution every run, or keep the full image after the first run? Recommendation: keep it for as long as the source is in use, and evict it with the cache.
  3. Answered (maintainer 2026-10-04: IIIF approved as recommended; asked again as question 6): As the spec recommends. Proxying remote images for viewers of a shared library who cannot reach the institution. Recommendation: no; the manifest points at the original. Revisit if a real case appears.
  4. Answered (maintainer 2026-10-04: IIIF approved as recommended): As the spec recommends. The storage call for a remote page. Today the storage layer resolves local files (db/storage.py). A remote page needs one call that both kinds of page answer (pixels for a page, a region and a size), so the Preview, thumbnails and model runs have one caller. Its shape is designed before iiif.import.by-reference is built, not during it.

Triaged from the backlog (2026-10-04)

  • iiif.import.json-type-strips-compact-prefixes — [OK] (#5405) iiif_import._json_type strips sc:, oa: and dctypes: prefixes so a v2 canvas reads as Canvas; pinned by fichero-server/tests/unit/importers/test_iiif_import_helpers.py::test_json_type.