Skip to content

Fix silent loss of files-to-download entries with directory destinations - #402

Merged
alex-feel merged 1 commit into
mainfrom
alex-feel-dev
Jul 20, 2026
Merged

Fix silent loss of files-to-download entries with directory destinations#402
alex-feel merged 1 commit into
mainfrom
alex-feel-dev

Conversation

@alex-feel

Copy link
Copy Markdown
Owner

Summary

  • Fixes the inheritance merge for files-to-download: the merge identity was the raw dest string, so distinct files sharing a directory-form dest (trailing / or \) collapsed into one identity and all but the last entry were silently dropped (in a real incident, two of three shared hook libraries were never deployed).
  • The merge identity is now the normalized final file path: directory-form dests are combined with the source filename, derived by a _source_filename() helper shared with the download-time destination resolution so the two can never diverge. The helper decodes GitLab API raw-file URLs, so pre-merge source resolution of remote parents no longer breaks identity matching (and such entries now deploy under their real filename instead of the literal raw).
  • Duplicate identities within one mcp-servers, skills, or files-to-download list now collapse to the last entry with a warning instead of silently.
  • Entries resolving to the same final path are deduplicated before the parallel download phase, and handle_resource writes atomically (temp file + os.replace), so a same-path race or interruption can never leave a partially-written file.
  • Docs updated (docs/environment-configuration-guide.md): key reference, merge-strategies table, and inheritance bullets now state the normalized-final-file-path identity.

Test plan

  • New unit tests: identity helpers, duplicate-identity warnings, dedupe helper, directory-form dest merge regression, GitLab-resolved parent override regression, download-phase dedupe, atomic write behavior (including POSIX mode tests that run on Linux/macOS CI).
  • New E2E tests: TestFilesToDownloadDirectoryDestMerge with a fixture pair reproducing the incident scenario.
  • Full suite: 2366 passed, 47 platform-skipped. uv run pre-commit run --all-files fully green.

…omic

The inheritance merge keyed files-to-download entries by the raw dest string, so distinct files sharing a directory-form dest (trailing separator) collapsed into one identity and all but the last entry were silently dropped.
The merge identity is now the normalized final file path: a directory-form dest is combined with the source filename, derived by a helper shared with the download-time destination resolution so the two stay in lockstep.
The shared helper decodes GitLab API raw-file URLs, so a parent entry resolved to such a URL still matches a child override and deploys under its real filename instead of the literal raw.
Duplicate identities within one mcp-servers, skills, or files-to-download list now collapse to the last entry with a warning instead of silently.
Entries resolving to the same final path are deduplicated before the parallel download phase, and downloads are written atomically via a temp file and rename so a race or interruption can never leave a partially-written file.
@github-actions

Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  scripts
  setup_environment.py 8295-8299
Project Total  

This report was generated by python-coverage-comment-action

@alex-feel
alex-feel merged commit a0b4dcf into main Jul 20, 2026
17 checks passed
@alex-feel
alex-feel deleted the alex-feel-dev branch July 20, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant