Skip to content
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

feat(hub): add dedicated name column for actors & builds #1995

Conversation

NathanFlurry
Copy link
Member

Changes

Copy link

cloudflare-workers-and-pages bot commented Feb 3, 2025

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 63eb01a
Status: ✅  Deploy successful!
Preview URL: https://18caa143.rivet-hub-7jb.pages.dev
Branch Preview URL: https://02-03-feat-hub-add-dedicated.rivet-hub-7jb.pages.dev

View logs

Copy link
Member Author

NathanFlurry commented Feb 3, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds dedicated name columns for actors and builds, separating the name tag from other tags for better visibility and organization in the UI.

  • Added new grid column layout in frontend/apps/hub/src/domains/project/components/actors/actors-list.tsx expanding from 6 to 7 columns
  • Introduced BUILT_IN_TAGS structure in actor-tags.tsx to properly categorize and filter tags for actors vs builds
  • Enhanced usePatchActorBuildTagsMutation in mutations.ts to handle 'current' tag transitions between builds
  • Added name tag extraction logic in actors-list-row.tsx with fallback display for missing names
  • Updated builds table in builds.tsx to properly exclude built-in tags using the new category system

5 file(s) reviewed, 9 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -71,13 +73,17 @@ export const ActorsListRow = memo(
/>
</SmallText>
<SmallText>{id.split("-")[0]}</SmallText>
<SmallText>
{(tags as Record<string, string>).name ?? "-"}
Copy link

Choose a reason for hiding this comment

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

logic: unsafe type assertion - should validate tags is an object before casting to Record<string, string>

@@ -12,6 +12,8 @@ import { ActorRegion } from "./actor-region";
import { ActorStatusIndicator } from "./actor-status-indicator";
import { ActorTags } from "./actor-tags";

const BUILT_IN_TAGS = ["name"];
Copy link

Choose a reason for hiding this comment

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

style: BUILT_IN_TAGS is defined but never used in this file - consider removing or using it to filter tags

Comment on lines 27 to +28
tags?: unknown;
excludeBuiltIn?: boolean;
excludeBuiltIn?: keyof typeof BUILT_IN_TAGS;
Copy link

Choose a reason for hiding this comment

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

style: tags is typed as unknown but used as object in implementation. Consider using Record<string, string> or a more specific type

Suggested change
tags?: unknown;
excludeBuiltIn?: boolean;
excludeBuiltIn?: keyof typeof BUILT_IN_TAGS;
tags?: Record<string, string>;
excludeBuiltIn?: keyof typeof BUILT_IN_TAGS;

} & Rivet.servers.PatchBuildTagsRequest) =>
rivetClient.actor.builds.patchTags(buildId, {
} & Rivet.servers.PatchBuildTagsRequest) => {
console.log("mutating", request.tags);
Copy link

Choose a reason for hiding this comment

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

style: Remove debug console.log before production deployment

current: "true",
}),
});
console.log("updating builds", currentBuilds.builds);
Copy link

Choose a reason for hiding this comment

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

style: Remove debug console.log before production deployment

Comment on lines +82 to +92
for (const build of currentBuilds.builds) {
await rivetClient.actor.builds.patchTags(build.id, {
project: projectNameId,
environment: environmentNameId,
body: {
tags: {
current: null,
},
},
});
}
Copy link

Choose a reason for hiding this comment

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

style: This loop makes multiple sequential API calls. Consider using Promise.all for better performance

Suggested change
for (const build of currentBuilds.builds) {
await rivetClient.actor.builds.patchTags(build.id, {
project: projectNameId,
environment: environmentNameId,
body: {
tags: {
current: null,
},
},
});
}
await Promise.all(currentBuilds.builds.map(build =>
rivetClient.actor.builds.patchTags(build.id, {
project: projectNameId,
environment: environmentNameId,
body: {
tags: {
current: null,
},
},
})
));

Comment on lines +67 to +72
// If setting build to current, remove current tag from all other builds with the same name
if (
ogBuild.build.tags.name &&
(request.tags as Record<string, string> | undefined)
?.current === "true"
) {
Copy link

Choose a reason for hiding this comment

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

logic: Type assertion on request.tags could fail silently. Consider adding runtime type validation

Comment on lines +225 to 230
await mutateBuildTagsAsync({
projectNameId,
environmentNameId,
buildId: id,
tags: { current: "true" },
exclusiveTags: ["current"],
});
Copy link

Choose a reason for hiding this comment

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

logic: removing exclusiveTags parameter could allow multiple builds to have current=true tag simultaneously, potentially causing inconsistent behavior

Comment on lines +231 to 238
if (latestBuilds.length > 0) {
mutateUpgradeActors({
projectNameId,
environmentNameId,
buildTags: { current: "true" },
tags: { name: latestBulds[0].name },
tags: { name: latestBuilds[0].name },
});
}
Copy link

Choose a reason for hiding this comment

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

style: no error handling for failed mutations - could leave system in inconsistent state if first mutation succeeds but second fails

Copy link

cloudflare-workers-and-pages bot commented Feb 3, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 63eb01a
Status: ✅  Deploy successful!
Preview URL: https://1ce11a9c.rivet.pages.dev
Branch Preview URL: https://02-03-feat-hub-add-dedicated.rivet.pages.dev

View logs

@NathanFlurry NathanFlurry force-pushed the 02-03-feat_hub_add_dedicated_name_column_for_actors_builds branch from a0ed162 to 2c5f0f9 Compare February 3, 2025 21:38
@NathanFlurry NathanFlurry force-pushed the 02-03-feat_hub_add_dedicated_name_column_for_actors_builds branch 5 times, most recently from b9b9ec4 to 2c5f0f9 Compare February 3, 2025 21:54
@NathanFlurry NathanFlurry force-pushed the chore_limit_log_output_to_100_lines branch from bced972 to f86b7c7 Compare February 3, 2025 22:43
@NathanFlurry NathanFlurry force-pushed the 02-03-feat_hub_add_dedicated_name_column_for_actors_builds branch from 322d2c8 to 537f3d9 Compare February 3, 2025 22:43
@NathanFlurry NathanFlurry force-pushed the chore_limit_log_output_to_100_lines branch from f86b7c7 to 02479da Compare February 4, 2025 02:00
@NathanFlurry NathanFlurry force-pushed the 02-03-feat_hub_add_dedicated_name_column_for_actors_builds branch from 537f3d9 to 63eb01a Compare February 4, 2025 02:01
Copy link
Contributor

graphite-app bot commented Feb 4, 2025

Merge activity

  • Feb 4, 1:42 AM EST: A user added this pull request to the Graphite merge queue.
  • Feb 4, 1:43 AM EST: CI is running for this PR on a draft PR: #1999
  • Feb 4, 1:44 AM EST: A user merged this pull request with the Graphite merge queue via draft PR: #1999.

graphite-app bot pushed a commit that referenced this pull request Feb 4, 2025
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
@graphite-app graphite-app bot deleted the branch chore_limit_log_output_to_100_lines February 4, 2025 06:44
@graphite-app graphite-app bot closed this Feb 4, 2025
@graphite-app graphite-app bot closed this Feb 4, 2025
@graphite-app graphite-app bot deleted the 02-03-feat_hub_add_dedicated_name_column_for_actors_builds branch February 4, 2025 06:44
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