You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by ar...@apache.org on 2026/05/14 14:39:01 UTC

(tooling-trusted-releases) branch arm updated: #1240 - add updated date and by to project and committee.

This is an automated email from the ASF dual-hosted git repository.

alitheg pushed a commit to branch arm
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git


The following commit(s) were added to refs/heads/arm by this push:
     new fc01da35 #1240 - add updated date and by to project and committee.
fc01da35 is described below

commit fc01da353ccedaceaf16acba243d815cef3317ff
Author: Alastair McFarlane <ar...@apache.org>
AuthorDate: Thu May 14 15:38:40 2026 +0100

    #1240 - add updated date and by to project and committee.
---
 atr/datasources/apache.py                       | 24 ++++++++++-----
 atr/get/projects.py                             | 10 +++++++
 atr/models/sql.py                               |  6 ++++
 atr/storage/writers/policy.py                   |  4 +++
 atr/storage/writers/project.py                  | 17 ++++++++++-
 atr/templates/committee-view.html               |  5 ++++
 migrations/versions/0082_2026.05.14_a1b2c3d4.py | 39 +++++++++++++++++++++++++
 7 files changed, 97 insertions(+), 8 deletions(-)

diff --git a/atr/datasources/apache.py b/atr/datasources/apache.py
index a00c8470..36ae5c21 100644
--- a/atr/datasources/apache.py
+++ b/atr/datasources/apache.py
@@ -471,6 +471,8 @@ async def _update_committees(
         if committee_info:
             committee.charter = committee_info.charter
 
+        committee.updated = datetime.datetime.now(datetime.UTC)
+        committee.updated_by = "bootstrap"
         updated_count += 1
 
     return added_count, updated_count
@@ -519,6 +521,9 @@ async def _update_podlings(
         else:
             log.warning(f"could not find ldap data for podling {podling_name}")
 
+        ppmc.updated = datetime.datetime.now(datetime.UTC)
+        ppmc.updated_by = "bootstrap"
+
         podling = await data.project(key=podling_name).get()
         if not podling:
             # Create the associated podling project
@@ -530,6 +535,8 @@ async def _update_podlings(
 
         podling.name = podling_data.name.removesuffix(" (Incubating)")
         podling.committee = ppmc
+        podling.updated = datetime.datetime.now(datetime.UTC)
+        podling.updated_by = "bootstrap"
         # TODO: Why did the type checkers not detect this?
         # podling.is_podling = True
 
@@ -572,15 +579,14 @@ async def _update_projects(data: db.Session, projects: ProjectsData) -> tuple[in
             continue
 
         project_model = await data.project(key=project_key).get()
+        if project_model:
+            continue
+
         # Check whether the project is retired, whether temporarily or otherwise
         status = _project_status(pmc, project_key, project_status)
-        if not project_model:
-            project_model = sql.Project(key=project_key, committee=pmc, status=status)
-            data.add(project_model)
-            added_count += 1
-        else:
-            project_model.status = status
-            updated_count += 1
+        project_model = sql.Project(key=project_key, committee=pmc, status=status)
+        data.add(project_model)
+        added_count += 1
 
         # Pass the project name through the validator
         safe.ProjectKey(project_model.key)
@@ -596,6 +602,8 @@ async def _update_projects(data: db.Session, projects: ProjectsData) -> tuple[in
         project_model.mailing_lists = project_status.mailing_list
         project_model.repository = _doap_repository_urls(project_status.repository)
         project_model.standards = [str(impl.url) for impl in project_status.implements if impl.url]
+        project_model.updated = datetime.datetime.now(datetime.UTC)
+        project_model.updated_by = "bootstrap"
 
     return added_count, updated_count
 
@@ -628,5 +636,7 @@ async def _update_tooling(data: db.Session) -> tuple[int, int]:
     tooling_committee.committers = tooling_users
     tooling_committee.release_managers = tooling_users
     tooling_committee.is_podling = False
+    tooling_committee.updated = datetime.datetime.now(datetime.UTC)
+    tooling_committee.updated_by = "bootstrap"
 
     return added_count, updated_count
diff --git a/atr/get/projects.py b/atr/get/projects.py
index 118a58f6..22d4349c 100644
--- a/atr/get/projects.py
+++ b/atr/get/projects.py
@@ -191,6 +191,16 @@ async def view(
         else "",
     ]
     page.append(title_row)
+    if project.updated:
+        page.append(
+            htm.div(".row.mb-2")[
+                htm.div(".col")[
+                    htm.p(".text-muted.small.mb-0")[
+                        f"Last updated {project.updated.strftime('%Y-%m-%d')} by {project.updated_by or 'unknown'}"
+                    ]
+                ]
+            ]
+        )
     page.append(_render_project_label_card(project))
     page.append(_render_pmc_card(project))
     page.append(_render_description_card(project))
diff --git a/atr/models/sql.py b/atr/models/sql.py
index f60e8b23..6e059805 100644
--- a/atr/models/sql.py
+++ b/atr/models/sql.py
@@ -700,6 +700,9 @@ class Committee(sqlmodel.SQLModel, table=True):
         back_populates="committees", link_model=KeyLink
     )
 
+    updated: datetime.datetime | None = sqlmodel.Field(default=None, sa_column=sqlalchemy.Column(UTCDateTime))
+    updated_by: str | None = sqlmodel.Field(default=None)
+
     @property
     def display_name(self) -> str:
         """Get the display name for the committee."""
@@ -789,6 +792,9 @@ class Project(sqlmodel.SQLModel, table=True):
     )
     created_by: str | None = sqlmodel.Field(default=None, **example("user"))
 
+    updated: datetime.datetime | None = sqlmodel.Field(default=None, sa_column=sqlalchemy.Column(UTCDateTime))
+    updated_by: str | None = sqlmodel.Field(default=None)
+
     @property
     def display_name(self) -> str:
         """Get the display name for the Project."""
diff --git a/atr/storage/writers/policy.py b/atr/storage/writers/policy.py
index c8c019ba..f7d59c29 100644
--- a/atr/storage/writers/policy.py
+++ b/atr/storage/writers/policy.py
@@ -335,6 +335,10 @@ class CommitteeMember(CommitteeParticipant):
         await self.__commit_and_log(str(str(project_key)))
 
     async def __commit_and_log(self, project_key: str) -> None:
+        project = await self.__data.project(key=project_key).get()
+        if project:
+            project.updated = datetime.datetime.now(datetime.UTC)
+            project.updated_by = self.__asf_uid
         await self.__data.commit()
         self.__write_as.append_to_audit_log(
             asf_uid=self.__asf_uid,
diff --git a/atr/storage/writers/project.py b/atr/storage/writers/project.py
index 577739c5..f2df7674 100644
--- a/atr/storage/writers/project.py
+++ b/atr/storage/writers/project.py
@@ -114,6 +114,8 @@ class CommitteeMember(CommitteeParticipant):
             project.category = ", ".join(current_categories)
             if project.category == "":
                 project.category = None
+            project.updated = datetime.datetime.now(datetime.UTC)
+            project.updated_by = self.__asf_uid
             await self.__data.commit()
             self.__write_as.append_to_audit_log(
                 asf_uid=self.__asf_uid,
@@ -135,6 +137,8 @@ class CommitteeMember(CommitteeParticipant):
             project.category = ", ".join(current_categories)
             if project.category == "":
                 project.category = None
+            project.updated = datetime.datetime.now(datetime.UTC)
+            project.updated_by = self.__asf_uid
             await self.__data.commit()
             self.__write_as.append_to_audit_log(
                 asf_uid=self.__asf_uid,
@@ -185,6 +189,7 @@ class CommitteeMember(CommitteeParticipant):
         if await self.__data.project(key=label).get():
             raise storage.AccessError(f"Project {label} already exists", status=409)
 
+        now = datetime.datetime.now(datetime.UTC)
         project = sql.Project(
             key=label,
             name=display_name,
@@ -194,8 +199,10 @@ class CommitteeMember(CommitteeParticipant):
             category=super_project.category if super_project else None,
             programming_languages=super_project.programming_languages if super_project else None,
             committee_key=str(committee_key),
-            created=datetime.datetime.now(datetime.UTC),
+            created=now,
             created_by=self.__asf_uid,
+            updated=now,
+            updated_by=self.__asf_uid,
         )
         if super_project and super_project.release_policy:
             project.release_policy = super_project.release_policy.duplicate()
@@ -236,6 +243,8 @@ class CommitteeMember(CommitteeParticipant):
         project.mailing_lists = str(form.mailing_lists) if form.mailing_lists else None
         project.repository = list(form.repository)
         project.standards = list(form.standards)
+        project.updated = datetime.datetime.now(datetime.UTC)
+        project.updated_by = self.__asf_uid
 
         await self.__data.commit()
         self.__write_as.append_to_audit_log(
@@ -257,6 +266,8 @@ class CommitteeMember(CommitteeParticipant):
             project.programming_languages = ", ".join(current_languages)
             if project.programming_languages == "":
                 project.programming_languages = None
+            project.updated = datetime.datetime.now(datetime.UTC)
+            project.updated_by = self.__asf_uid
             await self.__data.commit()
             self.__write_as.append_to_audit_log(
                 asf_uid=self.__asf_uid,
@@ -276,6 +287,8 @@ class CommitteeMember(CommitteeParticipant):
             project.programming_languages = ", ".join(current_languages)
             if project.programming_languages == "":
                 project.programming_languages = None
+            project.updated = datetime.datetime.now(datetime.UTC)
+            project.updated_by = self.__asf_uid
             await self.__data.commit()
             self.__write_as.append_to_audit_log(
                 asf_uid=self.__asf_uid,
@@ -302,6 +315,8 @@ class CommitteeMember(CommitteeParticipant):
                     **policy_args.model_dump(exclude_unset=True),
                 )
                 await self.__write_as.policy._edit_policy_no_commit(args.project_key, policy_update)
+            project.updated = datetime.datetime.now(datetime.UTC)
+            project.updated_by = "API"
             await self.__data.commit()
         except sqlalchemy.exc.IntegrityError as e:
             await self.__data.rollback()
diff --git a/atr/templates/committee-view.html b/atr/templates/committee-view.html
index c7e0df3e..868522f6 100644
--- a/atr/templates/committee-view.html
+++ b/atr/templates/committee-view.html
@@ -6,6 +6,11 @@
 
 {% block content %}
   <h1>{{ committee.display_name }}</h1>
+  {% if committee.updated %}
+    <div class="row mb-2">
+      <p class="text-muted small">Last updated {{ committee.updated.strftime("%Y-%m-%d") }} by {{ committee.updated_by or "unknown" }}</p>
+    </div>
+  {% endif %}
 
   {% if committee.charter %}
     <div class="card mb-4">
diff --git a/migrations/versions/0082_2026.05.14_a1b2c3d4.py b/migrations/versions/0082_2026.05.14_a1b2c3d4.py
new file mode 100644
index 00000000..27d49eb4
--- /dev/null
+++ b/migrations/versions/0082_2026.05.14_a1b2c3d4.py
@@ -0,0 +1,39 @@
+"""add updated and updated_by to committee and project
+
+Revision ID: 0082_2026.05.14_a1b2c3d4
+Revises: 0081_2026.05.13_03b12df9
+Create Date: 2026-05-14 11:30:00.000000+00:00
+"""
+
+from collections.abc import Sequence
+
+import sqlalchemy as sa
+from alembic import op
+
+import atr.models.sql as sql
+
+# Revision identifiers, used by Alembic
+revision: str = "0082_2026.05.14_a1b2c3d4"
+down_revision: str | None = "0081_2026.05.13_03b12df9"
+branch_labels: str | Sequence[str] | None = None
+depends_on: str | Sequence[str] | None = None
+
+
+def upgrade() -> None:
+    with op.batch_alter_table("committee", schema=None) as batch_op:
+        batch_op.add_column(sa.Column("updated", sql.UTCDateTime(timezone=True), nullable=True))
+        batch_op.add_column(sa.Column("updated_by", sa.String(), nullable=True))
+
+    with op.batch_alter_table("project", schema=None) as batch_op:
+        batch_op.add_column(sa.Column("updated", sql.UTCDateTime(timezone=True), nullable=True))
+        batch_op.add_column(sa.Column("updated_by", sa.String(), nullable=True))
+
+
+def downgrade() -> None:
+    with op.batch_alter_table("project", schema=None) as batch_op:
+        batch_op.drop_column("updated_by")
+        batch_op.drop_column("updated")
+
+    with op.batch_alter_table("committee", schema=None) as batch_op:
+        batch_op.drop_column("updated_by")
+        batch_op.drop_column("updated")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org