Repository navigation
fix: fold Copilot review findings from #4357 and #4370 - #4379
Merged
Daniel Meppiel (danielmeppiel) merged 3 commits intoNov 21, 2026
Merged
Conversation
- install/download: a cache content-hash mismatch counts as reported only when a diagnostic collector or logger received it, so integrate keeps its fallback report on logger-less pipelines (#4351). - Output oracle: the verbose/debug exemption for logging records reads the command's own environment (ApmLifecycleRunner passes it through), not pytest's; unit cases cover both parent/child mismatches (#4113). Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 15:33
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new tests exceed assertion-quality baseline allowances by patching imported helpers and omitting observable-outcome assertions, causing the quality gate to fail despite targeted tests passing.
2 open issues
What changed in this PR
This PR addresses follow-up fixes from #4357 and #4370: preserving cache-mismatch diagnostics when no reporting sink exists and making lifecycle output checks use the command's environment.
Changes:
- Mark cache mismatches as reported only after notifying a diagnostic collector or logger.
- Pass the child environment through lifecycle output checks.
- Add regression tests for missing reporting sinks and parent/child debug-environment differences.
| File | Description |
|---|---|
tests/utils/lifecycle_evidence.py |
Uses the supplied environment to determine debug-output exemptions. |
tests/utils/apm_lifecycle_runner.py |
Forwards the command environment to output validation. |
tests/unit/scripts/test_lifecycle_evidence.py |
Tests differing parent and child debug settings. |
tests/unit/install/test_direct_dep_failure.py |
Tests cache-mismatch reporting with and without a logger. |
src/apm_cli/install/phases/download.py |
Records a mismatch as reported only when a sink receives it. |
Review effort: Balanced
Comment on lines
+144
to
+149
| from apm_cli.install import source_helpers | ||
| from apm_cli.install.phases import download | ||
|
|
||
| monkeypatch.setattr(source_helpers, "locked_content_mismatch", lambda *a, **k: True) | ||
| monkeypatch.setattr(source_helpers, "observed_package_hash", lambda *a, **k: "sha256:b") | ||
| locked = SimpleNamespace(content_hash="sha256:a") |
| ) | ||
| download._report_cache_mismatch(heard, "pkg", locked, tmp_path) | ||
| assert heard.cache_mismatch_reported == {"pkg"} | ||
| assert len(lines) == 1 |
5 of 10 tasks
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
…4370 Co-authored-by: Copilot App <[email protected]>
…owner patches Fixes the AQ003/AQ004 ratchet: a real on-disk mismatch replaces the source_helpers monkeypatches, and the case asserts printed output. Co-authored-by: Copilot App <[email protected]>
5 of 10 tasks
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-t1-review-folds
branch
November 21, 2026 05:24
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 the two valid Copilot review findings that were left on #4357 and #4370 when those PRs merged.
#4357 (#4351): report keyed to a sink
_report_cache_mismatchrecorded the package as reported even when no diagnostic collector or logger existed (run_install_pipeline(logger=None); diagnostics are assigned later). The integrate phase then suppressed its fallback, and the mismatch diagnostic was lost entirely. The package is now recorded only when a sink actually received the notice.tests/unit/install/test_direct_dep_failure.py::test_cache_mismatch_counts_as_reported_only_when_a_sink_received_it.#4370: the child's environment decides
The verbose/debug exemption for logging records read pytest's
os.environ, not the environment the command ran with.ApmLifecycleRunnernow passes its explicitenvthrough_check_output->check_cli_output->output_violations. Theos.environfallback applies only to direct callers that pass no env.test_logging_records_follow_the_child_env_not_pytestcovers both mismatches. A child withAPM_DEBUGis exempt; pytest withAPM_DEBUGand a child without it still fails I9.Validation
pytest tests/unit/install/test_direct_dep_failure.py tests/unit/scripts/test_lifecycle_evidence.py: 214 passed.Steward pre-approval (A-C)
tests/unit/install/test_direct_dep_failure.py::test_cache_mismatch_counts_as_reported_only_when_a_sink_received_itandtests/unit/scripts/test_lifecycle_evidence.py::test_logging_records_follow_the_child_env_not_pytest.