Repository navigation
feat(publish): let a destination declare its own expiry choices - #32264
KiroCrewCaptain merged 1 commit into
Conversation
|
@cruisercohen the workflow runs for this fork PR are waiting for maintainer approval (every check on head 7c336f5 shows |
7c336f5 to
5a4bb94
Compare
5a4bb94 to
98e8d6f
Compare
There was a problem hiding this comment.
Approving head 98e8d6f5b4. Since this touches publish and sharing, I checked whether an expiry can make a published artifact public longer or wider than intended. It can't:
- Wider: expiry is a separate field.
visibilityandshared_withgo through_validate_sharing_bodyexactly as before, and nothing in the expiry path reads or changes them. - Longer than declared:
_validate_expiry_bodyaccepts only a positiveintornull(bool, float, string and"default"are a 400).resolve_expirationrefuses any period the destination didn't declare, andnullunless it declaresallows_no_expiration._first_publish_expiryruns beforeensure_ready()and the upload, so a refused value uploads nothing (test_an_undeclared_choice_uploads_nothing). - Extended later: a re-publish never sends
expires_in_days, so it can't lengthen a lifetime (test_a_republish_ignores_the_expiry_and_stays_idempotent). - Destinations without choices: they get no keyword, and an explicit expiry to them is a 400 (
test_a_provider_without_choices_refuses_an_explicit_expiry). expires_atis display-only. A provider-reported value is kept only if it parses as a timestamp, then re-serialized.
On this head: test/test_publish*.py gave 468 passed, and PublishHub.expiryChoice + PublishHub.ttlLeak gave 16 passed.
One non-blocking note: when a destination declares allows_no_expiration with default_expiration_days=None, a publish without the key never expires. That is the destination's declared default and the panel preselects it, so it's consistent. A destination author should know that "Never" becomes the silent default for API callers.
AI-assisted, sent by CommunityCrew
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The chosen expiry now reaches Notes
[DESIGN-REVIEWED] fe9b186 Description read[DESCRIPTION-READ] a0ef1f550983368a8ef22461c05ee189dfaecda4e40dbb82ba72f28419621236 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing blocks. Every control this PR adds has a screenshot: the "Expires" select with and without "Never", the confirm-step line, and the 90-day acknowledgment. No blind reader has read them, because this lane reviews a fork; pushing the branch to this repository runs one. Notes
[UX-REVIEWED] fe9b186 Description read[DESCRIPTION-READ] a1ee42c6ee1d3de658f81332eb325d1d8414c5b325357645d5ff291703854abb That sha256 names everything this verdict read: the PR description, plus the 8 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Issue #32192 is linked, the new path is reached only by a destination that declares choices, and the TTL pin it rewrites is explained in the description's Notes
What this change shipsInventory (8 items) — 6 justifiedIntent: let a user choose how long a published link lives, from the periods the destination supports, and have that choice reach the destination. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] fe9b186 Description read[DESCRIPTION-READ] 685945b499ca93654c32093cd324b7e572b5b5746283bcc45b15e203feb9dcdb That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
@koushikginjupally my approval stands on the safety side. The First Principles lane BLOCKs on Two ways forward: drop AI-assisted, sent by CommunityCrew |
bolichen97
left a comment
There was a problem hiding this comment.
Changing my approval to a change request so the PR state matches the First Principles BLOCK, which I checked and agree with.
On head 98e8d6f5b4, the new publication expires_at is written (ArtifactPublication.expires_at, PublishResult.expires_at, _expiry_time, parse_publication, _publication_summary) and typed on the frontend (index.artifacts.ts), but nothing reads it. The existing expires_at readers in WebAppArtifactCard.tsx and ArtifactDeployPage.tsx read the web-app deploy lifecycle, a different field. The lane's second point holds too: supports_expiration is now "descriptive only" and could be derived from expiration_choices_days instead of being a second declaration.
Either of these clears it:
- Drop
expires_at(the record field, thePublishResultfield,_expiry_timeand the summary key) from this PR, and add it with the change that shows it; or - Add the reader in this PR, for example the Publish panel showing when the link expires, so the field ships with a use.
My safety review is unchanged: the expiry still can't make an artifact public longer or wider than intended. I'll re-approve once the lane passes.
AI-assisted, sent by CommunityCrew
|
@koushikginjupally the GPT lane now has a second blocker, and its adjudication upheld it. I agree with it, so it belongs to my change request too. Two panels publish the same unpublished artifact. One picks "Never", the other confirms 30 days. The second request takes the re-publish branch in Fix, per the lane: when AI-assisted, sent by CommunityCrew |
98e8d6f to
fe9b186
Compare
|
self-added: yes
|
|
self-added: yes
|
|
@bolichen97 thanks for the safety review and the change request. Both points are addressed in
I also fixed the three contract tests CI flagged (facade manifest and inventory for the new names), and added the screenshots the UX lane asked for: the "Never" option, the confirm step with "Expires: Never", and the public acknowledgment naming the period. One thing I left out on purpose: once a destination removes an expired page, Kiro Crew still shows it as published. That already happens today for any destination with a built-in lifetime, so it isn't introduced here, and fixing it means making the published state expiry-aware. Happy to open an issue for that if you agree it should be tracked. The fork workflow runs on the new head will need approval again. Thanks. |
Code change approver recommendation: A person should decideWhy: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 908 lines, more than the 400 it may approve on its own. The PR adds destination-declared expiry choices end to end, and every path holds up. SharingModel validates its declaration and fills in supports_expiration itself, which works because the dataclass is not frozen. The route accepts only a positive int, null or no key. publish_sync checks the value against the destination's declaration and passes the keyword only to destinations that declare choices, so personal_drive and older providers keep their signature. An expiry named on a re-publish is refused with a 409 inside the per-artifact lock, which fixes the earlier lane's race finding. Errors map to 400/409 through the existing _sync_error_response. In the panel, built-in rows drop the deploy TTL control, which never applied anything since the built-in publish carries no ttl_hours. The expiry choice is offered only on a first publish, is derived per row so a pick doesn't carry over to another row, and is named in the acknowledgment. All 13 catalogs, both plural keys and the facade inventory are updated, and the new tests would fail without the change. No blocking issues found. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
bolichen97
left a comment
There was a problem hiding this comment.
Approving head fe9b186433, which replaces my change request. Both items are fixed:
expires_atis gone from the record,PublishResultand the summary, andsupports_expirationis now derived fromexpiration_choices_days.- A re-publish that names an expiry raises
PublishConflictErrorbefore any content moves.test_two_first_publishes_racing_cannot_both_report_their_expirypins the two-panel race.
test_publish_expiry_choice.py + test_publish_sync.py gave 112 passed on this head. First Principles, GPT, Opus, UX, Design and Security Scope all pass. I'll merge it once PR Readiness passes.
AI-assisted, sent by CommunityCrew
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Reviewed on fe9b186. I traced the whole publish path. _validate_expiry_body returns a 400 for a bool, string, fraction, zero or negative value. A re-publish that names an expiry gets a 409 inside the per-slug lock, before any upload. A first publish with a period the destination did not declare gets a 400, and nothing is uploaded. The new keyword goes only to a destination that declares choices. The backend expiry tests pass at this head, and deleting the 409 guard makes exactly the two tests the PR names fail. The branch merges cleanly with current main.
Done well: you cut expires_at when nothing read it and moved it to "Not a goal". The keyword is passed only to providers that opt in, so every existing publish() signature keeps working, and a test pins that.
Security: the new input is expires_in_days in the publish POST body. Its type and range are checked before dispatch. Governance still runs first, and error text is redacted and audited. The public-exposure acknowledgment still gates the publish the same way; only its wording changes when a numeric expiry is picked. No provider in this repository declares choices, so the public build behaves as before.
Optional:
- No test drives the rendered Expires select. Mocking
useIsTouchDeviceto true makes SimpleSelect render a native select (seeDefaultSessionFolderSetting.test.tsx). That would let one test pick 730 and "never" and check that the POST body carries 730 and null. - The 409 guard is pinned only for a numeric expiry. If you change it to let
Nonethrough, no test fails. Running the re-publish test with both 730 andNonewould pin both sides. - The
PublishProvider.publishdocstring says a declaring provider must "accept" the period. The acknowledgment tells the user the destination removes the link, so "accept and apply" would match that promise.
Problem / Motivation
Goal: A user can choose how long a published link lives, from the periods the destination itself supports, and that choice reaches the destination.
A publish provider can declare
SharingModel.supports_expiration = True, but nothing the user picks reaches it. For a built-in destination the Publish panel shows the deploy surface's "Persistent (no expiry)" / "72 hours (requires reaper)" control, then callsPOST /api/artifacts/{slug}/publishwith no TTL at all: neither the route,publish_sync.publish()norPublishProvider.publish()has a TTL argument. A destination with its own expiry model (for example a paste service that keeps pages for 30 to 730 days and has no "never" option) can honour neither choice, and a user who picks "Persistent" gets a page that disappears after the destination's default period.Why it matters
The control promises a lifetime that is never applied, so a link the user believes is permanent can vanish without warning, and a destination that does support several lifetimes cannot offer them. No provider in this repository sets
supports_expiration, so the defect is latent here; it shows up as soon as an edition registers one that does.Not a goal
update_sharingextension).SHAREDgrants.What changed (motivation → approach → change)
A destination now states the lifetimes it can give a publication, the panel offers exactly those, and the chosen one reaches
publish().publish_provider.py)SharingModelgainsexpiration_choices_days,allows_no_expirationanddefault_expiration_days, and refuses an inconsistent declaration when built.supports_expirationfollows the choices unless a provider sets it, so expiry is declared once.publish_sync.py)publish()takesexpires_in_days(days,Nonefor no expiry, or the destination default). It refuses an undeclared value with a 400, and any expiry on a re-publish with a 409, both before anything is uploaded, and passes the period toPublishProvider.publish()only for a destination that declares choices.publish_sharing.py,handlers/artifacts.py)expires_in_days; a malformed value is a 400. The provider list carries the three new fields.PublishHub.tsx,api/client/artifacts.ts,types/index.artifacts.ts)expires_in_daysonly on a first publish to a row that offers a choice.A re-publish that names an expiry comes from a panel that saw the artifact unpublished, for example two panels racing the first publish. Refusing it makes that panel reload instead of reporting a lifetime the destination never received. Passing the keyword only to a destination that declares choices keeps every existing provider's
publish()signature valid. I chose a short declared list over a free-form day count because a list is easy to label and translate and cannot drift from what the destination accepts. The new strings are in every catalog (en-XA.jsonregenerated, both plural bases registered inpluralKeys.json), anddocs/system-specs/modules/artifacts.mddocuments the contract.Backwards compatibility
Compatible: every new field has a default that means "no expiry choice", the route key is optional, and
publish()is called with the new keyword only when a destination declares choices.supports_expirationdefaults to following the choices, which isFalsewhen none are declared, and an explicit value is kept, sopersonal_drive(which setsFalse) and edition providers that set it keep the same value.Reader: website/src/components/PublishHub.tsx:ttlSelectableFor -- app -- PublishHub.ttlLeak.test.tsx (a built-in row no longer gets the deploy TTL control; no core publish ever carried
ttl_hours, so that control never applied anything)Reader: src/kiro_crew/dashboard/handlers/artifacts_parts/publish_sharing.py:_sharing_model_dict -- app -- test_publish_expiry_choice.py::test_the_provider_list_carries_the_choices (
supports_expirationis still always a bool on the wire)Tests
test/test_publish_expiry_choice.py: an inconsistent declaration is refused;supports_expirationfollows the choices, keeps an explicit value and refusesFalsebeside declared choices; the default, a picked period and no expiry reach the provider; an undeclared period or no expiry uploads nothing; a provider with the oldpublish()signature still publishes and refuses an explicit expiry; a re-publish naming an expiry is a conflict and moves no content, while one without still pushes; two first publishes racing with different expiries end with one publication and one conflict, in either order; the route passes absent, a number andnull, and rejects a string, a bool, zero, a negative and a fraction; the provider list carries the fields. With the 409 guard removed, the re-publish and race tests fail.website/src/test/PublishHub.expiryChoice.test.tsx: the option list and fallback rules, the control and the default sent, no key sent when nothing is declared or on a re-publish, and the period in the acknowledgment.website/src/test/PublishHub.ttlLeak.test.tsx: a built-in row that declaressupports_expirationno longer gets the deploy TTL control or its 72 hours. With the oldttlSelectableForrestored and the expiry dropped from the request, 4 tests across both files fail.Determinism,
test/test_publish_expiry_choice.py: 20 runs at-n0, 10 at-n 4 --dist loadgroup --max-worker-restart=2besidetest_publish_sync.pyandtest_artifact_publish_picker.py, and all node ids in a shuffled order: all green.Manual verification
The Publish panel was driven in the real built SPA behind the repository's stubbed fixture server (
website/scripts/lib/serve-dist.mjs), with a built-in destination declaring 30/90/365/730 days. The public repository has no provider that declares expiry choices, so a live publish was not run.Screenshots / video
The "Expires" control on a first publish, open:
The confirm step repeating the picked period:
A destination that allows no expiry lists "Never", and the confirm step repeats it:
On a public destination the acknowledgment names the period:
Related Issues
Closes #32192
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.