Repository navigation
test(schema): pin offline-validation errors and AttributeKind values - #1523
Merged
Merged
Conversation
…teKind into the enum table The schema tests added by #1135 checked validator errors with `any("<field>" in message ...)`. That passes as long as some message mentions the field, so a changed message text or an extra error does not fail the suite. Each of those tests now asserts exactly one error with its full message, or its field, reason and received value. The separate AttributeKind test checked only that "Text" is present and "String" is absent. AttributeKind is now an entry of the parametrized enum table, which also pins the member order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
🤖 platform-health-agent · PR opened, waiting for CI and human review · 2026-11-13 detailsCard: INBOX-129 (Engineering Inbox). The agent does not merge; a human reviews and merges. History (newest first):
|
Deploying infrahub-sdk-python with
|
| Latest commit: |
745be3f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://20de3fae.infrahub-sdk-python.pages.dev |
| Branch Preview URL: | https://pha-inbox-129.infrahub-sdk-python.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## stable #1523 +/- ##
=======================================
Coverage 87.88% 87.88%
=======================================
Files 157 157
Lines 15660 15660
Branches 2114 2114
=======================================
Hits 13763 13763
Misses 1336 1336
Partials 561 561
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
polmichel
added a commit
that referenced
this pull request
Nov 16, 2026
* test(schema): assert exact offline-validation errors and fold AttributeKind into the enum table (#1523) The schema tests added by #1135 checked validator errors with `any("<field>" in message ...)`. That passes as long as some message mentions the field, so a changed message text or an extra error does not fail the suite. Each of those tests now asserts exactly one error with its full message, or its field, reason and received value. The separate AttributeKind test checked only that "Text" is present and "String" is absent. AttributeKind is now an entry of the parametrized enum table, which also pins the member order. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * chore(speckit): upgrade Spec Kit to 1.2.5 and opsmill-speckit to 1.4.1 (#1490) * chore(lint): exclude the vendored spec-kit scripts from ruff and ty The agent-context extension that Spec Kit 1.2 ships contains Python that does not follow the project's rules. `.specify` is in the ruff and ty exclude lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(speckit): upgrade Spec Kit to 1.2.5 and opsmill-speckit to 1.4.1 Follows the "Upgrading spec-kit to 1.2 or later" steps of opsmill-speckit v1.4.1, as in opsmill/infrahub#11376: - remove the review extension, which does not install on Spec Kit 1.x - upgrade the Claude integration to Spec Kit 1.2.5 - reinstall opsmill from the v1.4.1 tag - add the checkpoint extension and the critique-opsmill preset - replace the infrahub Jira preset with jira-branch, and delete dev/spec-kit/presets/infrahub - update agent-context to 1.0.2, the version Spec Kit 1.2.5 ships, and keep its CLAUDE.md configuration No file that the integration manages had local changes, so the forced upgrade loses nothing. Also deletes the command files that Spec Kit 0.x generated in .agents/commands. Spec Kit 1.2 uses the skills in .agents/skills instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(speckit): replace the infrahub branch hook with the git extension's The infrahub extension, added in #979, ran speckit.infrahub.feature before each specification to check the Jira reference in the branch name. Its command file was removed with the infrahub preset, so the hook pointed to a command that no longer exists. The jira-branch preset now does that check in speckit.git.feature, so the hook is the git extension's, as in opsmill/infrahub#11376. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(lint): exclude the spec-kit presets from rumdl The upgrade installs presets in .specify/presets, which rumdl checked, unlike .specify/extensions and .specify/templates. Spec Kit regenerates these files on each upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(speckit): run the spec-kit scripts with the project's Python The plan, tasks and template scripts of Spec Kit 1.2 need PyYAML, which the system python3 often lacks. The Claude Code and Codex hooks that opsmill-speckit 1.4.1 ships point them at the project environment when it has PyYAML, and do nothing otherwise. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X9ZEsTmHy1shuNRt88HiUb --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * test(schema): align merged dropdown choice cases with exact-error assertions develop (#1523) switched OutOfEnumCase to expected_input/expected_reason and asserted exact messages; infrahub-develop (e5d1ed6) added a dropdown-choice-state case with the old invalid_value field and made the choices fixture a Dropdown attribute. Port the new case to the new fields and expect Dropdown in the choice color message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Saltaferis Dimitrios <d.saltaferis@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: infrahub-github-bot-app[bot] <190746546+infrahub-github-bot-app[bot]@users.noreply.github.com>
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.
Why
PR #1135 added the offline schema validator tests. Its review left two threads open (AttributeKind test, error-message assertions):
tests/unit/test_schema_offline_validation.pyassertedany("<field>" in message for message in result.messages). These pass as long as some message mentions the field, so a changed message text or an extra error does not fail them. The reviewer asked for "only 1 error and it should be possible to assert more, or all, of its text".test_attribute_kind_enum_present_without_deprecated_string_memberrepeated the parametrized enum test becauseAttributeKindwas missing from its table.Tracked as INBOX-129 in the Engineering Inbox.
What changed
Test code only. The validator and the generated models are unchanged.
test_schema_offline_validation.py:test_out_of_enum_value_is_rejected_naming_field_and_valueasserts exactly one error, its field, the received value, the reason and the rendered message. For the two literal enums (relationshipkindandcardinality) the expected reason is the whole reason. For the attribute and computed-attributekinddiscriminators, it is the part that names the rejected tag. Pydantic then lists every accepted tag in the order of the generated union. That list is not pinned, so regenerating the union in a different order does not break the test.test_schema_generated_models.py:AttributeKindis an entry of_EXPECTED_ENUM_VALUESwith its full member list, which does not includeString. The separate test is removed.How to test
112 passed. Full unit suite: 3,148 passed, 2 skipped, 1 xfailed, the same as on
stable.invoke format, ruff, ty, mypy, yamllint, rumdl andinvoke docs-validatepass. Vale is not installed on the machine that ran the checks, so the docs style check did not run. The diff changes no documentation.To check that the tests now detect message changes,
(received:was changed to(got:ininfrahub_sdk/schema/validate.py. The two modules then fail 10 tests on this branch and 2 onstable.🤖 Generated with Claude Code