Skip to content

feat(classifier): add R31 abstract modifier added rule - #32

Merged
Aryan0628 merged 2 commits into
Aryan0628:mainfrom
Aakif-Kohari:feat/r31-abstract-modifier-added
Jul 13, 2026
Merged

feat(classifier): add R31 abstract modifier added rule#32
Aryan0628 merged 2 commits into
Aryan0628:mainfrom
Aakif-Kohari:feat/r31-abstract-modifier-added

Conversation

@Aakif-Kohari

@Aakif-Kohari Aakif-Kohari commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds classification rule R31: Abstract Modifier Added.

  • src/classifier/rules/R31_abstract_modifier_added.ts — new rule, flags when a concrete method gains the abstract modifier (concrete → abstract only; the reverse direction is safe and not flagged).
  • src/classifier/rules/index.ts — exports the new rule.
  • tests/rules/function-rules.test.ts — 4 new test cases (true positive, safe reverse direction, both-concrete, undefined/undefined edge case).
  • tests/e2e/ast-e2e.test.ts — 1 new E2E case through the full WASM parse → classify pipeline.
  • README.md, CONTRIBUTING.md — rule count bumped to 29.
  • client/src/components/Terminal.tsx, client/src/components/docs/DocsSidebar.tsx, client/src/content/docs/cli-rules.tsx, client/src/content/docs/rules-data.ts — docs site updated with the new rule entry.

No new dependencies. isAbstract was already populated by every language translator (TypeScript, Python, Go, Java, Rust) — this PR only adds the missing rule that consumes it.

I have solved this Issue under ECSoC26.

Closes #29

Testing

  • npm test passes (all existing + 5 new tests)
  • npm run lint passes
  • npm run build succeeds
  • Manual npx dg check verified on a throwaway abstract-conversion diff — fires correctly on concrete→abstract, silent on abstract→concrete

Breaking changes

None to the tool itself — this only adds new detection coverage.

@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

@Aakif-Kohari is attempting to deploy a commit to the Aryan Gupta's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Aryan0628

Copy link
Copy Markdown
Owner

Note: Tracking "Abstract → Concrete" as an Advisory Change

PR 32 correctly identifies when a method goes from concreteabstract and flags it as a breaking change. However, it currently ignores the reverse direction (abstractconcrete) entirely by returning null, meaning the change is completely silent in our reports.

The Issue
While abstractconcrete is a safe, backwards-compatible change, it is still a notable API behavioral change. Developers downstream might want to know that a default implementation is now provided so they can optionally delete their boilerplate overrides.

The Approach
Since Diff-Guardian's architecture natively supports safe and warning severities, we don't need a new rule. We just need to update the logic in R31_abstract_modifier_added.ts to actively return an advisory result for the reverse direction instead of falling through to null.

After making this minor change, i will merge your PR.

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
diffguardian Ready Ready Preview, Comment Jul 13, 2026 4:25am

@Aakif-Kohari
Aakif-Kohari force-pushed the feat/r31-abstract-modifier-added branch from 5d3c1fa to e19a2e1 Compare July 12, 2026 16:46
@Aakif-Kohari

Copy link
Copy Markdown
Contributor Author

@Aryan0628 Good catch, agreed - makes sense to surface it rather than drop it silently. Updated R31_abstract_modifier_added.ts to return a safe-severity advisory result on the abstract → concrete direction, with a message pointing out that existing overrides are now optional. Updated the doc comment and swapped the now-inaccurate "must return null" test for one asserting the new advisory result. Pushed as a separate commit so the original logic and this follow-up stay easy to review independently.

@Aryan0628
Aryan0628 merged commit 50cc6a6 into Aryan0628:main Jul 13, 2026
4 checks passed
@Aakif-Kohari
Aakif-Kohari deleted the feat/r31-abstract-modifier-added branch July 13, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(classifier): add rule for abstract modifier added (R31)

2 participants