Skip to content

Commit 307b5e8

Browse files
ClupaimaplefoxgitDavid-Tenniswyamk3ZHIYIYANGFreddy
committed
feat(submissions): submission processing, DOCX feedback and upload rules
Brings the T2 2026 submissions work from ontrack-features-t2-2026 11.0.x (reviewed and merged work) onto thoth-tech 11.0.x. Co-authored-by: maplefoxgit <s223932052@deakin.edu.au> Co-authored-by: David Tenni <davidctenni@gmail.com> Co-authored-by: Swyam Khare <s223759285@deakin.edu.au> Co-authored-by: Maple Fox <s223932052@deakin.edu.au> Co-authored-by: Freddy <zhiyi9043@gmail.com> Co-authored-by: Reem-997 <s224722416@deakin.edu.au> Co-authored-by: Tan Tai <s224621011@deakin.edu.au> Co-authored-by: Sujay-Deakin <s225044103@deakin.edu.au> Co-authored-by: SandilBandara <sandilbandara@gmail.com> Co-authored-by: sakethsram888 <s225092561@deakin.edu.au> Co-authored-by: Roeenk27 <wagwancentralaaa@gmail.com> Co-authored-by: owensmac <owencostin@bigpond.com> Co-authored-by: Niethin <niethinrueshil@gmail.com> Co-authored-by: mudith-perera <makawitagemudith@gmail.com> Co-authored-by: lgr2002 <leeongouravrangey@gmail.com> Co-authored-by: Gaurav Myana <s225108954@deakin.edu.au> Co-authored-by: dylancleal <dylancleal@gmail.com> Co-authored-by: baohuy-tran <baohuy.tranaus@gmail.com>
1 parent 20d1f38 commit 307b5e8

71 files changed

Lines changed: 4793 additions & 642 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/FILE-A01-safe-upload-policy-matrix.md‎

Lines changed: 849 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# English-Only Assessment Submission Notice
2+
3+
## Proposed Notice
4+
5+
All assessment submissions must be written and submitted in English. Translation tools may be used to help understand the assessment instructions, but the final submitted work must remain in English.
6+
7+
## Recommended Placement
8+
9+
The notice should appear in the following locations:
10+
11+
1. **Assessment task details page** — near the assessment requirements.
12+
2. **Submission upload page** — above the upload or submit button.
13+
3. **Final submission confirmation window** — before the student confirms the submission.
14+
15+
## Behaviour When Translation Is Enabled
16+
17+
The notice should remain visible in English when the language or translation option is active. Translation must not hide or change the requirement that the final assessment submission must be in English.
18+
19+
## Scope
20+
21+
This document provides the proposed wording and recommended placement only. No application or interface changes have been implemented.

‎docs/safe-upload-and-chat-guide.md‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Task uploads and chat attachments
2+
3+
This guide covers the companion Safe Uploads changes under review. They become
4+
available after the web and API PRs are reviewed and merged. It builds on
5+
FILE-A01 by Sandil Sithmaka Bandara Weganthale and the existing FILE-F01 upload
6+
requirements component. The earlier design matrix remains a design record;
7+
this guide records the implemented boundaries and corrects audit assumptions.
8+
9+
## Students and staff
10+
11+
Before choosing a task submission, read its required categories, exact formats,
12+
file count and size limit. Expand the list for Code. Provide one file for each
13+
configured requirement. Spreadsheet means CSV, XLS or XLSX and keeps the original
14+
file and all worksheets for download. The PDF contains a download notice. Code
15+
uses the existing curated extension list; rename tricks do not bypass checks.
16+
The task's PDF category means PDF. PostScript was advertised by the browser but
17+
rejected by the API, so it is no longer advertised as accepted.
18+
19+
In task chat, requirements appear above the composer before selection. Use
20+
**Attach a file** or drop a file onto the discussion. The server supplies the
21+
exact formats. Document accepts DOCX; Spreadsheet accepts CSV or XLSX. Images,
22+
PDF and supported audio remain available. Each attachment must be smaller than
23+
30 MB (30,000,000 bytes), and you may select up to five at once.
24+
25+
Review the name, category and size, then **Post Attachment**. **Cancel** removes
26+
that selection and leaves written text unchanged. Each file is posted as its
27+
own comment. Your written draft is separate: use Send when ready to post it.
28+
Uploading status appears while requests are pending. A failure keeps the draft;
29+
choose the file again to retry. Policy errors explain why the server refused it.
30+
A proxy size rejection asks you to use a smaller file.
31+
32+
Paste a screenshot while typing to enter the same image confirmation flow.
33+
Only approved raster images are accepted from the clipboard. Ordinary text paste
34+
still works. Duplicate paste/beforeinput browser events produce one confirmation.
35+
36+
Documents and spreadsheets appear as download cards with the filename and size.
37+
**Download** uses the authenticated task endpoint. Office documents are never
38+
rendered as active content in OnTrack. Existing attachments remain accessible to
39+
authorized users. A removed or unavailable file produces an error, not access to
40+
another task's file.
41+
42+
| Message / situation | Action |
43+
| -------------------------------------- | ------------------------------------------------------------------------------- |
44+
| Requirements unavailable | Reload and try again; text comments still work |
45+
| Unsupported format | Save in one of the formats listed before selection |
46+
| Empty file | Open and save the file again; check it contains data |
47+
| File too large | Reduce size below the displayed limit |
48+
| Malformed, encrypted or active content | Remove password protection/macros/embedded objects; export a clean copy |
49+
| Legacy XLS in chat | Save as CSV or macro-free XLSX; task Spreadsheet requirements still accept XLS |
50+
| Permission or missing-file error | Check the current task and contact teaching staff if access should be available |
51+
52+
## Unit chairs
53+
54+
In the task editor's upload requirements, choose a category rather than entering
55+
extensions: PDF, Code, Image, Spreadsheet or Archive. Spreadsheet stores the
56+
stable `csv` identifier and displays CSV/XLS/XLSX to students. Existing `archive`
57+
values retain their meaning. No saved-task migration is needed.
58+
59+
The previous audit found a browser CSV/XLS/XLSX list and assumed the task pipeline
60+
already supported it. The API actually omitted `csv` from category validation
61+
and archive handling. The companion API PR completes these paths. It retains
62+
spreadsheet originals and does not silently convert a workbook to its first sheet.
63+
64+
## Contributors and reviewers
65+
66+
- API authority: `app/helpers/comment_attachment_policy.rb`,
67+
`spreadsheet_upload_policy.rb`, `file_helper.rb`, and `task_comments_api.rb`.
68+
- Browser policy interface: `src/app/api/models/task-comment/attachment-policy.ts`.
69+
- Composer owns picker, drop and clipboard confirmation. The viewer delegates
70+
drops to that flow so there is no second permissive allowlist.
71+
- `file-upload-types.ts` owns task browser categories; `upload-category.ts`
72+
supplies requirement labels. The unit-chair selector uses the same stable keys.
73+
- API validates bytes independently; browser MIME is not trusted. Office files
74+
undergo ZIP/XML, active-content and external-content checks and remain download-only.
75+
- Task size: configured API limit, 10,000,000-byte fallback, inclusive. Chat size:
76+
strictly below 30,000,000 bytes. The production proxy default remains 1g; see
77+
[deploy PR 37](https://github.com/ontrack-features-t2-2026/doubtfire-deploy/pull/37)
78+
for finite-limit validation, JSON 413 and real API boundary probe commands.
79+
80+
To change a format, first update and review the API policy and validators. Add
81+
success, renamed-content, malformed, size, authorization and safe-download tests.
82+
The browser automatically receives chat picker extensions. For task categories,
83+
update both the API and browser contract and verify original archive retention.
84+
Do not add arbitrary unit-chair extension entry. New formats need a teaching use
85+
case and a security decision; a browser MIME string is not that decision.
86+
87+
Run with the repository's supported Node version (22.22.3 or newer):
88+
89+
```sh
90+
npm run test:ci -- --include='src/app/tasks/task-comment-composer/**/*.spec.ts' --include='src/app/tasks/task-comments-viewer/task-comments-viewer.component.spec.ts' --include='src/app/tasks/modals/upload-submission-modal/task-upload-requirements/*.spec.ts' --include='src/app/api/services/spec/task-comment.service.spec.ts'
91+
npm run typecheck
92+
npm run lint
93+
npm run build -- --configuration development
94+
```
95+
96+
The API regression matrix is in its `docs/uploads/safe-upload-contract.md`.
97+
Tests cover clipboard duplication separately from file selection, failure draft
98+
preservation, exclusion/size/count checks, drag/drop delegation and requirements.
99+
API tests cover upload/download policy, cleanup, safe headers and access denial.
100+
101+
Repeat these browser checks at desktop and a narrow mobile width before release:
102+
103+
1. Create a Spreadsheet requirement and confirm CSV/XLS/XLSX in student guidance.
104+
2. Select, drop and paste an image; confirm exactly once and cancel without losing text.
105+
3. Select DOCX, CSV and XLSX, post, and download from an authorized account.
106+
4. Try excluded, empty and oversize files; verify clear feedback and unchanged draft.
107+
5. Tab through Attach, confirmation Cancel/Post and Download; verify visible focus,
108+
accessible names and readable requirements at 200% zoom and narrow width.
109+
6. Confirm images/audio/PDF and text-only comments retain their existing behavior.
110+
111+
No malware scanning, cloud-drive links, active Office preview, chat XLS, macro
112+
files, encrypted packages, executables or arbitrary archives are added. Existing
113+
FILE-S01 follow-ups about aggregate quotas and worker recovery remain explicit.
114+
Non-GitHub evidence collection, leadership approval and merging are outside this PR.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# SLR-E01: proposed post-feedback deadline rule
2+
3+
**Status: Proposed; awaiting stakeholder approval.** This is a decision input, not
4+
approved policy, an implementation specification, or evidence that SLR-E01 is complete.
5+
Merging this document does not authorise changes to student deadlines.
6+
7+
This readable version preserves the proposal contributed by ReneeSleepy in
8+
[web #248](https://github.com/ontrack-features-t2-2026/doubtfire-web/pull/248).
9+
The [original PDF](https://github.com/ontrack-features-t2-2026/doubtfire-web/blob/53f6d11340eba4d53e245184507ff3f91743761b/SLR-E01%20.pdf)
10+
remains in that commit for provenance. It ended partway through its acceptance list;
11+
the complete candidate checks and unresolved decisions are recorded below.
12+
13+
## Existing implementation and duplication check
14+
15+
The API already implements a resubmission extension. Reuse its named methods and
16+
[existing rule record](https://github.com/ontrack-features-t2-2026/doubtfire-api/blob/bb360dfa/docs/submission-lifecycle/effective-resubmission-deadline.md)
17+
before considering new work. This was checked against API `11.0.x` at `bb360dfa`
18+
on 20 September 2026; API #94 is already included in that history.
19+
20+
| Area | Existing API behavior | Original proposal below |
21+
| ------------------ | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
22+
| Eligible statuses | Fix and Resubmit, Discuss, Rediscuss, Demonstrate | Same four statuses |
23+
| Eligibility window | Effective deadline less than seven calendar days after assessment | Every eligible feedback event, without that window |
24+
| New date | Adds configured `extension_weeks_on_resubmit_request` to the existing deadline, subject to limits | Seven calendar days after feedback was recorded |
25+
| Repeat handling | Guard targets one extension per submission round; known concurrency gaps remain | Each new eligible feedback event may recalculate |
26+
| Flexible dates | Excluded by existing extension eligibility | Proposed to participate |
27+
| Time zone | Student campus zone, falling back to application zone; effective deadline uses end-of-day anywhere on earth | Described only as the task/unit system time zone |
28+
| Configuration | Unit-level extension configuration | Proposed task-level opt-out, enabled by default |
29+
30+
These are material policy differences, not missing frontend features. The existing
31+
API record also identifies concurrency, transaction and group-comment risks; this
32+
document does not claim to fix them. No API, web behavior, mobile behavior, deploy
33+
configuration, migration or notification delivery changes are included here.
34+
35+
## Original proposed rule
36+
37+
When feedback is recorded with **Fix and Resubmit**, **Discuss**, **Rediscuss**, or
38+
**Demonstrate**, calculate a candidate deadline seven calendar days after the
39+
recorded feedback timestamp. Do not calculate the candidate by adding seven days
40+
to the old deadline or by adding a fixed 168 hours.
41+
42+
The author's proposed interactions are:
43+
44+
- Preserve any later approved extension rather than reducing it.
45+
- Include tasks with flexible dates.
46+
- Respect final and maximum dates; an authorised exception to a final deadline
47+
requires explicit approval.
48+
- Recalculate for each genuinely new eligible feedback event, including another
49+
event before the current extended deadline.
50+
- Apply a consistent result to the relevant group submission and its member tasks.
51+
- Enable the behavior for existing and new tasks, with an opt-out available to
52+
authorised staff at task level.
53+
- Apply only to future eligible feedback. Neither deployment, setting changes nor
54+
old feedback should automatically rewrite historical deadlines.
55+
- Preserve manually authorised changes and explain the actual resulting deadline
56+
to the student, including any limiting final/maximum date.
57+
58+
The original suggested message was: "Your task deadline has been extended to
59+
[date and time] because you received feedback requiring further action."
60+
It is suitable only when the deadline actually moves later. Wording for no change,
61+
a cap, or an opt-out needs acceptance alongside the final rule.
62+
63+
## Decisions required before implementation
64+
65+
| Decision | Why it remains open |
66+
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
67+
| Deadline precedence | Early feedback plus seven days may be earlier than the original deadline. Decide explicitly whether the original deadline, a manual deadline, an approved extension, and an automatic date may ever be shortened. A possible no-shortening rule is a proposal, not an approved formula. |
68+
| Conflicting caps | A later approved extension can exceed a stated final/maximum date. Decide which authority wins and what exception record is required; do not silently truncate an approved extension. |
69+
| Authoritative time zone | Choose campus, unit or another named IANA zone and a fallback. Define whether the result is a wall-clock instant or an end-of-day date; current API semantics must not be changed implicitly. |
70+
| DST transitions | Define the handling of nonexistent or repeated local times, in addition to using calendar days. Include forward and backward clock changes in tests. |
71+
| Feedback identity | Define a genuinely new event versus a retry, re-save, repeated status change, or resubmission round. Decide whether the current one-extension-per-round rule changes. Duplicate delivery must remain idempotent. |
72+
| Flexible and group tasks | Confirm the flexible-date change and how per-member deadlines, campus zones and manual extensions interact for groups. |
73+
| Settings and rollout | Confirm default-on behavior, staff permissions, unit-level configuration interaction, effective start time and treatment of existing extension records. |
74+
| Communication | Decide the authoritative API fields and whether the explanation is a discussion entry, in-app notice, push/email, or a combination. A visible message does not prove notification delivery. |
75+
76+
No stakeholder approval was supplied with this PR. The authorised policy owner
77+
must record their name/role, decision date, chosen rules, rationale and approval
78+
reference before SLR-E02 to SLR-E05 can treat this as an accepted contract.
79+
80+
## Worked examples from the proposal
81+
82+
All dates below illustrate the proposed local-calendar calculation. The zone and
83+
deadline precedence still require the decisions above; these are not assertions
84+
about current API output.
85+
86+
| Case | Input | Proposed candidate / result |
87+
| -------------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- |
88+
| Normal | Original 20 Sep 2026 17:00; Fix and Resubmit recorded 15 Sep 14:00 | 22 Sep 14:00, before applying any authorised caps |
89+
| Feedback after original deadline | Original 15 Sep 17:00; Discuss recorded 16 Sep 10:00 | 23 Sep 10:00, before caps |
90+
| New feedback event | First feedback 10 Sep 09:00; next eligible event 14 Sep 15:00 | Candidates 17 Sep 09:00 then 21 Sep 15:00; a replay of either event is not a new event |
91+
| Approved extension | Approved extension dated 25 Sep; feedback 18 Sep 10:00 | Candidate 25 Sep 10:00; the approved extension's exact time/zone is missing, so the later value cannot be selected yet |
92+
| Task opt-out | Setting disabled; feedback 18 Sep 10:00 | No automatic deadline change under the proposal |
93+
94+
Add an early-feedback example (original 30 September, feedback 15 September,
95+
candidate 22 September) to the policy decision: blindly replacing the original
96+
would shorten the available time by eight days.
97+
98+
## Candidate acceptance checks after policy approval
99+
100+
- Each eligible outcome follows the accepted formula; ineligible outcomes do not
101+
change the deadline.
102+
- Early, on-time and late feedback follow the explicit precedence rules.
103+
- Later approved/manual deadlines and final/maximum caps follow the recorded
104+
authority decision, including a conflict between a later extension and a cap.
105+
- A genuinely new event follows the repeat policy; retries, duplicate delivery,
106+
concurrent assessments and failed transactions do not stack extensions.
107+
- Spring/autumn DST, missing time zones, and cross-zone group members produce the
108+
agreed date and offset; seven calendar days are not assumed to be 168 hours.
109+
- Flexible dates, group propagation, unit settings and task opt-out follow the
110+
accepted configuration and permission rules.
111+
- Deployment and configuration changes leave historical feedback/deadlines intact
112+
unless a separately approved migration explicitly says otherwise.
113+
- Desktop web and the installed mobile PWA show the same server result, including
114+
a readable date/time/zone, accessible feedback explanation, and any cap/no-change
115+
wording. Do not recalculate the policy separately in each client.
116+
117+
Use synthetic accounts and dates for evidence. Link the exact API/web/deploy
118+
revisions and test results after implementation; none are claimed by this proposal.

0 commit comments

Comments
 (0)