fix(policy): handle OSError from is_file() on macOS PATH_MAX limit#860
fix(policy): handle OSError from is_file() on macOS PATH_MAX limit#860chaobo8484 wants to merge 10 commits intomicrosoft:mainfrom
Conversation
When load_policy() receives a YAML string that exceeds ~1023 bytes, the is_file() syscall fails on macOS (PATH_MAX ≈ 1024) with OSError [Errno 63] File name too long. Wrap the call in try/except to gracefully fall back to treating the input as a YAML string. Fixes microsoft#848
There was a problem hiding this comment.
Pull request overview
Fixes load_policy() to avoid crashing on macOS when given a long YAML string that triggers Path.is_file() to raise OSError: [Errno 63] File name too long, preserving the intended "path or YAML content" input behavior.
Changes:
- Wraps the
Path.is_file()probe intry/except OSErrorand falls back to treating the input as YAML content when the probe fails.
Show a summary per file
| File | Description |
|---|---|
src/apm_cli/policy/parser.py |
Adds defensive handling around Path.is_file() so long YAML inputs do not raise on macOS PATH_MAX limits. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
danielmeppiel
left a comment
There was a problem hiding this comment.
Per Copilot reviewer
* docs(ci): document merge-gate architecture and ruleset context gotcha
- Document merge-gate.yml as the single-authority PR-time aggregator
- Mark ci-integration-pr-stub.yml as DEPRECATED (slated for deletion)
- Renumber workflow list (now 6 entries, was misnumbered with two #3s)
- New section: Branch Protection & Required Checks
- Ruleset 'context' field MUST match check-run name ('gate'), not the
UI display string ('Merge Gate / gate'). Storing the display string
causes permanent 'Expected - Waiting for status to be reported' that
blocked PR #860 today
- Adding new required checks goes through EXPECTED_CHECKS in
merge-gate.yml, not the ruleset
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* chore(ci): remove deprecated PR-time stub workflow
The four PR stubs (Build/Smoke/Integration/Release Validation - Linux)
were a holdover from the pre-merge-gate model where branch protection
required each Tier 2 check name directly. After #867, branch protection
requires only the single 'gate' check from merge-gate.yml, so the stubs
are dead weight that fire on every PR for no reason.
Changes:
- Delete .github/workflows/ci-integration-pr-stub.yml
- Reduce EXPECTED_CHECKS in merge-gate.yml to just 'Build & Test (Linux)'
(the only PR-time check we still emit)
- Update merge-gate.yml + ci-integration.yml header comments
- Update cicd.instructions.md (drop DEPRECATED entry, renumber to 5
workflows)
- Drop stale CODEOWNERS reference to the deleted file
- CHANGELOG entry under [Unreleased] > Removed
Stacked on #874 (docs).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@danielmeppiel I have made adjustments according to Copilot's suggestion.Have a good day! |
DevX UX Review — PR #860Scope: CLI error ergonomics & silent-failure risk. No command surface / flag / help-text changes in this PR — review is limited to internal Findings
Verdict: Ship it. Clean defensive fix, no UX regressions, no silent failures introduced. 👍
|
When load_policy() receives a YAML string that exceeds ~1023 bytes, the is_file() syscall fails on macOS (PATH_MAX ≈ 1024) with OSError [Errno 63] File name too long. Wrap the call in try/except to gracefully fall back to treating the input as a YAML string.
Fixes #848
Description
Brief description of changes and motivation.
Fixes # (issue)
Type of change
Testing