chore(components) Mark some fields as optional #64
Conversation
…on error scenarios
📝 WalkthroughWalkthroughRename Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
Suggested Changelog EntriesBased on the changes in this PR, here are the suggested entries for the ```markdown [Unreleased]Changed
|
…o status_change_date
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
CHANGELOG.md (1)
11-12: Tighten changelog wording and code-span usage.Current phrasing is a bit awkward and combines two identifiers in one code span.
Suggested text cleanup
-- Marked as optional information several keys for `ComponentStatus and VersionStatus` -- Renamed `check_date` to `status_change_date` on `ComponentStatus and VersionStatus` +- Marked several `ComponentStatus` and `VersionStatus` keys as optional for error scenarios +- Renamed `check_date` to `status_change_date` in `ComponentStatus` and `VersionStatus`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@CHANGELOG.md` around lines 11 - 12, Change the awkward changelog phrasing and separate code spans for identifiers: reword the two lines to use clear prose and put each symbol in its own code span (e.g., refer to `ComponentStatus` and `VersionStatus` individually), and rename the field text to show the rename from `check_date` to `status_change_date` with each identifier in its own code span; ensure the first line reads something like "Marked several keys as optional for `ComponentStatus` and `VersionStatus`" and the second reads "Renamed `check_date` to `status_change_date` on `ComponentStatus` and `VersionStatus`."
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Line 9: The changelog entry "## [0.31.1]" is missing its link-reference
definition; add a compare-link reference named "[0.31.1]:" matching the style
used by other versions and place it with the other link references (typically at
the bottom). The reference should point to the repository compare URL for the
previous tag to this tag (e.g., .../compare/v0.31.0...v0.31.1) and follow the
exact formatting of existing references so the "## [0.31.1]" heading resolves
correctly.
- Around line 9-12: The CHANGELOG entry for [0.31.1] is missing its reference
link and contains an incorrect claim about renaming check_date to
status_change_date; add the missing reference line "[0.31.1]:
https://github.com/scanoss/papi/compare/v0.31.0...v0.31.1" to the references
section, and update the release notes for ComponentStatus and VersionStatus to
accurately reflect the real change (e.g., remove the "Renamed `check_date` to
`status_change_date`" sentence or replace it with a correct description such as
"ensured `status_change_date` exists" or "no-op—field already named
`status_change_date`" after verifying the proto definitions) so the text matches
the codebase.
---
Nitpick comments:
In `@CHANGELOG.md`:
- Around line 11-12: Change the awkward changelog phrasing and separate code
spans for identifiers: reword the two lines to use clear prose and put each
symbol in its own code span (e.g., refer to `ComponentStatus` and
`VersionStatus` individually), and rename the field text to show the rename from
`check_date` to `status_change_date` with each identifier in its own code span;
ensure the first line reads something like "Marked several keys as optional for
`ComponentStatus` and `VersionStatus`" and the second reads "Renamed
`check_date` to `status_change_date` on `ComponentStatus` and `VersionStatus`."
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0a5a8fb5-a2c7-4479-9c5e-f2d00ed82d1c
⛔ Files ignored due to path filters (1)
api/componentsv2/scanoss-components.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (3)
CHANGELOG.mdprotobuf/scanoss/api/components/v2/scanoss-components.protoprotobuf/scanoss/api/components/v2/scanoss-components.swagger.json
🚧 Files skipped from review as they are similar to previous changes (1)
- protobuf/scanoss/api/components/v2/scanoss-components.proto
| ## [0.31.1] - 2026-03-05 | ||
| ### Fixed | ||
| - Marked as optional information several keys for `ComponentStatus and VersionStatus` | ||
| - Renamed `check_date` to `status_change_date` on `ComponentStatus and VersionStatus` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# List the repository structure to understand layout
echo "=== Repository structure ==="
git ls-files | head -30
# Find proto, swagger, or API definition files
echo -e "\n=== Searching for contract files ==="
fd -e proto -e swagger.json -e swagger.yaml -e openapi.json -o --type f
# Find CHANGELOG and related files
echo -e "\n=== Changelog and release files ==="
fd -i changelog -o --type f | head -20Repository: scanoss/papi
Length of output: 1273
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search for ComponentStatus and VersionStatus definitions
echo "=== ComponentStatus and VersionStatus in proto files ==="
rg -n 'message (ComponentStatus|VersionStatus)' --type-list | head -5
rg -n 'message (ComponentStatus|VersionStatus)' -A 20
# Search for check_date and status_change_date occurrences
echo -e "\n=== Occurrences of check_date and status_change_date ==="
rg -n 'check_date|status_change_date'
# Look for backward compatibility hints (deprecated, json_name, reserved)
echo -e "\n=== Backward compatibility markers ==="
rg -n 'deprecated|json_name|reserved' -B 2 -A 2 | grep -E '(check_date|status_change_date|ComponentStatus|VersionStatus)' -B 5 -A 5Repository: scanoss/papi
Length of output: 519
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Find all .proto source files
echo "=== Proto source files ==="
find . -name "*.proto" -type f
# Check for a proto directory
echo -e "\n=== Directory structure of api/ ==="
ls -la api/ 2>/dev/null | head -20Repository: scanoss/papi
Length of output: 1616
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Search for ComponentStatus and VersionStatus in proto compiled files
echo "=== ComponentStatus definition ==="
rg -n 'type ComponentStatus' api/
# Search for check_date and status_change_date
echo -e "\n=== check_date and status_change_date occurrences ==="
rg -n 'check_date\|status_change_date'
# Look at full CHANGELOG to understand link structure
echo -e "\n=== CHANGELOG.md content (check for [0.31.1] reference) ==="
cat CHANGELOG.mdRepository: scanoss/papi
Length of output: 427
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Examine the proto source for ComponentStatus and VersionStatus
echo "=== scanoss-components.proto - ComponentStatus and VersionStatus ==="
rg -n 'message ComponentStatus|message VersionStatus' -A 15 ./protobuf/scanoss/api/components/v2/scanoss-components.proto
# Look for any field called check_date or status_change_date in proto
echo -e "\n=== Fields in ComponentStatus/VersionStatus ==="
rg -n 'check_date|status_change_date|reserved|json_name' ./protobuf/scanoss/api/components/v2/scanoss-components.protoRepository: scanoss/papi
Length of output: 5267
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Read the CHANGELOG.md to check link references and context
echo "=== Full CHANGELOG.md ==="
cat CHANGELOG.mdRepository: scanoss/papi
Length of output: 13344
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Double-check: search in all files including pb.go for check_date
echo "=== Comprehensive search for 'check_date' in entire repository ==="
rg 'check_date' . || echo "No results found for check_date"
# Verify the missing [0.31.1] link at bottom of CHANGELOG
echo -e "\n=== End of CHANGELOG.md (last 20 lines) ==="
tail -20 CHANGELOG.mdRepository: scanoss/papi
Length of output: 1594
Add missing [0.31.1] version reference link to CHANGELOG.
The version [0.31.1] is referenced in the header but not defined in the reference links section at the end of the file. Add:
[0.31.1]: https://github.com/scanoss/papi/compare/v0.31.0...v0.31.1
Additionally, the changelog entry states "Renamed check_date to status_change_date," but this field rename does not appear to exist in the codebase. The proto definitions already contain status_change_date fields with no trace of a check_date field. Verify and correct the changelog description to accurately reflect the actual changes made in this version.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CHANGELOG.md` around lines 9 - 12, The CHANGELOG entry for [0.31.1] is
missing its reference link and contains an incorrect claim about renaming
check_date to status_change_date; add the missing reference line "[0.31.1]:
https://github.com/scanoss/papi/compare/v0.31.0...v0.31.1" to the references
section, and update the release notes for ComponentStatus and VersionStatus to
accurately reflect the real change (e.g., remove the "Renamed `check_date` to
`status_change_date`" sentence or replace it with a correct description such as
"ensured `status_change_date` exists" or "no-op—field already named
`status_change_date`" after verifying the proto definitions) so the text matches
the codebase.
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
That text is already there! there was a typo on protobuff
| ## [0.31.1] - 2026-03-05 | ||
| ### Fixed | ||
| - Marked as optional information several keys for `ComponentStatus and VersionStatus` | ||
| - Renamed `check_date` to `status_change_date` on `ComponentStatus and VersionStatus` |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
protobuf/scanoss/api/components/v2/scanoss-components.proto (1)
183-183: Add error-case examples to reflect the new optional semantics.The examples at Line 183 and Line 238 only show populated success payloads. Given this PR’s behavior changes, add examples for invalid purl / invalid version / component-not-found where omitted keys are visible to clients.
Also applies to: 238-238
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@protobuf/scanoss/api/components/v2/scanoss-components.proto` at line 183, Add explicit error-case examples alongside the existing success example strings in the proto: update the existing example value (the JSON with purl/name/version_status/component_status) and add additional example entries demonstrating (1) invalid purl response, (2) invalid version response, and (3) component-not-found response where optional keys are omitted so clients can see absent fields; modify the same example metadata for the message that contains the shown JSON (the proto "example" entry containing "purl"/"version_status"/"component_status") at both places referenced in the PR so each location includes one success example and the three error-case example JSONs that show omitted keys and appropriate error info.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@protobuf/scanoss/api/components/v2/scanoss-components.proto`:
- Line 220: The generated Go proto for ComponentStatus has a mismatched JSON tag
for StatusChangeDate; regenerate the protobuf artifacts from
scanoss-components.proto (which correctly declares optional string
status_change_date = 5 [json_name = "status_change_date"]) so the
ComponentStatus struct's StatusChangeDate field JSON tag matches
"status_change_date" like VersionStatus does; run the protoc command (with the
same plugins/options you used originally) to recompile scanoss-components.proto
and replace the stale api/componentsv2/scanoss-components.pb.go output, then run
tests/formatting checks to ensure the JSON tags for StatusChangeDate in
ComponentStatus now match the proto definition.
---
Nitpick comments:
In `@protobuf/scanoss/api/components/v2/scanoss-components.proto`:
- Line 183: Add explicit error-case examples alongside the existing success
example strings in the proto: update the existing example value (the JSON with
purl/name/version_status/component_status) and add additional example entries
demonstrating (1) invalid purl response, (2) invalid version response, and (3)
component-not-found response where optional keys are omitted so clients can see
absent fields; modify the same example metadata for the message that contains
the shown JSON (the proto "example" entry containing
"purl"/"version_status"/"component_status") at both places referenced in the PR
so each location includes one success example and the three error-case example
JSONs that show omitted keys and appropriate error info.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ad367be8-f84b-46ea-a268-aa51791d1e6d
📒 Files selected for processing (2)
CHANGELOG.mdprotobuf/scanoss/api/components/v2/scanoss-components.proto
🚧 Files skipped from review as they are similar to previous changes (1)
- CHANGELOG.md
| string last_indexed_date = 4 [json_name = "last_indexed_date"]; | ||
| optional string last_indexed_date = 4 [json_name = "last_indexed_date"]; | ||
| // Date of the last detected change | ||
| optional string status_change_date = 5 [json_name = "status_change_date"]; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify proto declaration
echo "=== Proto declaration ==="
rg -n 'status_change_date|status_change_indexed_date' protobuf/scanoss/api/components/v2/scanoss-components.proto
# Verify generated Go protobuf tags
echo ""
echo "=== Generated Go protobuf tags ==="
rg -n 'StatusChangeDate|status_change_indexed_date|status_change_date' api/componentsv2/scanoss-components.pb.go
# Verify swagger/public schema field names
echo ""
echo "=== Swagger schema ==="
rg -n 'status_change_date|status_change_indexed_date' protobuf/scanoss/api/components/v2/scanoss-components.swagger.jsonRepository: scanoss/papi
Length of output: 3093
Fix protobuf tag mismatch in generated Go code for ComponentStatus.
At line 793 of api/componentsv2/scanoss-components.pb.go, the StatusChangeDate field has a conflicting protobuf tag: json=status_change_indexed_date in the protobuf directive, but the JSON struct tag declares json:"status_change_date". The proto file correctly declares json_name = "status_change_date" (line 220), but the generated Go code for ComponentStatus does not match. Meanwhile, the VersionStatus struct at line 694 is correct. Regenerate the protobuf artifacts to align all generated outputs.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@protobuf/scanoss/api/components/v2/scanoss-components.proto` at line 220, The
generated Go proto for ComponentStatus has a mismatched JSON tag for
StatusChangeDate; regenerate the protobuf artifacts from
scanoss-components.proto (which correctly declares optional string
status_change_date = 5 [json_name = "status_change_date"]) so the
ComponentStatus struct's StatusChangeDate field JSON tag matches
"status_change_date" like VersionStatus does; run the protoc command (with the
same plugins/options you used originally) to recompile scanoss-components.proto
and replace the stale api/componentsv2/scanoss-components.pb.go output, then run
tests/formatting checks to ensure the JSON tags for StatusChangeDate in
ComponentStatus now match the proto definition.
On components status service, some fields were marked as optional
This is for hiding missing values on error scenarios:
Invalid purl -> Show only invalid purl
Invalid version -> Show invalid version and error code but nothing related to required information. Component status is still shown
Component not foud -> Only component name and error messages
And other similar scenarios..
Summary by CodeRabbit