Improve compiler output, display constraints#101
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR enhances the builder's compiler integration to capture and clean full PTY output, extracting and persisting circuit constraint metadata. It introduces output normalization utilities, updates CompilerService to use system ChangesCompiler output cleaning and PTY capture
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/builder/src/Compiler.ts`:
- Around line 321-322: The error path currently prints stderr twice—once cleaned
and once raw—so remove the duplicate raw print by deleting the
UIService.printOutput(execError.stderr, chalk.red) call and keep only
UIService.printOutput(cleanForDisplay(execError.stderr), chalk.red); verify this
change in the error handling block where execError.stderr is used (look for the
calls to UIService.printOutput and cleanForDisplay in Compiler.ts) so only the
cleaned stderr is output.
- Around line 304-305: The code prints duplicate stderr output:
UIService.printOutput(cleanForDisplay(result.stderr), chalk.yellow) and
immediately UIService.printOutput(result.stderr, chalk.yellow); remove the
raw-print call so only the cleaned stderr is printed (delete or comment out the
UIService.printOutput(result.stderr, chalk.yellow) line) or, if raw output is
desired in some cases, wrap the raw call behind an explicit flag and reference
the same result.stderr/cleanForDisplay logic in the Compiler code path where
these lines live.
In `@packages/builder/src/services/CompilerService.ts`:
- Around line 51-104: spawnWithPty leaks the devNull file descriptor because
openSync('/dev/null', 'w') result (devNull) is never closed; ensure you close it
after the child process finishes or errors. Modify spawnWithPty to call
closeSync(devNull) in both the proc.on('error') handler and the proc.on('close')
handler (after unlinkSync(tmpFile) and before resolve/reject) so the fd is
always closed, and keep the existing unlinkSync(tmpFile)/readFileSync logic
intact; reference the devNull variable, proc.on('error'), and proc.on('close')
when applying the changes.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 48ee58de-bd19-4ef0-9184-511019c065af
📒 Files selected for processing (4)
packages/builder/src/Compiler.tspackages/builder/src/services/CompilerService.tspackages/builder/src/utils.tspackages/builder/test/utils.test.ts
compactcwrites circuit constraint info (k, rows) directly to the TTY via spinner animations, making it invisible when captured programmatically. This PR proposes to use the script command to silently capture the full PTY output during compilation, parse the circuit constraints, and:.circuit-info.jsonfiles per source dir with the parsed constraint dataThe idea is to eventually have a script/package that reads
.circuit-info.jsonand updates@circuitInfoannotations in module docsSummary by CodeRabbit
New Features
.circuit-info.jsonfiles, enabling tracking of compiled artifacts with their constraint details.Improvements