fix(core): make build attempt logs JSON-safe - #694
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds sanitizeLogValue and stringifyLogDetails to produce JSON-safe representations of arbitrary values and uses them in _logAttempt; two tests validate circular-reference and complex-type logging; install manifest metadata updated. ChangesResilient Build Attempt Logging
Sequence Diagram(s)sequenceDiagram
participant Code
participant LogAttempt
participant StringifyLogDetails
participant FileSystem
Code->>LogAttempt: _logAttempt(details)
LogAttempt->>StringifyLogDetails: stringifyLogDetails(details)
StringifyLogDetails->>StringifyLogDetails: sanitizeLogValue(details)
StringifyLogDetails-->>LogAttempt: safeString
LogAttempt->>FileSystem: append build-attempts.log
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Coverage ReportCoverage report not available
Generated by PR Automation (Story 6.1) |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 @.aiox-core/core/execution/build-state-manager.js:
- Around line 128-133: The code currently preserves raw Error.stack when
building safeError in the build-state-manager (the value instanceof Error
branch), which can leak paths; change this so safeError.stack is not persisted
by default — set safeError.stack = '[redacted]' (or omit the property) unless an
explicit debug flag is enabled (e.g., check process.env.DEBUG_STACKS or a
runtime config flag like DEBUG_ERROR_STACKS), and only include the real
value.stack when that flag is true; ensure the rest of the code that writes
build-attempts.log uses this safeError object.
In `@tests/core/build-state-manager.test.js`:
- Line 592: The test currently asserts an exact function source string which is
brittle; update the assertion that checks the serialized "callback" in the test
(the line using expect(content).toContain('"callback":"() => \'ignored\'"')) to
use a pattern-based check instead (e.g., assert that the serialized payload
contains the token ignored via a regex or string match) so it verifies presence
of the callback's intent rather than the exact Function.prototype.toString()
output.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7713488e-3e3a-4ad8-92f9-ada1cb429270
📒 Files selected for processing (3)
.aiox-core/core/execution/build-state-manager.js.aiox-core/install-manifest.yamltests/core/build-state-manager.test.js
* fix(core): make build attempt logs json-safe * fix(core): redact error stacks in attempt logs
Summary
[Circular]and normalize Error, Map, Set, BigInt, Date, RegExp, function, and symbol values into stable data shapes..aiox-core/install-manifest.yamlfor the changed core file hash.Issue
Contributes to #621 by delivering the Data Integrity slice for circular reference serialization in build attempt JSON logs.
Validation
node -c .aiox-core/core/execution/build-state-manager.jsjest tests/core/build-state-manager.test.js --runInBandnpm run generate:manifestnpm run validate:manifestgit diff --checknpm run lint(0 errors, 114 baseline warnings)npm run typechecknode scripts/validate-package-completeness.js(34/34 passed after initializingprosubmodule)node bin/utils/validate-publish.js(PASS after initializingprosubmodule)npm test -- --runInBand --forceExit(11 skipped, 330 passed, 330/341 suites; 149 skipped, 8336 passed, 8485 tests)Notes
.aiox-core/data/entity-registry.yamlwas touched by test/pre-commit hooks and intentionally restored before push as a volatile generated artifact.js-yamlin this temp worktree, but the same validation was run successfully with canonicalNODE_PATHbefore publication.Summary by CodeRabbit
Bug Fixes
Tests