Skip to content

Build Activity Stream links for inventory source sync schedules - #389

Merged
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:fix/activity-stream-schedule-links
Jun 12, 2026
Merged

Build Activity Stream links for inventory source sync schedules#389
cigamit merged 1 commit into
ctrliq:mainfrom
blaipr:fix/activity-stream-schedule-links

Conversation

@blaipr

@blaipr blaipr commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

The Activity Stream description for a schedule belonging to an inventory source sync hit an explicit throw new Error('activity.summary_fields to build this url not implemented yet') and fell back to plain unlinked text — every other schedule parent (job template, workflow job template, project) gets a clickable link.

The blocker was that the inventory-source schedule route (/inventories/inventory/<inventory_id>/sources/<id>/schedules/<schedule_id>/) needs the parent inventory id, which the activity stream serializer didn't provide.

  • API: ActivityStreamSerializer._summarize_parent_ujt now includes inventory_id when a schedule's parent unified job template is an InventorySource (the direct inventory_source summary gains it too, mirroring the existing group/inventory_id special case a few lines above).
  • UI: ActivityStreamDescription builds the link from summary_fields.inventory_source, falling back to plain text when the id is unavailable rather than relying on a thrown exception for control flow.

Tests: a functional API test asserting inventory_id is serialized for an inventory-source schedule activity, and two UI tests (link built with the right href; graceful plain-text fallback for unknown parents).

Independent of all open PRs — no dependency or lockfile changes.

ISSUE TYPE

  • Bug, Docs Fix or other nominal change

COMPONENT NAME

  • API
  • UI

ASCENDER VERSION

awx: 25.4.1.dev5+gcda0899.d20260610

ADDITIONAL INFORMATION

Reproduce on main: create a schedule on an inventory source, then open the Activity Stream — the schedule entry renders as plain text instead of a link (the throw is caught upstream).

py.test --create-db -n auto --dist=loadfile awx/main/tests/...   # 3477 passed
npm --prefix awx/ui run lint                                      # clean
npm --prefix awx/ui run test                                      # 544 suites, 2857 passed
npm --prefix awx/ui run build                                     # succeeds

The Activity Stream description for a schedule that belongs to an
inventory source sync hit an explicit 'not implemented yet' throw and
fell back to plain unlinked text, because the inventory-source schedule
url (/inventories/inventory/<inventory_id>/sources/<id>/schedules/...)
needs the parent inventory id, which the activity stream serializer did
not provide.

API: ActivityStreamSerializer._summarize_parent_ujt now includes
inventory_id when the schedule's parent unified job template is an
InventorySource (the direct inventory_source summary gains it too,
mirroring the existing group/inventory_id special case).

UI: ActivityStreamDescription builds the link from
summary_fields.inventory_source, and falls back to plain text when the
inventory id is unavailable instead of relying on the thrown exception.

Closes the first 'known bug' from the UI gaps list.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes Activity Stream rendering for schedules belonging to inventory source syncs by providing the missing parent inventory_id in the API serializer and updating the UI to build the correct inventory-source schedule URL (with a safe plain-text fallback when the URL can’t be constructed).

Changes:

  • API: Extend ActivityStreamSerializer schedule-parent summarization so inventory-source schedule activities include summary_fields.inventory_source[0].inventory_id.
  • UI: Teach ActivityStreamDescription to build /inventories/inventory/<inventory_id>/sources/<source_id>/schedules/<schedule_id>/ links for inventory-source schedules without relying on an exception path.
  • Tests: Add a functional API regression test and UI tests covering both link building and graceful fallback behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
awx/ui/src/screens/ActivityStream/ActivityStreamDescription.test.js Adds UI tests for inventory-source schedule link generation and plain-text fallback.
awx/ui/src/screens/ActivityStream/ActivityStreamDescription.js Adds inventory-source schedule URL building based on summary_fields.inventory_source.
awx/main/tests/functional/api/test_activity_streams.py Adds API functional test asserting inventory_id is serialized for inventory-source schedule activities.
awx/api/serializers.py Adds inventory_id to relevant Activity Stream summary serialization for inventory sources (including schedule-parent summarization).

@cigamit cigamit self-assigned this Jun 12, 2026
@cigamit cigamit added the bug Something isn't working label Jun 12, 2026

@cigamit cigamit left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and the name is now properly linked in Activity Stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

3 participants