Skip to content

feat(issue-discovery): precise post-merge edit detection (#402)#434

Open
corevibe555 wants to merge 2 commits intoentrius:testfrom
corevibe555:feature/issue-402-post-merge-edit-detection
Open

feat(issue-discovery): precise post-merge edit detection (#402)#434
corevibe555 wants to merge 2 commits intoentrius:testfrom
corevibe555:feature/issue-402-post-merge-edit-detection

Conversation

@corevibe555
Copy link
Copy Markdown

@corevibe555 corevibe555 commented Apr 15, 2026

Closes #402

Summary

Replaces the issue.updated_at anti-gaming logic in issue discovery scoring with precise timeline-based detection for body and title edits only. The old check false-positived on any activity (bot comments, label changes, reactions, stale-bots), silently demoting legitimate solved issues to closed_count and unfairly cutting miner credibility in active repos.

Body edit and title edit both should be checked.
This is because title and body are connected.
If title change allowed, it's possible to confuse the reviewer by changing title.
From the purpose of this feature from doc: https://docs.gittensor.io/issue-discovery.html, title is important to define scope, it's possible to inflate by just changing title.

Related Issues

Closes #402

Type of Change

  • New feature / enhancement (anti-gaming precision upgrade)
  • Bug fix
  • Refactor
  • Documentation
  • Other

Testing

Added: tests/validator/test_issue_discovery_post_merge_edit.py — 3 cases:

  1. Benign updated_at bump after merge (bot activity) → issue stays solved.
  2. Real body edit after merge → issue demoted to closed, no score.
  3. Body edit before merge → ignored, stays solved.

Results: 3/3 new tests pass. Broader existing suite (66 validator tests) still green. Pre-existing tree_sitter import errors in unrelated test modules are not affected by this change.

Manual testing

  1. Create an issue on open source repo. in my case, created one issue here: https://github.com/corevibe555/corevibe555/issues
  2. Create a new branch and create PR, mention "Closes rehaul weights #3" in PR description, merge PR
  3. If you go to issues list, the issue is closed.
  4. The best way to see updated_at is changed is adding a comment, so please add a new comment to that closed issue rehaul weights #3, see the screenshot.
  5. Change title case, attached screenshot
  6. Change body case, attached screenshot

Before adding comment
graphql-before-add-comment-to-closed-issue

After adding commment
graphql-after-add-comment-to-closed-issue

After changing title
graphql-after-title-change

After chaing body
graphql-after-body-change

Checklist

  • Code follows project style
  • Self-review completed (follow-up noted: body_or_title_edited_at is not persisted to DB — fine today since scoring re-fetches from GraphQL each run, but worth revisiting if any code path reconstructs Issue from storage)
  • Comments explain non-obvious why, not what
  • New tests added and passing
  • No schema/migration changes required (updated_at column preserved)
  • Documentation update pending — issue_discovery/issue-discovery-rewards.md still describes the updated_at proxy as current behavior; should be updated in a follow-up doc PR or this one if preferred

@corevibe555 corevibe555 force-pushed the feature/issue-402-post-merge-edit-detection branch from 7a98b6a to 4adaf12 Compare April 15, 2026 01:12
@corevibe555 corevibe555 changed the title [WIP] feat(issue-discovery): precise post-merge edit detection (#402) feat(issue-discovery): precise post-merge edit detection (#402) Apr 15, 2026
authorAssociation
userContentEdits(last: 1) {
nodes { editedAt }
}
Copy link
Copy Markdown
Author

@corevibe555 corevibe555 Apr 15, 2026

Choose a reason for hiding this comment

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

To get last body edit, first:1 will return newest edit time, proved by manual testing

nodes {
... on RenamedTitleEvent { createdAt }
}
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

To get last title edit time of the issue.

@corevibe555 corevibe555 force-pushed the feature/issue-402-post-merge-edit-detection branch from 5233f75 to 5ac412c Compare April 15, 2026 01:49
Replace the noisy updated_at proxy with timeline-based detection for
body and title edits only. updated_at fires on any activity (bot
comments, labels, reactions), silently demoting legitimate solved
issues to closed_count in active repos.

- GraphQL: fetch userContentEdits + RenamedTitleEvent alongside
  existing closingIssuesReferences (no extra round trip)
- Issue.body_or_title_edited_at: max(last body edit, last rename)
- scoring.py: anti-gaming check now uses body_or_title_edited_at
- Tests: benign updated_at bump ignored, real body edit demotes,
  pre-merge edits ignored

fix

fix

fix

fix
@corevibe555 corevibe555 force-pushed the feature/issue-402-post-merge-edit-detection branch from 5ac412c to a4af442 Compare April 15, 2026 01:52
userContentEdits is reverse-chronological on GitHub, so last:1 returned
the oldest body edit and the check never fired on subsequent edits.
first:1 returns the newest. timelineItems is chronological, so last:1
stays correct for title renames.
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.

[Feature] Post-merge edit detection upgrade

1 participant