Ignore people tree columns in Workforce::Person

What does this MR do and why?

This MR stops using the manager link (manager_external_xid) and ancestry path (traversal_ids) on workforce_people: it removes the two model scopes that read them and the tree-building part of the development seed, and ignores both columns in Workforce::Person so they can be dropped in 19.8.

The workforce hierarchy design changed: the hierarchy is a tree of workforce units, and people are only members of those units, so people need no tree of their own and Phase 1 does not store a person's manager. Removing the columns before the sync in https://gitlab.com/gitlab-org/gitlab/-/work_items/629840 starts writing them means they never hold HR data. Nothing reads them, so users see no change.

How:

  • Workforce::Person ignores both columns (remove_with: '19.9', remove_after: '2027-01-21'), and loses the Namespaces::Traversal::Traversable include, the subtree_of and direct_reports_of scopes, and manager_external_xid from its length validation. The matching Keela exclusions are removed.
  • The development seed now inserts a flat list of people in batches instead of building a reporting tree. It writes neither column, so they keep their defaults (NULL and {}).
  • person_subtree_benchmark_spec.rb is removed; https://gitlab.com/gitlab-org/gitlab/-/work_items/638005 can adapt it from this MR's history.

Dropping the columns

workforce_people ships in 19.6 with both columns, so they follow the three-release process:

  1. 19.7, this MR: remove the code that uses the columns and ignore them.
  2. 19.8: drop the columns, their two indexes and the text limit in a post-deployment migration: https://gitlab.com/gitlab-org/gitlab/-/work_items/639678. The migration was written and tested in this MR first, and is in that issue.
  3. 19.9: remove the ignore rule: https://gitlab.com/gitlab-org/gitlab/-/work_items/640570.

References

Screenshots or screen recordings

Not applicable: no UI change.

How to set up and validate locally

  1. In the Rails console, confirm the model hides both columns while the table still has them:

    Workforce::Person.column_names & %w[manager_external_xid traversal_ids]
    # => []
    %w[manager_external_xid traversal_ids].map { |c| Workforce::Person.connection.column_exists?(:workforce_people, c) }
    # => [true, true]
  2. Run the seed and confirm it completes:

    FILTER=99_workforce_hierarchy bundle exec rake db:seed_fu

Validation evidence

Development seed, with both columns present: 0 rows write them
$ CI=1 FILTER=99_workforce_hierarchy bundle exec rake db:seed_fu
Seeded 100 people into the workforce hierarchy of <group>.

$ rails runner (table check)
table has columns: [true, true]
model column_names include them: []
ignored_columns: ["manager_external_xid", "traversal_ids"]
{"rows" => 100, "mgr" => 0, "trav" => 0}

mgr counts non-null manager_external_xid, and trav counts non-empty traversal_ids.

Specs
$ bin/rspec ee/spec/models/workforce/
Finished in 8.84 seconds (files took 1 minute 17.48 seconds to load)
41 examples, 0 failures
GitLab.com row count (Database Lab): 0 rows, for the 19.8 drop

Screenshot 2026-11-11 at 10.54.35 PM.png

Acceptance criteria

From https://gitlab.com/gitlab-org/gitlab/-/work_items/638891:

  • workforce_people has no traversal_ids or manager_external_xid column, and neither index exists. (moved to the 19.8 drop: https://gitlab.com/gitlab-org/gitlab/-/work_items/639678)
  • Workforce::Person has no subtree_of or direct_reports_of scope, and scripts/lint/keela_excluded.yml has no entries for them. (diff of person.rb and keela_excluded.yml)
  • The development seed creates people without a manager link or ancestry path, and completes without errors. (seed evidence above)
  • The database reviewer has confirmed the plan: ignore in 19.7, drop in 19.8, remove the ignore in 19.9. (pending database maintainer review)

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Pranjal Jain

Merge request reports

Loading
Loading