Skip to content

feat(ripple): auto-resolve last export job for log/errors#10330

Merged
davidfirst merged 7 commits into
masterfrom
feat/ripple-last-export-resolve
Apr 27, 2026
Merged

feat(ripple): auto-resolve last export job for log/errors#10330
davidfirst merged 7 commits into
masterfrom
feat/ripple-last-export-resolve

Conversation

@davidfirst
Copy link
Copy Markdown
Member

@davidfirst davidfirst commented Apr 27, 2026

bit ripple errors / bit ripple log previously auto-detected a job only by querying the current lane. On main this didn't work at all, and on a lane with a successful latest job the errors command bailed out with "No failed Ripple CI job found".

After a successful export, ripple job slugs + lane/timestamp/components are now persisted to .bit/last-export.json. The resolver chain is: arg → last-export (when its target matches the current context) → lane → error. Slugs are looked up via getJob(slug: ID!). A contextual header is rendered when the job came from last-export, e.g. ✓ Your last export (2 minutes ago) to main succeeded. or ✗ Your last export (8 minutes ago) to lane "scope/dev44" failed.

Test plan

  • Export from main, run bit ripple errors / bit ripple log with no args.
  • Export from a lane, switch nothing, run the same commands — last-export wins because its lane matches.
  • Export, then switch to a different lane — falls back to lane lookup since last-export's lane no longer matches.
  • Failed export — bit ripple errors shows the failure header + error details.
  • Successful export on a lane — bit ripple errors reports "All N components built successfully" instead of the old "No failed Ripple CI job found".

After a successful export, persist the ripple job slugs + metadata to
`.bit/last-export.json`. `bit ripple errors` and `bit ripple log` now
fall back to that file when no current lane is detected (i.e. exports
from main), look up the job via `getJob(slug)`, and prepend a
contextual header showing the export age and outcome.
Copilot AI review requested due to automatic review settings April 27, 2026 18:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “last export” fallback for Ripple CLI commands when running on main (no lane), by persisting the most recent export’s Ripple job slug(s) and then resolving the job via getJob(slug: ID!) when needed.

Changes:

  • Persist last export metadata (timestamp, job slugs, lane info, exported components) to .bit/last-export.json after successful exports that return Ripple jobs.
  • Add Ripple support for resolving a job by slug and using last-export.json when no job-id and no lane are available.
  • Render a contextual header in bit ripple log/errors when the resolved job comes from the last export.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
scopes/scope/export/last-export.ts New helper to read/write .bit/last-export.json.
scopes/scope/export/index.ts Re-exports last-export helpers/types via @teambit/export.
scopes/scope/export/export.main.runtime.ts Writes last-export metadata after exports that produce Ripple jobs.
scopes/cloud/ripple/ripple.main.runtime.ts Adds getLastExport() and getJobBySlug() + GraphQL query for slug lookup.
scopes/cloud/ripple/ripple.cmd.ts Updates log/errors to resolve from last-export and render a contextual header.
scopes/cloud/ripple/ripple-utils.ts Enhances job resolution to include last-export fallback + adds relative age formatting.

Comment thread scopes/cloud/ripple/ripple.cmd.ts Outdated
Comment thread scopes/cloud/ripple/ripple.main.runtime.ts
When the user's last export targets the current lane, prefer that
job over the latest lane job. This avoids the misleading 'No failed
Ripple CI job found' message when on a lane where the user's last
export succeeded — the new behavior shows the actual outcome with the
contextual header. Also drops the FAILURE-only filter on lane fallback
so 'bit ripple errors' on a lane with no failures shows the success
state instead of bailing out.
When resolveJobId resolves from last-export it already calls
getJobBySlug to fetch the full job. Pass that job through ResolvedJobId
so RippleLogCmd can reuse it instead of issuing a second getJob round
trip. Addresses copilot review on #10330.
Copilot AI review requested due to automatic review settings April 27, 2026 19:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread scopes/cloud/ripple/ripple.cmd.ts
Comment thread scopes/cloud/ripple/ripple-utils.ts
Comment thread scopes/cloud/ripple/ripple.cmd.ts
readLastExport now rejects parsed JSON that doesn't match the expected
shape (e.g. corrupted file with rippleJobs as a string), so callers can
trust the returned data without repeating Array.isArray guards. Also
fix a stale --lane help text in 'ripple errors' that referenced 'latest
failed job' before the filter was dropped.
@davidfirst davidfirst changed the title feat(ripple): auto-resolve last export job when on main feat(ripple): auto-resolve last export job for log/errors Apr 27, 2026
@davidfirst davidfirst enabled auto-merge (squash) April 27, 2026 20:10
The bit.cloud /ripple-ci/job/<segment> page resolves <segment> by slug
(the url-safe identifier returned in the export response), not by the
GraphQL job id. Pass-through job ids were silently leading to 'No CI
job found' on the rendered page. Selecting Job.slug in getJob/getJobBySlug
and preferring it in getJobUrl restores working links.
Copilot AI review requested due to automatic review settings April 27, 2026 20:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread scopes/scope/export/last-export.ts Outdated
Comment thread scopes/cloud/ripple/ripple.cmd.ts Outdated
Comment thread scopes/cloud/ripple/ripple.main.runtime.ts
- isValidLastExport now rejects entries where exportedComponents is not
  an array of non-empty strings, and where lane (when present) lacks
  string scope/name. Prevents corrupt-but-parseable files from being
  used in header rendering.
- RippleErrorsCmd.json() now includes source/lastExport on the no-job
  branch so JSON consumers see a consistent shape.
- RETRY_JOB / STOP_JOB mutations now select slug, so the retry-printed
  url uses the slug-based bit.cloud route that actually resolves.
@davidfirst davidfirst merged commit e4cae5d into master Apr 27, 2026
12 checks passed
@davidfirst davidfirst deleted the feat/ripple-last-export-resolve branch April 27, 2026 21:14
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.

3 participants