Fix circular dependency resolution by switching to artifact-centric display
- Add artifact: prefix handling in resolve_dependencies for direct artifact ID references, enabling dependency resolution for tagless artifacts - Refactor PackagePage from tag-based to artifact-based data display - Add PackageArtifact type with tags array for artifact-centric API responses - Update download URLs to use artifact:ID prefix when no tags exist - Conditionally show "View Ensure File" only when artifact has tags
This commit is contained in:
@@ -680,14 +680,23 @@ def resolve_dependencies(
|
||||
if not package:
|
||||
raise DependencyNotFoundError(project_name, package_name, ref)
|
||||
|
||||
# Try to find artifact by tag or version
|
||||
resolved = _resolve_dependency_to_artifact(
|
||||
db, project_name, package_name, ref, ref
|
||||
)
|
||||
if not resolved:
|
||||
raise DependencyNotFoundError(project_name, package_name, ref)
|
||||
|
||||
root_artifact_id, root_version, root_size = resolved
|
||||
# Handle artifact: prefix for direct artifact ID references
|
||||
if ref.startswith("artifact:"):
|
||||
artifact_id = ref[9:]
|
||||
artifact = db.query(Artifact).filter(Artifact.id == artifact_id).first()
|
||||
if not artifact:
|
||||
raise DependencyNotFoundError(project_name, package_name, ref)
|
||||
root_artifact_id = artifact.id
|
||||
root_version = artifact_id[:12] # Use short hash as version display
|
||||
root_size = artifact.size
|
||||
else:
|
||||
# Try to find artifact by tag or version
|
||||
resolved = _resolve_dependency_to_artifact(
|
||||
db, project_name, package_name, ref, ref
|
||||
)
|
||||
if not resolved:
|
||||
raise DependencyNotFoundError(project_name, package_name, ref)
|
||||
root_artifact_id, root_version, root_size = resolved
|
||||
|
||||
# Track resolved artifacts and their versions
|
||||
resolved_artifacts: Dict[str, ResolvedArtifact] = {}
|
||||
|
||||
Reference in New Issue
Block a user