chore(#3484): adr-0174 behavior carry-forward amendment and merge gate (#3507)

* chore(#3484): adr-0174 behavior carry-forward amendment and merge gate

* chore(#3484): regen example context index for new ruleset predicates

* chore(#3484): review fixes - amendment heading per contributor-standards, helper-based fixtures

---------

Co-authored-by: sim <sim@local>
This commit is contained in:
Tom Boucher
2026-08-14 19:31:48 -04:00
committed by GitHub
parent ddf852873c
commit fba7c90327
9 changed files with 599 additions and 268 deletions

View File

@@ -378,6 +378,11 @@ function isInsideRoot(candidatePath: string, rootDir: string): boolean {
return target === root || target.startsWith(`${root}${path.sep}`);
}
// #3484: restored from the retired SDK lineage (dropped as a bare 256 * 1024 literal
// in the ADR-0174 collapse). Counts String#length (UTF-16 code units), not bytes —
// semantics preserved from the deleted source.
const MAX_MODIFIED_FILE_BYTES = 256 * 1024;
function readModifiedFilesContent(projectDir: string, summaries: string[]): string {
const out: string[] = [];
let total = 0;
@@ -390,7 +395,7 @@ function readModifiedFilesContent(projectDir: string, summaries: string[]): stri
if (total >= 50) break;
if (!file || !isInsideRoot(file, projectDir)) continue;
const raw = readIfExists(resolvePath(file, projectDir));
out.push(raw.length > 256 * 1024 ? raw.slice(0, 256 * 1024) : raw);
out.push(raw.length > MAX_MODIFIED_FILE_BYTES ? raw.slice(0, MAX_MODIFIED_FILE_BYTES) : raw);
total++;
}
if (total >= 50) break;