Repository navigation
NH-149584 Update license headers; add ci/cd to check them - #888
tammy-baylis-swi wants to merge 11 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Markdown metadata parsing, upstream attribution preservation, and header-check enforcement need corrections before approval.
5 open findings
What changed in this PR
Standardizes license comments across the SolarWinds APM Python distribution and adds automated header validation.
Changes:
- Replaces long license notices with condensed SPDX headers.
- Adds a header checker with file-selection and exclusion rules.
- Adds a tox environment and GitHub Actions workflow.
| File | Description |
|---|---|
| tox.ini | Adds header-check environment. |
| tests/unit/test_xtraceoptions.py | Condenses license comments. |
| tests/unit/test_w3c_transformer.py | Condenses license comments. |
| tests/unit/test_uams.py | Condenses license comments. |
| tests/unit/test_transaction_name_pool_api.py | Condenses license comments. |
| tests/unit/test_tracer_provider.py | Condenses license comments. |
| tests/unit/test_semconv/test_trace.py | Condenses license comments. |
| tests/unit/test_semconv/__init__.py | Condenses license comments. |
| tests/unit/test_sampler/test_sampler.py | Condenses license comments. |
| tests/unit/test_sampler/__init__.py | Condenses license comments. |
| tests/unit/test_response_propagator.py | Condenses license comments. |
| tests/unit/test_propagator.py | Condenses license comments. |
| tests/unit/test_processors/test_serviceentry_processor.py | Condenses license comments. |
| tests/unit/test_processors/test_response_time_processor.py | Condenses license comments. |
| tests/unit/test_processors/__init__.py | Condenses license comments. |
| tests/unit/test_oboe/test_transaction_name_pool.py | Adds SPDX header. |
| tests/unit/test_oboe/test_transaction_name_calculator.py | Adds SPDX header. |
| tests/unit/test_oboe/test_trace_options.py | Condenses license comments. |
| tests/unit/test_oboe/test_token_bucket.py | Condenses license comments. |
| tests/unit/test_oboe/test_settings.py | Condenses license comments. |
| tests/unit/test_oboe/test_sampler.py | Condenses license comments. |
| tests/unit/test_oboe/test_oboe_sampler.py | Condenses license comments. |
| tests/unit/test_oboe/test_json_sampler.py | Condenses license comments. |
| tests/unit/test_oboe/test_http_sampler.py | Condenses license comments. |
| tests/unit/test_oboe/test_dice.py | Condenses license comments. |
| tests/unit/test_oboe/__init__.py | Condenses license comments. |
| tests/unit/test_k8s.py | Condenses license comments. |
| tests/unit/test_distro.py | Condenses license comments. |
| tests/unit/test_configurator/test_configurator_traces_init.py | Condenses license comments. |
| tests/unit/test_configurator/test_configurator_span_processors.py | Condenses license comments. |
| tests/unit/test_configurator/test_configurator_propagators.py | Condenses license comments. |
| tests/unit/test_configurator/test_configurator_metrics_init.py | Condenses license comments. |
| tests/unit/test_configurator/test_configurator_configure_otel.py | Condenses license comments. |
| tests/unit/test_configurator/fixtures/trace.py | Condenses license comments. |
| tests/unit/test_configurator/fixtures/resource.py | Condenses license comments. |
| tests/unit/test_configurator/fixtures/logging.py | Condenses license comments. |
| tests/unit/test_configurator/conftest.py | Condenses license comments. |
| tests/unit/test_apm_resource.py | Condenses license comments. |
| tests/unit/test_apm_logging.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config_transaction_filters.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config_service_name.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config_cnf_file.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config_calculate_metrics_enabled.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config_calculate_collector.py | Condenses license comments. |
| tests/unit/test_apm_config/test_apm_config_agent_enabled.py | Condenses license comments. |
| tests/unit/test_apm_config/fixtures/env_vars.py | Adds SPDX header. |
| tests/unit/test_apm_config/fixtures/cnf_file.py | Adds SPDX header. |
| tests/unit/test_apm_config/fixtures/cnf_dict.py | Adds SPDX header. |
| tests/unit/test_apm_config/conftest.py | Adds SPDX header. |
| tests/unit/test_api.py | Condenses license comments. |
| tests/unit/__init__.py | Condenses license comments. |
| tests/integration/test_xtraceoptions_validation.py | Condenses license comments. |
| tests/integration/test_unsigned_tt.py | Condenses license comments. |
| tests/integration/test_signed_tt.py | Condenses license comments. |
| tests/integration/test_set_transaction_name.py | Condenses license comments. |
| tests/integration/test_service_name.py | Condenses license comments. |
| tests/integration/test_service_instance_id.py | Condenses license comments. |
| tests/integration/test_scenario_8.py | Condenses license comments. |
| tests/integration/test_scenario_4.py | Condenses license comments. |
| tests/integration/test_scenario_1.py | Condenses license comments. |
| tests/integration/test_base_sw_headers_attrs.py | Condenses license comments. |
| tests/integration/__init__.py | Condenses license comments. |
| tests/docker/install/windows/install_tests.ps1 | Condenses license comments. |
| tests/docker/install/windows/_helper_run_install_tests.ps1 | Condenses license comments. |
| tests/docker/install/windows/_helper_check_wheel.ps1 | Condenses license comments. |
| tests/docker/install/windows/_helper_check_sdist.ps1 | Condenses license comments. |
| tests/docker/install/install_tests.sh | Condenses license comments. |
| tests/docker/install/docker-compose.yml | Condenses license comments. |
| tests/docker/install/client.py | Condenses license comments. |
| tests/docker/install/app.py | Condenses license comments. |
| tests/docker/install/_helper_run_install_tests.sh | Condenses license comments. |
| tests/docker/install/_helper_check_wheel.sh | Condenses license comments. |
| tests/docker/install/_helper_check_sdist.sh | Condenses license comments. |
| solarwinds_apm/w3c_transformer.py | Condenses license comments. |
| solarwinds_apm/uams.py | Condenses license comments. |
| solarwinds_apm/tracer_provider.py | Condenses license comments. |
| solarwinds_apm/traceoptions.py | Condenses license comments. |
| solarwinds_apm/trace/serviceentry_processor.py | Condenses license comments. |
| solarwinds_apm/trace/response_time_processor.py | Condenses license comments. |
| solarwinds_apm/trace/__init__.py | Adds SPDX header. |
| solarwinds_apm/semconv/trace/__init__.py | Condenses license comments. |
| solarwinds_apm/sampler.py | Condenses license comments. |
| solarwinds_apm/response_propagator.py | Condenses license comments. |
| solarwinds_apm/propagator.py | Condenses license comments. |
| solarwinds_apm/oboe/transaction_name_pool.py | Adds SPDX header. |
| solarwinds_apm/oboe/transaction_name_calculator.py | Adds SPDX header. |
| solarwinds_apm/oboe/trace_options.py | Condenses license comments. |
| solarwinds_apm/oboe/token_bucket.py | Condenses license comments. |
| solarwinds_apm/oboe/settings.py | Condenses license comments. |
| solarwinds_apm/oboe/sampler.py | Condenses license comments. |
| solarwinds_apm/oboe/oboe_sampler.py | Condenses license comments. |
| solarwinds_apm/oboe/metrics.py | Condenses license comments. |
| solarwinds_apm/oboe/json_sampler.py | Condenses license comments. |
| solarwinds_apm/oboe/http_sampler.py | Condenses license comments. |
| solarwinds_apm/oboe/dice.py | Condenses license comments. |
| solarwinds_apm/oboe/configuration.py | Condenses license comments. |
| solarwinds_apm/oboe/__init__.py | Condenses license comments. |
| solarwinds_apm/k8s.py | Condenses license comments. |
| solarwinds_apm/distro.py | Condenses license comments. |
| solarwinds_apm/configurator.py | Condenses license comments. |
| solarwinds_apm/apm_resource.py | Condenses license comments. |
| solarwinds_apm/apm_logging.py | Condenses license comments. |
| solarwinds_apm/apm_constants.py | Condenses license comments. |
| solarwinds_apm/apm_config.py | Condenses license comments. |
| solarwinds_apm/api/__init__.py | Condenses license comments. |
| solarwinds_apm/__init__.py | Condenses license comments. |
| scripts/lint_and_format.py | Condenses license comments. |
| scripts/check_license_header.py | Adds header validation script. |
| Makefile | Condenses license comments. |
| lambda/tests/test_instrumentation.py | Condenses license comments. |
| lambda/tests/mocks/lambda_function.py | Replaces license and attribution comments. |
| lambda/solarwinds-apm/wrapper | Condenses license comments. |
| lambda/otel_wrapper.py | Replaces license and attribution comments. |
| lambda/check_lambda_modules.sh | Condenses license comments. |
| image/Dockerfile-beta | Adds SPDX header. |
| image/Dockerfile | Adds SPDX header. |
| examples/aws_lambda_container/lambda_function.py | Adds SPDX header. |
| examples/aws_lambda_container/download-layer.sh | Updates copyright and adds SPDX identifier. |
| examples/aws_lambda_container/Dockerfile | Adds SPDX header. |
| docker-compose.yml | Condenses license comments. |
| .github/workflows/verify_install.yaml | Condenses license comments. |
| .github/workflows/verify_install_windows.yaml | Condenses license comments. |
| .github/workflows/verify_install_macos.yaml | Condenses license comments. |
| .github/workflows/run_tox_tests.yaml | Condenses license comments. |
| .github/workflows/run_tox_ruff_format.yaml | Condenses license comments. |
| .github/workflows/run_tox_lint_format.yaml | Condenses license comments. |
| .github/workflows/run_header_check.yaml | Adds CI header validation. |
| .github/workflows/reversinglabs_scan.yaml | Condenses license comments. |
| .github/workflows/publish_lambda_layer.yaml | Condenses license comments. |
| .github/workflows/get_apm_python_version.yaml | Condenses license comments. |
| .github/workflows/create_testrelease_pr.yaml | Condenses license comments. |
| .github/workflows/create_release_pr.yaml | Condenses license comments. |
| .github/workflows/codeql_analysis.yml | Condenses license comments. |
| .github/workflows/build_sdist_and_wheel.yaml | Condenses license comments. |
| .github/workflows/build_publish_testpypi.yaml | Condenses license comments. |
| .github/workflows/build_publish_pypi_and_draft_release.yaml | Condenses license comments. |
| .github/workflows/build_publish_lambda_layer.yaml | Condenses license comments. |
| .github/workflows/build_publish_image_autoinstrumentation.yaml | Condenses license comments. |
| .github/workflows/build_publish_image_autoinstrumentation_beta.yaml | Condenses license comments. |
| .github/scripts/testrelease_pr.sh | Condenses license comments. |
| .github/scripts/release_pr.sh | Condenses license comments. |
| .github/scripts/is_publishable.sh | Condenses license comments. |
| .github/ISSUE_TEMPLATE/regular_bug_report.md | Prepends SPDX comments. |
| .github/ISSUE_TEMPLATE/feature_request.md | Prepends SPDX comments. |
| .github/instructions/python.instructions.md | Prepends SPDX comments. |
| .github/dependabot.yml | Adds SPDX header. |
| .github/copilot-instructions.md | Adds SPDX comments and separator. |
| .github/agents/python-security-vulnerability-agent.md | Prepends SPDX comments. |
| .github/actions/package_solarwinds_apm/action.yaml | Condenses license comments. |
| .github/actions/package_lambda_solarwinds_apm/action.yaml | Condenses license comments. |
| .github/actions/jira_vuln_k8s/action.yaml | Adds SPDX header. |
| .claude/agents.md | Prepends SPDX comments. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Locale-dependent decoding causes the new checker to fail on valid repository files under common Windows configurations.
0 open findings
5 resolved since last review
Previously missed (1)
In code that hasn't changed since last review

Open repository files explicitly as UTF-8

scripts/check_license_header.py:80
On Windows with a cp1252 locale and UTF-8 mode disabled, open(path) uses cp1252. The existing ❌ characters in .github/actions/jira_vuln_k8s/action.yaml then cause readlines() to raise UnicodeDecodeError, aborting tox -e license-header-check despite a valid header. Open repository files explicitly as UTF-8 so the check does not depend on the local encoding.
🧠 Review effort: Balanced

Updates license headers to follow condensed, 2-line version with SPDX ID. This follows upstream and APM JS. See also this blog and survey for more info.
Adds locally runnable
tox -e license-header-checkand CI/CD ("Run header license check / license-header-check (pull_request)") to check them from now on in Python src files, workflow files, scripts (where we already had them). Also checks agent instruction markdown files. Excludes files where the header shouldn't be like__pycache__andjsonfiles.