Skip to content

5376 [Frontend] Decouple Program Participation from STT Model - #6206

Open
mattcoleanderson wants to merge 16 commits into
developfrom
5376-frontend-changes-decouple-program-particpation-from-stt-model
Open

mattcoleanderson wants to merge 16 commits into
developfrom
5376-frontend-changes-decouple-program-particpation-from-stt-model

Conversation

@mattcoleanderson

@mattcoleanderson mattcoleanderson commented Nov 6, 2026 •

Copy link
Copy Markdown

Summary of Changes

Pull request closes #5376.

  • Drive TANF, Tribal TANF, and SSP-MOE options and upload/history sections from the effective STT's existing program_participations metadata. SSP participation presence replaces legacy STT.ssp; participation status is ignored.
  • Render exactly the assigned sections in both areas, preserving API names, canonical sparse numbering/order, and case-versus-aggregate table types. Missing/empty assignments grant no default sections or usable submit controls; malformed metadata surfaces a configuration error.
  • Keep initial/deferred URLs, radio selections, and confirmed/cancelled STT/program changes consistent with actually available options. Preserve URL fragments, role-permitted STT/region resolution, Regional Staff's history-only access, and download restrictions.
  • Scope staged files, validation, submissions, history responses, and polling to their current context. Reject hidden/incompatible staged files and suppress stale local callbacks while retaining audit events for successful server writes. Fiscal-period corrections retain and revalidate staged files.
  • Add realistic participation fixtures and focused unit/integration coverage, including contradictory legacy flags, SSP-only records, status independence, empty assignments, metadata arrival, and deferred-response races.

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 ssp discriminator, 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.

  1. Sign in as a Data Analyst and open TANF Data Files. Select a fiscal year/quarter containing known submissions. Confirm the profile STT's assigned inputs and Submission & Error Reports tables match exactly. For the sparse TANF example, expect Sections 1 and 3, not 1 and 2; Section 3 must retain the aggregate table layout.
  2. As an authorized administrative user, select the state with different TANF/SSP assignments. Switch to SSP-MOE: only Section 2 — Closed Case Data and its SSP history should appear. Switch back to TANF and confirm neither program's rows leak into the other.
  3. Use an STT with legacy ssp: false and a valid SSP participation. Confirm SSP-MOE is available. Repeat with ssp: true but no SSP record: SSP-MOE must be absent, including through a direct type=ssp-moe URL. Only a genuinely available option may be selected; if none exists, expect no program selection or usable submission controls.
  4. Review an SSP-only STT and a participation with 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.
  5. Keep assignments unchanged while varying only participation status, including an omitted or unfamiliar status. Confirm options, inputs, history, and existing role-based submission behavior remain unchanged. A staged file should not disappear solely because status changed.
  6. Stage a valid file, then change STT or program. Choose Cancel and confirm the original selection/file remains; repeat and choose OK, confirming incompatible files, errors, and old history disappear. Repeat with SSP-only and empty targets. Correct only the fiscal year/quarter and confirm the staged file remains and is revalidated.
  7. With slow history/file-processing responses, switch reporting contexts before the older response completes. Confirm old rows, validation results, alerts, and polling updates do not reappear in the newer selection. Replace a staged file and confirm an older read/submission completion does not clear the replacement.
  8. As an authorized user, submit an assigned TANF/SSP file to the dedicated review environment. Confirm canonical section numbers in the success message, history refresh, parser/error links, and permitted historical-file downloads. In browser network details, confirm section remains a scalar name and the request's ssp discriminator is correct; physical submission filenames must remain unchanged.
  9. Repeat with a tribal Data Analyst and Regional Staff. Tribes must use Tribal TANF assignments. Regional Staff must remain limited to their permitted STTs, history-only, with nondownloadable original filenames. Foreign analyst or out-of-region direct links must not expose usable foreign content.
  10. Exercise the existing PIA quarter upload/history flow under its configured feature/year rules and an authorized FRA flow. Confirm their behavior is unchanged. Use keyboard navigation to review program options, sparse inputs, empty/loading states, and discard-modal focus/announcements.

Demo GIF(s), screenshots, and reviewer results: pending.

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):

  • TANF/Tribal TANF/SSP uploads and history use only matching participation assignments, with exact names, sparse numbering/order, and correct table types.
  • SSP-MOE availability follows participation presence, not legacy flags; status does not change rendering or submission behavior.
  • Missing/empty/malformed metadata grants no default sections or usable submission controls.
  • URLs, metadata arrival, STT/program transitions, staged files, and delayed callbacks remain isolated to the current context.
  • Existing role, STT/region, download, scalar API, PIA, and FRA behavior is preserved.
  • Required workflow documentation and release-digest testing steps/media are complete.
  • lfrohlich and/or adpennington confirmed that ACs are met.

Deliverable 2: Tested Code

  • Are all areas of code introduced in this PR meaningfully tested?
    • If this PR introduces backend code changes, are they meaningfully tested? N/A — no backend changes.
    • If this PR introduces frontend code changes, are they meaningfully tested?
  • Are code coverage minimums met?
    • Frontend coverage: pending full-suite/CodeCov verification; focused results do not establish the global minimum.
    • Backend coverage: N/A — no backend changes.

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

  • Are backend code style checks passing on CircleCI? N/A to changed code.
  • Are frontend code style checks passing on CircleCI?
  • Are code maintainability principles being followed?

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

  • Does this PR complete the epic?
  • Are links included to any other gov-approved PRs associated with epic?
  • Does PR include documentation for Raft's a11y review?
  • Did automated and manual testing with iamjolly and ttran-hub using 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

  • Was the code successfully deployed via automated CircleCI process to development on Cloud.gov?

Deployment verification remains pending.

Deliverable 6: Documented

  • Does this PR provide background for why coding decisions were made?
  • If this PR introduces backend code, is that code easy to understand and sufficiently documented, both inline and overall? N/A — no backend changes.
  • If this PR introduces frontend code, is that code easy to understand and sufficiently documented, both inline and overall?
  • If this PR introduces dependencies, are their licenses documented? N/A — no new dependencies.
  • Can reviewer explain and take ownership of these elements presented in this code review?

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

  • Does the OWASP Scan pass on CircleCI?
  • Do manual code review and manual testing detect any new security issues?
  • If new issues detected, is investigation and/or remediation plan documented?

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):

  • the purpose of the research
  • methods used to conduct the research
  • who participated in the research
  • what was tested and how
  • impact of research on TDP
  • (if applicable) final design mockups produced for TDP development

No new research artifacts are included; PM/UX acceptance remains pending.

@mattcoleanderson mattcoleanderson self-assigned this Nov 10, 2026
@mattcoleanderson mattcoleanderson added the raft review This issue is ready for raft review label Nov 10, 2026
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.54378% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.96%. Comparing base (0f6739f) to head (1b0d78c).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...-frontend/src/components/FileUpload/FileUpload.jsx 85.71% 2 Missing and 5 partials ⚠️
tdrs-frontend/src/hooks/useFileUploadForm.js 95.65% 2 Missing ⚠️
tdrs-frontend/src/reducers/reports.js 95.65% 2 Missing ⚠️
tdrs-frontend/src/actions/reports.js 98.68% 1 Missing ⚠️
...mponents/FileUploadForms/SectionFileUploadForm.jsx 88.88% 1 Missing ⚠️
...nts/SubmissionHistory/SectionSubmissionHistory.jsx 85.71% 1 Missing ⚠️
tdrs-frontend/src/hooks/usePollingTimer.js 95.45% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
dev-backend 95.21% <ø> (ø)
dev-frontend 92.64% <96.54%> (+0.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tdrs-frontend/src/components/Reports/Reports.jsx 93.10% <ø> (-1.77%) ⬇️
...tend/src/components/Reports/tdr/TanfSspReports.jsx 100.00% <100.00%> (ø)
tdrs-frontend/src/hooks/useFormSubmission.js 100.00% <100.00%> (ø)
tdrs-frontend/src/hooks/useReportAssignment.js 100.00% <100.00%> (ø)
tdrs-frontend/src/hooks/useSubmissionHistory.js 100.00% <100.00%> (ø)
tdrs-frontend/src/mirage.data.js 100.00% <100.00%> (ø)
tdrs-frontend/src/reducers/sttList.js 100.00% <ø> (ø)
tdrs-frontend/src/selectors/stts.js 100.00% <100.00%> (ø)
...rs-frontend/src/test-utils/programParticipation.js 100.00% <100.00%> (ø)
tdrs-frontend/src/test-utils/reportScopes.js 100.00% <100.00%> (ø)
... and 7 more

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e562855...1b0d78c. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jtimpe jtimpe left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it's working so far, got a few notes on code while i finish testing

const initialState = {
sttList: [],
loading: false,
loaded: false,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 : [])

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) =>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrap the output in Boolean() here too?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i get what this is supposed to do, but it hurts my head to look at lol. i think to make it more readable

  1. add some whitespace
  2. less ternary and spread stuff. for options, you can just push the option
  3. move the [{ label: tanf.program.name, value: 'tanf'}] kind of stuff to separate variables
  4. work on the variable naming. i'm confused at what resolution is 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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could also use some whitespace. maybe some of this could go in the hook mentioned in my other comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread tdrs-frontend/src/selectors/stts.js Outdated
return { state: catalog?.error ? 'error' : 'loading', stt: null }
return {
state: 'ready',
stt: catalog.sttList.find((stt) => stt.name === selectedName) || null,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

featureFlags
)

const sttResolution = useMemo(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gone ahead and attempted your hook idea. The new hook is tdrs-frontend/src/hooks/useReportAssignment. let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

raft review This issue is ready for raft review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render upload and history sections from STT program participation

2 participants