Skip to content

Support subteams that have subteams #1857

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2023
Merged

Conversation

fmease
Copy link
Member

@fmease fmease commented Aug 21, 2023

Fixes #1854.

Renders subteams of arbitrary depth.

The "flat design" doesn't allow for subteams to have working groups or project groups since the WGs and PGs are rendered separately below all other teams and therefore can't possibly be placed below their parent team. Therefore I simply don't render them. I'm gonna update rust-lang/team#1046 to disallow such children.

CC @GuillaumeGomez

subsubteam

@fmease fmease marked this pull request as ready for review August 23, 2023 15:40
@fmease fmease requested a review from a team as a code owner August 23, 2023 15:40
Copy link
Member Author

@fmease fmease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I now support subteams of arbitrary depth. Should I add a #[test] fn?

src/teams.rs Outdated
if let TeamKind::Team = team.kind {
let mut team = &team.name;

// The graph of teams is guaranteed to be acyclic by the the CI script of
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true yet but I'm gonna push an update to rust-lang/team#1046 in a sec

result.push(team.clone());
}

for subteam in subteams {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super happy about this loop inside this recursive function. Complexity could be better but input size should be relatively low. Let me know if there's a nice way to improve the algorithmic complexity.

let mut subteams = Vec::with_capacity(raw_subteams.len());
lay_out_subteams_hierarchically(&mut subteams, None, &main_team.name, &raw_subteams);

fn lay_out_subteams_hierarchically<'a>(
Copy link
Member Author

@fmease fmease Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're wondering why we need to re-lay out the subteams at all after having fetched all direct and transitive subteams, it's because raw_subteams is not necessarily ordered hierarchically.

This might sound obvious but in the case of rustdoc and rustdoc-contributors, the original ordering is actually correct (coincidentally) due to the naming of the two teams (them being sorted alphabetically implies being sorted hierarchically as they share the same prefix and the latter is longer).

However, in general this is not the case (the names might not necessarily reflect the hierarchy). Especially if we add weights to the equation: E.g., we don't want to place subsubteams with weight 1000 at the top of the page above everything else (including their parent team!). The weight should be relative to the level / rank / tier. lay_out_subteams_hierarchically guarantees that.

@fmease
Copy link
Member Author

fmease commented Aug 23, 2023

@Manishearth, do you like this approach of laying out subsubteams (etc.)?

Namely arranging them flat on the page of a main team? This design doesn't introduce any new pages or clutter. OTOH, it doesn't allow subteams to have WGs and PGs (see PR description) and it might be confusing to the reader since the hierarchy is not obvious.

Alternatively, we could create subpages for subsubteams (etc.) but I don't know how easy it would be to implement and I'm not sure how we would link to them because at the moment the section headers of subteams are already link anchors (and link targets).

@Manishearth
Copy link
Member

I think that's fine!

@Manishearth Manishearth merged commit e6fc0f6 into rust-lang:master Aug 23, 2023
@Manishearth
Copy link
Member

This should show up on www-staging.rust-lang.org in a bit, and after that we should check and see if it works (and then make a PR from main to deploy to deploy)

@fmease fmease deleted the subsubteams branch August 23, 2023 20:55
@fmease
Copy link
Member Author

fmease commented Aug 23, 2023

This should show up on www-staging.rust-lang.org in a bit, and after that we should check and see if it works (and then make a PR from main to deploy to deploy)

The website shouldn't have changed since neither rust-lang/team#1046 nor rust-lang/team#1040 has been merged yet.

@Manishearth
Copy link
Member

Yes, but this code will be running and we need to verify it hasn't broken everything before deploy 😄

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.

Support for subteams that have subteams
3 participants