Enforce existence of the bundle manifest file (fixes #688) - #695
Open
EngineerOnTravel wants to merge 1 commit into
Open
Enforce existence of the bundle manifest file (fixes #688)#695EngineerOnTravel wants to merge 1 commit into
EngineerOnTravel wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
EngineerOnTravel
force-pushed
the
fix-issue-688
branch
from
August 1, 2026 07:25
2b74c90 to
862e74a
Compare
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.
Enforce existence of the bundle manifest file (fixes #688)
Problem
apigeelintnever validates that a bundle actually has a manifest file(
apiproxy.xml/sharedflowbundle.xml) at its root.In
lib/package/Bundle.js,processFileSystem()reads the.xmlfiles atthe bundle root and only guards against the "too many" case:
When
files.length === 0(no manifest file at all),files[0]isundefined, sobundle.filePathsilently becomes the string"<root>/undefined". Every downstream consumer offilePath(
getElement(),getName(),getRevision(), etc.) just callsfs.existsSync(...), finds nothing, and quietly falls back to defaults.The result: a bundle with a completely missing manifest is linted as if
it were fine, and no error or warning is ever produced, even though such
a bundle cannot be imported into Apigee at all.
Fix
lib/package/Bundle.js: only setbundle.filePathwhen a manifestfile was actually found; leave it
undefinedotherwise (instead of thebogus
"<root>/undefined"path).BN015(lib/package/plugins/BN015-checkManifestExists.js),that runs at the Bundle level and reports a severity-2 (error) message
when
bundle.filePathisundefined, i.e. when no manifest file wasfound at the bundle root. This follows the same pattern as the other
BN0xxbundle-structure rules (e.g.BN001,BN010), so it plugs intothe existing plugin discovery, reporting, and severity/exit-code
machinery for free.
README.mdto documentBN015.test/fixtures/resources/missingManifest/apiproxy/— a bundlefixture with a valid
apiproxyfolder structure (proxies/default.xml)but no manifest
.xmlfile at the root — to exercise the new behavior.test/specs/BN015-checkManifestExists.js, verifying:BN015error-severity message;
sampleProxy/24Solver/apiproxy)produces no
BN015message.test/specs/testBundleEx.jsconfirmingbundle.filePathisundefined(not".../undefined") for a bundlemissing its manifest.
I considered raising the error directly from
Bundle.js's constructorinstead of adding a plugin, but every message emitted there needs a
ruleIdto satisfy the report JSON schema (test/fixtures/reportSchema.js,enforced by
test/specs/testAllPluginsMultipleBundlesReportSchema.js,which scans every
apiproxyfixture undertest/fixtures/resourcesagainst every registered plugin). A dedicated plugin gets a
ruleIdforfree via
lintUtil.getRuleId()'s filename convention, matches how theissue's "secondary enhancement" suggested a new rule for manifest/
BN00xchecks, and keeps the check enable/disable-able like any other rule.
Verification
npm cinpm run eslint— clean, no errors.npm test(mocha, the same command CI runs via.github/workflows/run-tests.yml) — full suite passes:1330 passing,0 failing(2 new specs added on top of the previous1326 passing / 2 that would otherwise fail against the new fixture
without the
ruleIdfix).Fixes #688.