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::Personignores both columns (remove_with: '19.9',remove_after: '2027-01-21'), and loses theNamespaces::Traversal::Traversableinclude, thesubtree_ofanddirect_reports_ofscopes, andmanager_external_xidfrom 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 (
NULLand{}). person_subtree_benchmark_spec.rbis 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:
- 19.7, this MR: remove the code that uses the columns and ignore them.
- 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.
- 19.9: remove the ignore rule: https://gitlab.com/gitlab-org/gitlab/-/work_items/640570.
References
- Work item: https://gitlab.com/gitlab-org/gitlab/-/work_items/638891
- Epic: https://gitlab.com/groups/gitlab-org/-/work_items/23625
- MR that added the columns: !261107 (merged)
- Related, out of scope (workforce unit store): https://gitlab.com/gitlab-org/gitlab/-/work_items/638005
Screenshots or screen recordings
Not applicable: no UI change.
How to set up and validate locally
-
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] -
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 failuresAcceptance criteria
From https://gitlab.com/gitlab-org/gitlab/-/work_items/638891:
-
workforce_peoplehas notraversal_idsormanager_external_xidcolumn, and neither index exists. (moved to the 19.8 drop: https://gitlab.com/gitlab-org/gitlab/-/work_items/639678) -
Workforce::Personhas nosubtree_ofordirect_reports_ofscope, andscripts/lint/keela_excluded.ymlhas no entries for them. (diff ofperson.rbandkeela_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.
