Skip to content

Handle empty metadata values in predictive cache files - #92

Merged
Ayomi-gh merged 3 commits into
mainfrom
ayomi-gh/empty-metadata-value
Nov 12, 2026
Merged

Ayomi-gh merged 3 commits into
mainfrom
ayomi-gh/empty-metadata-value

Conversation

@Ayomi-gh

@Ayomi-gh Ayomi-gh commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

A predictive cache file containing a metadata line with an empty value (e.g. metadata_team_maintainers=) caused load_caches to raise wrong array length ... (expected 2, was 1), failing the whole run.

Splitting on the first = only (split("=", 2)) keeps the empty value as "". It also preserves values that contain =.

Also bumps the version to 1.2.13.

Copilot AI adaptive review requested due to automatic review settings November 6, 2026 16:19

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.

🟡 Changes recommended

An active finding remains because the parser change lacks a fixture and assertion covering metadata values containing an embedded “=”, leaving a regression risk for that input.

1 open issue
What changed in this PR

Updates predictive cache parsing to support metadata entries with empty values and values containing =, while bumping the application version to 1.2.12.

Changes:

  • Limits metadata splitting to the first = delimiter.
  • Adds fixture and expectation coverage for empty metadata values.
  • Updates the application version in the source and lockfile.

Review note (nit): Add fixture/assertion coverage for metadata values containing an embedded =.

File Description
spec/​unit/​fixtures/​predictive-state/​cache1/​cn=cheese,ou=Pizza_Teams,dc=kittens,dc=net Adds an empty metadata value to the cache fixture.
spec/​unit/​entitlements/​data/​groups/​cached_spec.rb Verifies empty metadata values load as empty strings.
lib/​version.rb Bumps the application version to 1.2.12.
lib/​entitlements/​data/​groups/​cached.rb Parses metadata using a bounded split.
Gemfile.lock Synchronizes the locked application version.

Review effort: Lite (auto)

Comment thread lib/entitlements/data/groups/cached.rb Resolved
@Ayomi-gh
Ayomi-gh marked this pull request as draft November 10, 2026 11:53
Ayomi-gh and others added 3 commits November 10, 2026 15:05
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@Ayomi-gh
Ayomi-gh force-pushed the ayomi-gh/empty-metadata-value branch from 6b5902f to c706324 Compare November 10, 2026 15:05
@Ayomi-gh
Ayomi-gh marked this pull request as ready for review November 10, 2026 15:06
@northrup

Copy link
Copy Markdown
Member

We have historically never allowed blank metadata because that should be translated as not having the field at all.

If you encounter blank metadata how are you treating it? Are you deleting the metadata attribute or are you trying to set it to "" or nul?

🤔 it might make more sense to completely ignore blank metadata.

@Ayomi-gh

Copy link
Copy Markdown
Contributor Author

We have historically never allowed blank metadata because that should be translated as not having the field at all.

If you encounter blank metadata how are you treating it? Are you deleting the metadata attribute or are you trying to set it to "" or nul?

🤔 it might make more sense to completely ignore blank metadata.

This came from a CI failure: a deploy's sync commit briefly wrote metadata_team_maintainers= into the auditlog cache, and a merge-queue run cloned it in the ~12 s window before the next commit removed it. load_caches then crashed on the split. Currently the PR keeps it as ""; I'm happy to change it to skip blank metadata entirely, so it's treated as absent.

@Ayomi-gh

Copy link
Copy Markdown
Contributor Author

updated to skip blank values

@Ayomi-gh
Ayomi-gh merged commit 737a57f into main Nov 12, 2026
20 checks passed
@Ayomi-gh
Ayomi-gh deleted the ayomi-gh/empty-metadata-value branch November 12, 2026 15:12
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