kunibert
All repositories: gitoria
3.5 KB
$mode = 'static'import { run } from 'hl:proc'import { require } from './review-output.hl'// Read the optional ignore file from the exact PR HEAD, also before a worktree exists.vendoredPaths = (String repo, String head, Hybrid configured) => {prefixes = []for (p of configured) { if (p != '' && !prefixes.includes(p)) { prefixes.push(p) } }names = run(['git', 'ls-tree', '--name-only', head, '--', '.kunibertignore'], { cwd = repo, timeout = 30 })require(names.exit == 0, 'cannot look up .kunibertignore at PR head')if (!names.lines.includes('.kunibertignore')) { return prefixes }file = run(['git', 'show', head + ':.kunibertignore'], { cwd = repo, timeout = 30 })require(file.exit == 0, 'cannot read .kunibertignore at PR head')for (line of file.lines) {p = line.trim()if (p != '' && !p.startsWith('#') && !prefixes.includes(p)) { prefixes.push(p) }}return prefixes}isVendored = (String path, Hybrid prefixes) => {for (p of prefixes) { if (path.startsWith(p)) { return true } }return false}// The PR diff without vendored files: used when the full diff is over the size limit (jukebox PR #9, a framework bump).// A rename or copy with one app side keeps both sides, so git still shows it as a rename.appDiff = (String repo, String range, Hybrid prefixes) => {names = run(['git', 'diff', '--no-ext-diff', '--name-status', '-z', '-M', range, '--'], { cwd = repo, timeout = 30 })require(names.exit == 0, 'cannot list the changed files')nul = JSON.parse('"\u0000"')items = names.lines.join('').split(nul)paths = []let i = 0while (i < items.length && items[i] != '') {status = items[i]pair = [items[i + 1]]i = i + 2if (status.startsWith('R') || status.startsWith('C')) { pair.push(items[i]) i = i + 1 }let app = falsefor (p of pair) { if (!isVendored(p, prefixes)) { app = true } }if (app) { for (p of pair) { paths.push(p) } }}if (paths.length == 0) { return '' }d = run(['git', '--literal-pathspecs', 'diff', '--no-ext-diff', '--no-textconv', '-M', range, '--'] + paths, { cwd = repo, timeout = 30 })require(d.exit == 0, 'cannot read the app diff')return d.lines.join('')}// Keep old keys stable, but settle these threads before thread updates and wake prompts.settleVendored = (Hybrid state, Hybrid prefixes) => {for (let i = 0; i < state.threads.length; i = i + 1) {t = state.threads[i]if (isVendored(t.path, prefixes)) {t.vendored = truet.settled = trueif (!state.settled.includes(t.key)) { state.settled.push(t.key) }state.threads[i] = t}}return state}// Only app findings enter applyResult: framework findings never get a thread key.appResult = (Hybrid result, Hybrid prefixes, Hybrid state, String link) => {app = []framework = []for (f of result.findings) {if (isVendored(f.path, prefixes)) { framework.push(f) } else { app.push(f) }}replies = []for (r of result.replies) {let vendored = falsefor (t of state.threads) { if (t.key == r.thread && t.vendored) { vendored = true } }if (!vendored) { replies.push(r) }}result.findings = appresult.framework = frameworkresult.replies = repliesresult.vendoredLink = linkif (prefixes.length > 0) {result.verdict = app.length == 0 ? 'approve' : 'comment'for (f of app) { if (f.severity == 'blocker' || f.severity == 'major') { result.verdict = 'request_changes' } }}return result}
Branches
Latest commits
- bd3591c7conductor: gates run on the live day44 binarymre
- 47f747a7records: jukebox #9 fix livemre
- 0a3169fdMerge branch 'vendored-size' into mainKunibert
- e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
- 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
- 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
- 50a1867estatus: jukebox #9mre
- c57484e6log: jukebox #9 diff sizemre
- 795a20carecords: guard fix live (PR 8)mre
- 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
- 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
- f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
- 10b2a49estatus: PR 314, guard fix proposedmre
- e73995a3log: hycon PR 314 approved after fresh reviewmre
- f60427falog: hycon PR 314 false tool errormre
- 481974f7log: Hermes accepts PR 259 findingmre
- bb0976acrecords: hycon PR 259 design findingmre
- 5c637c24records: hycon PR 259 false tool errormre
- a344c406log: routger 132 reviewedmre
- 56e70dcbrecords: review time limit 1800 s (routger 132)mre