Skip to content

Conversation

@jviotti
Copy link
Member

@jviotti jviotti commented Dec 26, 2025

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

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

augmentcode bot commented Dec 26, 2025

🤖 Augment PR Summary

Summary: This PR re-enables and improves detection of unreferenced schema definitions in the linter by updating the vendored sourcemeta/core and switching the transformer framing to reference-oriented analysis.

Changes:

  • Updates the vendored core dependency to a newer revision.
  • Re-enables the orphan_definitions lint rule in src/command_lint.cc.
  • Refactors OrphanDefinitions to identify orphaned entries in $defs/definitions using resolved reference destinations (rather than instance-location tracking).
  • Changes SchemaTransformer framing from SchemaFrame::Mode::Instances to Mode::References to support reference-based lint rules.
  • Adds JSON Pointer helpers (Pointer::starts_with(...)) and introduces a new mangle(PointerTemplate, prefix) utility.
  • Adds a new linter rule unsatisfiable_in_place_applicator_type and updates lint rule list tests/counts accordingly.

Technical Notes: The linter rule inventory grows (rule list counts updated), and orphan detection now explicitly considers references coming from outside the definitions containers.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@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. 2 suggestions posted.

Fix All in Augment

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

auto operator()(const sourcemeta::core::Pointer::Token &token) const noexcept
-> void {
this->output_ << SEPARATOR;
encode_string_or_empty(this->output_, token.to_property());
Copy link

Choose a reason for hiding this comment

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

TokenVisitor::operator()(const Pointer::Token&) unconditionally calls token.to_property(), but PointerTemplate can contain index tokens (e.g. { "foo", 1, "bar" }), which will trip the to_property() assert at runtime. It seems worth handling token.is_index() (or explicitly constraining mangle to property-only templates) to avoid crashes.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

for (const auto character : input) {
const auto unsigned_character{static_cast<unsigned char>(character)};

if (is_ascii_alpha(unsigned_character)) {
Copy link

Choose a reason for hiding this comment

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

encode_prefix() doesn’t appear to apply the same “reserved at segment start” handling described in the public doc comment for mangle (e.g. distinguishing x/X/X.. escape prefixes), which can lead to prefix collisions. If mangle is meant to be collision-free for arbitrary prefixes, it may be worth aligning prefix encoding with the documented rules (or documenting allowed prefix constraints).

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

@jviotti jviotti merged commit fe07eda into main Dec 29, 2025
12 checks passed
@jviotti jviotti deleted the orphan-definitions-again branch December 29, 2025 12:59
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.

2 participants