Skip to content

Commit d771012

Browse files
authored
feat: add Debian checkstyle official evidence
Add verified official-source distro evidence for the existing Debian checkstyle mapping. Summary: - Extend OFFICIAL_DISTRO_EVIDENCE_BY_POLICY with deb/checkstyle. - Promote exactly one additional mapping: deb/checkstyle. - Preserve existing deb/yamllint official evidence. - Preserve existing deb/shellcheck official evidence. - Preserve existing deb/clang-tidy official evidence. - Preserve existing deb/cppcheck official evidence. - Preserve existing deb/clang-format official evidence. - Keep package name checkstyle unchanged. - Keep executable name checkstyle unchanged. - Use official Debian package/source/tracker/manpage metadata as official-source evidence. - Set evidence_source_type to official-distro-metadata. - Set evidence_status to verified-official-source. - Set official_source_kind to distro-package-index. - Set verification_scope to package-name-and-executable. - Use official evidence record ID: official-distro-metadata:deb:checkstyle. - Keep docker-deb-helper/checkstyle as repository-local baseline evidence. - Keep non-Debian mappings as current-policy-baseline. Validation: - ruff check passed - ruff format --check passed - runtime import guard passed - Linux provisioning tests passed: 116 passed - packaging tests passed: 489 passed - extensions/linters tests passed: 226 passed - docs tests passed: 18 passed - CodeRabbit passed - SonarCloud passed - CI/test passed - PyPI contract validation passed No new package names, no OS_PACKAGE_NAMES changes, no executable-name changes, no versions as contract fields, no checksums, no package-manager calls, no downloads, no network operations, no generated artifacts, no vendored binaries, and no UI/provider/parser/runtime/TextMate/theme changes.
1 parent 9a7b8c5 commit d771012

2 files changed

Lines changed: 157 additions & 25 deletions

File tree

scripts/f4_linter_linux_provisioning.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,34 @@
438438
"release_blocking": False,
439439
"blocker_reason": None,
440440
},
441+
("deb", "checkstyle"): {
442+
"evidence_source": "Debian official package metadata for checkstyle",
443+
"evidence_source_type": "official-distro-metadata",
444+
"evidence_status": "verified-official-source",
445+
"evidence_note": (
446+
"Verified against official Debian package metadata "
447+
"https://packages.debian.org/checkstyle, source package metadata "
448+
"https://packages.debian.org/source/stable/checkstyle, tracker "
449+
"metadata https://tracker.debian.org/pkg/checkstyle, and manpage "
450+
"metadata https://manpages.debian.org/testing/checkstyle/checkstyle.1.en.html "
451+
"for the existing checkstyle package/executable mapping."
452+
),
453+
"official_source_name": "Debian Package Search: checkstyle",
454+
"official_source_url": "https://packages.debian.org/checkstyle",
455+
"official_source_kind": "distro-package-index",
456+
"verification_scope": "package-name-and-executable",
457+
"verification_note": (
458+
"Verified against official Debian package metadata "
459+
"https://packages.debian.org/checkstyle, source package metadata "
460+
"https://packages.debian.org/source/stable/checkstyle, tracker "
461+
"metadata https://tracker.debian.org/pkg/checkstyle, and manpage "
462+
"metadata https://manpages.debian.org/testing/checkstyle/checkstyle.1.en.html: "
463+
"package name checkstyle and executable checkstyle."
464+
),
465+
"external_verification_required_for_new_mappings": False,
466+
"release_blocking": False,
467+
"blocker_reason": None,
468+
},
441469
}
442470

443471
OS_PACKAGE_NAMES: dict[str, dict[str, tuple[str, ...]]] = {

tests/packaging/test_f4_linter_linux_provisioning.py

Lines changed: 129 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def test_distro_evidence_scope_is_approved_package_mappings_only(
275275
("deb", "clang-tidy"),
276276
("deb", "cppcheck"),
277277
("deb", "clang-format"),
278+
("deb", "checkstyle"),
278279
]
279280
assert all(
280281
record.evidence_source_type == "official-distro-metadata" for record in promoted
@@ -379,6 +380,8 @@ def test_existing_os_package_policy_has_approved_distro_mapping_evidence(
379380
cppcheck_evidence = _evidence_record(deb_evidence, "cppcheck")
380381
clang_format = _mapping_record(deb, "clang-format")
381382
clang_format_evidence = _evidence_record(deb_evidence, "clang-format")
383+
checkstyle = _mapping_record(deb, "checkstyle")
384+
checkstyle_evidence = _evidence_record(deb_evidence, "checkstyle")
382385

383386
_assert_approved_deb_mapping(yamllint, yamllint_evidence, "yamllint")
384387
_assert_official_deb_evidence(
@@ -437,14 +440,25 @@ def test_existing_os_package_policy_has_approved_distro_mapping_evidence(
437440
"official_source_url": "https://packages.debian.org/clang-format",
438441
},
439442
)
443+
_assert_approved_deb_mapping(checkstyle, checkstyle_evidence, "checkstyle")
444+
_assert_official_deb_evidence(
445+
checkstyle,
446+
checkstyle_evidence,
447+
{
448+
"tool_id": "checkstyle",
449+
"evidence_source": "Debian official package metadata for checkstyle",
450+
"official_source_name": "Debian Package Search: checkstyle",
451+
"official_source_url": "https://packages.debian.org/checkstyle",
452+
},
453+
)
440454

441455

442456
def test_generated_distro_evidence_preserves_repository_local_baseline(
443457
linux_helper: ModuleType,
444458
tmp_path: Path,
445459
) -> None:
446-
manifest = _build_manifest(linux_helper, tmp_path, "deb")
447-
evidence = _manifest_distro_evidence(manifest, "checkstyle")
460+
manifest = _build_manifest(linux_helper, tmp_path, "rpm")
461+
evidence = _manifest_distro_evidence(manifest, "yamllint")
448462

449463
assert evidence["evidence_source"] == "OS_PACKAGE_NAMES"
450464
assert evidence["evidence_source_type"] == "repository-local-policy"
@@ -524,13 +538,14 @@ def test_generated_baseline_evidence_records_are_not_promotable(
524538
("deb", "clang-tidy"),
525539
("deb", "cppcheck"),
526540
("deb", "clang-format"),
541+
("deb", "checkstyle"),
527542
]
528543
assert all(
529544
linux_helper.linux_distro_mapping_evidence_can_promote(record)
530545
is (record in promoted)
531546
for record in matrix
532547
)
533-
assert sum(row["can_promote"] is True for row in promotion_matrix) == 5
548+
assert sum(row["can_promote"] is True for row in promotion_matrix) == 6
534549
assert all(
535550
row["promotion_state"] == "baseline-not-promoted"
536551
for row in promotion_matrix
@@ -541,6 +556,7 @@ def test_generated_baseline_evidence_records_are_not_promotable(
541556
("deb", "clang-tidy"),
542557
("deb", "cppcheck"),
543558
("deb", "clang-format"),
559+
("deb", "checkstyle"),
544560
}
545561
)
546562

@@ -549,15 +565,15 @@ def test_complete_synthetic_verified_official_evidence_is_promotable(
549565
linux_helper: ModuleType,
550566
tmp_path: Path,
551567
) -> None:
552-
manifest = _build_manifest(linux_helper, tmp_path, "deb")
568+
manifest = _build_manifest(linux_helper, tmp_path, "rpm")
553569
evidence = _complete_verified_evidence(
554-
_manifest_distro_evidence(manifest, "checkstyle")
570+
_manifest_distro_evidence(manifest, "yamllint")
555571
)
556572

557573
assert linux_helper.linux_distro_mapping_evidence_promotion_errors(evidence) == []
558574
assert linux_helper.linux_distro_mapping_evidence_can_promote(evidence) is True
559575

560-
_manifest_tool(manifest, "checkstyle")["distro_mapping"]["evidence"] = evidence
576+
_manifest_tool(manifest, "yamllint")["distro_mapping"]["evidence"] = evidence
561577
assert linux_helper.verify_linux_provisioning_manifest(manifest) == []
562578

563579

@@ -617,6 +633,7 @@ def test_docker_helper_distro_mappings_inherit_deb_and_rpm_policy(
617633
("clang-tidy", "clang-tidy"),
618634
("cppcheck", "cppcheck"),
619635
("clang-format", "clang-format"),
636+
("checkstyle", "checkstyle"),
620637
):
621638
_assert_docker_deb_baseline_mapping(
622639
_mapping_record(docker_deb, tool_id),
@@ -708,7 +725,8 @@ def test_manifest_records_distro_mapping_for_package_manager_tools(
708725
tmp_path: Path,
709726
) -> None:
710727
manifest = _build_manifest(linux_helper, tmp_path, "deb")
711-
checkstyle = _manifest_tool(manifest, "checkstyle")
728+
rpm_manifest = _build_manifest(linux_helper, tmp_path, "rpm")
729+
rpm_yamllint = _manifest_tool(rpm_manifest, "yamllint")
712730
biome = _manifest_tool(manifest, "biome")
713731
cargo_clippy = _manifest_tool(manifest, "cargo-clippy")
714732
ruff = _manifest_tool(manifest, "ruff")
@@ -751,15 +769,22 @@ def test_manifest_records_distro_mapping_for_package_manager_tools(
751769
"evidence_source": "Debian official package metadata for clang-format",
752770
"official_source_url": "https://packages.debian.org/clang-format",
753771
},
772+
{
773+
"tool_id": "checkstyle",
774+
"package_name": "checkstyle",
775+
"executable_name": "checkstyle",
776+
"evidence_source": "Debian official package metadata for checkstyle",
777+
"official_source_url": "https://packages.debian.org/checkstyle",
778+
},
754779
):
755780
_assert_manifest_official_deb_mapping(
756781
_manifest_tool(manifest, expected["tool_id"]),
757782
expected,
758783
)
759-
assert checkstyle["distro_mapping"]["evidence"]["evidence_status"] == (
784+
assert rpm_yamllint["distro_mapping"]["evidence"]["evidence_status"] == (
760785
"current-policy-baseline"
761786
)
762-
assert checkstyle["distro_mapping"]["evidence"]["evidence_source_type"] == (
787+
assert rpm_yamllint["distro_mapping"]["evidence"]["evidence_source_type"] == (
763788
"repository-local-policy"
764789
)
765790
assert biome["distro_mapping"]["mapping_status"] == (
@@ -771,6 +796,7 @@ def test_manifest_records_distro_mapping_for_package_manager_tools(
771796
assert "distro_mapping" not in cargo_clippy
772797
assert "distro_mapping" not in ruff
773798
assert linux_helper.verify_linux_provisioning_manifest(manifest) == []
799+
assert linux_helper.verify_linux_provisioning_manifest(rpm_manifest) == []
774800

775801

776802
def test_linux_manifest_rejects_invalid_or_non_linux_artifact_ids(
@@ -1274,6 +1300,71 @@ def test_manifest_verifier_rejects_deb_clang_format_without_verification_note(
12741300
)
12751301

12761302

1303+
@pytest.mark.parametrize(
1304+
("field", "tampered_value", "expected_error"),
1305+
(
1306+
(
1307+
"official_source_url",
1308+
"https://tracker.debian.org/pkg/checkstyle",
1309+
"checkstyle: distro_mapping evidence official_source_url differs",
1310+
),
1311+
(
1312+
"official_source_kind",
1313+
"upstream-release-page",
1314+
"checkstyle: distro_mapping evidence official_source_kind differs",
1315+
),
1316+
(
1317+
"verification_scope",
1318+
"package-name-only",
1319+
"checkstyle: distro_mapping evidence verification_scope differs",
1320+
),
1321+
(
1322+
"verified_package_names",
1323+
["wrong-package"],
1324+
"checkstyle: distro_mapping evidence verified_package_names differs",
1325+
),
1326+
(
1327+
"verified_executable_names",
1328+
["wrong-executable"],
1329+
"checkstyle: distro_mapping evidence verified_executable_names differs",
1330+
),
1331+
(
1332+
"evidence_source_type",
1333+
"repository-local-policy",
1334+
"checkstyle: distro_mapping evidence: verified-official-source evidence cannot use repository-local-policy",
1335+
),
1336+
),
1337+
)
1338+
def test_manifest_verifier_rejects_tampered_deb_checkstyle_official_evidence(
1339+
linux_helper: ModuleType,
1340+
tmp_path: Path,
1341+
field: str,
1342+
tampered_value: Any,
1343+
expected_error: str,
1344+
) -> None:
1345+
manifest = _build_manifest(linux_helper, tmp_path, "deb")
1346+
_manifest_distro_evidence(manifest, "checkstyle")[field] = tampered_value
1347+
1348+
errors = linux_helper.verify_linux_provisioning_manifest(manifest)
1349+
1350+
assert any(expected_error in error for error in errors)
1351+
1352+
1353+
def test_manifest_verifier_rejects_deb_checkstyle_without_verification_note(
1354+
linux_helper: ModuleType,
1355+
tmp_path: Path,
1356+
) -> None:
1357+
manifest = _build_manifest(linux_helper, tmp_path, "deb")
1358+
del _manifest_distro_evidence(manifest, "checkstyle")["verification_note"]
1359+
1360+
errors = linux_helper.verify_linux_provisioning_manifest(manifest)
1361+
1362+
assert any(
1363+
"checkstyle: distro_mapping evidence: missing verification_note" in error
1364+
for error in errors
1365+
)
1366+
1367+
12771368
def test_manifest_verifier_rejects_verified_evidence_with_repository_local_source_type(
12781369
linux_helper: ModuleType,
12791370
tmp_path: Path,
@@ -1396,15 +1487,15 @@ def test_manifest_verifier_rejects_current_baseline_without_external_verificatio
13961487
linux_helper: ModuleType,
13971488
tmp_path: Path,
13981489
) -> None:
1399-
manifest = _build_manifest(linux_helper, tmp_path, "deb")
1400-
_manifest_distro_evidence(manifest, "checkstyle")[
1490+
manifest = _build_manifest(linux_helper, tmp_path, "rpm")
1491+
_manifest_distro_evidence(manifest, "yamllint")[
14011492
"external_verification_required_for_new_mappings"
14021493
] = False
14031494

14041495
errors = linux_helper.verify_linux_provisioning_manifest(manifest)
14051496

14061497
assert any(
1407-
"checkstyle: distro_mapping evidence: current-policy-baseline evidence must require external verification"
1498+
"yamllint: distro_mapping evidence: current-policy-baseline evidence must require external verification"
14081499
in error
14091500
for error in errors
14101501
)
@@ -1414,20 +1505,20 @@ def test_manifest_verifier_rejects_current_baseline_with_official_source_claims(
14141505
linux_helper: ModuleType,
14151506
tmp_path: Path,
14161507
) -> None:
1417-
manifest = _build_manifest(linux_helper, tmp_path, "deb")
1418-
evidence = _manifest_distro_evidence(manifest, "checkstyle")
1508+
manifest = _build_manifest(linux_helper, tmp_path, "rpm")
1509+
evidence = _manifest_distro_evidence(manifest, "yamllint")
14191510
evidence["official_source_name"] = "synthetic distro package index"
14201511
evidence["official_source_url"] = "synthetic-official-source"
14211512

14221513
errors = linux_helper.verify_linux_provisioning_manifest(manifest)
14231514

14241515
assert any(
1425-
"checkstyle: distro_mapping evidence: current-policy-baseline evidence must not claim official_source_name"
1516+
"yamllint: distro_mapping evidence: current-policy-baseline evidence must not claim official_source_name"
14261517
in error
14271518
for error in errors
14281519
)
14291520
assert any(
1430-
"checkstyle: distro_mapping evidence: current-policy-baseline evidence must not claim official_source_url"
1521+
"yamllint: distro_mapping evidence: current-policy-baseline evidence must not claim official_source_url"
14311522
in error
14321523
for error in errors
14331524
)
@@ -1611,6 +1702,22 @@ def test_manifest_verifier_rejects_tampered_deb_clang_format_evidence_record_id(
16111702
)
16121703

16131704

1705+
def test_manifest_verifier_rejects_tampered_deb_checkstyle_evidence_record_id(
1706+
linux_helper: ModuleType,
1707+
tmp_path: Path,
1708+
) -> None:
1709+
manifest = _build_manifest(linux_helper, tmp_path, "deb")
1710+
evidence = _manifest_tool(manifest, "checkstyle")["distro_mapping"]["evidence"]
1711+
evidence["evidence_record_id"] = "repository-local-policy:deb:checkstyle"
1712+
1713+
errors = linux_helper.verify_linux_provisioning_manifest(manifest)
1714+
1715+
assert any(
1716+
"checkstyle: distro_mapping evidence evidence_record_id differs" in error
1717+
for error in errors
1718+
)
1719+
1720+
16141721
def test_manifest_verifier_rejects_wrong_docker_evidence_inheritance(
16151722
linux_helper: ModuleType,
16161723
tmp_path: Path,
@@ -2060,12 +2167,10 @@ def test_release_blocking_provenance_summary_tracks_current_linux_gaps(
20602167
evidence_summary["evidence_record_count"] == mapping_summary["approved_count"]
20612168
)
20622169
assert evidence_summary["evidence_status_counts"] == {
2063-
"current-policy-baseline": evidence_summary["evidence_record_count"] - 5,
2064-
"verified-official-source": 5,
2170+
"verified-official-source": 6,
20652171
}
20662172
assert evidence_summary["evidence_source_type_counts"] == {
2067-
"official-distro-metadata": 5,
2068-
"repository-local-policy": evidence_summary["evidence_record_count"] - 5,
2173+
"official-distro-metadata": 6,
20692174
}
20702175
assert (
20712176
mapping_summary["evidence_status_counts"]
@@ -2075,14 +2180,13 @@ def test_release_blocking_provenance_summary_tracks_current_linux_gaps(
20752180
promotion_summary["evidence_record_count"]
20762181
== evidence_summary["evidence_record_count"]
20772182
)
2078-
assert promotion_summary["promotable_count"] == 5
2183+
assert promotion_summary["promotable_count"] == 6
20792184
assert promotion_summary["baseline_not_promoted_count"] == (
2080-
evidence_summary["evidence_record_count"] - 5
2185+
evidence_summary["evidence_record_count"] - 6
20812186
)
2082-
assert promotion_summary["verified_official_source_count"] == 5
2187+
assert promotion_summary["verified_official_source_count"] == 6
20832188
assert promotion_summary["promotion_state_counts"] == {
2084-
"baseline-not-promoted": evidence_summary["evidence_record_count"] - 5,
2085-
"verified-official-source": 5,
2189+
"verified-official-source": 6,
20862190
}
20872191
assert (
20882192
docker_summary["mapping_status_counts"]

0 commit comments

Comments
 (0)