Skip to content

Navigation Menu

Sign in
Sign up

feat(analyzer): add declarative lint rule contract - #310

Merged
Teakowa merged 5 commits into
main from
issue-309
Sep 11, 2026
Merged

feat(analyzer): add declarative lint rule contract #310
Teakowa merged 5 commits into
main from
issue-309

Conversation

@e54-bot

@e54-bot e54-bot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add canonical SemanticFacts and local YAML declarative lint rules
  • resolve localized and canonical Workshop identities through workshop-rs
  • add namespaced IDs, metadata, bounded project options, and explicit skipped results
  • expose the same registry through analyzer, driver/tool service, and wright lint
  • document the contract and add analyzer, driver, and CLI coverage

Verification

  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace --all-targets --all-features
  • targeted post-change analyzer/driver/CLI tests
  • declarative-path ablation failed its regression test as expected

Closes #309

@Teakowa Teakowa 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.

Three required fixes before this matches #309:

  • crates/wright-analyzer/src/declarative.rs / docs/specs/SPEC-309-extensible-lint-rules.md: external rule YAML currently requires evidence and default-severity, while #309 explicitly keeps evidence classification Wright/owner-backed and project severity outside rule definitions. Project config also exposes only warning/info, not the approved off/warn/error policy. Align the public rule/config contract with the Issue AC rather than freezing the conflicting surface in an accepted spec.
  • crates/wright-analyzer/src/declarative.rs: the matcher implements positional args plus exact literal equality only. #309 requires direct </<=/>/>= comparisons and localized/canonical parameter names, with representative complex-rule validation. Implement and verify those approved capabilities before treating the grammar as stable.
  • crates/wright-analyzer/src/declarative.rs::condition_values: scoped condition matching walks facts.actions() for the whole Workshop rule, so a scope: while/if matcher can be satisfied by sibling or unrelated nested conditions; the selected if branch condition is not scoped correctly either. Restrict condition candidates to the selected scope so unrelated conditions cannot produce findings.

@Teakowa Teakowa 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.

crates/wright-analyzer/src/declarative.rs::resolve_parameter still does not satisfy the previous localized/canonical parameter-name finding. _locale is unused and resolution only compares against CatalogEntry::params; with the pinned workshop-rs contract those are canonical parameter labels, not locale-specific aliases. The updated spec also narrows this to "canonical catalog labels", which conflicts with #309 rather than implementing its document-locale requirement. The new test only covers English duration, with no non-en-US/representative complex parameter case. Resolve parameter spellings through owner-backed locale data (adding the missing workshop-rs contract first if necessary) and verify canonical plus localized parameter authoring before treating the grammar as accepted.

e54-bot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the latest review in f2ac79f. Parameter spellings now resolve only through the owner-backed workshop-rs catalog API: canonical labels and localized zh-CN labels are both covered, with no Wright-side translation table or normalization fallback. The owner contract is proposed in workshop-rs PR #176; this branch pins that commit until the owner change is released. Local verification: cargo fmt --all -- --check; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo test --workspace --all-targets --all-features (all passed; the two corpus-dependent tests remain intentionally ignored).

@Teakowa Teakowa 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.

Cargo.toml: the locale fix now correctly consumes an owner API, but it pins an unreleased commit from open workshop-rs#176 as a second workshop-rs dependency alongside =0.1.18. This skips the required owner -> contract/tests -> release -> consumer integration sequence and leaves Wright coupled to a transient post-v0.3.4 commit. Merge/release the owner capability first, then consume the released workshop-rs version here as the normal dependency rather than a parallel git-pinned catalog crate.

e54-bot commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Owner review corrections are now pushed to workshop-rs PR #176 in 46e27e1: catalog dataset version 0.1.4, refreshed digest, and explicit provenance for the initial Wait zh-CN parameter labels. Per the review's required owner -> release -> consumer sequence, Wright is intentionally not changed again until #176 is merged and a released workshop-rs version containing resolve_param is available; then the temporary git-pinned catalog dependency will be replaced with the normal released dependency. Wright's existing 18 hosted checks remain green.

e54-bot commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up: workshop-rs PR #176 now includes the reviewer-requested correction in commit 260c496, using the evidenced Wait zh-CN parameter spellings 时间 and 等待行为. All 4 owner hosted checks pass. Wright remains unchanged pending reviewer reapproval and the required owner merge/release step.

e54-bot commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator Author

Owner capability is now released: workshop-rs 0.3.6 includes resolve_param after workshop-rs PR #176 was merged. Wright commit 8ff16bc now consumes the released registry package instead of the temporary git-pinned catalog dependency, updates Cargo.lock, and aligns the localized Wait test with the evidenced spelling 时间. Local fmt, clippy, full workspace tests, and diff validation pass.

Add canonical Workshop facts, local YAML rules, bounded project configuration, and shared CLI/tool metadata surfaces.
Fixes #309 
Expose canonical-evidence skips as additive machine-readable lint result data.
Align external rule metadata with Wright-owned evidence and project severity policy. Add catalog-backed named parameter and numeric comparison matching, and scope condition candidates to the selected rule scope.
Refs #309 

@Teakowa Teakowa 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.

LGTM

Teakowa merged commit db25c08 into main Sep 11, 2026
17 checks passed
Teakowa deleted the issue-309 branch September 11, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Teakowa Teakowa Teakowa approved these changes

Assignees

No one assigned

Labels

None yet

Projects

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Define an extensible analysis and lint rule contract

2 participants

AltStyle によって変換されたページ (->オリジナル) /