Conversation
Change schema name Add trusted domains info to readme Clean up ParseAndValidate
… and spiritual enlightenment. mostly renaming the package
Add ParseMetadata tests
Enforce lowercase property keys
add chowbench
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
|
Warning Review limit reached
More reviews will be available in 4 minutes and 12 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
WalkthroughThis PR refactors payload validation infrastructure by migrating the ChangesPayload Package Refactoring & Benchmarking
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
main.go (1)
79-108:⚠️ Potential issue | 🟠 Major | ⚡ Quick winSurface report write failures to
main().
outputReportcan fail, but the caller still ignores that result. A short write or broken pipe will currently produce a partial/missing report while the process may still exit successfully. Please propagate this error back tomain()and exit non-zero.🤖 Prompt for 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. In `@main.go` around lines 79 - 108, The caller of outputReport currently ignores its returned error which can hide write failures; modify the call site in main to check the error returned by outputReport and if non-nil log or print the error and exit non-zero (e.g., via os.Exit(1)); ensure outputReport continues to return any write/formatting errors from formatCriticalError/formatValidationError and w.Write calls so failures propagate up; update main to handle that returned error path (use the existing outputReport function name and the main function) and ensure the process exits with a non-zero code on failure.
🤖 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 `@cmd/chowbench/main.go`:
- Around line 72-73: writeResults currently has its errors (broken-pipe/flush)
ignored, so the process can exit successfully despite write failures; update
writeResults to return an error and change all call sites (e.g., the calls in
main where writeResults(w, results) is invoked and the other similar block
around the long-running result emission) to check that error and propagate it as
the command failure (either return the write error directly or combine it with
exitErrorForResults(results, strict) so any writer error wins and results in a
non-zero exit). Ensure callers handle and return the error up the stack so
write/flush failures are not dropped.
- Around line 94-103: The loop currently overwrites result fields each iteration
causing later successful runs to hide earlier failures; modify the loop that
calls validateFile and statusForValidationResult so it preserves the
worst-observed outcome across all runs: after calling
statusForValidationResult(report, err) compare the returned Status and numeric
error counts against the existing result.Status, result.CriticalErrors,
result.ValidationErrors and only update result to the new values if the new
Status is worse (or equal but with higher CriticalErrors/ValidationErrors) and
ensure result.Error is set if any iteration returned a non-nil err; keep
durations collection as-is but ensure the final result reflects the worst
observed validation, so -strict will see any failure.
In `@pkg/payload/jsonschema/node.json`:
- Around line 42-50: The "kinds" array currently allows empty arrays and empty
strings; update the JSON Schema for the "kinds" property to require at least one
non-empty kind by changing "minItems": 0 to "minItems": 1 and strengthen the
item schema (the "items" object) to disallow empty strings (e.g., add
"minLength": 1 or an equivalent non-empty pattern alongside the existing "not"
pattern) so that kinds[0] is always a usable non-empty string.
In `@pkg/payload/validator.go`:
- Around line 453-462: The new "meta" branch in ParseMetadata bypasses legacy
type validation and should preserve the original validation performed by
handleOriginalMetadata; modify the "meta" case so after decoding into
ingest.OriginalMetadata it either calls v.handleOriginalMetadata(metadata) (or
invokes the same type-check logic that raises ErrInvalidDataType) before setting
v.originalData.MetadataFound/Metadata and returning, and ensure any validation
error is returned (e.g., propagate ErrInvalidDataType) instead of silently
accepting invalid legacy meta.type values so ParseMetadata mirrors
ParseAndValidate's behavior.
---
Outside diff comments:
In `@main.go`:
- Around line 79-108: The caller of outputReport currently ignores its returned
error which can hide write failures; modify the call site in main to check the
error returned by outputReport and if non-nil log or print the error and exit
non-zero (e.g., via os.Exit(1)); ensure outputReport continues to return any
write/formatting errors from formatCriticalError/formatValidationError and
w.Write calls so failures propagate up; update main to handle that returned
error path (use the existing outputReport function name and the main function)
and ensure the process exits with a non-zero code on failure.
🪄 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: 834740df-1c3e-47ed-a342-e2f6f00965b6
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (16)
.gitignoreREADME.mdcmd/chowbench/main.gocmd/chowbench/main_test.gogo.modmain.gopkg/payload/jsonschema/edge.jsonpkg/payload/jsonschema/metadata.jsonpkg/payload/jsonschema/node.jsonpkg/payload/jsonschema/schema.jsonpkg/payload/schema.gopkg/payload/schema_contract_test.gopkg/payload/schema_test.gopkg/payload/validator.gopkg/payload/validator_test.gopkg/validator/validator_test.go
💤 Files with no reviewable changes (1)
- pkg/validator/validator_test.go
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Description
Add a function that just parses metadata to satisfy a code path in BHCE
Motivation and Context
Resolves BED-7790
Why is this change required? What problem does it solve?
In order to replace BHCE ingest with chow, this function had to be added
How Has This Been Tested?
Tests passing in BHCE as expected!
Screenshots (optional):
Types of changes
Checklist:
Summary by CodeRabbit
New Features
chowbenchcommand for benchmarking validation performance with configurable runs, warmups, and strict-mode exit behavior. Reports include min/max/avg timing and per-file validation status.Bug Fixes
Documentation
Chores