feat: support anonymous instances registration according to the latest gts specification#74
Conversation
…t gts specification Signed-off-by: Artifizer <artifizer@gmail.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughUpdates a submodule pointer in Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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 |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@gts/src/store.rs`:
- Around line 1030-1036: The two error messages use mixed identifiers:
StoreError::ObjectNotFound uses instance_id while
StoreError::SchemaForInstanceNotFound uses lookup_id, which can confuse users if
GtsID::new normalizes input; change the second error construction in the schema
lookup to use instance_id (the original user input) instead of lookup_id so both
errors consistently report the same ID (update the code around the schema_id
.ok_or_else(...) that currently references lookup_id to reference instance_id).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 846d02b4-5fa4-4af0-abe7-16d8c3113e53
📒 Files selected for processing (2)
.gts-specgts/src/store.rs
| .ok_or_else(|| StoreError::ObjectNotFound(instance_id.to_owned()))? | ||
| .clone(); | ||
|
|
||
| let schema_id = obj | ||
| .schema_id | ||
| .as_ref() | ||
| .ok_or_else(|| StoreError::SchemaForInstanceNotFound(gid.id.clone()))? | ||
| .ok_or_else(|| StoreError::SchemaForInstanceNotFound(lookup_id.clone()))? |
There was a problem hiding this comment.
Inconsistent ID used in error messages.
Line 1030 reports instance_id (the user's input) in ObjectNotFound, but line 1036 reports lookup_id (the resolved internal ID) in SchemaForInstanceNotFound. If GtsID::new() normalizes the input, these could differ, confusing the user.
For consistency, use instance_id in both error messages since that's what the user passed in.
Proposed fix
let schema_id = obj
.schema_id
.as_ref()
- .ok_or_else(|| StoreError::SchemaForInstanceNotFound(lookup_id.clone()))?
+ .ok_or_else(|| StoreError::SchemaForInstanceNotFound(instance_id.to_owned()))?
.clone();📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .ok_or_else(|| StoreError::ObjectNotFound(instance_id.to_owned()))? | |
| .clone(); | |
| let schema_id = obj | |
| .schema_id | |
| .as_ref() | |
| .ok_or_else(|| StoreError::SchemaForInstanceNotFound(gid.id.clone()))? | |
| .ok_or_else(|| StoreError::SchemaForInstanceNotFound(lookup_id.clone()))? | |
| .ok_or_else(|| StoreError::ObjectNotFound(instance_id.to_owned()))? | |
| .clone(); | |
| let schema_id = obj | |
| .schema_id | |
| .as_ref() | |
| .ok_or_else(|| StoreError::SchemaForInstanceNotFound(instance_id.to_owned()))? | |
| .clone(); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@gts/src/store.rs` around lines 1030 - 1036, The two error messages use mixed
identifiers: StoreError::ObjectNotFound uses instance_id while
StoreError::SchemaForInstanceNotFound uses lookup_id, which can confuse users if
GtsID::new normalizes input; change the second error construction in the schema
lookup to use instance_id (the original user input) instead of lookup_id so both
errors consistently report the same ID (update the code around the schema_id
.ok_or_else(...) that currently references lookup_id to reference instance_id).
Signed-off-by: Artifizer <artifizer@gmail.com>
Summary by CodeRabbit
Chores
Improvements