Skip to content

Support bool/int/string_list attribute values in the target graph mapper - #319

Draft
yushan8 wants to merge 1 commit into
mainfrom
yushan/support-non-string-attribute-values
Draft

yushan8 wants to merge 1 commit into
mainfrom
yushan/support-non-string-attribute-values

Conversation

@yushan8

@yushan8 yushan8 commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Intent:

  • Tango's OptimizedTarget.Attributes only ever carried string-valued Bazel
    rule attributes: mapper.go filtered ingestion to Attribute_STRING and
    dropped every other type, so a target whose only real change was e.g. a
    boolean or integer attribute flip was still flagged as changed (via the
    target hash) but got misclassified during finer-grained diffing since the
    attribute-equality check never saw the change.

Changes:

  • Replaced the STRING-only filter in mapper.ResultToTargetGraph with
    attributeValue, which stringifies STRING, BOOLEAN, INTEGER, and
    STRING_LIST typed attributes into the existing string value intern table.
  • STRING_LIST values are sorted before encoding, matching the existing
    precedent in core/targethasher/sourcehasher.go's encodeAttribute (which
    sorts string_list_value for the same reason: Bazel query does not
    guarantee stable list ordering across runs when nothing semantically
    changed). Values are JSON-encoded rather than delimiter-joined so
    elements containing arbitrary characters can't collide.
  • Other collection/dict/label attribute types (STRING_DICT, LABEL_LIST,
    INTEGER_LIST, etc.) are still dropped rather than stringified, since a
    naive string join isn't safe for them without a canonical encoder.

Generated by the 🪄 pr-create skill in devexp-agent-marketplace

Test Plan

Issues

Summary:
Intent:
- Tango's OptimizedTarget.Attributes only ever carried string-valued Bazel
  rule attributes: mapper.go filtered ingestion to Attribute_STRING and
  dropped every other type, so a target whose only real change was e.g. a
  boolean or integer attribute flip was still flagged as changed (via the
  target hash) but got misclassified during finer-grained diffing since the
  attribute-equality check never saw the change.

Changes:
- Replaced the STRING-only filter in mapper.ResultToTargetGraph with
  attributeValue, which stringifies STRING, BOOLEAN, INTEGER, and
  STRING_LIST typed attributes into the existing string value intern table.
- STRING_LIST values are sorted before encoding, matching the existing
  precedent in core/targethasher/sourcehasher.go's encodeAttribute (which
  sorts string_list_value for the same reason: Bazel query does not
  guarantee stable list ordering across runs when nothing semantically
  changed). Values are JSON-encoded rather than delimiter-joined so
  elements containing arbitrary characters can't collide.
- Other collection/dict/label attribute types (STRING_DICT, LABEL_LIST,
  INTEGER_LIST, etc.) are still dropped rather than stringified, since a
  naive string join isn't safe for them without a canonical encoder.

---

<sub>Generated by the 🪄 [pr-create](https://sg.uberinternal.com/code.uber.internal/uber-code/devexp-agent-marketplace/-/blob/claude-code/plugins/dev/uber-dev/skills/pr-create/SKILL.md) skill in devexp-agent-marketplace</sub>
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