Repository navigation
fix(integration-tests): throw on malformed bundle metadata instead of silent nullopt - #12870
Conversation
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
|
[Warning] This block comment is stale after the PR. It still says golden blobs whose metadata is "missing or unparseable" map to Generated by AI |
ed59482 to
fb13190
Compare
… silent nullopt Bundle metadata (.meta.json and inline sweep-case metadata) that is malformed (not an object, missing or non-integer format_version, unsupported version, invalid enforcement_level, unreadable or unparseable file) now throws BundleMetadataError instead of returning std::nullopt and silently falling back to defaults. A missing .meta.json still returns nullopt. format_version is compared as a JSON value, so 1.5 is no longer truncated to 1 and accepted. IntegrationTestBundle translates the error to UNVALIDATABLE_GOLDEN_DATA when golden outputs are present (registered as a failure), otherwise to MISSING_METADATA / INVALID_SWEEP_CASE (logged and skipped). Follow-up to #10244 (ALMIOPEN-2331). Co-Authored-By: Claude <noreply@anthropic.com>
… and reject non-numeric inputs keys BundleMetadataError now propagates out of the bundle loader instead of being mapped to MISSING_METADATA / UNVALIDATABLE_GOLDEN_DATA / INVALID_SWEEP_CASE. classifyBundle turns it into a FailedLoad whose message carries the parser's detail, so malformed metadata is red on every bundle type (graph-only included) and the author sees what to fix. Those LoadError values now mean "metadata absent" only. parseBundleMetadataJson throws on an inputs key that is not entirely an integer instead of dropping it with a warning, and sets formatVersion to the validated constant. Co-Authored-By: Claude <noreply@anthropic.com>
Update the loadDiscoveredBundles() comment to list all three hard-fail cases, including BundleMetadataError, and reflow the SkippedLoad comment so the malformed-metadata note no longer splits a sentence. Co-Authored-By: Claude <noreply@anthropic.com>
fb13190 to
384b8a6
Compare
adickin-amd
left a comment
There was a problem hiding this comment.
LGTM, just running a quick test locally to test out a bunch of malformed bundles on my machine. If you dont see any comments after that feel free to merge.
TheRock Submodule Bump ActivityNewest first
|
Summary
Harden bundle metadata parsing: a malformed
.meta.jsonor sweep-casemetadatablock now throwsBundleMetadataErrorinstead of silently returningstd::nulloptand running the bundle with default metadata. The bundle then fails as a registered test, and the failure message carries the parser's detail (file or case, and what is wrong). Follow-up to #10244 (review comment r3715954787).JIRA ID : ALMIOPEN-2393
Risk Assessment
Risk 2. Host-side integration-test harness only; no library, provider, or kernel code changes. All 59 checked-in
.meta.jsonfiles and all 10,732 sweep metadata blocks pass the stricter parser (including 9,145inputskeys, none non-numeric), so no existing bundle changes behavior. The.meta.jsonfiles in #12738 also pass.ASIC Coverage
Arch-independent (JSON parsing in the test harness). Standard PR CI is sufficient.
Testing Summary
format_versiontruncation case, and non-numericinputskeys.Testing Checklist
cmake --build build --target hipdnn_integration_tests hipdnn_integration_tests_unit_tests- Status: Passedbuild/bin/hipdnn_integration_tests_unit_tests- Status: Passed (897 passed, 2 pre-existing skips)pre-commit run --files <changed files>- Status: PassedTechnical Changes
BundleMetadata.hpp: addBundleMetadataError.parseBundleMetadataJsonreturnsBundleMetadataand throws on malformed input, including aninputskey that is not entirely an integer ("x","12abc"), which used to be dropped with a warning.loadBundleMetadatareturns nullopt only when the file is absent.format_versionis compared as a JSON value, so1.5and2^32 + 1are rejected.IntegrationTestBundle.hpp:BundleMetadataErrorpropagates out of both load paths, the same wayRuntimePassByValueInvariantErroralready does.MISSING_METADATAandUNVALIDATABLE_GOLDEN_DATAnow mean only "metadata absent".BundleRegistration.hpp:classifyBundleturnsBundleMetadataErrorinto aFailedLoadwhose message includese.what(). Malformed metadata is red on every bundle type, including graph-only bundles, so a typo cannot silently skip a test.TestBundleMetadata.cppusesEXPECT_THROWand adds theTestParseBundleMetadataJsonsuite.TestBundleDiscovery.cppcovers malformed metadata on graph-only, golden, and sweep-case bundles, and theFailedLoadmessage detail.GoldenReferenceCpu.hpp, listed in the ticket, was removed in cleanup(integration-tests): remove legacy per-op golden test classes #10343. Its remaining callers are the two load paths inIntegrationTestBundle.hpp, both covered here.BundleMetadataError.🤖 Generated with Claude Code