feat: handle auth-filtered projections without dropping or stranding local files - #288
Open
Ruari-Phipps wants to merge 7 commits into
Open
feat: handle auth-filtered projections without dropping or stranding local files#288Ruari-Phipps wants to merge 7 commits into
Ruari-Phipps wants to merge 7 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
…ojection-guards
Ruari-Phipps
force-pushed
the
fix/slim-projection-guards
branch
from
August 27, 2026 10:36
ae51eaa to
0cd6194
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ruari-Phipps
marked this pull request as ready for review
August 27, 2026 13:18
This comment has been minimized.
This comment has been minimized.
Contributor
Coverage Report
Changed file coverage
|
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.
Summary
The API filters projections per permission slice: a user without read access to a slice
gets a skeleton carrying only identity fields, with the substantive fields stripped. This
makes every resource type tolerate that shape, and keeps withheld resources as lightweight
mappings rather than half-built resources, so references to them still resolve to a name.
Motivation
Pulling as a restricted reader either crashed on a missing field or wrote out resources
built from a skeleton, corrupting them on the next push. Withheld resources also have to
survive in the status file: without them, every
{{entity:...}}-style reference to aresource the user cannot read renders as a raw id, and the file then looks locally
modified on every command.
Changes
from_projectionnow detects an auth-filtered slice and either drops the resourceor keeps it as an identity-only stub, instead of assuming fields are present.
slim_resources, a list ofResourceMapping. They resolve references but are never iterated for a file, saved, orpushed.
load_resources_from_projectionandpull_resourcesreturn them alongside theresource map.
ResourceMappinggainedto_dict/from_dict, storingresource_typeby its registeredname so slim mappings persist in the status file. An unregistered type is dropped on read
rather than raising.
file_structure_info— they have no file on disk, so abaseline entry would make
find_new_kept_deletedreport them deleted on every run.pull_resources,pull_deployment_resources,pull_branch_resources,get_template_resources,get_remote_resources_by_nameand_resolve_branch_fork_pointall return their slim mappings alongside the resource map, and every caller was updated
to match.
the incoming projection. The deletions were batched into the file cache, which was then
discarded when the pull returned. The leftover cache entry was also stamped with the file's
pre-write mtime, so the staleness check treated it as fresh and every later read in the
process saw a file state that was not on disk. Withheld types take this path, so a force
pull had to be run twice before
poly diffcame back clean.Test strategy
poly <command>)Checklist
ruff check .andruff format --check .passpytestpasses (1372 passed, 159 subtests)polyCLI interface (or migration path documented)