Skip to content

fix(customer): keep malformed affiliate hierarchies visible - #907

Draft
seonghobae wants to merge 18 commits into
mainfrom
fix/affiliate-tree-cycle-safe-forest
Draft

fix(customer): keep malformed affiliate hierarchies visible#907
seonghobae wants to merge 18 commits into
mainfrom
fix/affiliate-tree-cycle-safe-forest

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Buyer-visible defect

The post-detail Affiliate Tree must preserve every authorized organization/person observation when hierarchy data is malformed or partially unresolved, without broadening metadata reads or inventing corporate authority.

Current repairs cover pure cycles, self-parent pointers, unavailable parents, bounded ancestor/alias reads, unavailable entity references with identical display names, and conflicting duplicate canonical entity rows.

TDD / repairs

  • cycle RED f614ff65fc34bd87635217b8dd9ff92c93d9d025 → GREEN ca9031fcb6441da26333286f81eea91fe79acbd0: cycle/self-parent/missing-parent records remain visible with deterministic disclosure.
  • hierarchy bounded-read RED dcf6ddec8b6ce32f32705fe5e761c4eea367dbb2 → GREEN 076e87325dd2d9e7a8adc55f56986d39b1266b9a.
  • alias bounded-read RED dc0ea5a66e15c1a8db1d55bd1a03aacd7b939a99 → GREEN a0fd03daf03fb7363c0398a6f720bfd056a3d9a1 + 3be6ec3249d65e55c03a12a21c3940273e95a36c.
  • unavailable-reference RED 44d8effb3fb0be7740c1441f21295c4b601d2a64 → GREEN 0902c402f29c6be4dbf1a5877dfce9924e6a693a: unresolved roots retain opaque source entity references and do not collapse by display name.
  • duplicate canonical entity RED f25f479502dd96b5eff4213a1f975091f0a275fd: two available CorporateEntityRow values with one entity_id must not be collapsed by dict last-wins semantics.
  • duplicate canonical entity GREEN c12b3f3501d7bca61691386cbdc5c099f6c2f761: _index_entities() fails closed before hierarchy construction when a canonical entity ID is duplicated. A focused exact-logic probe confirms the duplicate rejection while preserving the ordinary one-row index contract.

Duplicate available entity rows are not treated like an unavailable parent edge: choosing one row would let database/input order select business truth. The repair therefore rejects the ambiguous snapshot rather than fabricating a resolved hierarchy. The ingestion boundary remains bounded to this post's touched entity/name set.

Scope / ownership

This PR owns lineageweave/affiliate_tree.py, the post-detail Affiliate Tree ingestion path, and its bounded organization-alias lookup. It does not modify Customer Master (#909), source-system corporate authority, another repository's persistence, or authorization scope.

Exact live identity / governance

  • protected base: main@3f61c8242b9c02dec307a7396e83e28f7cdd9f3d
  • exact current head: c12b3f3501d7bca61691386cbdc5c099f6c2f761
  • PR: Draft / open / mechanically mergeable
  • exact-head Tests 33568582495, Security 33568582394, SAST 33568582650: queued and therefore non-passing
  • review threads currently empty; predecessor checks/reviews do not transfer
  • live rules require one qualifying independent approval; no self-approval, force-push, or bypass

@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant