Skip to content

E2: gradual-adoption policy and documentation - #18

Merged
milyin merged 1 commit into
docs/validation-umbrellafrom
step/e2-rollout-and-docs
Aug 6, 2026
Merged

E2: gradual-adoption policy and documentation#18
milyin merged 1 commit into
docs/validation-umbrellafrom
step/e2-rollout-and-docs

Conversation

@milyin

@milyin milyin commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Step E2 of #6. Stacked on #17. Last PR in the chain.

Gradual adoption

ValidationPolicy::warn_all() turns every check into a warning. That is how a
generator which already produces output adopts validation: run in warning mode,
look at what comes back, drop the call once it is quiet. Much less disruptive
than a build that starts failing on output that was fine yesterday.

let (files, warnings) = merge_files_with(fragments, &ValidationPolicy::warn_all())?;
for w in warnings { println!("cargo:warning={w}"); }

Check::ALL backs it, so adding a check later extends warn_all automatically
rather than leaving the new one silently fatal during someone's rollout. A test
pins that every variant appears in it.

Documentation

README gains a section on what is caught and — as importantly — what is
deliberately not, plus one on the identifier utilities. It also drops a stale
reference to Code, which was renamed KtCode before any of this.
docs/validation.md is marked implemented, with its work order corrected to the
one the chain actually followed (E1 moved ahead of B1, since the checks needed
the diagnostics plumbing to exist first).

What is left

The other half of the rollout — running warn mode against the downstream
generated output and confirming it is quiet — needs the consumer, which #6
scopes out of this chain. It goes with the prebindgen-jni migration.

The JVM-erasure check (f(List<String>) vs f(List<Int>)) remains deliberately
deferred; the reasoning is in docs/validation.md.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a “gradual adoption” path for validation by introducing a policy helper that downgrades all checks to warnings, and updates public documentation to describe validation scope and identifier utilities.

Changes:

  • Introduces Check::ALL and ValidationPolicy::warn_all() to support warn-mode rollouts.
  • Adds tests around warn_all() behavior and basic sanity checks for Check::ALL.
  • Updates README and docs/validation.md to reflect the implemented validator and current API names.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/validate.rs Adds Check::ALL and ValidationPolicy::warn_all() plus API docs.
src/tests.rs Adds tests for warn_all() and Check::ALL invariants.
README.md Documents validation behavior and identifier utilities; fixes KtCode naming.
docs/validation.md Marks validation design as implemented and updates the recorded work order.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/tests.rs
Comment on lines +1383 to +1385
fn check_all_lists_every_variant() {
// `Check::ALL` drives `warn_all`, so a check missing from it would silently
// stay fatal during a warn-mode rollout. Names are unique and non-empty.
Comment thread src/validate.rs
Comment on lines +72 to +74
/// Every check, so a policy can be built over all of them. Adding a check
/// extends this list, which is what keeps
/// [`ValidationPolicy::warn_all`] correct as the set grows.
Adds ValidationPolicy::warn_all() and Check::ALL. A generator that
already produces output can turn every check into a warning, look at
what comes back, and drop the call once it is quiet — much less
disruptive than a build that starts failing on output that was fine
yesterday. Check::ALL keeps warn_all correct as checks are added, and a
test pins that every variant is in it.

Documents what shipped: README gains sections on validation and on the
identifier utilities, and drops a stale reference to the old `Code`
name. docs/validation.md is marked implemented and its work order
updated to the one the chain actually followed.

The remaining half of the rollout — running warn mode against the
downstream generated output and confirming it is quiet — belongs with
the consumer migration, which the umbrella scopes out of this chain.
@milyin
milyin force-pushed the step/e2-rollout-and-docs branch from ce16ec3 to f13aef6 Compare August 6, 2026 11:40
@milyin
milyin force-pushed the step/b3-shape-checks branch from 133b37d to 42419dc Compare August 6, 2026 11:40
@milyin
milyin changed the base branch from step/b3-shape-checks to docs/validation-umbrella August 6, 2026 11:41
@milyin
milyin merged commit 27b96fb into docs/validation-umbrella Aug 6, 2026
0 of 4 checks passed
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