Skip to content

fix(review): CommentReview redeclares checklist bindings instead of reassigning#91

Merged
taras merged 1 commit into
mainfrom
fix/comment-review-const
Jul 18, 2026
Merged

fix(review): CommentReview redeclares checklist bindings instead of reassigning#91
taras merged 1 commit into
mainfrom
fix/comment-review-const

Conversation

@taras

@taras taras commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Motivation

PR #87's review comment renders <!-- ERROR: Assignment to constant variable. -->
in its Slop section instead of the comment-review checklist.
CommentReview.md declares let hasChecklist / let checklistMd in its first
eval block and assigns them in its final eval block — but bindings cross eval
blocks as consts, so the assignment throws. The failure is data-dependent: the
final block sits inside <Show when={hasPairs}> and only runs when the PR
diff has three or more comment/code pairs.

Approach

The final block redeclares the two bindings as fresh consts instead of
assigning: a block-local declaration shadows the injected binding, and the
block's exports override env for the trailing <Show when={hasChecklist}>.
The first block's let initializers stay — they cover the no-pairs path where
the final block never runs.

Verified with minimal two-block documents against the compiled binary: the
reassignment pattern reproduces the exact error (with stale binding values
downstream), and the redeclaration pattern renders the updated values. An
audit of .reviews/ found no other cross-block reassignment
(Pattern.md's re.lastIndex = 0 is a property mutation;
DispatchRepoAnalysis.md reassigns within a single block). Full
CommentReview needs the CI LLM provider, so the next PR review run is the
end-to-end confirmation.

Scope confirmation

  • All changed files relate to the stated purpose
  • No drive-by refactors or "while I'm here" cleanups
  • No formatting changes mixed with functional changes

New abstractions (if any)

None.

New dependencies (if any)

None.

New tests (if any)

None — verified via repro documents against the binary; lint/typecheck/tests
remain green (no .ts touched).

…eassigning

Bindings cross eval blocks as consts, so the final block's assignments to
hasChecklist/checklistMd threw 'Assignment to constant variable' whenever the
PR diff had enough comment/code pairs to reach that block — the Slop section
of the review comment rendered the error instead of the checklist (seen on
PR #87). Fresh const declarations shadow the injected bindings and their
exports override env for the trailing <Show>. The block-1 let initializers
stay: they cover the no-pairs path where the final block never runs.
@github-actions

Copy link
Copy Markdown

PR #91: fix(review): CommentReview redeclares checklist bindings instead of reassigning

1 files, +5 / -2

Scope

✅ PR scope looks good.

Structural

✅ No structural bloat detected.

Slop

✅ Slop indicators look low.

Static Analysis

✅ Oxlint found no issues.

Correctness

✅ Small PR — correctness review skipped.

@taras
taras merged commit c74079d into main Jul 18, 2026
7 checks passed
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.

1 participant