Repository navigation
build02: compare the two clause headers as clauses, as the instruction says - #16
Merged
Merged
Conversation
…n says The instruction publishes State A's manifest and then states the contract: Export-Package and Import-Package are compared clause by clause, so ordering and whitespace do not matter, but the packages, versions, `uses:=` sets and `resolution:=optional` do. `test_required_header_exact` compared all thirteen required headers as whole strings, so a jar whose only difference was `uses:=` written before `version=` rather than after -- a choice that belongs to bnd's version, that OSGi gives no meaning and that no resolver can observe -- failed a scored check. Under the stage's all-pass gate that one check took the stage, with 2,668 behavioural checks passing beside it. The parser this needed was already here and already quote-aware; `osgi_header_meaning` normalises on top of it and the two headers route through it. The other eleven are untouched and still byte-exact. `parse_osgi_header` also stopped folding `a:=b` into `a=b`. OSGi reads the first as an instruction to the resolver and the second as an attribute a consumer may match on, and only the first makes an import optional; stripping the colon let a clause that declared one answer a check written for the other. The regression test is the half that matters: four reorderings must pass, and ten differences the instruction calls graded must still fail -- a dropped `uses:=`, a changed uses set, a wrong version, a package added or missing, and `resolution=optional` in place of `resolution:=optional`.
hongdy22
force-pushed
the
fix/build02-osgi-clause-comparison
branch
from
September 14, 2026 06:19
d5eff0d to
b4530e0
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.
Fixes #13.
The instruction publishes State A's manifest and then states the contract:
Export-PackageandImport-Packageare compared clause by clause, so ordering and whitespace do not matter, but the packages, versions,uses:=sets andresolution:=optionaldo.test_required_header_exactcompared all thirteen required headers as whole strings, so a jar whose only difference wasuses:=written beforeversion=rather than after — a choice that belongs to bnd's version, that OSGi gives no meaning and that no resolver can observe — failed a scored check. Under the stage's all-pass gate that one check took the stage, with 2,668 behavioural checks passing beside it.What changed
osgi_header_meaning()normalises on top of it, and onlyExport-PackageandImport-Packageroute through it; the other eleven headers are untouched and still byte-exact.parse_osgi_header()stopped foldinga:=bintoa=b. OSGi reads the first as an instruction to the resolver and the second as an attribute a consumer may match on, and only the first makes an import optional; stripping the colon let a clause that declared one answer a check written for the other.tests/verification/lib/jarinspect.pyis kept in step with the behavioural copy.Regression —
infra/tests/test_build02_osgi_clauses.py, 20 checks against the real module with a manifest dict in place of a jar. The half that matters is the second one:uses:=set, the clauses themselves, whitespace — and one test proves each really is a reordering of State A and not some other header;uses:=, a uses set with a package added or missing, a wrong version, a package not exported, an internal package exported, aversionwith no value,resolution:=optionaldropped or changed tomandatory, an import that is not there, andresolution=optionalwritten as an attribute;Bundle-RequiredExecutionEnvironment) is asserted to be still byte-exact, which is what would notice the routing widening by accident.Fails on
main(19 of 20).