Skip to content

Fail closed on broken extension registries during template resolution - #4004

Closed
mnriem with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-review-comments
Closed

Fail closed on broken extension registries during template resolution#4004
mnriem with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-review-comments

Conversation

Copilot AI commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Addresses both comments in review thread pullrequestreview-4865182104: a dangling extension .registry symlink still fails open, and canonical resolution keeps enumerating lower tiers after a higher-priority replace layer has already won.

ExtensionRegistry._load() — dangling symlink fail-open

  • Path.exists() follows symlinks, so a dangling .registry symlink read as an absent registry, after which every on-disk extension directory was scanned as unregistered/enabled.
  • Now detect the entry lexically and require a readable regular file before parsing; a broken symlink or directory at the registry path fails closed, raising the same errno open() would (ENOENT for a dangling symlink, EISDIR for a directory).
if not self.registry_path.is_symlink() and not self.registry_path.exists():
    return {"schema_version": self.SCHEMA_VERSION, "extensions": {}}
if not self.registry_path.is_file():
    code = errno.EISDIR if self.registry_path.is_dir() else errno.ENOENT
    raise OSError(code, "Extension registry is not a readable regular file",
                  str(self.registry_path))

PresetResolver.collect_all_layers() — priority parity

  • Skip enumerating the extension tier once an effective replace base has already won at a higher tier (project override or a replace-strategy preset). The extension tier is the only lower-tier step that reads the extension registry, so a corrupt/unreadable one can no longer break init/constitution-sync materialization that a winning override or preset has already decided.
  • Extensions are still enumerated when a higher composing layer (append/prepend/wrap) needs an extension-provided base; lower presets and the core layer remain collected for the diagnostic full chain.

Tests

  • Fail-closed coverage for dangling-symlink and directory extension registries.
  • collect_all_layers/resolve_content remain robust to a broken extension registry when a replace preset wins.

Copilot AI balanced review requested due to automatic review settings August 6, 2026 19:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

…ip lower extension tier when a replace base already won

Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous)

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 6, 2026 19:44
…ar-file registry

Assisted-by: GitHub Copilot (model: Claude Opus 4.8, autonomous)

Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code based on review comments Fail closed on broken extension registries during template resolution Aug 6, 2026
Copilot AI requested a review from mnriem August 6, 2026 19:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

3 participants