Skip to content

Source URL missing from Evidences in Timeline #68

Open

Description

@melkuo

Describe the bug
There should be a "View Source URL" link for each evidence on a promise, in the timeline section. It seems to be missing for all promises. It should appear below the evidence description at the bottom of this screenshot:
Image

Activity

  1. added theissue type on Jul 16, 2025
  2. added
    bug
    good first issue
    on Jul 16, 2025
  3. self-assigned this
    on Jul 18, 2025
  4. githubedward commented on Jul 18, 2025

    @githubedward

    Looks like this issue is caused by source_url set to null

    Image
  5. removed their assignment
    on Jul 18, 2025
  6. melkuo commented on Jul 19, 2025

    @melkuo
    ContributorAuthor

    @githubedward perhaps the URL is not being passed through or it should be referencing another field?

    I do see it on Entries

    Image
  7. melkuo commented on Jul 20, 2025

    @melkuo
    ContributorAuthor
  8. githubedward commented on Jul 22, 2025

    @githubedward

    Two things to note here:

    1. There is a 2-month logic that basically checks selectedEvent.sourceUrl and renders the link if it is present. The selectedEvent is tied to the evidence type and not the promise.
    2. Recently, a change was made to render the sourceUrl as label instead of View Source text

    See file reference

    I believe the missing source_url from the JSON is a data issue. Once that is fixed, we can fix the rendering label to show View Source instead of the URL.

  9. added
    bug
    good first issue
    on Jul 28, 2025
  10. added theissue type on Jul 28, 2025
  11. thomas-hul commented on Jul 29, 2025

    @thomas-hul
    Contributor

    Taking a look into this

  12. self-assigned this
    on Jul 29, 2025
  13. thomas-hul commented on Jul 30, 2025

    @thomas-hul
    Contributor
    1. @githubedward is right about it being a data issue. The function that builds the component is looking for a source_url from an evidences item but you can see in our api at https://www.buildcanada.com/tracker/api/v1/evidences that there is no source_url as part of evidences params.
    const evidenceEvents: TimelineDisplayEvent[] =
          promise?.evidences?.map((evidence) => {
            // Create a brief description for the timeline node (max 60 chars)
            const briefDescription = evidence.title;
            return {
              id: `ev-${evidence.id}`,
              type: "evidence" as const,
              date: evidence.published_at || new Date().toISOString(),
              title: briefDescription, // Brief description for the node
              fullTitle: evidence.title,
              fullText: evidence.summary,
              sourceUrl: evidence.source_url,
              // evidenceSourceType: item.evidence_source_type, // Pass the source type
            };
          }) || [];
        events.push(...evidenceEvents);
    

    @melkuo based on your screenshot it looks like there is a URL under entries. Can you confirm if source_url is coming from the evidence object or the entry object?

    If it’s in entries, we’ll need to either update the frontend to pull from the correct place or adjust the API to include source_url in the evidence payload.

    1. I'm in the process of verifying if the source_url exists in our entries however when I try to access https://www.buildcanada.com/tracker/api/v1/entries the server times out. @xrendan is this just on my end?

    2. @xrendan looks like our seed data and live prod data are not in sync. I don't get anything when I hit localhost:3000/entries, activities, evidences but do on https://www.buildcanada.com/tracker/api/v1/activities. Can confirm that I have `localhost:3000/promises and departments seeding properly.

  14. melkuo commented on Jul 30, 2025

    @melkuo
    ContributorAuthor

    Thanks @verrixkio! I can confirm from looking at the production admin that all entries seem to have a url. I presume that the evidence source_url would be always be the same, so either of your solutions work.

    On #3, I can confirm also never been able to get entries, activities and evidences populated on my local cc @xrendan

  15. thomas-hul commented on Aug 1, 2025

    @thomas-hul
    Contributor

    @melkuo Got it, I'll pull it from the entries object when I refactor the frontend to fetch it, so no DB changes needed. Should have a PR soon.

  16. removed their assignment
    on Sep 17, 2025
  17. maxnorm commented on Sep 23, 2025

    @maxnorm
    Contributor

    Hi yall,

    can i get a clear explanation & update of this issue? Was it finally fix on the front-end or not?

    As what i'm understanding, we are missing source_url data when fetching the evidences from the API.

    Just want to know more before proposing a fix.

    Thanks

  18. melkuo commented on Sep 24, 2025

    @melkuo
    ContributorAuthor

    The issue is not fixed yet. This thread contains all the latest findings. Specifically, @verrixkio 's comment on July 29 is the latest as I understand it. Would be awesome if you could dig in from there!

  19. xrendan commented on Oct 2, 2025

    @xrendan
    Member

    the missing source_url issue was for the promises and not each piece of evidence. This one is separate.

  20. maxnorm commented on Oct 5, 2025

    @maxnorm
    Contributor

    @xrendan I saw your latest changes for including the source_url to the promises.

    Just to confirm, this issue for the source_url of the evidence? I think i found the root cause last weekend but didn't get time to dig deeper to confirm & test my changes.

    This issue is a bit hard to reproduce on dev/local env since we doesn't have evidence seed and what's seed for the promises under commitment_history_rationale doesn't include source_url values.

    I'll try to finish this today and submit a PR soon

  21. maxnorm commented on Oct 5, 2025

    @maxnorm
    Contributor

    The current evidence view work well?

    // app/views/evidences/_evidence.json.jbuilder
    
    json.(evidence.activity,
      :title,
      :summary,
      :source_url
      :published_at,
    )

    After creating a dummy evidence, activity & entry linked to the promise at ID 1, this is what i get from the API:
    Endpoint: /promises/1.json

    Image

    It's getting the Activity source_url related to the evidence.

    We can return the URL of the entry instead with this:

    json.(evidence.activity,
      :title,
      :summary,
      :published_at,
    )
    
    json.source_url evidence.activity.entry.url

    With the current view, i'm able to get the URL from a dummy evidence. Like i said on the previous comment, there is currently no evidences, activities and entries seed.

    Let me know your thought on what's next.

  22. xrendan commented on Oct 16, 2025

    @xrendan
    Member

    @maxnorm sorry for missing this. Would you be able to make a PR for that fix?

  23. maxnorm commented on Oct 18, 2025

    @maxnorm
    Contributor

    @xrendan Like i said in the previous comment, without any changes, the API call return the URL after creating dummy evidence, activity and entry via the admin panel.

    My suggestion for change was based on which URL is wanted either the activity URL or the actual entry URL.
    If you want the activity url -> current code would work
    If you want the entry url -> json.source_url evidence.activity.entry.url

    Since there no seed for these entities in LOCAL and i don't have access to the PROD or DEV env, i can't really debug further with only a local instance. If you make a updated db dump of PROD with all the relevant entities, it would be easier to debug in local imo.

    Currently with dummy data created via the admin, your current code should work well if the source_url field of the activity is defined and associated to the evidence.

    My quick guess is that the source_url in activity is not properly defined.

    Image

    For a quick fix, we access the entry url instead of the activity source_url since we have the url for the entry but doesn't have the source_url set for the activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions