Skip to content

Commit 8824801

Browse files
onthebigtreeclaude
andcommitted
fix: respect gene max_files constraint; remove variable shadowing
Two fixes in this commit: 1. Gene max_files constraint silently ignored (solidify.js:265) `Math.max(Number(constraints.max_files) || 0, 20)` forced the effective limit to at least 20, so any gene with `max_files < 20` (e.g. the built-in gene at line 780 uses `max_files: 12`) had its constraint silently overridden. Replace with a conditional that only falls back to the default of 20 when no constraint is configured: Number(constraints.max_files) > 0 ? Number(constraints.max_files) : DEFAULT_MAX_FILES 2. Redundant variable declarations shadowing outer scope - solidify.js: `const sourceType` re-declared inside the `eligible_to_broadcast` block with identical logic; the outer declaration (line 942) is already in scope there. - evolve.js: `const selectedBy` re-declared inside the solidify `try` block with identical logic; the outer declaration (line 1036) is already in scope there. Removing the inner declarations eliminates the shadowing and ensures any future change to the outer declaration propagates correctly. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent 682c333 commit 8824801

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/evolve.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,6 @@ async function run() {
11371137
try {
11381138
const runId = `run_${Date.now()}`;
11391139
const parentEventId = getLastEventId();
1140-
const selectedBy = memoryAdvice && memoryAdvice.preferredGeneId ? 'memory_graph+selector' : 'selector';
11411140

11421141
// Baseline snapshot (before any edits).
11431142
let baselineUntracked = [];

src/gep/solidify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ function checkConstraints({ gene, blast, blastRadiusEstimate, repoRoot }) {
262262

263263
if (!gene || gene.type !== 'Gene') return { ok: true, violations, warnings, blastSeverity };
264264
const constraints = gene.constraints || {};
265-
const maxFiles = Math.max(Number(constraints.max_files) || 0, 20);
265+
const DEFAULT_MAX_FILES = 20;
266+
const maxFiles = Number(constraints.max_files) > 0 ? Number(constraints.max_files) : DEFAULT_MAX_FILES;
266267

267268
// --- Blast radius severity classification ---
268269
blastSeverity = classifyBlastSeverity({ blast, maxFiles });
@@ -1076,7 +1077,6 @@ function solidify({ intent, summary, dryRun = false, rollbackOnFailure = true }
10761077
// Search-First Evolution: auto-publish eligible capsules to the Hub (as Gene+Capsule bundle).
10771078
let publishResult = null;
10781079
if (!dryRun && capsule && capsule.a2a && capsule.a2a.eligible_to_broadcast) {
1079-
const sourceType = lastRun && lastRun.source_type ? String(lastRun.source_type) : 'generated';
10801080
const autoPublish = String(process.env.EVOLVER_AUTO_PUBLISH || 'true').toLowerCase() !== 'false';
10811081
const visibility = String(process.env.EVOLVER_DEFAULT_VISIBILITY || 'public').toLowerCase();
10821082
const minPublishScore = Number(process.env.EVOLVER_MIN_PUBLISH_SCORE) || 0.78;

0 commit comments

Comments
 (0)