Add deb repository and remote pages - #347
Conversation
There was a problem hiding this comment.
Thanks for this - solid work overall, and I've left comments on the specific issues, tagged using MoSCoW. A couple of things I'd suggest:
-
Commit size: This is a large PR, 1,942 lines across 32 files submitted as a single commit. That makes it much harder for reviewers to follow, especially when trying to understand how the implementation came together. Smaller, sequential PRs would be preferred going forward.
-
Cypress Testing: As this is new UI functionality within PulpUI, could you please add corresponding test cases to
cypress/e2e/smoke.js. -
AI-assisted contributions: No issue either way, but if any AI tooling was used, please make sure the appropriate attributions is included, in line with Pulp's AI policy.
Ref:
https://github.com/pulp/.github/blob/cf562eff2ec6fe0f49bdfd693c3627453eef5203/profile/README.md
9772856 to
9ce27a7
Compare
|
Thanks for the review -- all nine comments are addressed, force-pushed and rebased on current main. Details are in the individual threads; the three broader points: Cypress. Added Commit size. Point taken. I have not retro-split the original commit, since the pages only work once the API layer, routes and menu entry are all present, but the review fixes are eight separate commits, one per point, so the diffs should be easy to follow. Anything further I send will be scoped smaller from the start -- starting with the SyncModal extraction, as its own PR. AI-assisted. Yes, AI-assisted throughout, and thanks for pointing at the policy. Every commit now carries an |
ansible-repository-sync and file-repository-sync each carried a byte identical copy of the modal, some ninety lines apiece, so the mirror and optimize wording had to be changed in two places. Moved to src/components/sync-modal.tsx as it stood; the only edit is the inline prop type becoming an IProps interface, as the other components declare theirs. No behaviour change. Each action keeps its own permission check, its own disabled reasons and its own sync call. Refs #347 Assisted By: Cursor (Claude Opus 5)
|
@Redtigercod4 are you happy that this meets your list of suggested changes? |
Adds a "Pulp deb" menu section with Repositories and Remotes, mirroring the structure of Pulp file: list, detail and edit for each, plus the versions and distributions tabs on a repository. Deliberately scoped to repositories and remotes. Publications are left out because deb has two publication endpoints rather than a field -- publications/deb/apt generates fresh metadata and needs a signing service, publications/deb/verbatim republishes upstream's Release byte for byte -- so a publications tab needs a design decision rather than just wiring. Content browsing is left out for the same reason: deb has a dozen content endpoints where rpm has one. RemoteForm gains the APT fields, which have no equivalent in the other plugins: distributions (suites), components, architectures, gpgkey, and the sync_sources/sync_udebs/sync_installer switches. `distributions` is added to requiredFields for deb only -- pulp_deb answers a remote without it with "This field is required.", unlike every other plugin where url alone is enough. gpgkey reuses the FileUpload treatment the certificate fields already use, since it is an armoured key file. The remaining changes are registry entries: plugin2api, the plugin unions on LazyRepositories/LazyDistributions/RepositoryForm, and the deb-only fields on the shared RemoteType. All are additive; ansible, container and file behaviour is unchanged. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
The lookup asked for the first hundred and left a TODO for the rest, so deleting a repository with more distributions than that would leave the excess pointing at a repository that no longer exists. Walk the pages until as many have been collected as `count` reports, stopping early on an empty page so a disagreeing count cannot loop. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Opening the sync modal offered to mirror, which deletes local content the remote no longer has. The API's own default is the non-destructive one and the modal should agree with it, so the deletion is opted into. The value was written out three times; it is now one constant, which is also where the divergence from ansible and file is explained. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Both detail pages read results[0] straight out of the response, which throws on any unexpected shape, and past page-with-tabs' catch that leaves the page loading with nothing to show. Read the first result defensively instead. The comment claimed the API returns a 404; it returns 200 and an empty list, and it is this code that synthesizes the 404. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Three entries tested the same tab and were filtered back out again when the answer was no. It is one decision -- which crumbs the versions tab adds -- so make it once. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Three chained ternaries picked the remote API by plugin, repeating the same list call in each branch. plugin2api already maps a plugin to its repository and distribution APIs, so add the remote API there and let the form ask for it: one switch to extend when a plugin is added, not a conditional to unpick. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
The stub answered true to every permission. Nothing in this list is gated on one, and an apt repository carries no my_permissions field for the ansible-style check to read, so copying that check would answer no to everyone instead. Leave the permission out and say why, so an action added later gets a real check rather than a stub that always agrees. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Both types hold property declarations only, with no constructor, no methods and no instantiation, which is what an interface is for. Also fixes a typo in the smartUpdate comment. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Reaches both lists and their empty states, then opens the remote form to check the APT-only fields render, since those are what the shared form gained for this plugin. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
pulp#363 has landed, so drop the copy this branch was carrying and use the shared component. The deb sync action goes from 154 lines to 64. The one thing deb needs that ansible and file do not is the mirror switch starting off, so the component takes a defaultMirror prop that defaults to what the other two have always sent. Their behaviour is unchanged. A boolean rather than a params object deliberately: the effect that resets the switches has to depend on it, and an object prop would either lie about that dependency or, passed as a literal, reset the switches on every render. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
9ce27a7 to
159ea94
Compare
Redtigercod4
left a comment
There was a problem hiding this comment.
Thanks for the work on adding deb support and addressing the changes. I will speak to the core team regarding releasing this in the near future.
|
Done -- #363 merged yesterday, so this branch is rebased on main and now uses the shared One addition to the shared component: deb wants the mirror switch starting off, since that is what It is a boolean rather than a sync-params object on purpose. The effect that resets the switches has to depend on whatever carries that default, and an object prop would either lie about that dependency or, passed as a literal at the call site, reset the switches on every render. If you would rather it were an object, or want the mirror default handled some other way, happy to change it. 159ea94. Green in CI. |
|
@ggainey Happy with the reviewed changes. Please feel free to merge. |
ggainey
left a comment
There was a problem hiding this comment.
Good work, good discussion - thanks for the contribution and the responsiveness, both of you!
* Add deb repository and remote pages Adds a "Pulp deb" menu section with Repositories and Remotes, mirroring the structure of Pulp file: list, detail and edit for each, plus the versions and distributions tabs on a repository. Deliberately scoped to repositories and remotes. Publications are left out because deb has two publication endpoints rather than a field -- publications/deb/apt generates fresh metadata and needs a signing service, publications/deb/verbatim republishes upstream's Release byte for byte -- so a publications tab needs a design decision rather than just wiring. Content browsing is left out for the same reason: deb has a dozen content endpoints where rpm has one. RemoteForm gains the APT fields, which have no equivalent in the other plugins: distributions (suites), components, architectures, gpgkey, and the sync_sources/sync_udebs/sync_installer switches. `distributions` is added to requiredFields for deb only -- pulp_deb answers a remote without it with "This field is required.", unlike every other plugin where url alone is enough. gpgkey reuses the FileUpload treatment the certificate fields already use, since it is an armoured key file. The remaining changes are registry entries: plugin2api, the plugin unions on LazyRepositories/LazyDistributions/RepositoryForm, and the deb-only fields on the shared RemoteType. All are additive; ansible, container and file behaviour is unchanged. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Page through the distributions of a deb repository being deleted The lookup asked for the first hundred and left a TODO for the rest, so deleting a repository with more distributions than that would leave the excess pointing at a repository that no longer exists. Walk the pages until as many have been collected as `count` reports, stopping early on an empty page so a disagreeing count cannot loop. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Default a deb sync to mirror: false, as pulp_deb does Opening the sync modal offered to mirror, which deletes local content the remote no longer has. The API's own default is the non-destructive one and the modal should agree with it, so the deletion is opted into. The value was written out three times; it is now one constant, which is also where the divergence from ansible and file is explained. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Turn an empty deb detail lookup into a not-found rejection Both detail pages read results[0] straight out of the response, which throws on any unexpected shape, and past page-with-tabs' catch that leaves the page loading with nothing to show. Read the first result defensively instead. The comment claimed the API returns a 404; it returns 200 and an empty list, and it is this code that synthesizes the 404. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Collapse the deb repository breadcrumb branches Three entries tested the same tab and were filtered back out again when the answer was no. It is one decision -- which crumbs the versions tab adds -- so make it once. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Resolve the remote API through plugin2api Three chained ternaries picked the remote API by plugin, repeating the same list call in each branch. plugin2api already maps a plugin to its repository and distribution APIs, so add the remote API there and let the form ask for it: one switch to extend when a plugin is added, not a conditional to unpick. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Stop stubbing hasObjectPermission on deb distributions The stub answered true to every permission. Nothing in this list is gated on one, and an apt repository carries no my_permissions field for the ansible-style check to read, so copying that check would answer no to everyone instead. Leave the permission out and say why, so an action added later gets a real check rather than a stub that always agrees. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Describe the deb remote and repository as interfaces Both types hold property declarations only, with no constructor, no methods and no instantiation, which is what an interface is for. Also fixes a typo in the smartUpdate comment. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Add smoke tests for the deb pages Reaches both lists and their empty states, then opens the remote form to check the APT-only fields render, since those are what the shared form gained for this plugin. Refs pulp#277 Assisted By: Cursor (Claude Opus 5) * Take the shared SyncModal for the deb sync action shared component. The deb sync action goes from 154 lines to 64. The one thing deb needs that ansible and file do not is the mirror switch starting off, so the component takes a defaultMirror prop that defaults to what the other two have always sent. Their behaviour is unchanged. A boolean rather than a params object deliberately: the effect that resets the switches has to depend on it, and an object prop would either lie about that dependency or, passed as a literal, reset the switches on every render. Refs pulp#277 Assisted By: Cursor (Claude Opus 5)
Addresses part of #277 (deb in the side menu).
Draft on purpose — I asked three scoping questions in #277 and haven't heard back yet. This is here so there's something concrete to react to rather than to pre-empt the answers. Happy to cut it down, extend it, or restructure it entirely.
What this adds
A
Pulp debmenu section gated onhasPlugin('deb'), with Repositories and Remotes, mirroringPulp file:remotes/deb/aptrepositories/deb/aptWhat it deliberately leaves out
publications/deb/aptgenerates fresh metadata and needs a signing service to be consumable, whilepublications/deb/verbatimrepublishes upstream'sRelease/InReleasebyte for byte so an ordinaryubuntu-archive-keyringverifies it. A publications tab has to either show both or ask which to create, which is a design decision rather than wiring, so it seemed better to agree it first.content/deb/packagesis the useful one, but there are a dozen deb content endpoints where rpm has one. Easy follow-up once the shape here is agreed.The one place deb genuinely differs from file
RemoteFormneeded the APT fields, which have no equivalent elsewhere:distributions(suites),components,architectures,gpgkey, and thesync_sources/sync_udebs/sync_installerswitches.distributionsis required, for deb only. Every other plugin's remote needs just a URL; pulp_deb rejects one without suites:So
requiredFieldsbecomes conditional.gpgkeyreuses theFileUploadtreatmentca_certandclient_certalready get, since it's an armoured key file rather than a one-line value.Everything else is registry entries —
plugin2api, the plugin unions onLazyRepositories/LazyDistributions/RepositoryForm, and deb-only optional fields on the sharedRemoteType. All additive; ansible, container and file behaviour is unchanged (theRemoteFormdiff is worth a look on that point specifically).Testing
Verified against a live pulpcore 3.116.0 / pulp_deb 3.10.0 mirroring Ubuntu noble, with the dev server proxied at it (
API_PROXY):ordering/name__icontains/pulp_label_select/remotefilters,…/versions/,…/versions/?number=N, anddistributions/deb/apt/?repository=<href>DebRemoteEditsends → 201; thesmartUpdatePUT with all APT fields → 202, and the fields read back verbatimpluginRepositoryBasePath('deb', …)resolves the base_path the Repository URL field showsnpm run lint:js,lint:ts,lint:ls, thethis-without-classcheck andnpm run buildare all clean (build warnings unchanged at 18, all pre-existing bundle-size ones). NoCHANGES.mdentry, since that's generated from PR titles at release.Two things I'd flag for review
SyncModal.ansible-repository-sync.tsxandfile-repository-sync.tsxalready carry identical copies and I've followed suit rather than refactoring inside a feature PR. Happy to extract all three into a shared component, here or separately, if you'd prefer.mirrordefaults totruein the sync modal, matching the other plugins, though pulp_deb's own API default isfalse. I kept UI consistency, but say the word and I'll flip it — mirroring is the destructive direction.@bmbouter @himdel @dkliban @ipanova