Skip to content

control_plane/projects: single-source the safe project-id grammar - #8666

Open
psychologister wants to merge 1 commit into
loopx-project:mainfrom
psychologister:codex/project-registry-safe-id-owner
Open

psychologister wants to merge 1 commit into
loopx-project:mainfrom
psychologister:codex/project-registry-safe-id-owner

Conversation

@psychologister

Copy link
Copy Markdown
Contributor

repository_identity.SAFE_PROJECT_ID is the canonical stable-identifier grammar
(^[A-Za-z0-9][A-Za-z0-9.
:-]{0,255}$); resolve_project_identity uses it to validate
the loopx: fallback when a checkout has no origin remote. The projects registry
restated the identical pattern as its own _SAFE_ID and used it in _identifier to
reject unsafe project/goal ids. The registry already imports
normalize_repository_identity from repository_identity, so borrowing one more
owner object adds no import edge and cannot cycle. _SAFE_ID is retired and
_identifier now fullmatches against the owner; the sole remaining use of the re
module in this file was that definition, so its import is dropped too.

presentation/static_site.py keeps a same-named _SAFE_ID with a genuinely different
grammar (no colon, 63-character cap) and is left untouched -- it is a neighbour,
not a copy.

The by-name semantic inventory cannot see this: both bindings are private
_-names it does not catalogue, and they carried different names, so a name-keyed
match would not pair them even if it looked. The new guard keys on the compiled
pattern value -- a whole-tree census of re.compile sites, identity for the
consumer, retirement, the distinct static-site neighbour, and behavioural parity
through registry._identifier over the owner's grammar (including the 256/257
length boundary) plus the resolve_project_identity fallback.

Refs #4447.

Signed-off-by: psychologister 230141834+psychologister@users.noreply.github.com

repository_identity._SAFE_PROJECT_ID is the canonical stable-identifier grammar
(^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$); resolve_project_identity uses it to validate
the loopx:<id> fallback when a checkout has no origin remote. The projects registry
restated the identical pattern as its own _SAFE_ID and used it in _identifier to
reject unsafe project/goal ids. The registry already imports
normalize_repository_identity from repository_identity, so borrowing one more
owner object adds no import edge and cannot cycle. _SAFE_ID is retired and
_identifier now fullmatches against the owner; the sole remaining use of the re
module in this file was that definition, so its import is dropped too.

presentation/static_site.py keeps a same-named _SAFE_ID with a genuinely different
grammar (no colon, 63-character cap) and is left untouched -- it is a neighbour,
not a copy.

The by-name semantic inventory cannot see this: both bindings are private
_-names it does not catalogue, and they carried different names, so a name-keyed
match would not pair them even if it looked. The new guard keys on the compiled
pattern value -- a whole-tree census of re.compile sites, identity for the
consumer, retirement, the distinct static-site neighbour, and behavioural parity
through registry._identifier over the owner's grammar (including the 256/257
length boundary) plus the resolve_project_identity fallback.

Refs loopx-project#4447.

Signed-off-by: psychologister <230141834+psychologister@users.noreply.github.com>

This branch has not been deployed

No deployments
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