Skip to content

XRAY-170058 - Supports requirements file flag in jf ca - #952

Open
gauriy-tech wants to merge 2 commits into
jfrog:devfrom
gauriy-tech:bugfix/XRAY-170058-allw-req-txt
Open

gauriy-tech wants to merge 2 commits into
jfrog:devfrom
gauriy-tech:bugfix/XRAY-170058-allw-req-txt

Conversation

@gauriy-tech

@gauriy-tech gauriy-tech commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Before
Screenshot 2026-11-19 at 2 17 01 PM

After

Screenshot 2026-11-19 at 2 43 07 PM Screenshot 2026-11-19 at 2 43 13 PM Screenshot 2026-11-19 at 2 43 20 PM

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI; Enforced overrides: Organization, Workspace
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: ce7d6951-81a5-4175-a956-6644b09d8fc0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

if ca.Progress() != nil {
err = errors.Join(err, ca.Progress().Quit())
}
if err == nil && ca.detectedTechCount == 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Runs that produce no audit report (an unsupported-only directory such as conanfile.txt, or Hugging Face auto-discovery that finds no model references) still exit 0 with nothing audited, because the counter is incremented on detection (techs), not on a produced report. Consider checking results instead. results only gets an entry once an audit produced a report, so it needs no extra state; detectedTechCount (field at 316-318 and the += in doCurateAudit) can then be removed.

Suggested change
if err == nil && ca.detectedTechCount == 0 {
if err == nil && len(results) == 0 {

One question: an HF run where every reference is unresolved or dynamic still adds a warnings-only placeholder to results (it already exits 0 today with a "NOT audited" warning). Is exit 0 intended there?


Review generated by xray-pr-review

techs := promotePnpmWorkspaceMember(techutils.DetectedTechnologiesListForCurationAudit())
techs := promotePnpmWorkspaceMember(techutils.DetectedTechnologiesListForCurationAuditWithRequirementsFile(ca.PipRequirementsFile()))
techs = promoteYarnWorkspaceMember(techs)
techs = promotePipToUvIn(techs, ca.OriginPath)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With a machine-global ~/.config/uv/uv.toml (a curation-only signal, PromotePipToUvForCurationAudit), --requirements-file=requirements-dev.txt — the example in the jf ca help — is audited as uv, so the flag is silently ignored. jf audit doesn't consider the global config. Consider using techutils.PromotePipToUv only when the named file exists in this directory, so other --working-dirs entries keep the default promotion, and replacing this line with techs = ca.promotePipToUv(techs):

func (ca *CurationAuditCommand) promotePipToUv(techs []string) []string {
	if ca.PipRequirementsFile() == "" || ca.OriginPath == "" {
		return promotePipToUvIn(techs, ca.OriginPath)
	}
	if _, statErr := os.Stat(filepath.Join(ca.OriginPath, ca.PipRequirementsFile())); statErr != nil {
		return promotePipToUvIn(techs, ca.OriginPath)
	}
	promoted := techutils.PromotePipToUv(techutils.ToTechnologies(techs), ca.OriginPath)
	result := make([]string, 0, len(promoted))
	for _, t := range promoted {
		result = append(result, t.String())
	}
	return result
}

A uv.lock next to the custom file still promotes to uv, as in jf audit. An absolute --requirements-file value isn't covered by the stat (it falls back to the current behavior).


Review generated by xray-pr-review

Comment on lines +97 to +98
errorNothingAudited = "no supported package manager was recognised in any working directory, so nothing was audited. " +
"Check the working directories, or pass --requirements-file for a custom pip file name."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When --requirements-file was passed but matched nothing, the "pass --requirements-file" hint isn't actionable. Consider naming the value only when it is set (the wording is neutral because the same error also covers unsupported-only and HF-empty runs):

Suggested change
errorNothingAudited = "no supported package manager was recognised in any working directory, so nothing was audited. " +
"Check the working directories, or pass --requirements-file for a custom pip file name."
errorNothingAudited = "nothing was audited: no supported project files were found in the working directories. " +
"For a custom-named pip requirements file, use --requirements-file."
errorNothingAuditedWithRequirementsFile = "nothing was audited: no supported project files were found in the working directories " +
"(--requirements-file %q matched no file there)."

plus a small helper that picks the message, used at the call site in Run():

func (ca *CurationAuditCommand) nothingAuditedError() error {
	if file := ca.PipRequirementsFile(); file != "" {
		return errorutils.CheckErrorf(errorNothingAuditedWithRequirementsFile, file)
	}
	return errorutils.CheckErrorf(errorNothingAudited)
}

Review generated by xray-pr-review

err = errors.Join(err, ca.Progress().Quit())
}
if err == nil && ca.detectedTechCount == 0 {
err = errorutils.CheckErrorf(errorNothingAudited)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was the exit-code change (exit 0 → error when nothing is audited) part of XRAY-170058's scope? It also applies to the curation-after-failure path (an extra [Error] line after the user's own failed install) and to HF-only runs under a globally exported HF_ENDPOINT. If it is intended, could the PR description, the release note and the help.go "Gotchas" mention it? Would a warning first be an option for existing CI usage?


Review generated by xray-pr-review

@Phavya-jfrog

Copy link
Copy Markdown
Contributor

In the curation-after-failure path (cli/scancommands.go, getCurationCommand) the requirements file comes from the calling command's flags. Does jf pip install in jfrog-cli forward --requirements-file there? If not, a custom-named file would now end in the new [Error] line right after the user's own failed install, with a hint to use a flag that command may not accept.


Review generated by xray-pr-review

@Phavya-jfrog

Copy link
Copy Markdown
Contributor

Could you add a short description to the PR? Currently it has the template checklist (unchecked) and screenshots but no text on what changed and why. It would help to mention that --requirements-file is now honored by jf ca technology detection (it previously only reached pip install -r), and that a run that audits nothing now fails, plus the release-note decision.


Review generated by xray-pr-review

This branch is waiting to be deployed

1 waiting deployment
frogbot — 8a257899 Waiting Nov 20, 2026 by gauriy-tech via scan-pull-request #4841
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.

2 participants