feat: per-PR debt delta + shared GitHub helpers - #20
Draft
moyom96 wants to merge 3 commits into
Draft
Conversation
model_file?/job_file? matched %r{/app/models/} and %r{/app/jobs/}, which
require a leading slash that relative scan paths (app/models/...) never
have, so the collector never fired in a standard Rails layout. Anchor the
match to a path-segment boundary so it fires on relative and nested engine
paths without matching unrelated dirs (e.g. lib/myapp/models). Add
LayerCollector specs covering line/end_line extraction.
Replace the version-pinned arm64-darwin-23 with the conventional unversioned arm64-darwin, and add x86_64-linux so the lockfile resolves on Linux CI/containers without a frozen-bundle platform error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
The scheduled scan files tracked issues weekly, and
--verify-prchecks fixes against already-filed issues. Neither gives fast feedback on debt a PR introduces. This adds a per-PR debt delta so contributors see, on the PR itself, the tech debt landing on the lines they changed, with no LLM cost and no new issues.What Changed
--pr-delta NUMBER(TechDebt::Delta::PrDelta): runs the static collectors scoped to the PR's changed Ruby files, keeps only findings whose line range overlaps the lines the PR added, and posts a single summary comment grouped by severity. Static-only (no OpenAI key needed) and creates no issues. Optional gating viapr_delta.fail_on(none/high/any).Github::Client(Octokit client + repo + token resolution factory)Github::PullRequest(changed-file index, linked-issue parsing, diff-hunk added-line parsing)Github::CommentUpserter(find-by-hidden-marker, update-or-create)auto_paginateenabled in the client factory so comment and changed-file listings are not silently truncated at 30 per page (which would have defeated upsert dedup on busy PRs and dropped files on large PRs).line/end_lineso findings can be intersected with a PR's added lines (also improves issue precision generally).model_file?/job_file?required a leading slash that relative scan paths never have, so the collector never fired in a standard Rails layout. Now anchored to a path-segment boundary.PrDelta,Client,CommentUpserter,PullRequest, and thedebride/complexity/layercollectors. Suite: 54 examples, 0 failures.wall_e_pr_delta.ymlworkflow (pull_request,concurrencycancel,GITHUB_TOKENonly) and apr_deltaconfig block.Gemfile.lock(the gemspec'sflayand devrspecwere missing from it).How to Test
mise exec ruby@3.3.6 -- bundle exec rspec(system Ruby 2.6 is incompatible). Expect 54 examples, 0 failures.GITHUB_TOKEN=... mise exec ruby@3.3.6 -- bundle exec wall-e --pr-delta <PR> --dry-runIt prints the comment it would post and the JSON summary; nothing is written.
pr_delta.fail_on: "high"and confirm the command exits non-zero only when a high-severity finding lands on changed lines.Deployment Tasks
wall_e_pr_delta.ymlworkflow is added by the install generator for downstream consumers; it needs only the defaultGITHUB_TOKEN. No migrations, env vars, or backfills.