Skip to content

Upgrade Core to 4707860933842426b0e9d1647215921967077c2a#755

Merged
jviotti merged 2 commits into
mainfrom
core-io
May 12, 2026
Merged

Upgrade Core to 4707860933842426b0e9d1647215921967077c2a#755
jviotti merged 2 commits into
mainfrom
core-io

Conversation

@jviotti
Copy link
Copy Markdown
Member

@jviotti jviotti commented May 12, 2026

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 42 files

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 12, 2026

🤖 Augment PR Summary

Summary: Upgrades the vendored Sourcemeta Core dependency (and accompanying Blaze/Jsonbinpack updates) and refactors JSONSchema CLI code to use the new Core io utilities.

Changes:

  • Bump dependency SHAs for core, jsonbinpack, and blaze (including vendor subtree updates).
  • Replace manual ifstream/ofstream usage with read_file_to_string, read_stdin, and atomic_write_file for safer writes.
  • Standardize “file vs directory” CLI error behavior via IOIsADirectoryError and additional IO exception handling in try_catch.
  • Core IO: introduce atomic write helpers, binary reader/writer utilities, and typed IO error classes.
  • Core URI/URI-template: route serialization version bump (v6) and add operation-id indexing/lookup with a FileView-backed router view.
  • Jsonbinpack runtime: migrate stream wrappers to Core BinaryReader/BinaryWriter and inline varint encode/decode.

Technical Notes: URI-template router binary format changes imply previously serialized router files must be regenerated using the new version.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 4 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

}

const auto canonical_path{sourcemeta::core::canonical(path)};
std::ifstream stream{canonical_path};
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vendor/core/src/lang/io/include/sourcemeta/core/io.h:99: read_file is templated on CharT/Traits but constructs a std::ifstream, which ignores those template parameters and can break (or fail to compile) for non-char instantiations. This looks like it should construct std::basic_ifstream<CharT, Traits> to match the return type.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.


std::basic_string<CharT, Traits> result;
result.resize(
static_cast<std::size_t>(std::filesystem::file_size(canonical_path)));
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vendor/core/src/lang/io/include/sourcemeta/core/io.h:173: read_file_to_string relies on std::filesystem::file_size(), which will throw for non-regular files (e.g., FIFOs like /dev/fd/* from process substitution). Since canonical() explicitly preserves FIFO paths, this can regress previously-working FIFO reads (JSON/YAML parsing now routes through read_file_to_string).

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

std::string base_path_;
std::vector<std::pair<Identifier, std::vector<Argument>>> arguments_;
std::vector<std::tuple<Identifier, Identifier, std::string_view>> entries_;
std::unordered_map<std::string_view, std::pair<Identifier, Identifier>>
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vendor/core/src/core/uritemplate/include/sourcemeta/core/uritemplate_router.h:149: operations_ uses std::string_view keys, so passing an operation_id that doesn’t outlive the router can leave dangling references and make operation() unsafe. The doc comment mentions string lifetime for uri_template but not for operation_id, which seems equally required given this storage.

Severity: high

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

// `std::filesystem::rename` stays on a single filesystem and remains
// atomic. Using the system-wide temporary directory would risk `EXDEV`
// errors on cross-filesystem builds (CI containers, NFS mounts, etc.).
this->staging_ += ".tmp";
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vendor/core/src/lang/io/io_atomic.cc:32: Using a fixed staging name (destination + ".tmp") can collide if two writers target the same destination concurrently (or if a stale staging file exists), which can undermine the intended atomicity guarantees. Consider whether the staging filename needs to be unique per write attempt.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti jviotti changed the title Upgrade Core to ce85e618da1277977a08dcc360135e2fcbefe472 Upgrade Core to 4707860933842426b0e9d1647215921967077c2a May 12, 2026
@jviotti jviotti merged commit 9bd61f2 into main May 12, 2026
14 checks passed
@jviotti jviotti deleted the core-io branch May 12, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant