feat(list): surface favorited projects first in railway list - #1166
Merged
Conversation
Dashboard parity: favorites render at the top of their workspace, marked with a star, and carry an `is_favorite` flag in `--json`. Favorites are fetched with a second query and joined client-side rather than being added as a field on `Project`. `projectFavorites` hangs off `Query` and takes one workspace, so it cannot be selected inside the existing `UserProjects` document; the listing walks every workspace, so the lookups run concurrently with a bound. Every favorites failure degrades to "no favorites" instead of propagating. The field requires a user principal and is refused for the workspace- and project-scoped tokens `railway list` must keep serving, and it can additionally be gated off by a feature flag — so a caller that cannot read favorites gets exactly the listing it got before. `src/gql/schema.json` gains only the one `projectFavorites` field rather than a full re-introspection, which would have dragged unrelated upstream drift into the diff. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Padding every non-favorite to the star's width shifted the whole listing two columns right — including for callers the favorites field refuses, whose output must not change at all. Reserve the marker's width only in a workspace that actually has a favorite to show, so a mixed workspace still aligns into one column while a workspace with none renders exactly as it did before favorites existed. Found by Codex in review. Also picks up rustfmt on the test fixture added in the previous commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Favorited projects render first in
railway list, marked with a star, and carry anis_favoriteflag in
--json. Dashboard parityTwo queries joined client-side —
projectFavoriteshangs offQueryand takes one workspace, soit can't live inside
UserProjects. Lookups run concurrently, bounded at 6.A favorites failure never breaks
railway listor changes its output. The field needs a userprincipal and is refused for workspace- and project-scoped tokens, and can be gated off by a
rollout flag. Every failure collapses to "no favorites" for that workspace, independently, and
silently — on a project token the refusal is the expected outcome on every run.
Verified live rather than argued; the test account has favorites in one of three workspaces, so one
run covers both branches:
RailwayRaildevthat's only the subgraph exposure. The auth hardening (
isUserAuthenticated) is in mono#37601,still open — so a workspace-scoped token may currently succeed here rather than be refused.
This code is correct either way; it never depends on a refusal.
src/gql/schema.jsongains only the one field, not a full re-introspection — verified structurallythat nothing outside
Query.fieldschanged.iacfailures (neednode, absent locally)build,fmt,lint-fix,clippy -D warnings— all exit 0Full evidence: https://gist.github.com/fcx-railway/4bc9cda9cd96bd3b72581f0d61c3192b
Favoriting/unfavoriting is out of scope — per Mahmoud,
railway apiis the escape hatch.🤖 Generated with Claude Code