Evidence descriptor · NexusScholar.Artifacts
Artifacts
A small, storage-neutral descriptor for exact bytes, safe logical names, schema meaning, producer lineage, and provenance bindings.
Purpose and authority boundary
ArtifactDescriptor describes an artifact; it does not store or retrieve it. Scientific byte identity is the SHA-256 of the exact content, not a filename, path, URL, database row, or runtime object. The module keeps that distinction usable without introducing a filesystem or cloud dependency.
Descriptor contract
Idis a typed entity id;ArtifactRefis the stable workflow/bundle reference.LogicalPathis a portable relative path, not a machine location.ArtifactKind,MediaType,SchemaId, andSchemaVersiondescribe how the bytes are interpreted.SizeBytesandRawByteDigestbind the exact content.- Optional
SourceRecordDigest, workflow node, provenance event id/digest, andRequiredForpreserve lineage and intended use.
The complete implementation is Artifacts.cs. The broader portable-artifact contract is in ADR 0009.
Identity and path rules
content bytes ──SHA-256──→ raw-byte digest
local input path ────────→ acquisition/reference metadata
portable logical path ───→ bundle/workflow addressing
These three values are not interchangeable.ComputeRawByteDigest hashes bytes without newline, encoding, filename, or container normalization. NormalizeLogicalPath accepts slash-separated relative logical paths and rejects backslashes, absolute paths, URI schemes, drive letters, leading/trailing slash, empty segments, and ./... Equality remains ordinal and case-sensitive at the bundle boundary.
Typical developer flow
- Read or produce bytes in an adapter that owns I/O.
- Compute
ContentDigest.Sha256(bytes)before any storage or transport transformation. - Create a descriptor with a portable logical path, media type, schema, and stable source/producer references.
- Persist bytes and descriptor atomically in the owning workspace or bundle adapter.
- On read, recompute size and digest; never trust descriptor text alone.
Failure behavior
Creation rejects blank identity fields, unsafe logical paths, negative size, and invalid/default digests. A descriptor is not a verified-byte wrapper: callers must still compare the recorded size and digest against observed bytes. Changing bytes at the same local path produces a new identity; identical bytes from different locations retain the same raw-byte identity but may have distinct acquisition provenance.
Tests, extension points, and nonclaims
Artifact behavior is exercised with Bundle and Full Text tests, including path traversal, raw digest mismatch, changed bytes, duplicate content, and source-record binding: see BundleTests and FullTextTests.
New artifact kinds extend schema/media vocabularies in their owning domains. This package does not provide storage, retention, access control, malware scanning, MIME sniffing, signatures, encryption, legal/redistribution assessment, archive identity, or safe import commit by itself.