fix(3468):Tool update resets visibility to public when field not provided#3503
fix(3468):Tool update resets visibility to public when field not provided#3503crivetimihai merged 6 commits intoIBM:mainfrom
Conversation
a87cf56 to
cf8deea
Compare
|
Note — additional fix bundled in this PR: Besides the visibility-reset bug (#3468), commit The fix removes that |
e5bc346 to
2a64719
Compare
Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com>
…ate schema Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com>
…ck_tool fixture Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com>
…k visibility conflicts - Change ToolUpdate.visibility default from "public" to None so omitting the field preserves the existing value instead of resetting to public. - Remove client-settable team_id/owner_email from ToolUpdate; derive ownership fields from the DB record for conflict checks. - Extract _check_tool_name_conflict() to handle public/team/private scoped uniqueness checks in a single reusable method. - Add conflict checking when visibility changes without a name change. - Fix custom_name_ref fallback to use existing custom_name when it diverges from name (instead of incorrectly using the new name). - Remove the else branch that wiped auth_type when auth was not provided. Closes IBM#3468 Signed-off-by: Jonathan Springer <jps@s390x.com>
…complete conflict checks - Change ToolUpdate.visibility from Optional[str] to Optional[Literal["private", "team", "public"]] so Pydantic rejects invalid values at the schema boundary. - Add a warning log in _check_tool_name_conflict when a team/private visibility is missing the required team_id/owner_email, making skipped conflict checks observable. Signed-off-by: Jonathan Springer <jps@s390x.com>
2a64719 to
f62e6cb
Compare
Review SummaryRebased onto FindingsCorrectness — All logic is sound:
Security — Improves security:
Consistency — Aligns with Test Coverage — 100% differential coverage. 14 new tests + helper covering all new code paths. Performance — No additional DB queries introduced. Live E2E Test Results
LGTM. |
crivetimihai
left a comment
There was a problem hiding this comment.
Approved — rebased, reviewed, unit-tested (307 pass), and E2E-verified against live deployment. All visibility preservation, conflict detection, auth preservation, and schema validation scenarios confirmed working.
…rror ToolNameConflictError formatted private-scope conflicts as "Public" because the else branch caught both public and private visibility. This path is newly reachable since the PR adds private conflict detection. Add an explicit "private" branch and a test. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
…ided (#3503) * fix(#3468): handle visibility in tool update conflict checks Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> * fix(#3468): remove default value from visibility field in tool update schema Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> * test(#3468): update tool visibility conflict check tests to use mock_tool fixture Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> * fix(#3468): harden tool update to preserve omitted fields and check visibility conflicts - Change ToolUpdate.visibility default from "public" to None so omitting the field preserves the existing value instead of resetting to public. - Remove client-settable team_id/owner_email from ToolUpdate; derive ownership fields from the DB record for conflict checks. - Extract _check_tool_name_conflict() to handle public/team/private scoped uniqueness checks in a single reusable method. - Add conflict checking when visibility changes without a name change. - Fix custom_name_ref fallback to use existing custom_name when it diverges from name (instead of incorrectly using the new name). - Remove the else branch that wiped auth_type when auth was not provided. Closes #3468 Signed-off-by: Jonathan Springer <jps@s390x.com> * fix(#3468): add visibility value validation and warning log for incomplete conflict checks - Change ToolUpdate.visibility from Optional[str] to Optional[Literal["private", "team", "public"]] so Pydantic rejects invalid values at the schema boundary. - Add a warning log in _check_tool_name_conflict when a team/private visibility is missing the required team_id/owner_email, making skipped conflict checks observable. Signed-off-by: Jonathan Springer <jps@s390x.com> * fix(#3468): label private conflicts correctly in ToolNameConflictError ToolNameConflictError formatted private-scope conflicts as "Public" because the else branch caught both public and private visibility. This path is newly reachable since the PR adds private conflict detection. Add an explicit "private" branch and a test. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> Signed-off-by: Jonathan Springer <jps@s390x.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Nithin Katta <Nithin.Katta@ibm.com> Co-authored-by: Jonathan Springer <jps@s390x.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
…ided (#3503) * fix(#3468): handle visibility in tool update conflict checks Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> * fix(#3468): remove default value from visibility field in tool update schema Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> * test(#3468): update tool visibility conflict check tests to use mock_tool fixture Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> * fix(#3468): harden tool update to preserve omitted fields and check visibility conflicts - Change ToolUpdate.visibility default from "public" to None so omitting the field preserves the existing value instead of resetting to public. - Remove client-settable team_id/owner_email from ToolUpdate; derive ownership fields from the DB record for conflict checks. - Extract _check_tool_name_conflict() to handle public/team/private scoped uniqueness checks in a single reusable method. - Add conflict checking when visibility changes without a name change. - Fix custom_name_ref fallback to use existing custom_name when it diverges from name (instead of incorrectly using the new name). - Remove the else branch that wiped auth_type when auth was not provided. Closes #3468 Signed-off-by: Jonathan Springer <jps@s390x.com> * fix(#3468): add visibility value validation and warning log for incomplete conflict checks - Change ToolUpdate.visibility from Optional[str] to Optional[Literal["private", "team", "public"]] so Pydantic rejects invalid values at the schema boundary. - Add a warning log in _check_tool_name_conflict when a team/private visibility is missing the required team_id/owner_email, making skipped conflict checks observable. Signed-off-by: Jonathan Springer <jps@s390x.com> * fix(#3468): label private conflicts correctly in ToolNameConflictError ToolNameConflictError formatted private-scope conflicts as "Public" because the else branch caught both public and private visibility. This path is newly reachable since the PR adds private conflict detection. Add an explicit "private" branch and a test. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Nithin Katta <Nithin.Katta@ibm.com> Signed-off-by: Jonathan Springer <jps@s390x.com> Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> Co-authored-by: Nithin Katta <Nithin.Katta@ibm.com> Co-authored-by: Jonathan Springer <jps@s390x.com> Co-authored-by: Mihai Criveti <crivetimihai@gmail.com> Signed-off-by: Yosief Eyob <yosiefogbazion@gmail.com>
🔗 Related Issue
Closes #3468
📝 Summary
Added logic to handle visibility when not provided
🏷️ Type of Change
✅ Checklist
make black isort pre-commit)