Skip to content

feat(npqs): send the trader's documents with the ePhyto certificate - #59

Open
Aravinda-HWK wants to merge 1 commit into
mainfrom
feat/npqs-ephyto-send-documents
Open

feat(npqs): send the trader's documents with the ePhyto certificate#59
Aravinda-HWK wants to merge 1 commit into
mainfrom
feat/npqs-ephyto-send-documents

Conversation

@Aravinda-HWK

@Aravinda-HWK Aravinda-HWK commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

The ePhyto certificate named no supporting documents, so a treatment certificate or invoice the trader had uploaded reached the importing NPPO as nothing at all. This wires the selection through the NPQS flow.

Pairs with OpenNSW/nsw-srilanka#386, which reads these artifacts — neither half does anything alone.

Changes

tnsw/npqs/9-ephyto/submit_form.json — the submission form asks which documents to send: the application's own attachments, the treatment certificate, the supervision report, the invoice, the packing list, and the additional supporting document.

tnsw/npqs/npqs_workflow.json — the macro workflow passes each upload's storage key down to the ePhyto step. Every mapping is optional (?): a consignment that skipped the treatment branch has no key to map.

tnsw/npqs/9-ephyto/workflow.json (v8 → v10)

  • The submit node now receives both the storage keys and the trader's answers.
  • The submission node's output_mapping carried only hub_destination, so the six answers never reached the workflow variables the submit node reads, and every document resolved to "no" however the trader answered. Mapping them is what makes the selection take effect at all.
  • The poll node wrote its results into the ephyto namespace, where each check overwrote the submit node's tracking number. It writes to ephyto_poll now, and the delivery-status pages read from there.

The form offers every document the flow can produce, whichever path the consignment took. A tick naming a document that was never uploaded is ignored by the submit step — there is nothing to attach and nothing to refuse — so the certificate carries the selected documents that exist and nothing else.

Testing

Ran end to end against the IPPC UAT Hub: the envelope was accepted with the invoice and packing list the trader selected inside the certificate, and a ticked toggle for a document the consignment never produced was skipped without failing the submission.

All seven files parse as valid JSON. npqs_workflow.json is a five-line addition; the reformatting an editor had introduced is not included.

Deploying

The artifact registry is read at boot — tnsw-api needs a recreate for these to take effect.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: d067088c-f44a-4f64-9733-e31841162cff


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The certificate named no supporting documents, so a treatment
certificate or invoice the trader had uploaded reached the importing
NPPO as nothing at all.

The submission form now asks which documents to send, the macro workflow
passes each upload's storage key down to the ePhyto step, and the submit
node receives both the keys and the trader's answers. Every toggle is
optional: a consignment that skipped the treatment branch simply has no
key to map, and the step sends what exists — a tick naming a document
that was never uploaded is ignored rather than refused.

The submission node's output_mapping carried only hub_destination, so
the six answers never reached the workflow variables the submit node
reads and every document resolved to "no" however the trader answered.
They are mapped now, which is what makes the selection take effect.

The poll node also wrote its results into the ephyto namespace, where
each check overwrote the submit node's tracking number. It writes to
ephyto_poll instead, and the delivery-status pages read from there.
@Aravinda-HWK
Aravinda-HWK force-pushed the feat/npqs-ephyto-send-documents branch from 0af57c8 to 745cab0 Compare September 3, 2026 07:43

@ginaxu1 ginaxu1 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.

Please check: the document-selection wiring (macro keys, submission output_mapping for the six toggles, submit input_mapping) matches what OpenNSW/nsw-srilanka#386 reads, and the description of that half is accurate. The poll rename is not.

StartSubTask loads npqs-ephyto-upload--poll from the registry on every poll (subtasktemplate.Load by id). It does not snapshot the template with the child workflow. soap_call then writes the result into Record.Data[output_namespace] and returns the whole Record.Data as the activity result. v8 of npqs-ephyto-upload (what any in-flight ePhyto child is already running) still has a required output_mapping of ephyto.delivered. After this recreate:

  • A consignment that has submitted but not yet polled has no ephyto.delivered key. The next poll writes ephyto_poll instead, mapTaskOutputs fails with "required task variable 'ephyto.delivered' not found", and the child workflow errors.
  • A consignment already in the poll loop may still have a stale ephyto.delivered=false from the last pre-deploy poll. New polls update ephyto_poll, the v8 gateway never sees delivery, and the loop runs to the 1440-check timeout.

The description presents the rename as an isolated UI fix for the tracking-number clobber. That clobber is real (soap_call replaces the namespace wholesale, which is why the polling page lost the number), but changing a live subtask_template namespace is not how to fix it while v8 children can still be running.

Suggested fix: leave poll.json output_namespace as ephyto, and revert the ephyto_poll mappings in 9-ephyto/workflow.json plus the three markdown templates. Preserve tracking_number by merging the poll result into the existing ephyto object in the SOAP plugin (nsw-srilanka#386) instead of replacing it. Keep the document-selection mappings; those are a new child graph (v10) and do not have this live-template problem.

If you keep the ephyto_poll split anyway, drain every in-flight npqs-ephyto-upload child before recreating tnsw-api. New flows would be fine; in-flight ones would not.

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