Relabel post-manifest-parse failure as TooNew; refuse zero-length package entries at encode

An additively-tagged newer package that fails to parse now reports TooNew (with
writer semver) instead of unactionable Malformed. Format layer also refuses encoding
a zero-length entry, honoring the shell's appendPayload contract; both test-covered.
This commit is contained in:
2026-08-02 08:14:55 -04:00
parent e0b4ec2e21
commit 1aebf51938
6 changed files with 77 additions and 9 deletions
+5 -1
View File
@@ -43,8 +43,12 @@ bool PackageManifest::operator==(const PackageManifest& o) const {
}
std::optional<std::string> serializeManifest(const PackageManifest& m) {
for (const auto& e : m.entries)
for (const auto& e : m.entries) {
if (!isValidEntryName(e.fileName)) return std::nullopt;
// Cross-module contract with src/shell/package — see this directory's
// CLAUDE.md.
if (e.byteLength == 0) return std::nullopt;
}
if (duplicateName(m.entries)) return std::nullopt;
std::string out;