mirror of
https://github.com/stablyai/orca.git
synced 2026-09-25 16:02:38 +00:00
* test(repro): demonstrate #7732 GitLab pipeline job details never load in Checks panel Co-authored-by: Orca <help@stably.ai> * fix(gitlab): load pipeline job traces in the Checks side panel (#7732) Expanding a GitLab pipeline job in the Checks panel always showed "No inline details are available for this check.": the mapper dropped the numeric job id, `PRCheckDetail` had nowhere to carry it, and every consumer called the GitHub check-runs API, which returns null for a GitLab job. - carry `gitlabJobId` on `PRCheckDetail` and add the `gitlab-job:` branch to all three identity ladders (panel rows, editor tabs, fix-prompt keys) so same-stage jobs with no web_url stop colliding - add a runtime-routed trace client so SSH/remote workspaces work, not just local IPC, and thread the MR's `projectRef` for fork pipelines - bound the trace in main via the existing `sliceCheckLogTail` (now shared, not GitHub-only) so a multi-megabyte CI log never crosses the 1 MB transport frame cap; strip ANSI/section markers up to the CR only, which keeps each section's visible header and command echo - render the excerpt inline instead of "Log tail available in full details." - feed GitLab traces to "Fix with AI", which previously sent bare check names - skip the fetch for jobs that cannot have a trace (created/manual/skipped) so GitLab's 404 does not replace the benign empty state, and re-arm a failed load when the job's state changes since the panel has no retry Co-authored-by: Orca <help@stably.ai> * fix(gitlab): treat a missing job log as an empty log, not an error (#7732) Round-1 review follow-up. - a job canceled before it started (or whose log was erased/expired) is `completed`/`cancelled`, so the panel fetched its trace, GitLab answered 404, and `classifyGlabError`'s issue-edit copy ("Issue not found — it may have been deleted.") landed verbatim on the auto-expanded check row; main now maps that 404 to an empty trace so the row keeps its benign empty state - keep a missing project a real error (GitLab masks unauthorized projects as 404) and add `classifyJobLogError` so 403/unknown failures stop borrowing issue-edit wording on a job-log read - broaden the empty-log copy in all five catalogs: it now covers erased and expired logs, not only jobs that never ran - e2e: derive the repro screenshot dir from `process.cwd()` (or an env override) instead of a hardcoded POSIX path to a throwaway worktree - bound the raw trace before the ANSI/section passes so a multi-megabyte log is not scanned in full on the main-process event loop - drop the redundant `if (repo)` in `handleFixChecksWithAI` and the now-dead "Log tail available in full details." catalog entry Co-authored-by: Orca <help@stably.ai> * fix(gitlab): address review — project ref on reload, retry re-arm, IPC timeout - Carry the MR's GitLab project ref on the check-details tab so reloading a fork/cross-project job tab fetches the trace from the pipeline's own project. - Re-arm the sidebar retry when a details load resolves to null, not only when it throws; a detail-less row otherwise never retried after the job moved on. - Bound the local `gl.jobTrace` IPC call with the same 30s timeout the runtime RPC path uses — glab runs without a subprocess timeout in main. - Document that the trace 404 -> empty-log mapping is deliberately broad. Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Orca <help@stably.ai>
86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { gitLabPipelineJobsToPRChecks } from './gitlab-pipeline-checks'
|
|
import type { GitLabPipelineJob } from './types'
|
|
|
|
describe('gitLabPipelineJobsToPRChecks', () => {
|
|
it('maps GitLab pipeline jobs into right-panel check rows', () => {
|
|
const jobs: GitLabPipelineJob[] = [
|
|
{
|
|
id: 1,
|
|
name: 'unit',
|
|
stage: 'test',
|
|
status: 'failed',
|
|
webUrl: 'https://gitlab.com/acme/orca/-/jobs/1',
|
|
duration: 12
|
|
},
|
|
{
|
|
id: 2,
|
|
name: 'deploy',
|
|
stage: 'deploy',
|
|
status: 'manual',
|
|
webUrl: '',
|
|
duration: null
|
|
},
|
|
{
|
|
id: 3,
|
|
name: 'delayed deploy',
|
|
stage: 'deploy',
|
|
status: 'scheduled',
|
|
webUrl: 'https://gitlab.com/acme/orca/-/jobs/3',
|
|
duration: null
|
|
},
|
|
{
|
|
id: 4,
|
|
name: 'external callback',
|
|
stage: 'integration',
|
|
status: 'waiting_for_callback',
|
|
webUrl: 'https://gitlab.com/acme/orca/-/jobs/4',
|
|
duration: null
|
|
}
|
|
]
|
|
|
|
expect(gitLabPipelineJobsToPRChecks(jobs)).toEqual([
|
|
{
|
|
name: 'test: unit',
|
|
status: 'completed',
|
|
conclusion: 'failure',
|
|
url: 'https://gitlab.com/acme/orca/-/jobs/1',
|
|
gitlabJobId: 1
|
|
},
|
|
{
|
|
name: 'deploy: deploy',
|
|
status: 'completed',
|
|
conclusion: 'neutral',
|
|
url: null,
|
|
gitlabJobId: 2
|
|
},
|
|
{
|
|
name: 'deploy: delayed deploy',
|
|
status: 'queued',
|
|
conclusion: 'pending',
|
|
url: 'https://gitlab.com/acme/orca/-/jobs/3',
|
|
gitlabJobId: 3
|
|
},
|
|
{
|
|
name: 'integration: external callback',
|
|
status: 'queued',
|
|
conclusion: 'pending',
|
|
url: 'https://gitlab.com/acme/orca/-/jobs/4',
|
|
gitlabJobId: 4
|
|
}
|
|
])
|
|
})
|
|
|
|
it('omits the job id when GitLab does not report a usable one', () => {
|
|
const jobs = [
|
|
{ id: 0, name: 'zero', stage: '', status: 'failed', webUrl: '', duration: null },
|
|
{ name: 'missing', stage: '', status: 'failed', webUrl: '', duration: null }
|
|
] as unknown as GitLabPipelineJob[]
|
|
|
|
// Why: the runtime RPC schema requires a positive int, so a falsy id must not be forwarded.
|
|
for (const check of gitLabPipelineJobsToPRChecks(jobs)) {
|
|
expect(check).not.toHaveProperty('gitlabJobId')
|
|
}
|
|
})
|
|
})
|