Repository navigation
Write to the Associations app on confirming Auto-Associations - #152
rmartinsen-ucd wants to merge 4 commits into
Conversation
Confirming stage 7 loads the cycle's projects, expenses and associations into load tables in the Associations app database, then swaps them into the live tables in one transaction that also sets CurrentFiscalYear and checks counts, totals and flags. Stage 8 unlocks only if the write succeeds, and gets a Reset to auto-associations button that reruns it. Closes #78 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ions-app # Conflicts: # client/src/components/autoAssociations/AutoAssociationsStage.tsx # client/src/test/mswUtils.ts # client/src/test/routes/(authenticated)/autoAssociations.test.tsx # server/Program.cs # server/Workflow/WorkflowService.cs # tests/server.tests/Import/ImportRunsControllerTests.cs # tests/server.tests/OrgR/OrgRControllerTests.cs # tests/server.tests/ProjectIdentification/ProjectIdentificationServiceTests.cs # tests/server.tests/ProjectList/ProjectListControllerTests.cs # tests/server.tests/Workflow/WorkflowControllerTests.cs # tests/server.tests/Workflow/WorkflowServiceTests.cs
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Ask before discarding when the target is already on this cycle's year, even with no write on record here. Load rows as VALUES statements that run whole on the target, not a four part insert that goes row by row. Run the swap to its end once the load is done. Record source totals next to the written ones. Run the store tests through a loopback linked server as well as directly. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
| <button | ||
| className="btn btn-sm" | ||
| disabled={rebuilding || continueMutation.isPending} | ||
| onClick={() => setConfirmingRebuild(true)} | ||
| type="button" | ||
| > | ||
| {rebuilding ? 'Rebuilding...' : 'Rebuild auto-associations'} |
There was a problem hiding this comment.
[P1] Require reopening before rebuilding exported expenses
One user can confirm stage 7, start manual associations, then revisit stage 7 and click Rebuild. Even with identical inputs, the rebuild gives every local expense a new ID while AD419 Next keeps the old IDs. Disable Rebuild on a completed stage and enforce the same check in the endpoint. The existing reopen and confirm flow can handle an intentional rebuild.
There was a problem hiding this comment.
We can depend on the user to orchestrate between ad419 and the associations app. It's expected that if you rebuild associations, you'll push them to the app. This will become obsolete when we bring the associations app into ad419
An included expense can sit on an AE project that is not on the cycle's NIFA project list, or is listed with no PI. The Associations app expenses view now falls back to PGMProjects by AE project number, so the PI name departments group by is not blank. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Closes #78
What this does
Confirming the Auto-Associations stage now writes the cycle's data to the Associations app database, so manual associations can be made in AD419 Next. The Manual Associations stage unlocks only if the write succeeds.
Load_tables in the target database, then runs one batch on the target server. That batch, in a single transaction, setsCurrentFiscalYear, clears and refillsOrgR_x_FinancialDepartment,Project,ProjXOrgR,AllAE_ExpensesandAssociations, checks row counts, totals and flags, and commits. Any failure rolls back, leaves the stage unconfirmed and shows the message on the stage.EXEC (...) AT [linked server], so it needs RPC Out but not MSDTC. The transaction lives inside the remote batch.INSERT ... VALUESstatements of up to 1000 rows each, which run whole on the target. A four part name insert through the linked server would go row by row, so it is not used.CurrentFiscalYearalready equals this cycle's year. The last one means an environment with no record of its own (test, a local build, a restored app database) cannot wipe this cycle's work unasked.app.AssociationsAppWrites(two EF migrations). The record holds the totals as read from staging next to the totals written, so rounding to the target's column scales is visible.Before a real write
database/donbot/associations-app-setup.sql(triggers, transaction probe, load timing).ASSOCIATIONS_APP_LINKED_SERVERandASSOCIATIONS_APP_DATABASE. There is no default, so an environment with nothing set fails the write with a clear message. Only prod should namead419.For local development,
npm run db:associations-appcreates a stand-inAssociationsAppDevdatabase in the SQL container.Things to know
isNonEmpExp,Sub_Exp_SFNandStaff_Grp_CdonAllAE_Expensesare written as NULL. AD419 Next is not believed to read them. Worth a look at what last year's load put there before the first production write.Associationsare compared within a small tolerance.Testing
826 server tests and 278 client tests pass. Client lint, type check and build are clean.
The store's tests run twice: directly, and through a linked server that points back at the test container, so the
EXEC ... ATpath is covered, including check failures coming back with their message. Not verified: the real linked server to donbot (login mapping, RPC Out, speed over the network) and a browser click-through.🤖 Generated with Claude Code