asf-tooling commented on issue #936:
URL: 
https://github.com/apache/tooling-trusted-releases/issues/936#issuecomment-4409963439

   <!-- gofannon-issue-triage-bot v2 -->
   
   **Automated triage** — analyzed at `main@2da7807a`
   
   **Type:** `new_feature`  •  **Classification:** `actionable`  •  
**Confidence:** `low`
   **Application domain(s):** `release_lifecycle`, 
`project_committee_management`
   
   ### Summary
   The issue requests updating the start release form (atr/shared/start.py and 
atr/get/start.py) to incorporate project-level 'cycles' and 'version schemas' 
settings. Currently the StartReleaseForm only collects a free-text version_key 
field. The issue implies these project settings already exist (described as 
'new project settings'), but they are not visible in any of the provided source 
files — neither in the SQL model excerpts, the project forms, nor the start 
release form. Without seeing the full atr/models/sql.py, it's unclear whether 
these fields have already been added to the Project model or still need to be 
created.
   
   ### Where this lives in the code today
   
   #### `atr/shared/start.py` — `StartReleaseForm` (lines 24-38)
   _needs modification_
   This is the form model that needs to be extended with cycle and version 
schema awareness.
   
   ```python
   class StartReleaseForm(form.Form):
       version_key: str = form.label(
           "Version",
           "Enter the version string for this new release."
           " This cannot be changed later, and must be the version of the 
finished release."
           " ATR generates a unique revision serial number for each voting 
round,"
           " and you can also set your own tag before a vote starts.",
       )
   
       @pydantic.field_validator("version_key", mode="after")
       @classmethod
       def validate_version_key(cls, value: str) -> str:
           if error := util.version_key_error(value):
               raise ValueError(error)
           return value
   ```
   
   #### `atr/get/start.py` — `selected` (lines 37-53)
   _needs modification_
   The GET handler that renders the start page; would need to pass cycle/schema 
info to the template.
   
   ```python
   @get.typed
   async def selected(session: web.Committer, _start: Literal["start"], 
project_key: safe.ProjectKey) -> str:
       """
       URL: /start/<project_key>
       """
       await session.prevent_confusing_ui_display(project_key)
       async with db.session() as data:
           project = await data.project(key=str(project_key), 
status=sql.ProjectStatus.ACTIVE).demand(
               base.ASFQuartException(f"Project {project_key} not found", 
errorcode=404)
           )
   
       releases = await interaction.all_releases(project)
       content = await _render_page(project, releases)
       return await template.blank(
           title=f"Start a new release for {project.display_name}",
           content=content,
       )
   ```
   
   #### `atr/get/start.py` — `_render_page` (lines 92-109)
   _needs modification_
   The render function where the form is displayed; would need to incorporate 
cycle selection and version schema guidance.
   
   ```python
   async def _render_page(project: sql.Project, releases: list[sql.Release]) -> 
htm.Element:
       page = htm.Block()
   
       page.h1[f"Start a new release for {project.display_name}"]
       page.p[
           "Starting a new release creates a ",
           htm.strong["release candidate draft"],
           ". You can then add files to this draft before promoting it for 
voting.",
       ]
       await form.render_block(
           page,
           model_cls=shared.start.StartReleaseForm,
           form_classes=".atr-canary.py-4.px-5.border.rounded",
           submit_classes="btn-primary btn-lg",
           submit_label="Start new release",
           cancel_url=util.as_url(root.index),
           defaults={"project_key": project.key},
       )
   ```
   
   #### `atr/post/start.py` — `selected` (lines 30-57)
   _needs modification_
   The POST handler that would need to pass cycle information when starting a 
release.
   
   ```python
   @post.typed
   async def selected(
       session: web.Committer,
       _start: Literal["start"],
       project_key: safe.ProjectKey,
       start_release_form: shared.start.StartReleaseForm,
   ) -> web.WerkzeugResponse:
       """
       URL: /start/<project_key>
       """
   
       try:
           async with storage.write(session) as write:
               wacp = await write.as_project_committee_participant(project_key)
               new_release, _project = await wacp.release.start(
                   project_key,
                   safe.VersionKey(start_release_form.version_key),
               )
   
           return await session.redirect(
               get.compose.selected,
               project_key=str(project_key),
               version_key=new_release.version,
               success="Release candidate draft created successfully",
           )
       except (web.FlashError, base.ASFQuartException) as e:
           await quart.flash(str(e), "error")
           return await session.redirect(get.start.selected, 
project_key=str(project_key))
   ```
   
   ### Where new code would go
   - `atr/shared/start.py` — after symbol StartReleaseForm
     The form model needs new fields for cycle selection (e.g., a 
dropdown/select) and possibly version schema validation logic.
   - `atr/models/sql.py` — new file
     If cycle and version_schema fields don't already exist on the Project 
model, they need to be added there.
   
   ### Proposed approach
   The start release form needs to incorporate project cycles (likely a 
dropdown or select field allowing the user to pick which release cycle this 
version belongs to) and version schemas (likely a validation constraint that 
enforces a specific version format configured at the project level). The 
implementation would: (1) ensure the Project model in atr/models/sql.py has 
cycle and version_schema fields, (2) add a cycle_key field to StartReleaseForm 
in atr/shared/start.py, (3) update version_key validation to respect the 
project's configured version schema, (4) update the GET handler in 
atr/get/start.py to fetch cycle options from the project and pass them as form 
defaults/choices, (5) update the POST handler in atr/post/start.py to pass the 
selected cycle when starting the release.
   
   However, without seeing the full sql.py model and without any discussion 
comments clarifying what 'cycles' and 'version schemas' mean concretely (e.g., 
are cycles like '2.x', '3.x' branches? are version schemas regex patterns?), 
the exact implementation details are uncertain.
   
   ### Open questions
   - What fields exist (or need to be added) on atr/models/sql.py Project model 
for 'cycles' and 'version schemas'? I don't have access to the full SQL model 
file.
   - What is a 'cycle' in this context — a release branch/series (e.g., '2.x'), 
a time-based cycle, or something else?
   - What is a 'version schema' — a regex pattern, a semver constraint, a named 
template (e.g., 'semver', 'calver'), or something else?
   - Should the cycle be a required field or optional? Should version schema 
validation replace or supplement the current util.version_key_error check?
   - Are there any related PRs or issues that introduce the project 
cycle/version schema model fields that this issue depends on?
   
   ### Files examined
   - `atr/shared/start.py`
   - `atr/get/start.py`
   - `atr/post/start.py`
   - `atr/shared/projects.py`
   - `atr/get/projects.py`
   - `atr/post/projects.py`
   - `atr/storage/writers/project.py`
   - `atr/storage/writers/revision.py`
   
   ---
   *Draft from a triage agent. A human reviewer should validate before merging 
any change. The agent did not run tests or verify diffs apply.*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to