Skip to content

Improve namespace implementation#824

Merged
ahouseholder merged 46 commits into820-add-a-minimalist-selection-objectfrom
780-clarify-distinction-between-private-and-extension-namespaces
Jul 23, 2025
Merged

Improve namespace implementation#824
ahouseholder merged 46 commits into820-add-a-minimalist-selection-objectfrom
780-clarify-distinction-between-private-and-extension-namespaces

Conversation

@ahouseholder
Copy link
Contributor

@ahouseholder ahouseholder commented Jul 17, 2025

This PR implements the namespace clarifications from #780.

Note

This PR builds on #821 and should either be merged into #821 or merged to main after #821 is merged into main.

CoPilot Summary

This pull request introduces several changes to improve the SSVC codebase by enhancing schema definitions, modularizing utility functions, and refining namespace validation. The updates include adjustments to schema descriptions, the introduction of reusable field specifications and patterns, and modifications to test cases to align with the new namespace format.

Schema Improvements:

Codebase Modularization:

  • Introduced utility modules:
  • Refactored imports: Updated references across modules to use the new utility functions and field specifications, improving maintainability and readability. (src/ssvc/_mixins.py, [1]; src/ssvc/selection.py, [2]

Namespace Validation Enhancements:

  • Improved namespace rules: Allowed additional punctuation (#) and refined validation logic to prevent consecutive separators. (src/ssvc/namespaces.py, src/ssvc/namespaces.pyL89-R39)
  • Aligned namespace format in tests: Updated test cases to use the new namespace format (x_example.test) for consistency. (src/test/decision_points/test_dp_base.py, [1]; src/test/decision_points/test_dp_helpers.py, [2]; src/test/dp_groups/test_dp_groups.py, [3]; src/test/outcomes/test_outcomes.py, [4]; src/test/test_doc_helpers.py, [5]

@ahouseholder ahouseholder self-assigned this Jul 17, 2025
@ahouseholder ahouseholder added integration/blocker Something that is blocking integration with another framework or system integration Related to integration of SSVC into another framework or system tech/backend Back-end tools, code, infrastructure labels Jul 17, 2025
@ahouseholder ahouseholder added this to the 2025-09 milestone Jul 17, 2025
@ahouseholder ahouseholder linked an issue Jul 17, 2025 that may be closed by this pull request
@ahouseholder
Copy link
Contributor Author

@tschmidtb51

Copy link
Contributor

@sei-vsarvepalli sei-vsarvepalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good and clear to me.. I will wait on Thomas' feedback if any over next week, then we can merge it off.

Copy link
Contributor

@tschmidtb51 tschmidtb51 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahouseholder Thank you for providing that. I missed the PR and therefore noted some comments in #780.

Main points:

  • enforcement of reverse DNS
  • provide option to separate organization (reverse DNS) and "model", e.g. #

I look forward to our conversation on Monday

@ahouseholder
Copy link
Contributor Author

For ease of figuring out what's new, I've marked all previous suggestions as resolved, and have re-requested review from @tschmidtb51 and @sei-vsarvepalli on the current version of the branch.

@ahouseholder
Copy link
Contributor Author

I did just push (in afe9c61) a revamp of the values part of the selection object.

Note

Strictly speaking, this should have gone into the #821 branch, but I'm doing this in #824 instead of #821 because it depends on a previous refactoring that only exists in the #824 branch.

To maintain parallelism with the full-size DecisionPointValue object, I added a MinimalDecisionPointValue that only requires a key. Compare:

from ssvc.decision_points.base import DecisionPointValue
DecisionPointValue.model_json_schema()

Out[6]: 
{'description': 'Models a single value option for a decision point.\n\nEach value should have the following attributes:\n\n- name (str): A name\n- description (str): A description\n- key (str): A key (a short, unique string) that can be used to identify the value in a shorthand way\n- _comment (str): An optional comment that will be included in the object.',
 'properties': {'key': {'title': 'Key', 'type': 'string'},
  'name': {'title': 'Name', 'type': 'string'},
  'description': {'title': 'Description', 'type': 'string'}},
 'required': ['key', 'name', 'description'],
 'title': 'DecisionPointValue',
 'type': 'object'}

from ssvc.selection import MinimalDecisionPointValue
MinimalDecisionPointValue.model_json_schema()
Out[8]: 
{'description': 'A minimal representation of a decision point value.',
 'properties': {'key': {'title': 'Key', 'type': 'string'}},
 'required': ['key'],
 'title': 'MinimalDecisionPointValue',
 'type': 'object'}

See commit diff for details of how this changes the JSON schema.

@ahouseholder
Copy link
Contributor Author

ahouseholder commented Jul 23, 2025

Current preview of the resulting selection object:

{
  "schemaVersion": "2.0.0",
  "selections": [
    {
      "namespace": "ssvc",
      "key": "A",
      "version": "2.0.0",
      "values": [
        {
          "key": "N"
        }
      ]
    },
    {
      "namespace": "ssvc",
      "key": "SI",
      "version": "2.0.0",
      "values": [
        {
          "key": "N"
        },
        {
          "key": "M"
        }
      ]
    }
  ],
  "timestamp": "2025-07-23T16:38:36Z"
}

@ahouseholder
Copy link
Contributor Author

After discussion with @sei-vsarvepalli, we've agreed to merge this into #821 and will continue the wrap-up tasks in that PR

@ahouseholder ahouseholder merged commit b955ef7 into 820-add-a-minimalist-selection-object Jul 23, 2025
1 check passed
@ahouseholder ahouseholder deleted the 780-clarify-distinction-between-private-and-extension-namespaces branch July 23, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration/blocker Something that is blocking integration with another framework or system integration Related to integration of SSVC into another framework or system tech/backend Back-end tools, code, infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clarify distinction between private and extension namespaces add ADR & clarify namespace reference doc to explain intent of non-ssvc namespaces

3 participants