Skip to content

Implement a new conflicting_readonly_writeonly linter rule#761

Merged
jviotti merged 1 commit into
mainfrom
upgrades
May 21, 2026
Merged

Implement a new conflicting_readonly_writeonly linter rule#761
jviotti merged 1 commit into
mainfrom
upgrades

Conversation

@jviotti
Copy link
Copy Markdown
Member

@jviotti jviotti commented May 21, 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 380 files

Note: This PR contains a large number of files. cubic only reviews up to 100 files per PR, so some files may not have been reviewed. cubic prioritizes the most important files to review.
On a pro plan you can use ultrareview for larger PRs.

Re-trigger cubic

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 21, 2026

🤖 Augment PR Summary

Summary: This PR introduces a new linter rule, conflicting_readonly_writeonly, and updates the CLI/vendored dependencies to the newer Blaze “foundation/editor” split.

Changes:

  • Added a new Blaze alterschema linter rule that flags schemas where both readOnly and writeOnly are set to true.
  • Registered the new rule in Blaze’s alterschema build (CMake source list) and in the rule bundle assembly.
  • Updated the CLI lint rule listing tests to include the new rule and bumped the expected rule counts.
  • Refactored multiple CLI commands to use sourcemeta::blaze foundation APIs (e.g., is_schema, schema_walker, bundling/formatting) instead of sourcemeta::core::jsonschema.
  • Adjusted link dependencies to use sourcemeta::blaze::foundation and sourcemeta::blaze::editor.
  • Bumped vendored dependency SHAs for core/jsonbinpack/blaze and propagated the new API types across vendored code.

Technical Notes: The new rule is a non-mutating lint check and is surfaced via the existing lint --list output and rule counting tests.

🤖 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. 3 suggestions posted.

Fix All in Augment

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

using mutates = std::false_type;
using reframe_after_transform = std::false_type;
ConflictingReadOnlyWriteOnly()
: SchemaTransformRule{"conflicting_readonly_writeonly",
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 21, 2026

Choose a reason for hiding this comment

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

The rule description says readOnly and writeOnly are "mutually exclusive", but the condition only triggers when both are present and both are true; consider tightening the wording so users don’t interpret it as “they can’t both appear at all”.

Severity: low

Fix This in Augment

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

const sourcemeta::blaze::SchemaResolver &) const
-> SchemaTransformRule::Result override {
ONLY_CONTINUE_IF(vocabularies.contains_any(
{Vocabularies::Known::JSON_Schema_2020_12_Meta_Data,
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 21, 2026

Choose a reason for hiding this comment

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

handle_readOnly/handle_writeOnly in Blaze’s known walker recognizes these keywords for JSON_Schema_Draft_7_Hyper (and Draft 6 variants), but this rule’s vocabulary gate only includes JSON_Schema_Draft_7; if you intend to lint those dialects too, this condition will currently skip them.

Severity: medium

Fix This in Augment

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

const auto *write_only{schema.try_at("writeOnly")};
ONLY_CONTINUE_IF(read_only && write_only);
ONLY_CONTINUE_IF(read_only->is_boolean() && write_only->is_boolean());
ONLY_CONTINUE_IF(read_only->to_boolean() && write_only->to_boolean());
Copy link
Copy Markdown

@augmentcode augmentcode Bot May 21, 2026

Choose a reason for hiding this comment

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

There doesn’t seem to be a failing lint test case exercising this new rule (only the --list output was updated); adding a minimal schema with both readOnly and writeOnly set to true would help prevent regressions in rule triggering and message/locations.

Severity: low

Fix This in Augment

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

@jviotti jviotti merged commit f47eb12 into main May 21, 2026
15 checks passed
@jviotti jviotti deleted the upgrades branch May 21, 2026 18:57
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