Skip to content

feat(client): display fork identity for Phase C / P4 (no forks yet) - #116

Merged
tonythethompson merged 5 commits into
masterfrom
feat/p4-fork-identity-tooling
Aug 10, 2026
Merged

feat(client): display fork identity for Phase C / P4 (no forks yet)#116
tonythethompson merged 5 commits into
masterfrom
feat/p4-fork-identity-tooling

Conversation

@tonythethompson

@tonythethompson tonythethompson commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Tooling-only groundwork for the selective fork policy (P4). No forks created — this is display/parsing plumbing so that when a fork is eventually created (after satisfying ADR 0001's Lane 3 checklist in full: license, bounded scope, build/release capability, ownership, stewardship record, upstreaming-default, exit condition), the client already knows how to show it honestly.

  • SourceInfo gains optional upstream: Option<String> (original repo URL, set only for numan-maintained fork versions).
  • numan info: adds Distribution: numan-maintained fork -- see 'upstream' under each version below when a package's owner is numan-maintained, and an upstream: line under any version whose source.upstream is set.
  • numan search: appends a [fork] marker to rows owned by numan-maintained (extracted as a small pure fork_marker() helper, mirroring format_row_status()'s existing style for testability).

Test plan

  • cargo build — clean
  • cargo test — 665+ passed across lib and all integration binaries, 0 failed
  • cargo fmt --check — clean
  • New tests: format_info fork-distribution note (present/absent), format_info upstream line (present/absent), fork_marker() (numan-maintained / normal owner)

Ref: docs/plans/2026-08-09-intake-process-reform.md (P4), docs/adr/0001-ecosystem-trust-upstream-contribution-fork-stewardship.md, numan-registry/numan-plugins companion PRs.

🤖 Generated with Claude Code

Review in cubic

Tooling-only groundwork -- no forks created. See docs/adr/0001 for
the full Lane 3 eligibility/stewardship checklist that gates any real
fork; this doesn't attempt that.

- SourceInfo gains optional upstream (original repo URL, set only for
  numan-maintained fork versions).
- numan info: adds a "Distribution: numan-maintained fork" line when
  a package's owner is numan-maintained, and an "upstream:" line
  under any version whose source.upstream is set.
- numan search: appends a " [fork]" marker to rows owned by
  numan-maintained (extracted as a small pure fork_marker() helper,
  mirroring format_row_status()'s style).

Ref: docs/plans/2026-08-09-intake-process-reform.md (P4),
docs/adr/0001-ecosystem-trust-upstream-contribution-fork-stewardship.md
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@tonythethompson, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: de0c229d-2e20-4697-8aca-57a85cb222aa

📥 Commits

Reviewing files that changed from the base of the PR and between 7122d78 and aaf10bd.

📒 Files selected for processing (3)
  • src/cmd/info.rs
  • src/cmd/search.rs
  • src/core/package.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tonythethompson
tonythethompson marked this pull request as ready for review August 10, 2026 08:36

@sourcery-ai sourcery-ai Bot left a comment

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.

Sorry @tonythethompson, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Display fork identity metadata in numan info and numan search

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Add optional upstream URL metadata to package source entries for future fork transparency.
• Improve CLI output to clearly label numan-maintained packages as forks (without creating forks).
• Add unit tests covering fork distribution notes, upstream line rendering, and search row markers.
Diagram

graph TD
  reg[("Registry entries (JSON)")] --> pkg["Package + SourceInfo"]
  pkg --> info["cmd: info"] --> out1["Terminal output"]
  pkg --> search["cmd: search"] --> out2["Terminal output"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Model distribution as an enum instead of owner string checks
  • ➕ Avoids scattering magic owner strings (e.g., numan-maintained) through CLI formatting
  • ➕ Makes “fork/official/upstream” status explicit and extensible
  • ➖ Requires a wider schema change and migration plan for registry entries
  • ➖ More code churn than needed for tooling-only groundwork
2. Derive fork marker purely from presence of `source.upstream`
  • ➕ Eliminates special-casing owner values in the UI
  • ➕ Fork identity becomes per-version (more precise if ownership changes over time)
  • ➖ Doesn’t support the requested UX of tagging the whole package as a fork based on ownership
  • ➖ Requires ensuring upstream is always populated consistently for forked versions

Recommendation: The PR’s incremental approach is appropriate for “display/plumbing only”: adding SourceInfo.upstream is a low-risk schema extension (with #[serde(default)]), and the CLI clearly marks numan-maintained ownership while also showing per-version upstream when present. If fork handling expands, consider a follow-up to replace hard-coded owner checks with an explicit distribution/fork status in the model to keep business rules centralized.

Files changed (3) +76 / -2

Enhancement (3) +76 / -2
info.rsShow fork distribution note and per-version upstream URL in 'numan info' +43/-0

Show fork distribution note and per-version upstream URL in 'numan info'

• Adds a distribution banner when the package owner is 'numan-maintained'. When a version’s 'source.upstream' is set, prints an aligned 'upstream:' line under the existing source details. Adds unit tests covering presence/absence of the fork note and upstream line.

src/cmd/info.rs

search.rsAppend a '[fork]' marker to search rows for 'numan-maintained' packages +29/-2

Append a '[fork]' marker to search rows for 'numan-maintained' packages

• Extends the search row format to include a fork suffix and extracts the logic into a small pure 'fork_marker()' helper. Adds unit tests verifying the marker appears for 'numan-maintained' and is empty for normal owners.

src/cmd/search.rs

package.rsAdd optional 'SourceInfo.upstream' field for original repository URL +4/-0

Add optional 'SourceInfo.upstream' field for original repository URL

• Extends 'SourceInfo' with an 'upstream: Option<String>' field (serde-defaulted) intended to record the original upstream repo URL when the version is a 'numan-maintained' fork. Documentation clarifies that 'git'/'rev' point at the fork while 'upstream' points at the original.

src/core/package.rs

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds client-side parsing and display support for identifying future numan-maintained forks.

  • Extends SourceInfo with optional upstream repository metadata.
  • Displays fork identity and upstream attribution in numan info.
  • Adds a fork marker to numan search results.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
src/cmd/info.rs Adds fork status, distribution, and per-version upstream attribution output with focused formatter tests.
src/cmd/search.rs Adds an owner-based fork marker to search rows and tests both marker outcomes.
src/core/package.rs Adds the shared maintained-owner constant and backward-compatible optional upstream source metadata.

Reviews (4): Last reviewed commit: "Merge branch 'master' into feat/p4-fork-..." | Re-trigger Greptile

greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 10, 2026
@qodo-code-review

qodo-code-review Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. fork_marker comment restates behavior ✓ Resolved 📘 Rule violation ⚙ Maintainability
Description
The new doc comment above fork_marker() describes behavior that is already obvious from the
function body, adding redundant noise. This conflicts with the guideline to keep comments focused on
non-obvious rationale rather than restating code.
Code

src/cmd/search.rs[151]

+/// Row suffix distinguishing a numan-maintained fork from its original owner.
Relevance

●●● Strong

Redundant/restating doc comments have been removed/rewritten before per comment-style guidance.

PR-#108

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2452624 requires avoiding comments that merely restate adjacent code behavior. The
comment at src/cmd/search.rs:151 explains what fork_marker() returns, which is directly
inferable from the immediately following if owner == "numan-maintained" { " [fork]" } else { "" }.

Rule 2452624: Restrict code comments to non-obvious rationale, not restating behavior
src/cmd/search.rs[151-158]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A newly added comment restates the immediately-adjacent code behavior instead of providing non-obvious rationale.

## Issue Context
`fork_marker()` is a small helper whose behavior is self-evident (`owner == "numan-maintained"` => `" [fork]"` else empty). The compliance rule requires comments to capture rationale/constraints rather than narrating what the code plainly does.

## Fix Focus Areas
- src/cmd/search.rs[151-158]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Misleading fork distribution note ✓ Resolved 🐞 Bug ≡ Correctness
Description
format_info() prints "see 'upstream' under each version below" solely based on pkg.id.owner ==
"numan-maintained", but upstream lines are only printed when ver.source.upstream is Some. This can
produce output that promises upstream details even when none are present (or present only for some
versions).
Code

src/cmd/info.rs[R28-31]

+    if pkg.id.owner == "numan-maintained" {
+        out.push_str(
+            "Distribution: numan-maintained fork -- see 'upstream' under each version below\n",
+        );
Relevance

●●● Strong

Team previously accepted rewording misleading CLI guidance; likely to fix overbroad “see upstream”
note.

PR-#110

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR adds an unconditional Distribution note for numan-maintained owners, but the upstream:
line is printed only when the optional source.upstream field is set, so the note can be
false/overbroad when metadata is absent or partial.

src/cmd/info.rs[25-33]
src/cmd/info.rs[87-97]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`format_info()` prints a package-level Distribution message that claims users can "see 'upstream' under each version below" whenever `pkg.id.owner == "numan-maintained"`, but the per-version `upstream:` line is only printed when `ver.source.upstream` is present. This makes the CLI output potentially inaccurate for fork-owned packages with missing/partial upstream metadata.

## Issue Context
- The Distribution note is emitted based only on the owner string.
- The `upstream:` line is emitted only when `ver.source` is present and `source.upstream` is `Some`.

## Fix Focus Areas
- src/cmd/info.rs[25-40]
- src/cmd/info.rs[87-97]

Suggested implementation options (pick one):
1. **Gate the Distribution note**: only print it if at least one version has `source.upstream.is_some()`.
2. **Reword the note**: avoid promising upstream lines for every version (e.g., "may include an upstream link under versions below").
3. **Fail-soft explicitness**: if owner is `numan-maintained` and a version has `source` but no `upstream`, print an explicit placeholder like `upstream:    (missing)` to keep the output "honest".

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

3. Fork owner slug duplicated ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
Fork detection relies on the hard-coded string "numan-maintained" in multiple commands, increasing
the chance of future inconsistent fork labeling if the slug or criteria ever changes. Centralizing
the slug/logic reduces maintenance risk.
Code

src/cmd/search.rs[R151-156]

+/// Row suffix distinguishing a numan-maintained fork from its original owner.
+fn fork_marker(owner: &str) -> &'static str {
+    if owner == "numan-maintained" {
+        " [fork]"
+    } else {
+        ""
Relevance

●●● Strong

They often centralize duplicated logic/strings into shared helpers to avoid drift.

PR-#41
PR-#58

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Both format_info() and fork_marker() independently compare the owner string to the same literal,
which is a new duplication introduced by this PR’s fork-labeling feature.

src/cmd/info.rs[25-33]
src/cmd/search.rs[151-158]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The fork identity is currently determined by comparing against the literal string `"numan-maintained"` in more than one module. This is consistent today, but makes future changes (renaming, expanding criteria) more error-prone.

## Issue Context
Fork labeling is now part of both `numan info` and `numan search` output paths.

## Fix Focus Areas
- src/cmd/info.rs[27-33]
- src/cmd/search.rs[151-158]
- src/core/package.rs[141-153]

Suggested implementation:
- Add a shared constant (e.g., `pub const NUMAN_MAINTAINED_OWNER: &str = "numan-maintained";`) in a suitable shared module (likely `core::package` or a small `core::constants`).
- Use it in both `format_info()` and `fork_marker()` to avoid drift.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context used
✅ Compliance rules (platform): 31 rules
✅ REVIEW.md
Review mode: ⚖️ Balanced: This changes runtime behavior and the serialized SourceInfo contract across client info/search paths; the scope is localized, but careful review is warranted for parsing and display compatibility.

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread src/cmd/search.rs Outdated
Comment thread src/cmd/info.rs Outdated
Comment thread src/cmd/search.rs Outdated
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo Fixer

No findings are within the configured fix scope. To change which findings are fixed, adjust the setting on your Qodo configuration page.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0546d6d86e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/cmd/info.rs Outdated
Show numan-maintained status distinctly, only promise upstream details
when attribution is present, and centralize the maintained-owner slug.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tonythethompson

Copy link
Copy Markdown
Collaborator Author

1886c10: numan-maintained packages show Status: numan-maintained fork; distribution note only prints when a version has source.upstream; NUAN_MAINTAINED_OWNER centralized in core::package.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 10, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 10, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 10, 2026
Resolve info.rs test conflicts by keeping both fork-identity and
commit-snapshot provenance coverage from master.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tonythethompson

Copy link
Copy Markdown
Collaborator Author

Merged latest master (ed2be9c, includes P1 provenance from #114) and resolved info.rs test conflicts. Fork status/distribution fixes from 1886c10 retained.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 10, 2026
greptile-apps[bot]
greptile-apps Bot previously approved these changes Aug 10, 2026
@tonythethompson

Copy link
Copy Markdown
Collaborator Author

Already fixed on this branch: format_info() now gates the Status line on pkg.id.owner == NUAN_MAINTAINED_OWNER, printing "Status: numan-maintained fork" instead of "verified upstream artifact" for maintained forks. See src/cmd/info.rs.

Keep both search row markers: [fork] from P4 and [provisional] from P6.

Co-authored-by: Cursor <cursoragent@cursor.com>
@tonythethompson
tonythethompson merged commit 2281b87 into master Aug 10, 2026
23 checks passed
@tonythethompson
tonythethompson deleted the feat/p4-fork-identity-tooling branch August 10, 2026 13:04
@linear-code

linear-code Bot commented Aug 10, 2026

Copy link
Copy Markdown

NUM-97

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