[codex] Add occurrence row history#1195
Merged
Merged
Conversation
3a2e868 to
f88f2a3
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends “entry history” support to occurrence rows (now_ls) in locality/species occurrence lists by enriching list-row payloads with merged occurrence update history (previously only available on occurrence detail), then reusing the shared EntryUpdateHistory popover UI.
Changes:
- Backend: add batched occurrence-history enrichment (
getOccurrenceUpdatesForRows) and attachnow_oauarrays ontonow_lsrows in locality/species detail payloads. - Frontend: render an occurrence-row history icon/action in locality and species occurrence list tabs using
EntryUpdateHistory. - Frontend: update history UI to group multiple logs per entry and deduplicate duplicate history entries; add/adjust tests and types to support optional
now_oauon list rows.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/tests/components/DetailView/FieldUpdateHistory.test.tsx | Expands tests to cover dedup/grouping for occurrence-row history popover content. |
| frontend/src/shared/types/data.ts | Extends occurrence list row types to allow optional now_oau history arrays. |
| frontend/src/components/Species/Tabs/LocalitySpeciesTab.tsx | Adds row-level history action for species → locality occurrence list rows. |
| frontend/src/components/Locality/Tabs/OccurrencesTab.tsx | Adds row-level history action for locality → species occurrence list rows. |
| frontend/src/components/DetailView/common/FieldUpdateHistory.tsx | Updates shared history popover to group logs and deduplicate duplicate history entries. |
| backend/src/services/species.ts | Enriches species detail now_ls rows with merged occurrence history (now_oau). |
| backend/src/services/occurrenceService.ts | Introduces batched getOccurrenceUpdatesForRows and reuses it for occurrence detail history. |
| backend/src/services/locality.ts | Enriches locality detail now_ls rows with merged occurrence history (now_oau). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+74
to
+79
| oau_date: '2026-06-04', | ||
| oau_authorizer: 'ED', | ||
| oau_coordinator: 'CO', | ||
| oau_comment: 'Occurrence row changed', | ||
| now_or: [reference], | ||
| updates: [ |
Comment on lines
+101
to
+106
| oau_date: '2026-06-04', | ||
| oau_authorizer: 'ED', | ||
| oau_coordinator: 'CO', | ||
| oau_comment: 'Occurrence row changed', | ||
| now_or: [reference], | ||
| updates: [ |
Comment on lines
188
to
194
| const uniqueLidPks = Array.from(new Set(uniqueKeys.map(({ lid }) => `${lid.toString().length}.${lid};`))) | ||
| const candidateLogsRaw = await logDb.log.findMany({ | ||
| where: { | ||
| table_name: 'now_ls', | ||
| pk_data: { contains: lidPk }, | ||
| OR: uniqueLidPks.map(lidPk => ({ pk_data: { contains: lidPk } })), | ||
| }, | ||
| }) |
f88f2a3 to
4394250
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
now_oauhistory arrays tonow_lsrows in locality and species detail payloads.now_oauon list rows.Root Cause / Context
Occurrence rows are stored as
now_lsrelation records and their log rows can be associated with both locality update entries (luid) and species update entries (suid). The occurrence detail endpoint already knew how to merge those logs intonow_oau, but the locality/species occurrence list rows did not receive that enriched history, so the row-level popover from #1191 had no complete occurrence history to show.Validation
npm run tsc:backendnpm run tsc:frontendcd frontend && npm test -- --runTestsByPath src/tests/components/DetailView/FieldUpdateHistory.test.tsx --runInBandnpm run lint:frontendnpm run lint:backendnpm run lintand rootnpm run tscsuccessfully.Closes #1192