Conversation
🤖 Augment PR SummarySummary: This PR tightens and consolidates CLI test coverage while fixing two behaviors. Changes:
Technical Notes: The resolver retains its existing exact and 🤖 Was this summary useful? React with 👍 or 👎 |
| // The identifier reaches us with an empty fragment already dropped, while the | ||
| // configuration keeps whatever the user typed. Without this, a key written as | ||
| // `https://example.com#` would silently never match anything | ||
| if (match == resolve_map.cend() && !identifier.ends_with("#")) { |
There was a problem hiding this comment.
find_resolve_match applies the .json aliases before normalizing an empty fragment. Consequently, a mapping such as https://example.com/types/name.json# will not resolve a reference to https://example.com/types/name, although the equivalent key without # does; this means an empty-fragment mapping does not fully behave like the same mapping without the fragment.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
All reported issues were addressed across 22 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
2 issues found across 1 file (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/resolver.h">
<violation number="1" location="src/resolver.h:45">
P1: When a configuration contains canonical-equivalent `resolve` keys, `canonical_resolve_map` silently keeps one mapping, so the other spelling can resolve to the wrong schema. Preserve exact-key precedence or retain all entries that share a canonical key.</violation>
<violation number="2" location="src/resolver.h:87">
P2: Every `resolve_map_uri(configuration, ...)` call rebuilds and canonicalizes the full map. `command_install.cc:57` uses this overload for each dependency resolution, so large installs pay repeated allocations; reuse a cached canonical map.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| std::unordered_map<std::string, std::string> result; | ||
| result.reserve(resolve_map.size()); | ||
| for (const auto &entry : resolve_map) { | ||
| result.emplace(sourcemeta::core::URI::canonicalize(entry.first), |
There was a problem hiding this comment.
P1: When a configuration contains canonical-equivalent resolve keys, canonical_resolve_map silently keeps one mapping, so the other spelling can resolve to the wrong schema. Preserve exact-key precedence or retain all entries that share a canonical key.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/resolver.h, line 45:
<comment>When a configuration contains canonical-equivalent `resolve` keys, `canonical_resolve_map` silently keeps one mapping, so the other spelling can resolve to the wrong schema. Preserve exact-key precedence or retain all entries that share a canonical key.</comment>
<file context>
@@ -34,44 +34,58 @@ namespace sourcemeta::jsonschema {
+ std::unordered_map<std::string, std::string> result;
+ result.reserve(resolve_map.size());
+ for (const auto &entry : resolve_map) {
+ result.emplace(sourcemeta::core::URI::canonicalize(entry.first),
+ entry.second);
+ }
</file context>
| static inline auto | ||
| resolve_map_uri(const sourcemeta::blaze::Configuration &configuration, | ||
| const std::string &identifier) -> std::optional<std::string> { | ||
| return resolve_map_uri(canonical_resolve_map(configuration.resolve), |
There was a problem hiding this comment.
P2: Every resolve_map_uri(configuration, ...) call rebuilds and canonicalizes the full map. command_install.cc:57 uses this overload for each dependency resolution, so large installs pay repeated allocations; reuse a cached canonical map.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/resolver.h, line 87:
<comment>Every `resolve_map_uri(configuration, ...)` call rebuilds and canonicalizes the full map. `command_install.cc:57` uses this overload for each dependency resolution, so large installs pay repeated allocations; reuse a cached canonical map.</comment>
<file context>
@@ -34,44 +34,58 @@ namespace sourcemeta::jsonschema {
+static inline auto
+resolve_map_uri(const sourcemeta::blaze::Configuration &configuration,
+ const std::string &identifier) -> std::optional<std::string> {
+ return resolve_map_uri(canonical_resolve_map(configuration.resolve),
+ configuration.base_path, identifier);
}
</file context>
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
resolve keys by canonical URI
Signed-off-by: Juan Cruz Viotti jv@jviotti.com