fix(cli): resolve the local project link in veryfront open - #3576
Conversation
|
Warning Review limit reached
Next review available in: 34 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe ChangesOpen dashboard flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant OpenHandler
participant ResolveOpenProjectSlug
participant ProjectReferences
participant ControlPlane
OpenHandler->>ResolveOpenProjectSlug: resolve project slug
ResolveOpenProjectSlug->>ProjectReferences: inspect project references
ProjectReferences->>ControlPlane: validate control-plane link
ControlPlane-->>ResolveOpenProjectSlug: return validated reference
ResolveOpenProjectSlug-->>OpenHandler: return slug or missing result
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d995056b55
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/getting-started/deploy-project.md`:
- Around line 85-90: Add a route-specific verification command alongside the
existing root URL curl, using a documented API route and its required HTTP
method and headers; alternatively revise the surrounding text to claim only page
verification. Update the deployment verification instructions without changing
unrelated steps.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a7183e12-0d26-45b1-b3b3-00b07b858cf3
📒 Files selected for processing (8)
cli/commands/open/command-help.tscli/commands/open/handler.test.tscli/commands/open/handler.tscli/help/tips.test.tscli/help/tips.tsdocs/getting-started/deploy-project.mddocs/guides/deploying.mdtests/docs/guide-content.test.ts
d995056 to
98ca115
Compare
`veryfront open` resolved only VERYFRONT_PROJECT_SLUG and the config file, so running it from a directory that `push`/`deploy` had just linked exited 1 with "No project found." — the last step of the getting-started deploy journey. It now follows the precedence the deploy docs publish, ending at the ignored `.veryfront/project.json` link, and emits a PROJECT_NOT_FOUND error envelope instead of the plain-text banner under `--json`. `open` builds Cloud dashboard URLs, never the deployed site, so the deploy docs and the post-deploy tip now point verification at the environment URL Deploy prints and describe `open` as the dashboard shortcut it is.
… the docs Review follow-up. `resolveEnvironmentProjectReference()` also returns `VERYFRONT_PROJECT_ID` / `TENANT_PROJECT_ID`, which name a project by ID. `buildUrl` pastes what it is given straight into the dashboard path, and the dashboard wants the canonical slug — `push` resolves an ID through the API before printing that URL, which `open` cannot do without a token. So `open` now takes only the slug-shaped environment references and keeps walking to the local link for an ID-only configuration, instead of opening `/projects/<project-id>`. The getting-started verification step also claimed API routes respond while only curling the environment root; it now requests the Create API agent route as well.
98ca115 to
36e09f0
Compare
Found during a DX dogfood walk of
getting-started/deploy-project
and guides/deploying, following
the published pages literally. Two findings, one root cause:
veryfront opendoesnot behave the way the deploy journey's final step assumes.
Symptom
Run from the project root seconds after a successful
npx veryfront deploy --env productionin that same directory:
The directory contains the
.veryfront/project.jsonlink thatpushanddeployhad just written and both had resolved the project from without any flag.
veryfront open --project <slug>andVERYFRONT_PROJECT_SLUG=<slug> veryfront openboth exit 0, isolating the failure to directory-based resolution.
--jsonmade itworse: the failure printed the human banner, so scripted verification could not
parse it.
Separately, no
openinvocation reaches the deployment:That is the Studio environment page, not the environment URL
deployitselfprinted — so "the deployed page and API routes respond" could not be checked via
openat all.Root cause
cli/commands/open/handler.tsresolved the project with onlygetEnvironmentConfig().projectSlug ?? (await readConfigFile(cwd()))?.projectSlug.That stops two tiers short of the precedence the same docs publish
("… then lower-level tenant or project-ID environment references, then the ignored
local link"): it never consults
resolveEnvironmentProjectReference()and neverreads
.veryfront/project.json.cli/commands/config/handler.tsalready resolvesthe full chain;
openwas the outlier.The failure branch also called
logUsageErrorunconditionally, ignoringisJsonMode().buildUrlhas only ever producedhttps://veryfront.com/projects/…dashboard URLs.That is the intended behavior of the command; the docs describing it as the way to
reach the running deployment were wrong.
Change
resolveOpenProjectSlugnow walks the documented precedence and ends atreadProjectLinkForControlPlane, the same readerconfig/push/deployuse —including its loud error when the link targets a different control plane, so a
stale link can never silently open someone else's project.
reportProjectNotFoundemits aPROJECT_NOT_FOUNDerror envelope under--jsonand keeps the existing banner otherwise.
openas the Cloud dashboard shortcut it is; the post-deploy CLI tip is relabeledDashboard:for the same reason. No behavior claim was invented — the docs now sayexactly what the command does.
Regression tests
cli/commands/open/handler.test.ts— Deno BDD, next to the handler it guards.Covers the linked-directory case that failed, each precedence tier above the link,
the control-plane mismatch, and the
--jsonerror envelope (captured from the realoutputJsoncall, not asserted on a constructed value). Before the fix these failwith
undefinedinstead of the linked slug,undefinedinstead of the tenantreference, and
SyntaxError: Unexpected end of JSON inputbecause nothing waswritten to stdout.
tests/docs/guide-content.test.ts— the doc claim is a doc contract, and this fileis where the repo already pins deploy-doc wording. It fails against the previous
text on "
openopens the deployed project."cli/help/tips.test.ts— pins the post-deploy tip label.Verified after the fix by rerunning the finding's command against the local tree:
veryfront openfrom the linked directory exits 0 and prints the project URL, andveryfront open --jsonwith no project anywhere emits a parseable{"success":false,…,"code":"PROJECT_NOT_FOUND"}envelope with exit 1.deno task docs:validatepasses; the full CLI unit suite and the pre-push gate are green.Summary by CodeRabbit
Bug Fixes
opento consistently resolve the intended project across command-line, configuration, and local project references.openopens the Cloud dashboard rather than the deployed site.Documentation