{
  "$comment": "Expected outcomes for the MDPack conformance corpus. Generated by tools/build-corpus.mjs; do not edit by hand. A Conforming Reader must accept every file under valid/ and reject every file under invalid/, reporting one of the listed error classes.",
  "specification": "0.1.0-draft",
  "errorClasses": {
    "not-an-mdpack": "The file is not an MDPack package: unreadable as ZIP, no manifest, or the manifest does not identify itself as MDPack.",
    "unsupported-version": "An MDPack package whose version the reader does not implement. Must be distinguishable from corruption so the user is told to upgrade.",
    "malformed-manifest": "mdpack.json is present and identifies itself as MDPack but violates a structural requirement.",
    "integrity-failure": "Package contents contradict themselves: checksum mismatch, byte-length mismatch, duplicate entries, truncation, or invalid UTF-8 in a text entry.",
    "security-violation": "The package attempts something hostile, such as path traversal or an encrypted entry.",
    "resource-limit": "Decompressing the package would exceed a reader resource limit."
  },
  "valid": [
    {
      "file": "minimal.mdpack",
      "description": "Manifest and document only, no assets.",
      "notes": "The smallest conforming package. Note there is no assets/ directory entry: 0.1 §3.5 requires readers to accept its absence, because ZIP archives do not reliably preserve empty directories."
    },
    {
      "file": "with-assets.mdpack",
      "description": "A PNG and a PDF, both referenced by relative path and both declared.",
      "notes": "The core happy path: relative reference resolution (§6.2), byte lengths and checksums (§7), and the inline and attachment roles (§4.9)."
    },
    {
      "file": "no-mimetype.mdpack",
      "description": "Package without the mimetype entry.",
      "notes": "The mimetype entry is SHOULD for writers and MUST NOT be required by readers (§3.3). A package written with a stock ZIP library will not have one."
    },
    {
      "file": "required-members-only.mdpack",
      "description": "A manifest carrying nothing but format, version, entrypoint and assets.",
      "notes": "Every other member is optional (§4.4). A reader must not require id, title or timestamps, and must fall back to the file name for the display title."
    },
    {
      "file": "unknown-entries.mdpack",
      "description": "Unknown entries and unknown manifest members that must survive a round trip.",
      "notes": "Round-trip-preserving Writers (§12.3) must reproduce thumbnails/cover.png, metadata/extra.json, vendor-notes.txt and the com.example.* manifest members unchanged after a read-modify-write cycle. Readers of any class must accept the file. The .scratch/ entry is the one exception: §3.6 says implementation scratch space must neither be extracted nor preserved."
    },
    {
      "file": "untracked-asset.mdpack",
      "description": "A file under assets/ that the manifest does not declare.",
      "notes": "Permitted by §4.7. Readers must accept it; a strict validator reports it as untracked, and cleanup tooling lists it as a deletion candidate (§9.3)."
    },
    {
      "file": "percent-encoded-asset.mdpack",
      "description": "A Unicode asset name that must be percent-encoded in the Markdown reference.",
      "notes": "The document references assets/%D1%81%D1%85%D0%B5%D0%BC%D0%B0%20%D1%81%D0%B5%D1%82%D0%B8.png, which decodes to \"assets/схема сети.png\". Exercises step 4 of the resolution algorithm (§6.2) and UTF-8 ZIP entry names (§3.1)."
    },
    {
      "file": "fragment-reference.mdpack",
      "description": "References carrying a fragment and a query component.",
      "notes": "Both must resolve to assets/appendix.pdf: §6.5 requires the query and fragment to be stripped before matching. A reader that matches the raw string reports a spurious missing asset."
    },
    {
      "file": "unknown-role.mdpack",
      "description": "An asset declaring a role this specification does not define.",
      "notes": "§4.9: readers must ignore unknown role values and must not reject the package. Roles are descriptive metadata, never authorisation."
    },
    {
      "file": "external-references.mdpack",
      "description": "A document referencing only external URLs.",
      "notes": "§6.4: external references are not package content. A reader must not fetch them, and in particular must not fetch anything in order to validate the package. Neither reference is a missing asset."
    },
    {
      "file": "document-with-bom.mdpack",
      "description": "document.md prefixed with a UTF-8 byte order mark.",
      "notes": "§3.1: writers should omit the BOM but readers must accept and strip one. Note that documentSha256 covers the bytes as stored, including the BOM (§7)."
    }
  ],
  "invalid": [
    {
      "file": "not-a-zip.mdpack",
      "description": "Plain text with a .mdpack extension.",
      "errors": [
        "not-an-mdpack"
      ],
      "notes": "Must not crash the reader."
    },
    {
      "file": "truncated-archive.mdpack",
      "description": "A valid package cut off halfway through.",
      "errors": [
        "not-an-mdpack",
        "integrity-failure"
      ],
      "notes": "The central directory is gone. Either classification is acceptable; crashing is not."
    },
    {
      "file": "missing-manifest.mdpack",
      "description": "A ZIP containing document.md but no mdpack.json.",
      "errors": [
        "not-an-mdpack"
      ],
      "notes": "§3.4."
    },
    {
      "file": "missing-document.mdpack",
      "description": "Manifest present, document.md absent.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§3.4. The package declares an entry document it does not contain."
    },
    {
      "file": "wrong-format.mdpack",
      "description": "format is \"note\" rather than \"mdpack\".",
      "errors": [
        "not-an-mdpack"
      ],
      "notes": "§4.4. Compared case-sensitively, so an unrelated ZIP that happens to carry an mdpack.json cannot be mistaken for a package."
    },
    {
      "file": "missing-version.mdpack",
      "description": "No version member.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.4. A reader must not assume the current version."
    },
    {
      "file": "version-future.mdpack",
      "description": "version is \"9.0.0\".",
      "errors": [
        "unsupported-version"
      ],
      "notes": "§4.5. Must be reported distinctly from corruption: the user should be told to upgrade, not told their file is broken."
    },
    {
      "file": "missing-entrypoint.mdpack",
      "description": "No entrypoint member.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.4 and §4.6: entrypoint is required. A reader must not silently assume \"document.md\"."
    },
    {
      "file": "entrypoint-traversal.mdpack",
      "description": "entrypoint is \"../outside.md\".",
      "errors": [
        "security-violation",
        "malformed-manifest"
      ],
      "notes": "§4.6: in this version entrypoint must be exactly \"document.md\", and a reader must never follow it as an arbitrary path. A reader that resolves it against the extraction directory reads a file outside the package."
    },
    {
      "file": "missing-assets.mdpack",
      "description": "No assets member.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.4: assets is required, even when empty. Unlike most optional members it carries meaning by its absence, so the specification pins it down rather than defaulting it."
    },
    {
      "file": "null-assets.mdpack",
      "description": "assets is JSON null.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "A deserialiser that maps this onto a null collection reference will throw when it iterates. The reader must report a clean error instead (§8.9)."
    },
    {
      "file": "assets-not-an-array.mdpack",
      "description": "assets is an object rather than an array.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "Same hazard as null-assets: the structural shape must be validated before deserialisation results are used."
    },
    {
      "file": "asset-missing-entry.mdpack",
      "description": "The manifest declares an asset the package does not contain.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.7. Without this check the document renders with silently broken images."
    },
    {
      "file": "asset-outside-assets.mdpack",
      "description": "A declared asset whose path is not under assets/.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.7: a declaration must point under assets/. Permitting arbitrary paths would let a manifest lay claim to mdpack.json or document.md."
    },
    {
      "file": "asset-duplicate-id.mdpack",
      "description": "Two declared assets sharing an id.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.7: identifiers must be unique within the assets array. A reader keyed by id would silently drop one of them."
    },
    {
      "file": "asset-missing-role.mdpack",
      "description": "A declared asset with no role member.",
      "errors": [
        "malformed-manifest"
      ],
      "notes": "§4.7: id, path, mediaType, bytes, sha256 and role are all required of a writer. A declaration missing one of them is not a valid declaration."
    },
    {
      "file": "asset-bytes-mismatch.mdpack",
      "description": "A declared asset whose bytes value does not match the stored length.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§4.7 makes byte-length verification a reader requirement, not just a writer one. This package's sha256 is correct, so a reader that only checks digests accepts it."
    },
    {
      "file": "bad-mimetype-entry.mdpack",
      "description": "A mimetype entry whose contents are wrong.",
      "errors": [
        "not-an-mdpack"
      ],
      "notes": "§3.3: the entry is optional, but when present it must be correct."
    },
    {
      "file": "traversal-parent.mdpack",
      "description": "Package holding an entry named \"../evil.txt\".",
      "errors": [
        "security-violation"
      ],
      "notes": "A parent segment at the root of the path. §8.2: an unsafe path invalidates the whole package, not just that entry. The manifest and document here are otherwise perfectly valid, so a reader that only validates paths at extraction time will wrongly accept this file."
    },
    {
      "file": "traversal-absolute.mdpack",
      "description": "Package holding an entry named \"/etc/passwd\".",
      "errors": [
        "security-violation"
      ],
      "notes": "An absolute POSIX path. §8.2: an unsafe path invalidates the whole package, not just that entry. The manifest and document here are otherwise perfectly valid, so a reader that only validates paths at extraction time will wrongly accept this file."
    },
    {
      "file": "traversal-drive.mdpack",
      "description": "Package holding an entry named \"C:/evil.txt\".",
      "errors": [
        "security-violation"
      ],
      "notes": "A Windows drive letter. §8.2: an unsafe path invalidates the whole package, not just that entry. The manifest and document here are otherwise perfectly valid, so a reader that only validates paths at extraction time will wrongly accept this file."
    },
    {
      "file": "traversal-nested.mdpack",
      "description": "Package holding an entry named \"assets/../../evil.txt\".",
      "errors": [
        "security-violation"
      ],
      "notes": "Parent segments hidden inside an otherwise valid prefix. §8.2: an unsafe path invalidates the whole package, not just that entry. The manifest and document here are otherwise perfectly valid, so a reader that only validates paths at extraction time will wrongly accept this file."
    },
    {
      "file": "traversal-backslash.mdpack",
      "description": "Package holding an entry named \"..\\\\evil.txt\".",
      "errors": [
        "security-violation"
      ],
      "notes": "Backslash separators, which some readers normalise too late. §8.2: an unsafe path invalidates the whole package, not just that entry. The manifest and document here are otherwise perfectly valid, so a reader that only validates paths at extraction time will wrongly accept this file."
    },
    {
      "file": "duplicate-document.mdpack",
      "description": "Two entries both named document.md.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§8.4. ZIP permits duplicates; extraction overwrites, so the entry a reader validates and the entry that lands on disk can differ."
    },
    {
      "file": "duplicate-asset-entry.mdpack",
      "description": "Two archive entries at assets/pixel.png differing only in case.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§8.4 requires duplicate detection to be case-insensitive. On Windows and macOS the second entry overwrites the first during extraction, so the bytes a reader verified are not the bytes it later renders."
    },
    {
      "file": "tampered-document-checksum.mdpack",
      "description": "documentSha256 does not match document.md.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§7."
    },
    {
      "file": "tampered-asset-checksum.mdpack",
      "description": "An asset whose sha256 does not match its bytes.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§7: asset checksums must be verified before the asset is presented, not only the document's."
    },
    {
      "file": "declared-size-lie.mdpack",
      "description": "The document entry declares an uncompressed size of 8 bytes but expands to far more.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§8.3. A reader that trusts the declared size reads a truncated document and, without checksum verification, shows the user half a note with no warning. The documentSha256 in this manifest is correct for the full text."
    },
    {
      "file": "invalid-utf8-document.mdpack",
      "description": "document.md contains a byte sequence that is not valid UTF-8.",
      "errors": [
        "integrity-failure"
      ],
      "notes": "§8.8. Silently substituting U+FFFD turns a detectable error into permanent data damage at the next save."
    },
    {
      "file": "compression-bomb.mdpack",
      "description": "An asset of 4 MiB of zero bytes, compressing at roughly 1000:1.",
      "errors": [
        "resource-limit",
        "integrity-failure"
      ],
      "notes": "§8.3. Trips the recommended 200:1 compression-ratio limit. A reader with a higher ratio limit may instead reject it on a size limit; either is conforming, but expanding it without bound is not."
    }
  ]
}
