Skip to content

fix: correct misspelled ExternalReferenceType.RFC_9166 to RFC_9116 - #1088

Closed
BLDT-36 wants to merge 1 commit into
CycloneDX:mainfrom
BLDT-36:fix/rfc-9116
Closed

BLDT-36 wants to merge 1 commit into
CycloneDX:mainfrom
BLDT-36:fix/rfc-9116

Conversation

@BLDT-36

@BLDT-36 BLDT-36 commented Nov 30, 2026

Copy link
Copy Markdown

Description

ExternalReferenceType declared the CycloneDX 1.6+ rfc-9116 external reference type with transposed digits as RFC_9166, so ExternalReferenceType.RFC_9116 did not exist:

>>> ExternalReferenceType('rfc-9116').name
'RFC_9166'

The member is now spelled RFC_9116, matching the CycloneDX schema value rfc-9116 and the UPPER_SNAKE_CASE naming of every other member. It is registered for the 1.6 and 1.7 views under the corrected name, and the 13 enum_ExternalReferenceType-* snapshots were updated -- their URLs are derived from .name, so they necessarily follow the rename.

RFC_9166 is kept as an alias of RFC_9116, the same way VCS is an alias of SCM in this enum, so ExternalReferenceType.RFC_9166 keeps resolving. Only the reported .name changes, which is the compatibility remark from your comment.

Three regression tests were added to TestEnumExternalReferenceType:

  • the corrected member name, its value, and lookup by value
  • that RFC_9166 is still the same member as RFC_9116
  • that every rfc-* member follows UPPER_SNAKE_CASE, so a transposition like this one cannot slip through again

The last one exists because _EnumTestCase._test_knows_value() only asserts that enum(value) resolves -- as its own # TODO test for an expected name notes -- which is exactly why this typo went unnoticed.

Verification

python -m pytest tests/test_enums.py -k ExternalReferenceType

65 passed, 675 deselected in 3.67s

Full suite: 7244 passed, plus 3 environment-only failures in tests/test_validation_xml.py on a non-UTF-8 Windows locale (open() without encoding= reading XML fixtures); they pass with PYTHONUTF8=1 on the same tree and are unrelated to this change.

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: DeepSeek Harness (agentic coding harness)
    • LLMs and versions: deepseek-v4.1-flash
    • Prompts: Pointed at issue #1074; asked to locate every occurrence of the misspelled member, rename it while keeping backward compatibility, update the affected snapshots, and add regression tests that would have caught the typo. The diff was reviewed before submitting.

Affirmation

`ExternalReferenceType` declared the CycloneDX 1.6+ `rfc-9116` external
reference type with transposed digits, so `ExternalReferenceType.RFC_9116`
did not exist and `ExternalReferenceType('rfc-9116').name` reported the
typo `'RFC_9166'`.

The member is now spelled `RFC_9116`, matching the schema value and the
`UPPER_SNAKE_CASE` naming of the other members. `RFC_9166` is kept as an
alias, so existing attribute access keeps working - only the reported
`.name` changes, which is the compatibility remark from the issue.

The schema-1.6 registration and the enum snapshots were updated as well;
their URLs are derived from `.name`.

Adds regression tests for the member name, the alias, and the naming of all
`rfc-*` members - `_test_knows_value()` only proved that a value is
known, never that its member name is spelled correctly.

Resolves CycloneDX#1074

Signed-off-by: 皇者华 <328654030+BLDT-36@users.noreply.github.com>
@BLDT-36
BLDT-36 requested a review from a team as a code owner November 30, 2026 06:15
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CycloneDX Python Library | 🛠️ Build #36255339 | 📁 Comparing 4c31d23 against latest (3bc82a5)

  🔍 Preview build  

2 files changed
± genindex.html
± autoapi/cyclonedx/model/index.html

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@BLDT-36

BLDT-36 commented Nov 30, 2026

Copy link
Copy Markdown
Author

Closing this: #1082 already does the same fix, was opened five days earlier, and has been through review and a revision round with @jkowalleck. Leaving a second PR for the same one-line change only splits attention over two branches.

What I missed when I started: I read #1074's comments and the guideline page, and looked at the wrong thing for duplicate work -- the issue had no linked PR and no assignee, so I took it as free. Checking the issue timeline for cross-references would have shown #1082 straight away. My mistake, not a disagreement with the existing PR.

For the record, in case anything here is useful to #1082 -- no action requested:

  • The one thing this branch has that feat: add correctly spelled ExternalReferenceType.RFC_9116 #1082 does not is a test over every rfc-* member, asserting the member name is the value in upper snake case. It would have caught RFC_9166 on its own, rather than pinning this one pair:

    for member in ExternalReferenceType:
        if member.value.startswith('rfc-'):
            self.assertEqual(member.value.upper().replace('-', '_'), member.name)

    It has to skip the other aliases (SCM/VCS, and any future ones), so it is only worth having if it stays narrow like this.

  • The rest of the branch (the rename, the alias, the __CASES entry for 1.6, the 13 snapshot files) matches feat: add correctly spelled ExternalReferenceType.RFC_9116 #1082 file for file.

.invalid note for anyone reading the CI here: the action_required conclusion is the first-time-contributor workflow approval, not a failure.

@BLDT-36 BLDT-36 closed this Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant