interplane.Get Omega
Read in your language

interplane-forge

INTERPLANE Forge

Brought by drakestapleton

branch main Branches Tags History

interplane-forge / tools / doi / README.md

204 lines · 13870 bytes Raw Blame History Source

Reserve a DOI for a paper

A local author tool, not an Interplane endpoint. It creates a Zenodo draft, reserves a DOI, uploads the paper, and puts the DOI into the author's .zenodo.json. It publishes only after the author types exactly yes at /dev/tty. No, Yes, yes , EOF and no terminal keep the draft unpublished. It does not publish the repository to Radicle or send a token to Interplane.

The default is sandbox.zenodo.org: test records, not registered DOIs. Production requires --production. A production publication is permanent: inspect the metadata and files first.

Build and use

Linux AArch64, seeded Omega. From this repository's root:

sh tools/doi/build.sh
# Or name the compiler and an output directory:
sh tools/doi/build.sh /path/to/omega-mv/seed/out/omc /path/to/output

The compiler must have SHA-256 3ad9f10f64309e7acf8a725082b28e23a2a4aeb07e98322fb4dc0fcd8fc93194 (omega-mv f4df82394e35893dcf1354dda69a2fe028d94bc1). Any other binary is refused. The default output is .build/doi/doi; set DOI_ENGINE=/path/to/output/doi when using another directory. Keep doi.sh, fixture-curl.sh and the engine together with this checkout; no system install or server change is needed.

Create a personal access token on the selected Zenodo site, with deposit:write and deposit:actions scopes. Sandbox and production tokens are separate. Enter it without shell history or a credentials file (these two lines are for Bash):

read -rsp 'Zenodo token: ' ZENODO_TOKEN; printf '\n'
export ZENODO_TOKEN

Then run:

sh tools/doi/doi.sh /path/to/paper-repo
# Optional: also upload a source archive you have already prepared and inspected.
sh tools/doi/doi.sh /path/to/paper-repo --source /path/to/source.tar.gz
# A real registered DOI, only when the author deliberately chooses production:
sh tools/doi/doi.sh /path/to/paper-repo --production
unset ZENODO_TOKEN

The tool checks everything locally before its first request. It then creates a draft, validates all returned links, prints the draft URL and reserved DOI, and inserts "doi" as the first metadata member. All original metadata bytes are retained. It uploads **every top-level *.pdf (case insensitive), including untracked PDFs, and the optional source file **before publish consent. Git tracking is not consulted. Inspect this selection before running the tool: declining publication does not undo these uploads to the private draft. The tool prints the selected names and checks each acknowledged file name and size. The publish prompt names the selected site and DOI. Type yes there only after deciding to publish; any other answer exits successfully with “Draft kept, not published.”

A reservation is saved before uploads so an upload failure does not lose its DOI. There are no automatic retries: a lost create response could otherwise create a second draft. On interruption, HTTP error, upload mismatch or declined consent, inspect the draft on the selected Zenodo site and finish or delete it there. A second run refuses metadata that already contains doi. Remove that field only when you deliberately want a new deposit, not as a retry. No replace/update/new-version API is used. .zenodo.json.doi-new is reserved exclusively before the first request. If it already exists, the tool makes zero requests. Inspect it after an interrupted or refused run; it may hold an empty reservation, a DOI candidate, or the displaced original following a sync failure. The tool does not overwrite or automatically delete a pre-existing temp. After a successful transaction it removes its own displaced original only after verifying its bytes and syncing the directory.

One Omega keeper retains the opened repository directory and its exclusive advisory directory lock through snapshot and metadata write-back. Changing the original repository pathname cannot redirect the write: if the directory is renamed, the write remains in that original directory. A competing instance fails before any request. All path components are opened without following symlinks; paths with empty, . or .. components are refused (use an absolute non-symlink path).

The submitted metadata bytes must still match before write-back. An atomic RENAME_EXCHANGE then preserves the displaced metadata, which is compared again to catch an edit immediately before the exchange. The candidate stays mode 0600 while written; after the exchange the keeper checks that the installed .zenodo.json is the same inode (device and inode number) as its retained candidate descriptor, and only then restores the original permission bits. If the candidate name was replaced by another file, the exchange is reversed: the original metadata is restored and the substituted file is left at .zenodo.json.doi-new for inspection. On metadata mismatch the exchange is reversed and the edit preserved; the printed draft URL and DOI remain available for manual reconciliation, and no upload or publication follows. Successful write-back fsyncs the candidate and retained repository directory before the shell proceeds. A sync failure is an error, not a saved/published result; inspect both local files and the draft.

Paper repository format

At the repository root, provide a nonempty LICENSE (also accepted: LICENSE.md, LICENSE.txt, LICENCE, COPYING), at least one nonempty PDF, and .zenodo.json. This is Zenodo metadata itself, not a {"metadata": ...} wrapper:

{
  "title": "My paper",
  "creators": [{"name": "Family, Given", "orcid": "0000-0000-0000-0000"}],
  "description": "The abstract or description of the paper.",
  "license": "cc-by-4.0",
  "upload_type": "publication",
  "publication_type": "article",
  "keywords": ["research"]
}

Required: nonempty strings title, description, license (or {"id":"cc-by-4.0"}), upload_type; a nonempty creators array, each element an object with a nonempty string name. publication_type is required for upload_type: publication; image_type for image. Other upload types are poster, presentation, dataset, video, software, lesson, physicalobject, other. Zenodo itself checks its controlled vocabularies and any optional metadata. Its field errors are displayed, not suppressed. Unknown metadata is retained verbatim. Top-level keys must be written plainly without JSON backslash escapes. Do not supply doi or prereserve_doi: this tool manages the reservation. There is no CFF parser.

Upload base names may contain only A-Z a-z 0-9 - . _ and cannot start with a dot. Duplicate base names, empty files, nonregular files and symlink inputs (including metadata, licenses, PDFs and source) are refused. Source is an explicit file: the tool never archives the repository or reads .git. Untracked PDFs are deliberately included: a matching PDF can contain private material, and the optional source is uploaded exactly as supplied.

Token and transport boundary

JSON parsing, validation, URL/DOI checks, rewrite and terminal consent are seeded Omega (doi.om). The shell performs transport/file IO and sequences curl with the Omega keeper protocol. Repository custody, enumeration, snapshot comparison, exclusive reservation and exchange are Omega, not shell. The parser is independently implemented using the recursive-descent pattern inspected in omega-harness tools/jflat.om at Radicle commit 92eba82c; no third-party parser is vendored. The pinned compiler has no runtime array growth: an input JSON file of 16777216 bytes or more is explicitly refused (its largest global array); excessive nesting stops at its 8 MiB stack limit. These are compiler storage boundaries, not claims of unlimited input support.

Transport dependency observed on the development host: curl 8.5.0, libcurl 8.5.0, OpenSSL 3.0.13. It supplies HTTPS/TLS and file transfer only. The Omega successor is a Zenodo HTTP adapter on omega-mv's om/tls primitives; it is not implemented or claimed by this slice. Shell/coreutils supply file IO (mktemp, mkfifo, dirname, wc, tr, cleanup); no Python, jq, Rust, C or JS product logic.

Offline fixtures and full check

bash tools/doi/tests/run.sh "$HOME/work/flux/omega-mv/seed/out/omc"

The suite builds the pinned engine and uses a fixed fake token. It runs every request through fixture-curl.sh, a stand-in that copies static response files and records method/URL/argv and uploaded bytes; it never runs curl or makes any connection. A pseudo-terminal simulates exact yes only for fixtures. Dependencies for the suite: Bash, coreutils, util-linux script/setsid, and strace (actual execve argv audit). It checks request JSON and rewritten metadata against independent byte fixtures, sandbox default, explicit production, source/PDF bytes, required metadata/LICENSE/PDF, existing DOI, declined/wrong-case/extra-space/no-tty consent, wrong origin/scheme/lookalike URLs, HTTP failures, upload mismatches, input symlinks (metadata/LICENSE/PDF/source, including dangling), post-snapshot replacement, ancestor/root swaps, two metadata-drift timings, exclusive writer/temp refusals with specific diagnoses, actual directory-fsync traces and injected sync failure, actual keeper protocol writes (including an erroneous-SAVED/nonzero-exit negative control), deterministic keeper death before input and output setup, identical stopped/continued startup controls, no remaining keeper/supervisor PIDs, a swallowed-death timeout negative control, inherited zero core limits, exact endpoint grammar, and token absence from every file and actual argv. The test timeout is an alarm, not a product startup timeout. The short Omega polling interval only schedules liveness checks; readiness and child status, never elapsed time, decide success.

Manual offline flow (copy the fixture directory first: the stand-in writes request logs there):

cp -R tools/doi/tests/fixtures /path/to/offline-responses
ZENODO_TOKEN=fixture-only sh tools/doi/doi.sh /path/to/test-paper --fixture /path/to/offline-responses

--fixture never falls back to a real request; omit it only for a deliberate author operation. The full fixture module is host-only verification. No real Zenodo operation or credential is part of development verification.