Skip to content

feat: (generic realm) expansion - #440

Merged
Benehiko merged 1 commit into
mainfrom
replacen
Jan 30, 2026
Merged

Benehiko merged 1 commit into
mainfrom
replacen

Conversation

@joe0BAB

@joe0BAB joe0BAB commented Jan 29, 2026 •

Copy link
Copy Markdown
Collaborator

We want a generic logic that allows to "resolve a realm".

Example: Let docker/auth/** be a realm. Then, the pattern query **/foo should get resolved to docker/auth/**/foo.

We can define ** to be a generic realm. Then this reframes our problem into a "generic realm replacement problem".

As there could be n generic realms, more generally speaking we can view this a "replace n" problem where we have a component string and up to n realm markers ** that should be replaced.

@joe0BAB joe0BAB self-assigned this Jan 29, 2026
@joe0BAB
joe0BAB requested a review from Benehiko January 29, 2026 13:00
@joe0BAB
joe0BAB force-pushed the replacen branch 2 times, most recently from adaceaf to 4e9669d Compare January 29, 2026 13:27
Comment thread x/secrets/pattern.go Outdated
@joe0BAB joe0BAB changed the title feat: n replace feat: (realm) expansion Jan 29, 2026
@joe0BAB joe0BAB changed the title feat: (realm) expansion feat: (generic realm) expansion Jan 29, 2026
@joe0BAB
joe0BAB marked this pull request as ready for review January 29, 2026 13:33
Comment thread x/secrets/pattern.go Outdated
Comment thread x/secrets/pattern.go
if len(candidates) != 1 {
return "", errors.New("invalid")
}
components[candidates[0]] = other

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

now that we only have 1 replace wouldn't this end up like:

pattern: docker/**/bar/**
input ID: bob
output: docker/bob/bar/**

@joe0BAB joe0BAB Jan 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So we could implement what you're describing, but right now it isn't. Instead if the candidate positions where we could replace are not equal 1, we return an error.

I'm hesitant to do this as eg the following could be a bit surprising:

pattern: docker/**/bar/**
input Pattern: bob/**
output: docker/bob/**/bar/**

🤷

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It also complicates things as with

pattern: docker/**/bar/**
input ID: bob
output: docker/bob/bar/**

you're converting an ID into a pattern. Then it wouldn't be ExpandID(ID) (ID, error) anymore.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes, i was asking if the output would be not should be.

@joe0BAB
joe0BAB requested a review from Benehiko January 29, 2026 13:54
@Benehiko
Benehiko merged commit 7eb6f61 into main Jan 30, 2026
13 checks passed
@Benehiko
Benehiko deleted the replacen branch January 30, 2026 17:13
joe0BAB pushed a commit that referenced this pull request Feb 16, 2026
feat: (generic realm) expansion
joe0BAB pushed a commit that referenced this pull request Feb 16, 2026
feat: (generic realm) expansion
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.

2 participants