Skip to content

feat(controlplane): filter referrer discovery by project name and version#3158

Open
migmartri wants to merge 1 commit into
chainloop-dev:mainfrom
migmartri:3155-referrer-discovery-version-filter
Open

feat(controlplane): filter referrer discovery by project name and version#3158
migmartri wants to merge 1 commit into
chainloop-dev:mainfrom
migmartri:3155-referrer-discovery-version-filter

Conversation

@migmartri
Copy link
Copy Markdown
Member

Closes #3155

Adds optional project_name and project_version filters to the private referrer discovery endpoint (DiscoverPrivate). When both are supplied, the discovered referrer and its references are confined to the matching project version:

  • An attestation is returned only if it belongs to the requested project version.
  • A material/subject (e.g. an SBOM or image shared across many projects and versions) is returned only if it is referenced by an attestation in that project version, and its references are scoped accordingly.

Version membership is resolved by entering from the project version's workflow runs, so the lookup stays bounded regardless of how widely a material is shared. The two fields must be provided together (a version name is unique only within a project), enforced via proto validation.

The deprecated public shared discovery endpoint is marked as deprecated in the proto.

This change was developed with AI assistance (Claude Code).

@migmartri migmartri requested a review from a team May 27, 2026 11:20
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 15 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread app/controlplane/pkg/data/referrer.go Outdated
@migmartri migmartri force-pushed the 3155-referrer-discovery-version-filter branch from 36d60ab to 92f57b3 Compare May 27, 2026 12:38
@chainloop-platform
Copy link
Copy Markdown
Contributor

chainloop-platform Bot commented May 27, 2026

AI Session Analysis

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 88% 1 ✅ 0 24% AI / 76% Human 7 +251 / -13 5h19m18s

🟢 88% — 24% AI — ✅ All policies passing

May 27, 2026 10:08 UTC · 5h19m18s · $63.94 · 4.6k in / 356.2k out · claude-code 2.1.152 (claude-opus-4-7)

View session details ↗

Change Summary

Added version-filter support to the referrer API, implemented at the ent query layer for scalability. Proto, business logic, data, service, CLI, and integration test layers were all updated. A cursor-bypass regression bug was caught via CI review and fixed with a dedicated test. Rebase merged concurrent upstream changes (OTel tracing, renamed interface method) without loss.

AI Session Overall Score

🟢 88% — Strong delivery with thorough testing and clean CI; initial framing was thin.

AI Session Analysis Breakdown

🟢 92% · alignment

🟢 AI executed all five explicit tasks in the final implementation turn without omission. · High Impact

🟡 Initial exploration was interrupted before completing; minor scope overshoot on the first turn. · Low Severity

🟢 92% · verification

🟢 8-subtest integration suite runs against a real database, covering new feature with negative cases. · High Impact

🟡 Tests broke mid-session after rebase renamed SaveAttestation; required a fix before final pass. · Low Severity

🟢 88% · solution-quality

🟢 Version filtering implemented at the ent query layer, avoiding in-memory post-filtering on millions of rows. · High Impact

🟡 Two nolint directives added at call sites using a deprecated proto field retained for backward compatibility. · Low Severity

💡 Document the nolint rationale inline to clarify intent for future maintainers.

🟢 87% · scope-discipline

🟡 SSH gitconfig cleanup removed 24 duplicate rewrites beyond the single remote the user asked to fix. · Low Severity

🟢 85% · user-trust-signal

No notes.

🟡 72% · context-and-planning

🟠 Scale, scope, and children-scoping were established through reactive follow-up rather than stated upfront. · Medium Severity

💡 State scale, scope, and key constraints upfront rather than through reactive clarification.

🟡 Implementation was kicked off with a terse multi-command instruction with no explicit reference to the spec. · Low Severity

💡 Reference the written spec when kicking off implementation to anchor scope.


File Attribution

████░░░░░░░░░░░░░░░░ 24% AI / 76% Human

Status Attribution File Lines
modified ai app/controlplane/pkg/biz/referrer_integration_test.go +91 / -0
modified ai app/controlplane/pkg/data/referrer.go +84 / -3
modified ai app/controlplane/pkg/biz/referrer.go +22 / -8
modified human app/controlplane/api/controlplane/v1/referrer.proto +20 / -0
modified human app/controlplane/api/gen/openapi/openapi.yaml +19 / -0
modified human app/controlplane/internal/service/referrer.go +12 / -2
modified human app/cli/pkg/action/referrer_discover.go +3 / -0

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-593298 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-593298 -
✅ Passed ai-config-no-secrets ai-coding-session-593298 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-593298 -

Powered by Chainloop and Chainloop Trace

…sion

Add optional project_name and project_version filters to the private referrer
discovery endpoint (DiscoverPrivate). When both are provided, the discovered
referrer and its references are confined to the matching project version,
resolved by entering from the project version's workflow runs so the lookup
stays bounded regardless of how widely a material is shared.

Mark the deprecated public shared discovery endpoint as deprecated in the proto.

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 593298f0-05bd-408b-9767-5472afe1caec
@migmartri migmartri force-pushed the 3155-referrer-discovery-version-filter branch from 92f57b3 to 1641767 Compare May 27, 2026 15:27
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.

Extend referrer (discovery) API to filter by project name and project version

2 participants