Repository navigation
5376 [Frontend] Decouple Program Participation from STT Model - #6206
mattcoleanderson wants to merge 16 commits into
Conversation
…rticpation-from-stt-model
…rticpation-from-stt-model
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #6206 +/- ##
===========================================
+ Coverage 94.94% 94.96% +0.01%
===========================================
Files 644 647 +3
Lines 34902 35252 +350
Branches 641 663 +22
===========================================
+ Hits 33139 33478 +339
- Misses 1649 1656 +7
- Partials 114 118 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
jtimpe
left a comment
There was a problem hiding this comment.
Looks like it's working so far, got a few notes on code while i finish testing
| const initialState = { | ||
| sttList: [], | ||
| loading: false, | ||
| loaded: false, |
There was a problem hiding this comment.
minor thing, but it's not my favorite. maybe one variable loadingState with enum options: empty, loading, success, error? or introduce an error: true|false state (since we don't seem to track that) and the selector could be sttList = useSelector(state => !state.stts.loading && !state.stts.error ? state.stts.sttList : [])
There was a problem hiding this comment.
loaded intentionally distinguishes an initial empty list from a successfully fetched empty response. It also remains true during refresh, so loading and loaded can legitimately both be true. We already store request errors through SET_STTS_ERROR. Returning [] whenever loading would temporarily hide authoritative assignments during refresh. I’d keep these separate here. a state machine refactor would need to preserve those distinctions. An enum alone wouldn't capture both "previously loaded" and "currently refreshing"
| left.generation === right.generation | ||
| ) | ||
|
|
||
| export const sameSection = (file, descriptor) => |
There was a problem hiding this comment.
Wrap the output in Boolean() here too?
There was a problem hiding this comment.
This already returns a boolean because every operand is a strict equality comparison. The other helpers require Boolena() because not every operand is a boolean comparison.
| .sort((a, b) => a.number - b.number) | ||
| } | ||
|
|
||
| export const getTdrAssignment = (resolution, fileType, piaEnabled = false) => { |
There was a problem hiding this comment.
i get what this is supposed to do, but it hurts my head to look at lol. i think to make it more readable
- add some whitespace
- less ternary and spread stuff. for
options, you can justpushthe option - move the
[{ label: tanf.program.name, value: 'tanf'}]kind of stuff to separate variables - work on the variable naming. i'm confused at what
resolutionis if i'm only looking at this function
this is a "maybe" idea that i haven't fully worked out in my head yet, but what if we added another hook to handle the report and/or section assignments? that way you could have all the useState stuff in the hook and not have to pass so much into the helper functions. maybe that helps avoid the need for the state: 'ready' kind of thing too?
There was a problem hiding this comment.
done. I applied your suggestions and refactored it.
| export const getTdrAssignment = (resolution, fileType, piaEnabled = false) => { | ||
| const { stt, state } = resolution | ||
| const pia = | ||
| piaEnabled && stt && stt.type !== 'tribe' |
There was a problem hiding this comment.
maybe pia should be an STTProgramAssignment too, just make it a first-class citizen. If we don't want to use it, don't assign it. open to opinions on that, and it could be a follow-on ticket
There was a problem hiding this comment.
I thought about this before and decided to leave it out since it wasn't an immediate need. I do think it makes sense to extract it to the model though. I'll write a follow on ticket for us to take on this work later.
| catalog, | ||
| selectedName, | ||
| }) => { | ||
| const loaded = catalog?.loaded || catalog?.sttList?.length > 0 |
There was a problem hiding this comment.
this could also use some whitespace. maybe some of this could go in the hook mentioned in my other comment
There was a problem hiding this comment.
added the whitespace. I haven't created that hook yet. Still thinking on whether it would be useful, but I think I like the idea
| return { state: catalog?.error ? 'error' : 'loading', stt: null } | ||
| return { | ||
| state: 'ready', | ||
| stt: catalog.sttList.find((stt) => stt.name === selectedName) || null, |
There was a problem hiding this comment.
i see the same sttList.find(stt > stt.name === selectedName) || null in a few spots here, moving it to getStt(name) might be helpful. it's a little thing by itself, but apply that same idea to several of the ternary/lookup/default expressions throughout the code and it can help clean things up significantly
| featureFlags | ||
| ) | ||
|
|
||
| const sttResolution = useMemo( |
There was a problem hiding this comment.
questioning the use of useMemo here and in the selectors/functions following. yes, there are several operations within the helper functions, but if the underlying state doesn't change, will it even trigger a component re-render? then i wonder if there are other ways we can reduce the computational load.
back to the idea of a hook, you could have all the redux "dependencies" of the helper function loaded with useState, then just pass them in for final checks. maybe something still has to be memoized, maybe a hook isn't the right answer.
i think in general, though, my suggestion is to follow the principle of "move state up". some sort of structure outside of the helper function should access and hold the redux state, then pass that info down to the appropriate place for making the decision. my gut says that would make things more readable and understandable, and potentially avoid the need for memoizing complicated functions
There was a problem hiding this comment.
I've gone ahead and attempted your hook idea. The new hook is tdrs-frontend/src/hooks/useReportAssignment. let me know what you think.
…rticpation-from-stt-model
Summary of Changes
Pull request closes #5376.
program_participationsmetadata. SSP participation presence replaces legacySTT.ssp; participation status is ignored.Compatibility and risk: Frontend-only changes; no backend models, endpoints, migrations, data, dependencies, or physical filename mappings change. Scalar upload/list contracts, including the upload request's
sspdiscriminator, remain intact. PIA retains separate feature/type/year gating; FRA participation and status-based access policies are out of scope. Shared upload/history/polling changes warrant PIA/FRA regression review. Target environments need correct canonical participation/section metadata; this PR does not populate or repair it and does not add server-side authorization.Remaining verification: Manual acceptance, authenticated target-data readiness, accessibility review, full coverage/browser regression evidence, workflow documentation, and release-digest steps/media remain pending. Implementation commits alone do not establish manual verification.
How to Test
Use a local or deployed review environment with canonical participation metadata. Arrange dedicated review records with approved local configuration or browser response overrides; do not change shared/production data. Include a state with TANF Active Case Data and Aggregate Data, SSP Closed Case Data, a Tribal TANF assignment, and SSP-only/empty/missing-participation cases. Keep global, profile, and regional metadata consistent.
ssp: falseand a valid SSP participation. Confirm SSP-MOE is available. Repeat withssp: truebut no SSP record: SSP-MOE must be absent, including through a directtype=ssp-moeURL. Only a genuinely available option may be selected; if none exists, expect no program selection or usable submission controls.sections: []. SSP-only must not invent TANF availability. Empty assignments must retain the participation-based option but show a clear empty state with no default inputs/history tables or usable submit action. Missing participation must not grant sections. Repeat through direct URLs and after metadata finishes loading; valid deferred SSP links must be retained, along with URL fragments such as#history.sectionremains a scalar name and the request'ssspdiscriminator is correct; physical submission filenames must remain unchanged.Deliverables
More details on how deliverables herein are assessed included here.
Deliverable 1: Accepted Features
Checklist of ACs (implementation is present; manual acceptance remains pending):
lfrohlichand/oradpenningtonconfirmed that ACs are met.Deliverable 2: Tested Code
Added selector, presentation, reducer/action, real-store integration, upload, history, and polling coverage. Last recorded Phase 4 focused/regression/helper runs passed 539 tests across 23 suites; full coverage and browser regression evidence remain pending, and these results are not a claim about subsequent merge-head checks.
Deliverable 3: Properly Styled Code
Recorded Phase 4 local frontend lint passed with 10 existing unused-variable warnings; explicit changed-JSX lint and whitespace checks passed. CircleCI status is not asserted here.
Deliverable 4: Accessible
iamjollyandttran-hubusing Accessibility Insights reveal any errors introduced in this PR?Manual keyboard/screen-reader review and accessibility sign-off remain pending. Prerequisite implementation context: #5947 and #6112; prior frontend proposal: #5963 (not evidence of approval).
Deliverable 5: Deployed
Deployment verification remains pending.
Deliverable 6: Documented
Uses the existing STT metadata instead of another request or legacy eligibility fallback. Upload assignment identity excludes fiscal periods so corrections retain files; history queries include fiscal periods so old results cannot populate a newer view. Workflow documentation and release-digest media remain pending.
Deliverable 7: Secure
Existing role/region/download restrictions are retained; participation-driven controls do not constitute new direct-API authorization.
Deliverable 8: User Research
Research product(s) clearly articulate(s):
No new research artifacts are included; PM/UX acceptance remains pending.