Repository navigation
fix(bundles): reject integration mappings without an id - #5161
Merged
Merged
Conversation
Fixes github#5091. Assisted-by: Muse (model: Muse Spark, supervised)
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The comment in manifest.py inaccurately describes prior handling of whitespace-only IDs, which produced an empty-ID IntegrationRef rather than integration=None.
1 open issue
What changed in this PR
Tightens Spec Kit bundle validation so a declared integration mapping must contain a usable ID, addressing #5091.
Changes:
- Normalize integration IDs with
_textand reject missing, null, empty, or whitespace-only IDs. - Preserve valid-ID trimming and integration-agnostic behavior when
integrationis absent. - Add manifest-level and offline CLI regression tests.
The PR reports before-and-after regression results; tests were not rerun during this review.
| File | Description |
|---|---|
tests/specify_cli/bundles/test_manifest.py |
Covers invalid mappings, valid-ID trimming, and absent integration. |
tests/specify_cli/bundles/test_command_validate.py |
Verifies offline validation rejects mappings without an ID. |
src/specify_cli/bundles/manifest.py |
Rejects integration mappings whose normalized ID is empty. |
Review effort: Max
Collaborator
|
Please address Copilot feedback |
Addresses Copilot review feedback on github#5161: a whitespace-only id did not fall through to integration=None; it passed the old truthiness check and became IntegrationRef(id=""). Assisted-by: Muse (model: Muse Spark, supervised)
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #5091.
Bug
BundleManifest.from_dictrejects a non-mappingintegrationvalue (e.g. bare string"claude") because it would otherwise be "wrongly integration-agnostic" — but a mapping with a missing, empty, or misspeltid({name: claude},{}) still fell through tointegration = None, andspecify bundle validatereported the manifest valid.Fix
In
from_dict, whenintegrationis a dict, compute the id with the codebase's own null-safe strip coercion (_text) and raiseBundlerError("'integration' mapping must include a non-empty 'id'.")when empty. This covers missing, empty-string, whitespace-only, and null ids. Absentintegrationstill means genuinely agnostic, and non-string ids coerce exactly as the rest of the manifest code does.Tests
integration: claude→ exit 1 (already correct);integration: {name: claude}andintegration: {}→ exit 0 "valid" before, exit 1 namingintegrationafter.from_dictrejections for{},{name: claude},{id: ""},{id: " "},{id: None}; acceptance + strip for{id: " claude "}; absent integration stays agnostic; CLIbundle validate --offlineexits 1 for{}and{name: claude}): fail on pristine code, pass with the fix.test_manifest.py+test_command_validate.py+test_validator.py+tests/contract/test_manifest_schema.py): 139 passed. Fulltests/specify_cli/bundles/suite: 1268 passed.ruff checkclean on all three touched files.AI Disclosure
Implemented with Muse (Muse Spark, human-supervised); code generation and tests.
I have reviewed every line of this diff.