Skip to content

feat(policy): use name as the sole policy identifier#292

Merged
v0lkan merged 1 commit into
mainfrom
feature/policy-name-id
Jul 14, 2026
Merged

feat(policy): use name as the sole policy identifier#292
v0lkan merged 1 commit into
mainfrom
feature/policy-name-id

Conversation

@v0lkan

@v0lkan v0lkan commented Jul 14, 2026

Copy link
Copy Markdown
Member

Folds in the substantive work from PR #284 (issue #250) onto current main, resolving the drift from the spike-sdk-go v0.19.9 migration.

SPIKE policies are uniquely identified by their user-provided name, so the auto-generated UUID id added drift and a practically unused column. This removes it end to end:

  • Drop the id column from the policies table; name is now the PRIMARY KEY. Upsert, load, and delete queries all key on name.
  • Persist, state, memory backend, and CLI operate on name; delete and load-by-name replace the id-based paths.
  • google/uuid is no longer imported directly (demoted to indirect).

Conflict resolutions preserve main's post-migration idioms:

  • persist StorePolicy/DeletePolicy keep the withSerializableTx helper while switching to name-based args
  • CLI keeps the context.Context threading; findPolicyByName uses the ctx-aware ListAllPolicies

The SDK still exposes the identifier as PolicyReadRequest.ID and PolicyDeleteRequest.ID, so request.ID carries the policy name at the route boundary. This bridge is documented inline; issue #250 tracks the pending SDK field rename. (TODO markers from the original PR were converted to plain comments per the no-TODO-in-main rule.)

make test and make audit both pass; govulncheck reports 0 affecting vulnerabilities.

cc: @Aliexe-code

Spec: TBD

Folds in the substantive work from PR #284 (issue #250) onto current
main, resolving the drift from the spike-sdk-go v0.19.9 migration.

SPIKE policies are uniquely identified by their user-provided name, so
the auto-generated UUID id added drift and a practically unused column.
This removes it end to end:

- Drop the id column from the policies table; name is now the PRIMARY
  KEY. Upsert, load, and delete queries all key on name.
- Persist, state, memory backend, and CLI operate on name; delete and
  load-by-name replace the id-based paths.
- google/uuid is no longer imported directly (demoted to indirect).

Conflict resolutions preserve main's post-migration idioms:
- persist StorePolicy/DeletePolicy keep the withSerializableTx helper
  while switching to name-based args
- CLI keeps the context.Context threading; findPolicyByName uses the
  ctx-aware ListAllPolicies

The SDK still exposes the identifier as PolicyReadRequest.ID and
PolicyDeleteRequest.ID, so request.ID carries the policy name at the
route boundary. This bridge is documented inline; issue #250 tracks the
pending SDK field rename. (TODO markers from the original PR were
converted to plain comments per the no-TODO-in-main rule.)

make test and make audit both pass; govulncheck reports 0 affecting
vulnerabilities.

Spec: TBD

Co-authored-by: Ali Mohammed <terminalexe1@gmail.com>
Signed-off-by: Volkan Özçelik <volkan.ozcelik@broadcom.com>
@v0lkan v0lkan self-assigned this Jul 14, 2026
@v0lkan

v0lkan commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

Supersedes and closes: #284

@v0lkan

v0lkan commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

reminder. Issue #250 is still open and it is related to this and possibly the next thing to be done.

@v0lkan v0lkan merged commit 8275999 into main Jul 14, 2026
14 checks passed
@v0lkan v0lkan deleted the feature/policy-name-id branch July 14, 2026 05:20
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