G
YouTube TikTok Games
Skip to content

fix(bundles): reject integration mappings without an id - #5161

Merged
mnriem merged 2 commits into
github:mainfrom
mirzasnowy:fix/5091-integration-id-required
Oct 28, 2026
Merged

mnriem merged 2 commits into
github:mainfrom
mirzasnowy:fix/5091-integration-id-required

Conversation

@mirzasnowy

Copy link
Copy Markdown
Contributor

Fixes #5091.

Bug

BundleManifest.from_dict rejects a non-mapping integration value (e.g. bare string "claude") because it would otherwise be "wrongly integration-agnostic" — but a mapping with a missing, empty, or misspelt id ({name: claude}, {}) still fell through to integration = None, and specify bundle validate reported the manifest valid.

Fix

In from_dict, when integration is a dict, compute the id with the codebase's own null-safe strip coercion (_text) and raise BundlerError("'integration' mapping must include a non-empty 'id'.") when empty. This covers missing, empty-string, whitespace-only, and null ids. Absent integration still means genuinely agnostic, and non-string ids coerce exactly as the rest of the manifest code does.

Tests

  • Issue repro: integration: claude → exit 1 (already correct); integration: {name: claude} and integration: {} → exit 0 "valid" before, exit 1 naming integration after.
  • 7 new tests (parametrized from_dict rejections for {}, {name: claude}, {id: ""}, {id: " "}, {id: None}; acceptance + strip for {id: " claude "}; absent integration stays agnostic; CLI bundle validate --offline exits 1 for {} and {name: claude}): fail on pristine code, pass with the fix.
  • Neighbouring files (test_manifest.py + test_command_validate.py + test_validator.py + tests/contract/test_manifest_schema.py): 139 passed. Full tests/specify_cli/bundles/ suite: 1268 passed. ruff check clean on all three touched files.

AI Disclosure

  • I did use AI assistance (fill in the disclosure below)

Implemented with Muse (Muse Spark, human-supervised); code generation and tests.

I have reviewed every line of this diff.

Fixes github#5091.

Assisted-by: Muse (model: Muse Spark, supervised)
@mirzasnowy
mirzasnowy requested a review from mnriem as a code owner October 28, 2026 15:24
@mnriem mnriem added the triage-must-have Verdict: high-value, important work for Spec Kit — do first label Oct 28, 2026
@mnriem
mnriem requested a max review from Copilot October 28, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 _text and reject missing, null, empty, or whitespace-only IDs.
  • Preserve valid-ID trimming and integration-agnostic behavior when integration is 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

Comment thread src/specify_cli/bundles/manifest.py Resolved
@mnriem

mnriem commented Oct 28, 2026

Copy link
Copy Markdown
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)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the change rejecting bundle integration mappings without usable IDs.

No open issues 🎉

1 resolved since last review

Review effort: Max

@mnriem
mnriem merged commit b0edc22 into github:main Oct 28, 2026
16 checks passed
@mnriem

mnriem commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

kevinnguyenhoang91 pushed a commit to kevinnguyenhoang91/spec-kit that referenced this pull request Nov 10, 2026
* fix(bundles): reject integration mappings without an id

Fixes github#5091.

Assisted-by: Muse (model: Muse Spark, supervised)

* docs(bundles): distinguish whitespace-only id in integration comment

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-must-have Verdict: high-value, important work for Spec Kit — do first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: integration: mapping without an id makes a bundle silently integration-agnostic

3 participants