Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 0 additions & 49 deletions .github/workflows/debug.yml

This file was deleted.

13 changes: 6 additions & 7 deletions docs/architecture/use-case-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,20 +209,19 @@ Current implementation:
### FetchLiveParliamentStatus

```
Actor: Scheduler (EventBridge, every 2 minutes during sitting windows) / User (iOS app, Home feed)
Actor: Scheduler (EventBridge, every 2 minutes during sitting windows)
Goal: Provide a fresh snapshot of whether the House is currently sitting and what business is in progress.
Inputs: None (scheduler) / none (iOS poll).
Outputs: LiveParliamentStatus (status, isSitting, businessType, currentItemTitle, currentSpeakerName, divisionInProgress, checkedAt).
Inputs: None (EventBridge scheduled event).
Outputs: LiveParliamentStatus persisted to PostgreSQL live_session table.
Entities / values: LiveParliamentStatus.
Ports: LiveParliamentStatusFetching, Clock.
Primary adapters: live-status Lambda (EventBridge ingest + GET /api/v1/live), PostgreSQL live_session table (singleton), LiveParliamentService (iOS), HomeFeedView.
Ports: Clock.
Primary adapters: live-status Lambda (EventBridge ingest + GET /api/v1/live), PostgreSQL live_session table (singleton).
Current implementation:
backend/live-status/main.go
ios/epac/Util/LiveParliamentService.swift
ios/epac/Views/Home/HomeFeedView.swift
```

> Architecture rationale: `docs/architecture/live-status-backend-epac165.md`.
> iOS client removed in EPAC-1919 (Aurora teardown). Re-introduction tracked in EPAC-1928.

---

Expand Down
1 change: 0 additions & 1 deletion ios/epac/Data/Adapters/ServicePortsAdapters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@

import Foundation

extension LiveParliamentService: LiveParliamentStatusFetching {}
extension OnThisDayService: @unchecked Sendable, OnThisDayFetching {}
2 changes: 0 additions & 2 deletions ios/epac/Domain/Entities/HomeFeedSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ enum HomeParliamentDayStatus {
struct HomeFeedSnapshot {
let isSittingToday: Bool
let parliamentDayStatus: HomeParliamentDayStatus
let liveParliamentStatus: LiveParliamentStatus?
let liveCardDecision: HomeLiveCardDecision
let nextSittingDate: Date?

let followedMember: HomeFollowedMember?
Expand Down
14 changes: 0 additions & 14 deletions ios/epac/Domain/Entities/HomeLiveCardDecision.swift

This file was deleted.

41 changes: 0 additions & 41 deletions ios/epac/Domain/Entities/LiveParliamentStatus.swift

This file was deleted.

4 changes: 0 additions & 4 deletions ios/epac/Domain/Ports/Ports.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ protocol HomeFeedRepository: Sendable {
func fetchSenators(for provinceAbbrev: String) async throws -> [Senator]
}

protocol LiveParliamentStatusFetching: Sendable {
func fetchStatus() async throws -> LiveParliamentStatus
}

protocol OnThisDayFetching: Sendable {
func fetch(date: Date, limit: Int) async throws -> [OnThisDayItem]
}
Expand Down
57 changes: 1 addition & 56 deletions ios/epac/Domain/UseCases/LoadHomeFeed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@ import Foundation
@MainActor
struct LoadHomeFeed {
private let repository: HomeFeedRepository
private let liveParliamentStatusFetching: LiveParliamentStatusFetching
private let onThisDayFetching: OnThisDayFetching
private let followPreferenceReading: FollowPreferenceReading
private let clock: Clock

init(
repository: HomeFeedRepository,
liveParliamentStatusFetching: LiveParliamentStatusFetching,
onThisDayFetching: OnThisDayFetching,
followPreferenceReading: FollowPreferenceReading,
clock: Clock = SystemClock()
) {
self.repository = repository
self.liveParliamentStatusFetching = liveParliamentStatusFetching
self.onThisDayFetching = onThisDayFetching
self.followPreferenceReading = followPreferenceReading
self.clock = clock
Expand All @@ -31,7 +28,6 @@ struct LoadHomeFeed {
// an offline pull-to-refresh doesn't erase the last successful snapshot.
func execute(preservingOnThisDayItems existing: [OnThisDayItem] = []) async -> HomeFeedSnapshot {
let today = Calendar.current.startOfDay(for: clock.now)
let ottawaTodayString = makeOttawaTodayString(from: clock.now)

let sittingDates = (try? await repository.fetchSittingDates()) ?? []
let isSittingToday = sittingDates.contains { Calendar.current.isDate($0, inSameDayAs: today) }
Expand Down Expand Up @@ -63,12 +59,7 @@ struct LoadHomeFeed {
let hansards = (try? await repository.fetchLatestHansards(limit: 10)) ?? []
let latestHansard = hansards.first

let liveParliamentStatus = try? await liveParliamentStatusFetching.fetchStatus()

var parliamentDayStatus = resolveParliamentDayStatus(today: today, latestHansard: latestHansard, isSittingToday: isSittingToday)
if liveParliamentStatus?.isSitting == true {
parliamentDayStatus = .sitting
}
let parliamentDayStatus = resolveParliamentDayStatus(today: today, latestHansard: latestHansard, isSittingToday: isSittingToday)

let recentSubjectTitles = Array(
(hansards.first?.subjectRecords.map(\.title) ?? []).prefix(3)
Expand All @@ -82,26 +73,6 @@ struct LoadHomeFeed {
latestMemberVote = try? await repository.fetchMemberVote(memberID: memberID, voteID: voteID)
}

var postSittingHansard: HomeHansardRecord?
if let status = liveParliamentStatus, !status.isSitting, let sittingDate = status.sittingDate {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
formatter.timeZone = TimeZone(identifier: "America/Toronto")
if let date = formatter.date(from: sittingDate) {
let start = Calendar.current.startOfDay(for: date)
if let end = Calendar.current.date(byAdding: .day, value: 1, to: start) {
let matchingHansards = try? await repository.fetchHansards(between: start, and: end)
postSittingHansard = matchingHansards?.first
}
}
}

let liveCardDecision = computeLiveCardDecision(
status: liveParliamentStatus,
postSittingHansard: postSittingHansard,
ottawaTodayString: ottawaTodayString
)

let onThisDayItems = (try? await onThisDayFetching.fetch(date: clock.now, limit: 5)) ?? existing

let civicContext = FollowedCivicContext(
Expand All @@ -119,8 +90,6 @@ struct LoadHomeFeed {
return HomeFeedSnapshot(
isSittingToday: isSittingToday,
parliamentDayStatus: parliamentDayStatus,
liveParliamentStatus: liveParliamentStatus,
liveCardDecision: liveCardDecision,
nextSittingDate: nextSittingDate,
followedMember: followedMember,
myMPActivityCount: myMPActivityCount,
Expand All @@ -136,30 +105,6 @@ struct LoadHomeFeed {
)
}

private func makeOttawaTodayString(from date: Date) -> String {
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
formatter.timeZone = TimeZone(identifier: "America/Toronto")
return formatter.string(from: date)
}

private func computeLiveCardDecision(
status: LiveParliamentStatus?,
postSittingHansard: HomeHansardRecord?,
ottawaTodayString: String
) -> HomeLiveCardDecision {
guard let status else { return .hidden }
if status.isSitting { return .live(status) }
guard let sittingDate = status.sittingDate, sittingDate == ottawaTodayString else {
return .hidden
}
if let hansard = postSittingHansard {
let subjectTitle = hansard.subjectRecords.first?.title ?? ""
return .todayPublished(hansardID: hansard.hansardID, date: hansard.date, subjectTitle: subjectTitle)
}
return .todayPending
}

private func resolveFollowedMember(from members: [HomeFollowedMember], savedName: String?, followedIDs: [Int]) -> HomeFollowedMember? {
if let savedName,
let match = members.first(where: {
Expand Down
80 changes: 0 additions & 80 deletions ios/epac/Domain/UseCases/RefreshLiveParliamentStatus.swift

This file was deleted.

10 changes: 0 additions & 10 deletions ios/epac/Util/AppEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,13 @@ enum AppEnvironment {
static var isEvidenceCaptureMode: Bool {
ProcessInfo.processInfo.arguments.contains("--evidence-mode") ||
ProcessInfo.processInfo.environment["EPAC_EVIDENCE_MODE"] == "1" ||
debugLiveStatusFixtureIsPresent ||
debugOnThisDayFixtureIsPresent
}

static var isMarketingCaptureMode: Bool {
isAppStoreScreenshotMode || isAppPreviewMode || isEvidenceCaptureMode
}

private static var debugLiveStatusFixtureIsPresent: Bool {
#if DEBUG
ProcessInfo.processInfo.arguments.contains("--live-status-fixture-json") ||
ProcessInfo.processInfo.environment["EPAC_DEBUG_LIVE_STATUS_FIXTURE_JSON"] != nil
#else
false
#endif
}

private static var debugOnThisDayFixtureIsPresent: Bool {
#if DEBUG
ProcessInfo.processInfo.arguments.contains("--on-this-day-fixture-json") ||
Expand Down
Loading
Loading