Repository navigation
feat: add --fields to pr, issue, and run detail views - #38
Conversation
The three list commands already narrow their output with --fields, but every detail view returned its whole field set, so an agent reading one value paid for all of them and had to pipe the result through a JSON tool to extract it. --fields on pr view, issue view, and run view selects from the same catalog the view emits, in emission order, so --fields all reproduces an unnarrowed view exactly. A requested field the host does not supply -- edit_history_count on a host without content history -- is omitted rather than emitted as null, so a narrowed view says exactly what an unnarrowed one would have said. On the detail views --fields is scoped to the primary object; the comment thread on issue view and the job list on run view are unaffected.
|
Separate from this change, and flagging it because it concerns your project rather than mine: I found I opened it because the tool is published, built on That pull request does not assert an admission verdict. It records the source review at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe CLI adds ChangesDetail field selection
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This additive change narrows fields for existing detail views without changing default output or remote operations; no actionable merge-blocking risk remains after normal checks and review. Sequence Diagram(s)sequenceDiagram
participant ViewCommand as Detail view command
participant FieldProjection as Detail-field projection
participant Response as Host response
ViewCommand->>Response: Fetch detail response
ViewCommand->>FieldProjection: Validate requested fields
FieldProjection-->>ViewCommand: Return filtered primary object
ViewCommand-->>Response: Preserve comments, jobs, logs, and metadata
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@Freudator86 Thank you for the contributions! There's actually a pending upstream PR kunchenguid/axi#123 but the added voice probably doesn't hurt. I made a couple of tweaks to the PRs you submitted, and am going to merge them. |
What this adds
--fields LIST|allonpr view,issue view, andrun view.pr list,issue list, andrun listalready narrow their output this way. The detail views did not, so an agent reading one value paid for the whole field set and then had to pipe the result through a JSON tool to extract it. That is the case principle 2 exists for, and the three list commands already establish the pattern this follows.Design notes
--fields allis the identity narrowing. The catalogs are built from the existing identity field lists in emission order, so--fields allreproduces an unnarrowed view byte for byte. A test pins that rather than trusting the ordering by eye.--fieldsnarrows nothing. A detail view's field set is not fixed --edit_history_countis present only on hosts that serve content history -- so there is no static default list that could stand for "whatever this view returned". This is why the detail helper is separate fromchooseFieldsrather than a third caller of it.edit_history_countagainst a host without content history returns the view without it, which is exactly what the unnarrowed view says about that field. Emitting an explicit null would claim the host answered.issue viewthe comment thread is untouched, and onrun viewthe job list is untouched. Both are stated in--help.Invalid or duplicate --fields valueerror and itsValid fields:help, so the three list commands and the three detail views fail identically.Contract
Additive: a new optional flag on three commands, no default output changed, no field renamed or repurposed. Minor-release shaped under
docs/contract.md.Verification
npm run checkpasses: lint, typecheck, 242 tests (237 before, 5 added), smoke.npm run gen:skillregenerated; the byte comparison incheckpasses.Live lanes: neither was run. I have no credential for a Forgejo host that these lanes may mutate, and the lanes mutate the repository they point at. Per CONTRIBUTING I am saying so rather than guessing.
What I did verify against a real host: the built CLI reading a live Forgejo 15.0.6+gitea-1.22.0 instance unauthenticated over a loopback forward, against a public repository:
--fields allagainst that same live pull request was byte-identical to the unnarrowed--jsonoutput. That exercises the real response shape but not the mutating lanes, so it is weaker evidence than lane 15 and I would not want it read as equivalent.Summary by CodeRabbit
New Features
--fields LIST|allto pull request, issue, and run detail views.allreturns the complete primary object.Documentation