Skip to content

fix(buck): stop defaulting METADATA.bzl package types#754

Merged
mstykow merged 4 commits intomainfrom
fix/buck-metadata-package-type
Apr 21, 2026
Merged

fix(buck): stop defaulting METADATA.bzl package types#754
mstykow merged 4 commits intomainfrom
fix/buck-metadata-package-type

Conversation

@mstykow
Copy link
Copy Markdown
Owner

@mstykow mstykow commented Apr 21, 2026

Summary

  • stop defaulting METADATA.bzl packages to type: buck when the file does not declare an ecosystem or package URL
  • keep buck_metadata as the source identity, preserve explicit ecosystem/type/package_type and package_url overrides, and still assemble a top-level package
  • generate opaque internal package_uid values for assembled typeless packages so for_packages linkage stays populated without inventing a fake PURL type

Scope and exclusions

  • Included: Buck metadata parser behavior, Buck metadata assembly eligibility, and internal package UID fallback for assembled packages without PURLs
  • Explicit exclusions: BUCK build-file parsing semantics and any broader PackageType taxonomy cleanup outside Buck metadata

Intentional differences from Python

  • Upstream ScanCode treats METADATA.bzl as type: buck by default. This branch intentionally leaves type unset unless the metadata declares a real ecosystem or package_url, while preserving buck_metadata as the datasource identity.
  • Because typeless assembled packages no longer have a PURL-derived UID, this branch assigns an opaque internal package_uid so top-level package linkage still works.

Expected-output fixture changes

  • Files changed: testdata/buck/metadata/METADATA.bzl.expected.json
  • Why the new expected output is correct: the fixture no longer emits "type": "buck" because the parser now distinguishes Buck file ownership from declared package ecosystem, while still preserving datasource_id: "buck_metadata" and producing an assembled package with a non-empty internal UID at scan time.

mstykow and others added 4 commits April 21, 2026 18:24
Keep Buck METADATA.bzl files identified by datasource ownership instead of inventing a fallback package type when the file does not declare one.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Allow Buck METADATA.bzl entries with names but no package type to assemble into top-level packages so scans still emit package records after the parser fallback is removed.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Generate internal package UIDs for assembled packages that still lack a PURL so Buck metadata packages keep stable linkage without reintroducing a fake package type.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
Keep parser-supplied PURLs as the canonical package identity when present so qualifiers such as Alpine arch survive assembly and file-reference matching.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Signed-off-by: Maxim Stykow <maxim.stykow@gmail.com>
@mstykow mstykow merged commit 7e4ae8b into main Apr 21, 2026
15 checks passed
@mstykow mstykow deleted the fix/buck-metadata-package-type branch April 21, 2026 19:35
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.

1 participant