Skip to content

TT-7180 limit data on export, throw on unhandled tables - #577

Draft
sarahentzel wants to merge 8 commits into
developfrom
TT-7180
Draft

TT-7180 limit data on export, throw on unhandled tables#577
sarahentzel wants to merge 8 commits into
developfrom
TT-7180

Conversation

@sarahentzel

Copy link
Copy Markdown
Collaborator

No description provided.

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.

🟡 Changes recommended

Confirmed issues in the new/refactored export/import logic can cause incorrect media version selection, possible export crashes on null relations, and unintended offline-project mutations for supporting projects.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Refactors the renderer-side export pipeline to centralize table record collection, reduce exported data to the intended project/org scope, and hard-fail on any newly introduced/unsupported table types during export.

Changes:

  • Introduces createExportCollector (exportTableRecs.ts) and reuses it from both electronExport and projectDataExport to unify table selection/scoping logic.
  • Updates project and organization export outputs to better respect “online vs offline” cohorts and adds support for exporting supporting orgs alongside supporting projects.
  • Adds a comprehensive Jest test suite for getProjectDataFiles scoping behavior and updates import handling to distinguish supporting org/project rows.
File summaries
File Description
src/renderer/src/store/importexport/projectDataExport.ts Switches PTF project data export to use the shared export collector and adds supporting org exports.
src/renderer/src/store/importexport/projectDataExport.test.ts Adds tests validating export scoping across online/offline cohorts and supporting-resource scenarios.
src/renderer/src/store/importexport/exportTableRecs.ts New shared collector that scopes/export-selects records per table and throws on unhandled tables.
src/renderer/src/store/importexport/electronExport.tsx Refactors Electron zip export to use the shared collector and exports supporting orgs.
src/renderer/src/store/importexport/actions.tsx Passes additional flags during import to distinguish primary vs supporting org/project rows.
src/renderer/src/schema.tsx Adds offlineId to the sectionresourceuser schema.
src/renderer/src/model/sectionResourceUser.ts Adds offlineId to the SectionResourceUser model attributes.
src/renderer/src/model/orgKeyterm.tsx Normalizes offlineidofflineId in the OrgKeyterm model.
src/renderer/src/crud/loadData.ts Adjusts import insertion behavior to avoid altering offline-project bookkeeping for supporting projects.
Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/renderer/src/crud/loadData.ts Outdated
Comment thread src/renderer/src/store/importexport/exportTableRecs.ts
Comment thread src/renderer/src/store/importexport/exportTableRecs.ts Outdated
Comment thread src/renderer/src/store/importexport/electronExport.tsx

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.

🟡 Changes recommended

Electron export now always writes an empty supportingprojects JSON file when there are none, and the newly added isOrganization flag in insertData is currently dead code, suggesting incomplete/inconsistent behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 9/9 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread src/renderer/src/crud/loadData.ts Outdated
Comment on lines +155 to +159
record.type === 'project'
? isProject
: record.type === 'organization'
? isOrganization
: false;
Comment on lines +331 to +333
ret.Added = recs.length;
await AddJsonEntry('supportingprojects', recs, 'Z');
let orgs = supportingOrgs(project);
include supporting orgs for categories
remove one project check to simplify
remove duplicate burrito export logic
do not allow graphic editing offline
only send an artifact type if the export will care about it - otherwise the file will be misnamed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants