From 58573b45e787626c4742a598daf53c14e7fafea1 Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Fri, 27 Nov 2026 22:55:16 +0500 Subject: [PATCH 01/10] Initial commit: adding submission template and initial version of the specification draft --- group-creation-tool/specification.md | 348 +++++++++++++++++++++++++++ group-creation-tool/submission.md | 87 +++++++ 2 files changed, 435 insertions(+) create mode 100644 group-creation-tool/specification.md create mode 100644 group-creation-tool/submission.md diff --git a/group-creation-tool/specification.md b/group-creation-tool/specification.md new file mode 100644 index 00000000..9b33539d --- /dev/null +++ b/group-creation-tool/specification.md @@ -0,0 +1,348 @@ +Project group creation tool +=========================== + +This document specifies what the tool does, as seen by its users. It does not +prescribe how the code is organized. + +Purpose +------- + +The tool is a web app that splits a class into project groups. An +**organizer** lists the students and the projects and posts a link. Each +**student** follows the link and says which projects and which classmates they +would like, or would rather avoid. The organizer then asks the tool to form the +groups that best satisfy these preferences and downloads the result as a +`.csv` file, which is the input to the next project. + +Everyone signs in with their Microsoft Teams (Microsoft 365 work or school) +account. A person's **userid** is the sign-in name of that account, such as +`student@university.edu`. Userids are compared without regard to case. + +Sessions +-------- + +A **session** is one run of the tool: one organizer, one student list, one +project list, the students' preferences, and the formed groups. A session is +either **Open**, when students can change their preferences, or **Closed**, +when they cannot. A new session is Open. + +The organizer can close and reopen a session at any time. Reopening discards +formed groups, after the organizer confirms. A session is kept until its +organizer deletes it; deleting asks for confirmation, removes all its data, and +cannot be undone. + +The organizer is the only person who can see or change a session's +organizer pages. Anyone who signs in can create sessions and becomes the +organizer of the sessions they create. An organizer may also be on the student +list of their own session. + +Organizer pages +--------------- + +### Sessions list + +After signing in at the tool's address, the organizer sees their sessions, +newest first, each with its title, its state, the number of students who have +saved preferences out of the total, and whether groups are formed. A **New +session** button starts the setup below. + +### Session setup + +The organizer enters: + +* A **title**, 1–100 characters, shown to the students. +* The **student list**: userids, separated by commas, spaces, or new lines. +* The **project list**: one project name per line, 1–200 characters each. + +In both lists, leading and trailing spaces are trimmed, empty entries are +ignored, and an entry that repeats an earlier one (ignoring case) is dropped. +In the student list, an entry that is not of the form `name@domain` is +dropped. Every dropped entry is listed under its field with the reason, so the +organizer can correct it. The lists keep the order in which they were entered. + +A session needs at least 1 student and 1 project, and holds at most 500 +students and 100 projects. **Create** is unavailable until these hold. + +Creating the session shows the session page. + +### Session page + +The session page shows: + +1. The title, the state, and **Close** or **Reopen**. +2. The **student link** with a **Copy** button. If the browser does not allow + copying, the link is shown selected, with a message asking the organizer to + copy it manually. The link stays the same for the life of the session and + cannot be guessed from the title or from other sessions' links. +3. The **student list**, showing for each student their userid, their display + name once they have signed in, and one of: *not signed in*, *signed in*, + *saved preferences*. A count above the list gives the number in each + status. +4. The **project list**. +5. The **grouping options** and **Form groups** (see Forming groups). +6. The **results**, once groups are formed (see Results). +7. **Delete session**. + +The organizer can edit both lists, using the same rules as at setup. A student +or project that is removed disappears from every student's preferences; one +that is added appears as unspecified for everyone. Editing the lists discards +formed groups, after the organizer confirms. If the organizer removes a student +or project and adds it again, its earlier preferences are not restored. + +Student page +------------ + +### Signing in + +The student link asks the student to sign in, unless they are already signed +in. Then: + +* If their userid is on the student list, they see the preferences page. +* Otherwise, they see a message naming their userid and the organizer, saying + they are not on this session's list and should contact the organizer, with + a **Sign out** button so they can switch accounts. +* If the session was deleted, they see a message saying so. + +### Preferences page + +The page shows the session title, the organizer's name, the session's state, +and the student's own name with **Sign out**. It has two sections, **Projects** +and **Teammates**, which work the same way: + +* Each section has three categories, shown in this order: **Preferred**, + **Unspecified**, and **Not preferred**. +* **Projects** lists every project. **Teammates** lists every other student + on the list, by display name when known and always by userid; it does not + list the student themselves. +* At first, every item is in Unspecified. Unspecified items keep the order of + the organizer's list; the student cannot reorder them. +* Within Preferred and Not preferred, the student ranks the items, **strongest + feeling first**: the first Preferred item is the one they most want, and the + first Not preferred item is the one they most want to avoid. Each category + says this in its heading. +* An item moved into a category goes to its end. The student can move any item + to another category and up or down within its category, by dragging it or by + using buttons and keys on the item. +* A student may leave any category empty, including putting everything in + Unspecified. + +On narrow screens (under 800 px wide) the categories stack, Preferred first. + +### Saving + +Each change is saved automatically within about a second; no button is needed. +A save indicator shows *Saving…*, *Saved*, or *Not saved*, with a **Retry** +button for the last. Leaving the page with unsaved changes asks the student to +confirm. If the same student edits in two tabs, the later save wins, and the +other tab shows the saved state the next time it saves or is reloaded. + +A student has *saved preferences* once any change of theirs has been saved. + +While the session is Closed, the page shows the student's saved preferences +read-only, with a notice that preferences are closed. A change made just as the +session closes is not saved, and the page says so. + +### Privacy between students + +A student sees only their own preferences. Nobody, including the organizer, +ever sees a student's teammate preferences; the organizer sees how each +student's project preferences were met (see Results). + +Forming groups +-------------- + +### Group sizes + +The organizer chooses the **number of groups**, *G*. It ranges from 1 to the +smaller of the number of projects and the number of students, and defaults to +that upper limit, so that by default every project gets a group. With *S* +students, each group gets about *S*/*G* of them: every group has either +⌊*S*/*G*⌋ or ⌈*S*/*G*⌉ students. Every student is in exactly one group, and +each group works on a different project. When *G* is smaller than the number +of projects, some projects are left without a group. + +A number outside the range is clamped to it, and an emptied number field +returns to its last value when it loses focus. When the lists change, *G* is +clamped to the new range; if it was at the default, it follows the new upper +limit. + +### What "best" means + +The tool scores every possible assignment and looks for the one with the +highest score. + +**Item value.** Every project and every possible teammate has a value for each +student. In a category holding *n* items, the item at position *i* (1 is +first) has the value: + +* Preferred: (*n* − *i* + 1) / *n*. The first choice is worth 1 and the last + 1/*n*. +* Not preferred: −(*n* − *i* + 1) / *n*. The most unwanted item is worth −1 + and the last −1/*n*. +* Unspecified: 0. + +Because each category's values are scaled by its length, ranking more items +does not give a student more weight than ranking fewer. + +**Student satisfaction.** For a student in a group, satisfaction is: + +> *W*p × (value of the group's project) +> \+ *W*t × (sum of the values of the group's other members) + +where *W*p and *W*t are the weights below. + +**Score.** An assignment's score is the sum of every student's satisfaction. +A student who never saved preferences counts as having everything +Unspecified, but other students' preferences about them still count. + +### Grouping options + +| Option | Control | Range | Default | +| --- | --- | --- | --- | +| Number of groups (*G*) | number | see Group sizes | see Group sizes | +| Project preference weight (*W*p) | number | 0–5 | 1 | +| Teammate preference weight (*W*t) | number | 0–5 | 1 | + +Each control has a one-line help text. The weights use the same clamping rule +as the number of groups. The options are saved with the session. + +### Forming + +**Form groups** is available only while the session is Closed; while it is +Open, the button offers to close the session first. Forming shows progress and +can be cancelled, which keeps any earlier results. Forming again replaces the +earlier results, after the organizer confirms. + +The result must be: + +* **Valid:** it satisfies every rule under Group sizes. +* **Best for small classes:** with 8 students or fewer, no valid assignment + has a higher score. +* **Not improvable by a simple change** for any class size: no move of one + student to another group that keeps the sizes valid, no swap of two students + in different groups, no swap of the projects of two groups, and no change of + a group's project to an unused project gives a higher score. +* **Repeatable:** forming again with the same lists, preferences, and options + gives the same groups. + +Results +------- + +### Results view + +The results show the score and, for each group, its number, its project, and +its members. Groups are numbered from 1 in the order of their projects in the +project list. Each member is shown with how their project preference was met: +*preferred #i*, *unspecified*, or *not preferred #i*. A summary gives, for the +whole class, the number of students who got a preferred project, an +unspecified project, and a not-preferred project, and the number of students +with at least one preferred teammate and with at least one not-preferred +teammate in their group. Projects without a group are listed as unused. + +### CSV download + +**Download CSV** saves the results as a file named after the session title, +with characters that are not allowed in file names replaced by `_`, followed +by `-groups.csv`. The file: + +* is UTF-8 text, without a byte-order mark, following RFC 4180: CRLF line + endings, and a field that contains a comma, a double quote, or a line break + is quoted, with its double quotes doubled; +* starts with the header row `student_id,group,project`; +* has one row per student, in the order of the student list, giving their + userid as entered by the organizer, their group number, and their group's + project name. + +For example, two groups, the first working on a project called +`Parser, part 2`: + +``` +student_id,group,project +a@uni.edu,1,"Parser, part 2" +b@uni.edu,2,Linter +c@uni.edu,1,"Parser, part 2" +``` + +Expected results +---------------- + +These rows are the reference behavior for forming groups. Each was checked by +scoring every valid assignment; each has exactly one best assignment. Every +row has students `a`–`d` (or `a`–`e`) and projects `X` and `Y`, in that order, +with every option at its default unless the Settings column says otherwise. +Preferences are written as `PP` (preferred projects), `NP` (not-preferred +projects), `PT` (preferred teammates) and `NT` (not-preferred teammates), each +listed strongest feeling first; anything not listed is Unspecified. + +| Preferences | Settings | Groups | Score | +| --- | --- | --- | --- | +| a PP X; b PP X; c PP Y; d PP Y | | X: a, b; Y: c, d | 4 | +| a PP X, Y; b PP X; c PP X; d PP Y | | X: b, c; Y: a, d | 3.5 | +| a PT b; b PP X; c PT d | | X: a, b; Y: c, d | 3 | +| a NP X; b PP X; c PP X | | X: b, c; Y: a, d | 2 | +| a PP X, Y; b PP X; c PP Y; d PP Y, X | | X: a, b; Y: c, d | 4 | +| a PP X, Y NT b; b PP X NT a; c PP Y; d PP Y, X | | X: b, d; Y: a, c | 3 | +| a PP X PT c; b PP X; c PP Y, X PT a; d PP Y | | X: a, c; Y: b, d | 4.5 | +| a PP X PT c; b PP X; c PP Y, X PT a; d PP Y | *W*t 0 | X: a, b; Y: c, d | 4 | +| a PP X; b PP X; c PP X; d PP Y; e PP Y (5 students) | | X: a, b, c; Y: d, e | 5 | +| a PP Z; b PP Z; c PP Y; d PP Y (projects `X`, `Y`, `Z`) | 2 groups | Y: c, d; Z: a, b | 4 | + +The fifth and sixth rows differ only in the two not-preferred teammates, which +split `a` and `b`. With 7 students, 3 projects, and no preferences, the groups +have 3, 2, and 2 students. + +Limits and failures +------------------- + +* **Sign-in.** Signing in asks only for permission to read the user's name and + sign-in name. If sign-in fails or is cancelled, the page says so and offers + to try again. +* **Lost connection.** If the tool cannot reach its server, every page says so + and keeps what the user has entered; the student page keeps retrying the + save, as described under Saving. +* **Forming time.** Forming groups for 500 students and 100 projects finishes + within 60 seconds. +* **Concurrent changes.** If the organizer edits the lists while a student's + page is open, the student's page shows the new lists within a minute, and at + the latest when it next saves. Preferences about removed items are dropped + as described under Session page. + +Constraints +----------- + +* **Security.** All traffic uses HTTPS. Only the organizer can open a + session's organizer pages, and only listed students can open its preferences + page; every other request is refused, whatever address is used. Nothing a + user enters, such as a title, project name, or display name, is ever run as + a script or shown as anything other than plain text. +* **Browsers:** current Chrome, Edge, Firefox, and Safari, on desktop and + phone. +* **Accessibility:** every control works from the keyboard, including ranking + and moving items between categories; has a visible focus style and a label; + and meets WCAG 2.1 AA, including its contrast requirements. Changes in the + save indicator and in forming progress are announced to screen readers. +* **Themes:** the pages follow the system's light or dark setting. +* **Speed:** every page shows its content within 2 seconds on a typical + connection, for a session of the largest size. + +Acceptance criteria +------------------- + +* Every row of Expected results gives the stated groups and score. +* With random lists of at most 8 students and preferences, the result's score + equals the best score found by checking every valid assignment. +* End to end: an organizer creates a session with three students and two + projects; two of the students sign in through the link and save + preferences, and the third never signs in; the organizer closes the session, + forms groups, and downloads a CSV file that lists all three students, in the + order of the student list, with groups of 2 and 1. + +Out of scope +------------ + +Sign-in other than with a Microsoft work or school account; running inside the +Teams app as a tab or bot; importing the student list from a Teams roster; +sending notifications or showing students their groups; deadlines that close a +session automatically; several organizers per session; editing groups by hand +in the tool; groups of unequal sizes or with several projects each; and +exporting any format other than the CSV file above. diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md new file mode 100644 index 00000000..a167c0b1 --- /dev/null +++ b/group-creation-tool/submission.md @@ -0,0 +1,87 @@ +Project 2 submission +==================== + +Team name: (team name) + +The specification consists of the file [spec.md](spec.md). (Update this with the +name of your specification.) + +Draft submission +---------------- + +### (Team member 1 name) + +GitHub userid: (team member 1's GitHub userid) + +#### Contributions + +(Team member 1's contributions) + +#### Build and run test + +(Summarized LLM output) + +#### Specification review rounds + +(Table showing spec review rounds) + +#### Last specification review + +(LLM and prompt used) + +(LLM output, possibly with strikethrough) + +### (Team member 2 name) + +(Same sections as Team member 1) + +### (Team member 3 name) + +(Same sections as Team member 1) + +### (Team member 4 name) + +(Same sections as Team member 1) + +Final submission +---------------- + +### (Team member 1 name) + +GitHub userid: (team member 1's GitHub userid) + +#### Contributions + +(Team member 1's contributions) + +#### Specification review rounds + +(Table showing spec review rounds) + +#### Last specification review + +(LLM and prompt used) + +(LLM output, possibly with strikethrough) + +#### Implementation review rounds + +(Table showing implementation review rounds) + +#### Last implementation review + +(LLM and prompt used) + +(LLM output, possibly with strikethrough) + +### (Team member 2 name) + +(Same sections as Team member 1) + +### (Team member 3 name) + +(Same sections as Team member 1) + +### (Team member 4 name) + +(Same sections as Team member 1) \ No newline at end of file From 00a0a9effaf60319c68f2a91bd14cba35db0cf7f Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Fri, 27 Nov 2026 23:50:08 +0500 Subject: [PATCH 02/10] Fixed Round 1 of findings, proceeding to Round 2 --- group-creation-tool/specification.md | 366 +++++++++++++++++---------- group-creation-tool/submission.md | 170 ++++++++++++- 2 files changed, 396 insertions(+), 140 deletions(-) diff --git a/group-creation-tool/specification.md b/group-creation-tool/specification.md index 9b33539d..3c6cd8ac 100644 --- a/group-creation-tool/specification.md +++ b/group-creation-tool/specification.md @@ -14,9 +14,10 @@ would like, or would rather avoid. The organizer then asks the tool to form the groups that best satisfy these preferences and downloads the result as a `.csv` file, which is the input to the next project. -Everyone signs in with their Microsoft Teams (Microsoft 365 work or school) -account. A person's **userid** is the sign-in name of that account, such as -`student@university.edu`. Userids are compared without regard to case. +Everyone signs in with the Microsoft 365 work or school account they use for +Microsoft Teams. A person's **userid** is the sign-in name of that account, +such as `student@university.edu`. Userids are compared without regard to case. +Lengths in this document are counted in Unicode code points. Sessions -------- @@ -27,14 +28,17 @@ either **Open**, when students can change their preferences, or **Closed**, when they cannot. A new session is Open. The organizer can close and reopen a session at any time. Reopening discards -formed groups, after the organizer confirms. A session is kept until its -organizer deletes it; deleting asks for confirmation, removes all its data, and -cannot be undone. +formed groups, after the organizer confirms. -The organizer is the only person who can see or change a session's -organizer pages. Anyone who signs in can create sessions and becomes the -organizer of the sessions they create. An organizer may also be on the student -list of their own session. +A session is deleted automatically 365 days after its last change, or earlier +when its organizer deletes it; deleting asks for confirmation and cannot be +undone. Deleting removes everything the session holds; the tool remembers only +that its link no longer works. + +The organizer is the only person who can see or change a session's organizer +pages. Anyone who signs in can create sessions and becomes the organizer of +the sessions they create. An organizer may also be on the student list of +their own session. Organizer pages --------------- @@ -43,8 +47,8 @@ Organizer pages After signing in at the tool's address, the organizer sees their sessions, newest first, each with its title, its state, the number of students who have -saved preferences out of the total, and whether groups are formed. A **New -session** button starts the setup below. +saved preferences out of the total, whether groups are formed, and the date it +will be deleted. A **New session** button starts the setup below. ### Session setup @@ -54,14 +58,20 @@ The organizer enters: * The **student list**: userids, separated by commas, spaces, or new lines. * The **project list**: one project name per line, 1–200 characters each. -In both lists, leading and trailing spaces are trimmed, empty entries are -ignored, and an entry that repeats an earlier one (ignoring case) is dropped. -In the student list, an entry that is not of the form `name@domain` is -dropped. Every dropped entry is listed under its field with the reason, so the +In both lists, leading and trailing spaces are trimmed and empty entries are +ignored. These entries are dropped: + +* an entry that repeats an earlier one, ignoring case; +* a project name longer than 200 characters; +* a student entry that is not a valid userid: one `@`, with text before it and + a domain after it that contains at least one `.`, such as `a@b.edu`. + +Every dropped entry is listed under its field with the reason, so the organizer can correct it. The lists keep the order in which they were entered. -A session needs at least 1 student and 1 project, and holds at most 500 -students and 100 projects. **Create** is unavailable until these hold. +A session needs a title, at least 1 student, and at least 1 project, and holds +at most 500 students and 100 projects. **Create** is unavailable until these +hold. Creating the session shows the session page. @@ -75,33 +85,50 @@ The session page shows: copy it manually. The link stays the same for the life of the session and cannot be guessed from the title or from other sessions' links. 3. The **student list**, showing for each student their userid, their display - name once they have signed in, and one of: *not signed in*, *signed in*, - *saved preferences*. A count above the list gives the number in each - status. + name once they have signed in, and one of: *not signed in*, *signed in* + (they have opened this session's link and signed in), or *saved + preferences*. A count above the list gives the number in each status. 4. The **project list**. 5. The **grouping options** and **Form groups** (see Forming groups). 6. The **results**, once groups are formed (see Results). 7. **Delete session**. -The organizer can edit both lists, using the same rules as at setup. A student -or project that is removed disappears from every student's preferences; one -that is added appears as unspecified for everyone. Editing the lists discards -formed groups, after the organizer confirms. If the organizer removes a student -or project and adds it again, its earlier preferences are not restored. +The organizer can edit both lists as text, using the same rules as at setup. +A student or project that is removed disappears from every student's +preferences; one that is added appears as unspecified for everyone. Changing +only the case of an entry keeps it as the same entry. Any other change to an +entry's text counts as removing it and adding a new one, so an entry that is +removed and added again starts over, without its earlier preferences and, for +a student, as *not signed in*. + +To correct a userid or a project name without losing preferences, the +organizer uses the entry's **Rename** action instead. A renamed entry keeps +every preference by it and about it, and a renamed student who had signed in +stays recognized, as described under Signing in. + +Editing or renaming entries discards formed groups, after the organizer +confirms. Student page ------------ ### Signing in -The student link asks the student to sign in, unless they are already signed -in. Then: - -* If their userid is on the student list, they see the preferences page. -* Otherwise, they see a message naming their userid and the organizer, saying - they are not on this session's list and should contact the organizer, with - a **Sign out** button so they can switch accounts. -* If the session was deleted, they see a message saying so. +If the student link does not belong to an existing session, for example +because the session was deleted, the page says so without asking the student +to sign in. Otherwise, the page asks the student to sign in, unless they are +already signed in. Then: + +* A student is **on the list** when their sign-in name or their account's + email address matches a userid on the student list. They see the + preferences page. +* The first time a student opens the session, it links that userid to their + account. From then on, the session recognizes them by their account even if + its sign-in name or email address changes, and no other account can use that + userid. +* Anyone else sees a message naming their sign-in name and the organizer, + saying they are not on this session's list and should contact the + organizer, with a **Sign out** button so they can switch accounts. ### Preferences page @@ -114,15 +141,19 @@ and **Teammates**, which work the same way: * **Projects** lists every project. **Teammates** lists every other student on the list, by display name when known and always by userid; it does not list the student themselves. -* At first, every item is in Unspecified. Unspecified items keep the order of - the organizer's list; the student cannot reorder them. +* At first, every item is in Unspecified. Unspecified items are always in the + order of the organizer's list: an item moved back to Unspecified takes its + place in that order, and the student cannot reorder them. * Within Preferred and Not preferred, the student ranks the items, **strongest feeling first**: the first Preferred item is the one they most want, and the first Not preferred item is the one they most want to avoid. Each category - says this in its heading. -* An item moved into a category goes to its end. The student can move any item - to another category and up or down within its category, by dragging it or by - using buttons and keys on the item. + says this in its heading. An item moved into one of these categories goes to + its end. +* The student can move any item to another category and, within Preferred and + Not preferred, up or down one place or to the top or the bottom. Every move + can be made by dragging the item or with buttons and keys on it. +* Each section has a filter field, which shows only the items whose name or + userid contains its text. Items can be moved while the section is filtered. * A student may leave any category empty, including putting everything in Unspecified. @@ -130,46 +161,67 @@ On narrow screens (under 800 px wide) the categories stack, Preferred first. ### Saving -Each change is saved automatically within about a second; no button is needed. -A save indicator shows *Saving…*, *Saved*, or *Not saved*, with a **Retry** -button for the last. Leaving the page with unsaved changes asks the student to -confirm. If the same student edits in two tabs, the later save wins, and the -other tab shows the saved state the next time it saves or is reloaded. +Each change is saved automatically within 2 seconds; no button is needed. A +save indicator shows *Saving…*, *Saved*, or *Not saved*. While a save is +failing, the page retries every 10 seconds, and *Not saved* has a **Retry** +button that retries at once. Leaving the page with unsaved changes asks the +student to confirm, in browsers that allow this; unsaved changes are lost when +the page is closed or reloaded. + +Each save replaces all of the student's saved preferences, so if the student +has the page open in two tabs, the last save wins. An open page shows +preferences saved from another tab within a minute, unless it has unsaved +changes of its own. A student has *saved preferences* once any change of theirs has been saved. While the session is Closed, the page shows the student's saved preferences -read-only, with a notice that preferences are closed. A change made just as the -session closes is not saved, and the page says so. +read-only, with a notice that preferences are closed. A change that reaches +the tool after the session closed is not saved, and the page says so. ### Privacy between students -A student sees only their own preferences. Nobody, including the organizer, -ever sees a student's teammate preferences; the organizer sees how each -student's project preferences were met (see Results). +A student sees only their own preferences. No page or file shows a student's +teammate preferences, or any figure computed from them, to anyone but that +student. The organizer sees how each student's project preference was met +(see Results). + +The groups themselves follow from the teammate preferences, so these cannot be +hidden completely: an organizer who compares groups formed with different +weights, or who knows a very small class, may infer some of them. Forming groups -------------- ### Group sizes -The organizer chooses the **number of groups**, *G*. It ranges from 1 to the -smaller of the number of projects and the number of students, and defaults to -that upper limit, so that by default every project gets a group. With *S* -students, each group gets about *S*/*G* of them: every group has either -⌊*S*/*G*⌋ or ⌈*S*/*G*⌉ students. Every student is in exactly one group, and -each group works on a different project. When *G* is smaller than the number -of projects, some projects are left without a group. +The organizer sets the **group size**, *k*. With *S* students: + +* *k* ranges from 1 to *S*. Until the organizer changes it, it is √*S* + rounded to the nearest whole number, with halves rounded up, but at least 2 + when there are 2 or more students, and it follows the student list as that + changes. Once the organizer changes it, it keeps its value, clamped to the + range when the student list changes. +* The tool forms *G* = ⌊*S*/*k*⌋ groups, but at least 1. Every group has + either ⌊*S*/*G*⌋ or ⌈*S*/*G*⌉ students, so the students left over after + filling groups of *k* are spread over the groups. Every student is in + exactly one group. + +For example, 50 students give a group size of 7 and 7 groups: six of 7 +students and one of 8. 500 students give 22 groups of 22 or 23. -A number outside the range is clamped to it, and an emptied number field -returns to its last value when it loses focus. When the lists change, *G* is -clamped to the new range; if it was at the default, it follows the new upper -limit. +Projects are spread evenly over the groups. With *P* projects, each project +gets ⌊*G*/*P*⌋ or ⌈*G*/*P*⌉ groups. So several groups can work on the same +project, and when there are fewer groups than projects, some projects get no +group. The preferences decide which projects get the extra groups, and which +group gets which project. ### What "best" means -The tool scores every possible assignment and looks for the one with the -highest score. +The score below measures how well an assignment of students to groups and +projects meets the preferences. The tool looks for an assignment with a high +score, with the guarantees under Forming. For a large class it cannot check +every assignment, so it need not find the very best one. **Item value.** Every project and every possible teammate has a value for each student. In a category holding *n* items, the item at position *i* (1 is @@ -181,13 +233,26 @@ first) has the value: and the last −1/*n*. * Unspecified: 0. -Because each category's values are scaled by its length, ranking more items -does not give a student more weight than ranking fewer. +**Project part.** A student's project part is the value of their group's +project. -**Student satisfaction.** For a student in a group, satisfaction is: +**Teammate part.** For a student whose group has *m* other members: -> *W*p × (value of the group's project) -> \+ *W*t × (sum of the values of the group's other members) +* The *preferred share* is the sum of the values of the members in their + Preferred category, divided by the largest sum any *m* members could give: + the sum of the first *m* values of that category, or of all of them if it + holds fewer than *m*. +* The *not-preferred share* is worked out the same way from their Not + preferred category, and is 0 or negative. +* An empty category's share is 0. The teammate part is the sum of the two + shares. + +So the project part and the teammate part each range from −1 to 1, however +many items a student ranks. + +**Student satisfaction** is: + +> *W*p × project part + *W*t × teammate part where *W*p and *W*t are the weights below. @@ -195,55 +260,79 @@ where *W*p and *W*t are the weights below. A student who never saved preferences counts as having everything Unspecified, but other students' preferences about them still count. +These teammate parts show the scaling, for a student `a`: + +| `a`'s teammate preferences | `a`'s group's other members | Teammate part | +| --- | --- | --- | +| Preferred: `b`, `c` | `b`, `c` | 1 | +| Preferred: `b`, `c` | `b`, `d` | 2/3 | +| Preferred: `b` | `b`, `c` | 1 | +| Not preferred: `b`, `c` | `b`, `d` | −2/3 | +| Preferred: `b`, `c`; Not preferred: `d` | `c`, `d` | −2/3 | + ### Grouping options | Option | Control | Range | Default | | --- | --- | --- | --- | -| Number of groups (*G*) | number | see Group sizes | see Group sizes | +| Group size (*k*) | number | 1 to the number of students | see Group sizes | | Project preference weight (*W*p) | number | 0–5 | 1 | | Teammate preference weight (*W*t) | number | 0–5 | 1 | -Each control has a one-line help text. The weights use the same clamping rule -as the number of groups. The options are saved with the session. +Each control has a one-line help text. The fields take whole numbers: a +fraction is rounded to the nearest whole number, a number outside the range +is clamped to it, and an emptied field returns to its last value when it loses +focus. + +The options are saved with the session. Changing one after groups are formed +marks the results as out of date: the results and the CSV file keep the groups +formed earlier, and the results show the options used to form them, until +groups are formed again. ### Forming **Form groups** is available only while the session is Closed; while it is -Open, the button offers to close the session first. Forming shows progress and -can be cancelled, which keeps any earlier results. Forming again replaces the -earlier results, after the organizer confirms. +Open, the button offers to close the session first. While groups are being +formed, the page says so, shows the time elapsed, and offers **Cancel**, which +keeps any earlier results. Forming again replaces the earlier results, after +the organizer confirms. The result must be: -* **Valid:** it satisfies every rule under Group sizes. +* **Valid:** it follows every rule under Group sizes. * **Best for small classes:** with 8 students or fewer, no valid assignment has a higher score. -* **Not improvable by a simple change** for any class size: no move of one - student to another group that keeps the sizes valid, no swap of two students - in different groups, no swap of the projects of two groups, and no change of - a group's project to an unused project gives a higher score. +* **Not improvable by a simple change** for any class size: none of these + gives a higher score while keeping the assignment valid: moving one student + to another group, swapping two students in different groups, swapping the + projects of two groups, or giving one group a different project. * **Repeatable:** forming again with the same lists, preferences, and options - gives the same groups. + gives the same groups, on any computer; the result does not depend on how + fast forming runs. Results ------- ### Results view -The results show the score and, for each group, its number, its project, and -its members. Groups are numbered from 1 in the order of their projects in the -project list. Each member is shown with how their project preference was met: -*preferred #i*, *unspecified*, or *not preferred #i*. A summary gives, for the -whole class, the number of students who got a preferred project, an -unspecified project, and a not-preferred project, and the number of students -with at least one preferred teammate and with at least one not-preferred -teammate in their group. Projects without a group are listed as unused. +The results show, for each group, its number, its project, and its members. +Groups are numbered from 1 in the order of their projects in the project +list; groups working on the same project are numbered in the order of their +first member in the student list. Each member is shown by display name when +known and always by userid, with how their project preference was met: +*preferred #i*, *unspecified*, or *not preferred #i*. + +A summary gives the number of students who got a preferred project, an +unspecified project, and a not-preferred project, and lists the projects +without a group. The results also show the options they were formed with. + +The score is not shown, since it is partly computed from teammate preferences +(see Privacy between students). ### CSV download -**Download CSV** saves the results as a file named after the session title, -with characters that are not allowed in file names replaced by `_`, followed -by `-groups.csv`. The file: +**Download CSV** saves the results as a file whose name is the session title, +with every character other than a letter, a digit, `-`, or `_` replaced by +`_`, followed by `-groups.csv`. The file: * is UTF-8 text, without a byte-order mark, following RFC 4180: CRLF line endings, and a field that contains a comma, a double quote, or a line break @@ -253,26 +342,35 @@ by `-groups.csv`. The file: userid as entered by the organizer, their group number, and their group's project name. -For example, two groups, the first working on a project called +The file is meant to be read by programs, such as the next project. Values are +written exactly as entered, even ones that a spreadsheet would treat as +formulas. + +For example, three groups, the first two working on a project called `Parser, part 2`: ``` student_id,group,project a@uni.edu,1,"Parser, part 2" -b@uni.edu,2,Linter +b@uni.edu,2,"Parser, part 2" c@uni.edu,1,"Parser, part 2" +d@uni.edu,3,Linter ``` Expected results ---------------- These rows are the reference behavior for forming groups. Each was checked by -scoring every valid assignment; each has exactly one best assignment. Every -row has students `a`–`d` (or `a`–`e`) and projects `X` and `Y`, in that order, -with every option at its default unless the Settings column says otherwise. -Preferences are written as `PP` (preferred projects), `NP` (not-preferred -projects), `PT` (preferred teammates) and `NT` (not-preferred teammates), each -listed strongest feeling first; anything not listed is Unspecified. +scoring every valid assignment; each has exactly one best assignment. The +score is not shown in the tool; it is given here for tests. + +Each row has students `a`–`d` and projects `X` and `Y`, in that order, unless +the Preferences column says otherwise, and every option is at its default +unless the Settings column says otherwise. With 4 to 6 students the default +group size is 2. Preferences are written as `PP` (preferred projects), `NP` +(not-preferred projects), `PT` (preferred teammates) and `NT` (not-preferred +teammates), each listed strongest feeling first; anything not listed is +Unspecified. | Preferences | Settings | Groups | Score | | --- | --- | --- | --- | @@ -284,58 +382,67 @@ listed strongest feeling first; anything not listed is Unspecified. | a PP X, Y NT b; b PP X NT a; c PP Y; d PP Y, X | | X: b, d; Y: a, c | 3 | | a PP X PT c; b PP X; c PP Y, X PT a; d PP Y | | X: a, c; Y: b, d | 4.5 | | a PP X PT c; b PP X; c PP Y, X PT a; d PP Y | *W*t 0 | X: a, b; Y: c, d | 4 | -| a PP X; b PP X; c PP X; d PP Y; e PP Y (5 students) | | X: a, b, c; Y: d, e | 5 | -| a PP Z; b PP Z; c PP Y; d PP Y (projects `X`, `Y`, `Z`) | 2 groups | Y: c, d; Z: a, b | 4 | +| students `a`–`e`; a PP X; b PP X; c PP X; d PP Y; e PP Y | | X: a, b, c; Y: d, e | 5 | +| projects `X`, `Y`, `Z`; a PP Z; b PP Z; c PP Y; d PP Y | | Y: c, d; Z: a, b | 4 | +| project `X` only; a PT b; c PT d | | X: a, b; X: c, d | 2 | +| students `a`–`f`; a PP X PT b; b PP X; c PP X PT d; d PP X; e PP Y; f PP Y | | X: a, b; X: c, d; Y: e, f | 8 | +| students `a`–`f`; a PT b, c; b PP X; d PT e | group size 3 | X: a, b, c; Y: d, e, f | 3 | The fifth and sixth rows differ only in the two not-preferred teammates, which -split `a` and `b`. With 7 students, 3 projects, and no preferences, the groups -have 3, 2, and 2 students. +split `a` and `b`. With 7 students and no preferences, the default group size +is 3, giving 2 groups, of 4 and 3 students. Limits and failures ------------------- -* **Sign-in.** Signing in asks only for permission to read the user's name and - sign-in name. If sign-in fails or is cancelled, the page says so and offers - to try again. -* **Lost connection.** If the tool cannot reach its server, every page says so - and keeps what the user has entered; the student page keeps retrying the - save, as described under Saving. +* **Sign-in.** Signing in asks only for permission to read the user's name, + sign-in name, and email address. If sign-in fails or is cancelled, the page + says so and offers to try again. If the user's organization requires an + administrator to approve the tool first, the page says so and suggests + asking the organization's IT administrator. +* **Lost connection.** If the tool cannot reach its server, every page says + so. The student page keeps retrying, as described under Saving; the + organizer pages keep what the organizer has entered while the page stays + open. * **Forming time.** Forming groups for 500 students and 100 projects finishes within 60 seconds. * **Concurrent changes.** If the organizer edits the lists while a student's - page is open, the student's page shows the new lists within a minute, and at - the latest when it next saves. Preferences about removed items are dropped - as described under Session page. + page is open, the student's page shows the new lists within a minute. + Preferences about removed items are dropped as described under Session + page. Constraints ----------- * **Security.** All traffic uses HTTPS. Only the organizer can open a - session's organizer pages, and only listed students can open its preferences - page; every other request is refused, whatever address is used. Nothing a - user enters, such as a title, project name, or display name, is ever run as - a script or shown as anything other than plain text. -* **Browsers:** current Chrome, Edge, Firefox, and Safari, on desktop and - phone. + session's organizer pages, and only students on the list can open its + preferences page; every other request is refused, whatever address is used. + Nothing a user enters, such as a title, project name, or display name, is + ever run as a script or shown on a page as anything other than plain text. +* **Browsers:** the two latest major versions of Chrome, Edge, Firefox, and + Safari, on desktop and phone. * **Accessibility:** every control works from the keyboard, including ranking and moving items between categories; has a visible focus style and a label; and meets WCAG 2.1 AA, including its contrast requirements. Changes in the - save indicator and in forming progress are announced to screen readers. + save indicator and in the forming status are announced to screen readers. * **Themes:** the pages follow the system's light or dark setting. -* **Speed:** every page shows its content within 2 seconds on a typical - connection, for a session of the largest size. +* **Speed:** every page shows its content within 2 seconds over a 10 Mbit/s + connection with 100 ms latency, for a session of the largest size. Acceptance criteria ------------------- -* Every row of Expected results gives the stated groups and score. +* Every row of Expected results gives the stated groups and score, and every + row of the teammate-part table under What "best" means gives the stated + value. * With random lists of at most 8 students and preferences, the result's score equals the best score found by checking every valid assignment. -* End to end: an organizer creates a session with three students and two - projects; two of the students sign in through the link and save - preferences, and the third never signs in; the organizer closes the session, - forms groups, and downloads a CSV file that lists all three students, in the - order of the student list, with groups of 2 and 1. +* End to end: an organizer creates a session with four students and two + projects; three of the students sign in through the link and save + preferences, and the fourth never signs in; the organizer closes the + session, forms groups, and downloads a CSV file that lists all four + students, in the order of the student list, in two groups of 2, one for each + project. Out of scope ------------ @@ -344,5 +451,6 @@ Sign-in other than with a Microsoft work or school account; running inside the Teams app as a tab or bot; importing the student list from a Teams roster; sending notifications or showing students their groups; deadlines that close a session automatically; several organizers per session; editing groups by hand -in the tool; groups of unequal sizes or with several projects each; and -exporting any format other than the CSV file above. +in the tool; group sizes or spreads of projects other than those under Group +sizes; groups with several projects each; and exporting any format other than +the CSV file above. diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index a167c0b1..9a1099fc 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -1,35 +1,183 @@ Project 2 submission ==================== -Team name: (team name) +Team name: Project Group Creation Tool 2 -The specification consists of the file [spec.md](spec.md). (Update this with the -name of your specification.) +The specification consists of the file [specification.md](specification.md). + +The submission consists of the file [submission.md](submission.md). Draft submission ---------------- -### (Team member 1 name) +### Daniil Kaimekin -GitHub userid: (team member 1's GitHub userid) +GitHub userid: dkaimekinmasters + +Git userid: dkaimekin #### Contributions -(Team member 1's contributions) +Generated initial specification for the project, conducted multiple calls to clarify requirements. #### Build and run test -(Summarized LLM output) +Build and run tests are not included, as current project stage only required the specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) is not directly related to the project, and only used for pull request tracking. #### Specification review rounds -(Table showing spec review rounds) +| Round | Findings | Main Changes Made | +| --- | --- | --- | +| 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | #### Last specification review -(LLM and prompt used) - -(LLM output, possibly with strikethrough) +LLM: Claude Opus 5.5 (`claude-opus-5-5`), in the Claude Code tab of the Claude +desktop app. + +Prompt: + +> Review a specification at @group-creation-tool/specification.md . Rate it +> from 1 to 10. Do not modify the file. Find logical inconsistencies, vague +> terms, architectural mismatch. + +Output (line numbers refer to [specification.md](specification.md) as it was +reviewed, before this round's changes; strikethrough marks findings judged +incorrect): + +I'd rate it **7/10**. It's precise, mostly testable, scopes itself clearly, and +its worked examples are correct. I ran an exhaustive search over every row of +the Expected results table, and each one produces exactly the stated groups and +score, with a single best assignment. What keeps it from an 8–9 is a handful of +real contradictions, one false claim in the scoring model, and identity and +privacy promises that can't be kept as written. + +##### Logical inconsistencies + +1. **The weighting claim is false for teammates** (line 184). The spec says + scaling by category length means ranking more items gives no extra weight. + That holds for projects, because a group has only one. It fails for + teammates, because satisfaction *sums* teammate values. A student with one + preferred teammate can add at most 1; one with four preferred teammates, all + placed together, adds 1 + .75 + .5 + .25 = 2.5. Students who rank more + classmates get more pull on the result, and the effect grows with group + size. +2. **Unspecified can't be reordered, yet items move to its end.** Unspecified + "keeps the order of the organizer's list" and "cannot reorder" (line 117). + But "an item moved into a category goes to its end" and "any item" can move + "up or down within its category" (lines 123–125). Moving a Preferred item + back to Unspecified breaks one rule or the other. +3. **The page reports a deletion that left no trace.** Deleting "removes all + its data" (line 31), but a later visitor "see[s] a message saying so" (line + 104). The server can only tell "deleted" from "never existed" if it keeps a + record of deleted sessions. The order of checks is also unstated: a deleted + session versus a user who isn't on the list. +4. **"Nobody ever sees teammate preferences" can't be guaranteed** (line 147). + The organizer sees the score, can set *W*p = 0, and sees how many + students have at least one preferred or not-preferred teammate (line 238). + In a small class, or by re-forming with different weights, teammate + preferences can be worked out. The promise should be "never shown + directly". +5. **The default number of groups contradicts its own rationale** (line 157). + The default is the smaller of the student and project counts, "so that by + default every project gets a group". When there are more projects than + students, that's untrue: the default becomes one student per group, + teammate preferences stop mattering, and some projects go unused. A class of + 20 with 25 project ideas gets 20 solo groups by default. +6. **The two-tab rule is self-defeating** (lines 136–137). "The later save + wins" means that when the other tab next saves, *its* state wins. So "shows + the saved state the next time it saves" never changes anything. Also, list + changes are polled (they appear "within a minute", line 305), but + preferences changed in another tab aren't, which is inconsistent. +7. **A cross-reference points to text that isn't there.** "Keeps retrying the + save, as described under Saving" (line 301), but Saving describes only a + manual **Retry** button, not automatic retries. +8. **Changing options doesn't say what happens to formed groups.** Editing the + lists discards them (line 89), but changing the grouping options says + nothing (line 207). The results and CSV can then disagree with the saved + options. +9. **Repeatability conflicts with the time limit.** "Repeatable" (line 225) and + "within 60 seconds" (line 303) only coexist if the search stops after a + fixed amount of work, not a wall-clock deadline. Otherwise a slower machine + gives different groups. ~~Which of several tied assignments wins is never + specified either, for example when both weights are 0 and every assignment + scores 0.~~ +10. **Over-long project names have no stated outcome.** Projects must be 1–200 + characters (line 55), but the list of drop reasons (lines 57–61) doesn't + cover a 201-character entry: is it dropped, truncated, or does it block + **Create**? + +##### Vague terms + +* **Wording that can't be tested:** "about a second" (133), "just as the + session closes" (142), "typical connection" (326), and "current" Chrome, + Edge, Firefox and Safari (318). +* **"At the default" for the number of groups** (166): does it mean the value + equals the upper limit, or that the organizer never touched it? +* **Number fields:** the step for the weights (integer or decimal?) and how a + fractional number of groups is rounded are both unstated. +* **Input formats:** what counts as `name@domain` (is `a@b` valid?), and + whether the 1–100 title length is counted in code points or graphemes. +* **File names:** "characters that are not allowed in file names" doesn't say + on which operating system. Windows reserved names like `CON` aren't + addressed. +* **Status labels:** does *signed in* mean signed in via this session's link or + to the tool at all? Does a student removed and re-added keep their status and + display name? +* **Display formats:** "Shows progress" (212) has no meaning for a local search + with no known end point. Score precision (values like 1/3) and whether + results show members by display name or userid are unspecified. +* **Renaming:** list identity is the name itself, so fixing a typo in a project + name counts as remove plus add and silently wipes everyone's preferences for + it (86–90). It's also unclear whether a case-only change (`Parser` → + `parser`) is the same item. + +##### Architectural mismatch + +* **Identity is keyed on a value Microsoft says not to authorize on.** The + userid is "the sign-in name" (17). With only name and sign-in-name permission + (297), that's the `preferred_username` claim, which Microsoft documents as + changeable and unsuitable for authorization decisions. Sign-in names also + often differ from the email addresses an organizer will paste in, and guest + accounts look like `x_gmail.com#EXT#@…`. Expect many false "not on this list" + pages. A safer design keeps the typed userid for matching but binds the + stable `tid` + `oid` account identifiers on first sign-in. +* **Any Microsoft work or school account can create sessions** (35), from any + organization. Some organizations also block users from granting consent to + outside apps, which is a likely sign-in failure the spec doesn't mention. +* **Safari on iPhone doesn't reliably support the leave-page warning** (135), + which conflicts with the browser list on line 318. +* **Ranking at 500 students is impractical by keyboard.** A student sees up to + 499 teammates, and moving one item a step at a time is the only keyboard + method (123, 320). That's technically accessible but unusable: it needs "move + to top" or search. +* **"Keeps what the user has entered"** (301) doesn't say whether that survives + a page reload, which decides whether browser storage is needed. +* **CSV gaps.** Project names starting with `=`, `+`, `-` or `@` become + formulas when opened in Excel, and the "never run as a script" rule (316) + doesn't cover the file. Without a byte-order mark, Excel on Windows also + garbles non-ASCII names. Both may be acceptable if the file is only read by + programs, but the spec should say so. +* **Data retention is unbounded.** Student data is kept indefinitely (30) and + only one organizer can delete it, so an organizer who leaves orphans their + sessions. That's a privacy and compliance concern for school data. +* ~~**Terminology:** a "Microsoft Teams account" (17) is really a Microsoft + work or school account, and Teams integration is out of scope, so the Teams + framing is misleading.~~ +* ~~**Repo fit:** the spec sits in the CodeChat Editor repo, a local + single-user Rust/TypeScript editor. Nothing there provides multi-user + storage, Microsoft sign-in or polling, so this would be a standalone + codebase. The "doesn't prescribe how the code is organized" claim (4) also + softens once polling, a cancellable server job, and stable ids are + effectively required.~~ + +##### What's strong + +The scoring model is stated exactly, the sizing rules are clear, the CSV format +is precise, and the example table is correct and covers useful edge cases. The +acceptance criteria can be checked, the out-of-scope list is explicit, and the +accessibility, theme and security requirements are concrete. Fixing items 1–6 +and the identity issue would put it at about 9. ### (Team member 2 name) From 676bb8c357698460d65ffaf6def5b6e7f6335878 Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Sat, 28 Nov 2026 00:10:36 +0500 Subject: [PATCH 03/10] Round 2 Findings --- group-creation-tool/submission.md | 229 ++++++++++++++---------------- 1 file changed, 108 insertions(+), 121 deletions(-) diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index 9a1099fc..c19c97d8 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -29,6 +29,7 @@ Build and run tests are not included, as current project stage only required the | Round | Findings | Main Changes Made | | --- | --- | --- | | 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | +| 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | | #### Last specification review @@ -45,139 +46,125 @@ Output (line numbers refer to [specification.md](specification.md) as it was reviewed, before this round's changes; strikethrough marks findings judged incorrect): -I'd rate it **7/10**. It's precise, mostly testable, scopes itself clearly, and -its worked examples are correct. I ran an exhaustive search over every row of -the Expected results table, and each one produces exactly the stated groups and -score, with a single best assignment. What keeps it from an 8–9 is a handful of -real contradictions, one false claim in the scoring model, and identity and -privacy promises that can't be kept as written. +I'd rate it **8/10**, up from 7 in round 1. Most of round 1's findings are +fixed and the scoring model is now tight. I brute-forced all 13 Expected +results rows. Each one gives exactly the stated groups and score, and each has +exactly one best assignment. The default group sizes for 4–7, 50 and 500 +students also match the text. Three things keep it from a 9: a sign error in +the teammate formula, a CSV example that the spec's own rules can't produce, +and an identity rule that lets one person pass as another. ##### Logical inconsistencies -1. **The weighting claim is false for teammates** (line 184). The spec says - scaling by category length means ranking more items gives no extra weight. - That holds for projects, because a group has only one. It fails for - teammates, because satisfaction *sums* teammate values. A student with one - preferred teammate can add at most 1; one with four preferred teammates, all - placed together, adds 1 + .75 + .5 + .25 = 2.5. Students who rank more - classmates get more pull on the result, and the effect grows with group - size. -2. **Unspecified can't be reordered, yet items move to its end.** Unspecified - "keeps the order of the organizer's list" and "cannot reorder" (line 117). - But "an item moved into a category goes to its end" and "any item" can move - "up or down within its category" (lines 123–125). Moving a Preferred item - back to Unspecified breaks one rule or the other. -3. **The page reports a deletion that left no trace.** Deleting "removes all - its data" (line 31), but a later visitor "see[s] a message saying so" (line - 104). The server can only tell "deleted" from "never existed" if it keeps a - record of deleted sessions. The order of checks is also unstated: a deleted - session versus a user who isn't on the list. -4. **"Nobody ever sees teammate preferences" can't be guaranteed** (line 147). - The organizer sees the score, can set *W*p = 0, and sees how many - students have at least one preferred or not-preferred teammate (line 238). - In a small class, or by re-forming with different weights, teammate - preferences can be worked out. The promise should be "never shown - directly". -5. **The default number of groups contradicts its own rationale** (line 157). - The default is the smaller of the student and project counts, "so that by - default every project gets a group". When there are more projects than - students, that's untrue: the default becomes one student per group, - teammate preferences stop mattering, and some projects go unused. A class of - 20 with 25 project ideas gets 20 solo groups by default. -6. **The two-tab rule is self-defeating** (lines 136–137). "The later save - wins" means that when the other tab next saves, *its* state wins. So "shows - the saved state the next time it saves" never changes anything. Also, list - changes are polled (they appear "within a minute", line 305), but - preferences changed in another tab aren't, which is inconsistent. -7. **A cross-reference points to text that isn't there.** "Keeps retrying the - save, as described under Saving" (line 301), but Saving describes only a - manual **Retry** button, not automatic retries. -8. **Changing options doesn't say what happens to formed groups.** Editing the - lists discards them (line 89), but changing the grouping options says - nothing (line 207). The results and CSV can then disagree with the saved - options. -9. **Repeatability conflicts with the time limit.** "Repeatable" (line 225) and - "within 60 seconds" (line 303) only coexist if the search stops after a - fixed amount of work, not a wall-clock deadline. Otherwise a slower machine - gives different groups. ~~Which of several tied assignments wins is never - specified either, for example when both weights are 0 and every assignment - scores 0.~~ -10. **Over-long project names have no stated outcome.** Projects must be 1–200 - characters (line 55), but the list of drop reasons (lines 57–61) doesn't - cover a 201-character entry: is it dropped, truncated, or does it block - **Create**? +1. **The not-preferred share has the wrong sign as written** (lines 241–247). + The share is "the sum of the values … divided by the largest sum", and the + not-preferred share is "worked out the same way". For not-preferred + teammates both of those sums are negative, so dividing one by the other + gives a positive number. Taken literally, table row 4 gives **+2/3** instead + of −2/3, and row 5 gives **4/3** instead of −2/3. The text needs "divided by + the absolute value of" (or "by the size of") the largest sum. The table and + the Expected results only come out right with that reading. +2. **The CSV example can't happen** (lines 349–358). It shows 4 students in 3 + groups. But G = ⌊4/*k*⌋ gives 4, 2, 1, 1 for *k* = 1…4, so 3 groups is + impossible with 4 students. Use 5 or 6 students, or 2 groups. +3. **Group size 1 divides by zero** (lines 200 and 239–248). *k* can be 1, + which leaves *m* = 0 other members. The denominator is then "the sum of the + first 0 values", which is 0. "An empty category's share is 0" covers an + empty category, not a group with no other members. +4. **A save rejected because the session closed collides with the retry + rule** (lines 165–167 and 178–180). "While a save is failing, the page + retries every 10 seconds." A save refused because the session is Closed + counts as failing, so the page would retry forever, keep the leave-page + warning on, and could succeed later if the organizer reopens. Say that a + closed-session refusal is final and the page switches to read-only. +5. **A stale tab can bring back preferences that should have been dropped** + (lines 96–102, 171–174 and 409–412). "Each save replaces all of the + student's saved preferences." Suppose the organizer removes project `Foo` + and adds it again; it is now a new entry that "starts over". A student page + loaded before that edit still ranks the old `Foo`. Its next save can attach + that ranking to the new `Foo` unless saves are checked against the current + list version. +6. **The privacy rule contradicts itself** (lines 184–191). "No page or file + shows … any figure computed from them", yet the groups are computed from + teammate preferences and are shown. The next paragraph admits this. Say "no + figure other than the groups themselves". +7. **The "group size" isn't the size of a group.** With 13 students and *k* = + 7, G = ⌊13/7⌋ = 1, so the organizer gets one group of 13. The real size + ranges from *k* up to almost 2*k*−1. The help text should say *k* is the + minimum size, or the control should be renamed. ##### Vague terms -* **Wording that can't be tested:** "about a second" (133), "just as the - session closes" (142), "typical connection" (326), and "current" Chrome, - Edge, Firefox and Safari (318). -* **"At the default" for the number of groups** (166): does it mean the value - equals the upper limit, or that the organizer never touched it? -* **Number fields:** the step for the weights (integer or decimal?) and how a - fractional number of groups is rounded are both unstated. -* **Input formats:** what counts as `name@domain` (is `a@b` valid?), and - whether the 1–100 title length is counted in code points or graphemes. -* **File names:** "characters that are not allowed in file names" doesn't say - on which operating system. Windows reserved names like `CON` aren't - addressed. -* **Status labels:** does *signed in* mean signed in via this session's link or - to the tool at all? Does a student removed and re-added keep their status and - display name? -* **Display formats:** "Shows progress" (212) has no meaning for a local search - with no known end point. Score precision (values like 1/3) and whether - results show members by display name or userid are unspecified. -* **Renaming:** list identity is the name itself, so fixing a typo in a project - name counts as remove plus add and silently wipes everyone's preferences for - it (86–90). It's also unclear whether a case-only change (`Parser` → - `parser`) is the same item. +* **"Last change"** (line 33): deletion comes 365 days after the last change. + Does a student's save, a sign-in, or an organizer just viewing the session + count? +* **"Until the organizer changes it"** (line 202): does typing the default + value into the field count as a change? +* **Number fields** (lines 282–284): "rounded to the nearest whole number" + doesn't say how halves round. Line 201 does say it for √*S*. +* **File name** (line 334): does "a letter" mean ASCII letters only, or + Unicode letters? That decides whether `Проект` keeps its letters or becomes + `______`. +* **Userid syntax** (lines 66–67): `a@b.` and `a@.edu` both pass ("contains at + least one `.`"). The case-insensitive comparison (line 19) also doesn't say + whether it uses full Unicode case folding. +* **Separators** (line 58): semicolons and tabs aren't separators. A list + pasted from Outlook (`Jane Doe ;`) is dropped entry by entry. +* **Title** (line 57): trimming is stated only for list entries, so a title + made only of spaces seems valid. +* **Rename collisions** (lines 104–108): what happens when a project or userid + is renamed to one already on the list, ignoring case? Also, the lists are + edited "as text", but Rename is a per-entry action; how the textarea and the + status table coexist isn't described. After a case-only edit, it's unclear + whether the CSV's userid "as entered" (line 342) uses the new or the + original casing. If one account's sign-in name matches one entry and its + email matches another (lines 122–128), which userid gets linked? +* **Propagation of Close, Reopen, Delete and removal:** list edits reach open + student pages "within a minute" (line 410), but nothing says how fast a + student page notices a Close, a Reopen, a deletion, or that the student was + removed. Nor does the spec say what happens if the organizer reopens the + session, edits the lists or changes the options while groups are being + formed (lines 293–297). ##### Architectural mismatch -* **Identity is keyed on a value Microsoft says not to authorize on.** The - userid is "the sign-in name" (17). With only name and sign-in-name permission - (297), that's the `preferred_username` claim, which Microsoft documents as - changeable and unsuitable for authorization decisions. Sign-in names also - often differ from the email addresses an organizer will paste in, and guest - accounts look like `x_gmail.com#EXT#@…`. Expect many false "not on this list" - pages. A safer design keeps the typed userid for matching but binds the - stable `tid` + `oid` account identifiers on first sign-in. -* **Any Microsoft work or school account can create sessions** (35), from any - organization. Some organizations also block users from granting consent to - outside apps, which is a likely sign-in failure the spec doesn't mention. -* **Safari on iPhone doesn't reliably support the leave-page warning** (135), - which conflicts with the browser list on line 318. -* **Ranking at 500 students is impractical by keyboard.** A student sees up to - 499 teammates, and moving one item a step at a time is the only keyboard - method (123, 320). That's technically accessible but unusable: it needs "move - to top" or search. -* **"Keeps what the user has entered"** (301) doesn't say whether that survives - a page reload, which decides whether browser storage is needed. -* **CSV gaps.** Project names starting with `=`, `+`, `-` or `@` become - formulas when opened in Excel, and the "never run as a script" rule (316) - doesn't cover the file. Without a byte-order mark, Excel on Windows also - garbles non-ASCII names. Both may be acceptable if the file is only read by - programs, but the spec should say so. -* **Data retention is unbounded.** Student data is kept indefinitely (30) and - only one organizer can delete it, so an organizer who leaves orphans their - sessions. That's a privacy and compliance concern for school data. -* ~~**Terminology:** a "Microsoft Teams account" (17) is really a Microsoft - work or school account, and Teams integration is out of scope, so the Teams - framing is misleading.~~ -* ~~**Repo fit:** the spec sits in the CodeChat Editor repo, a local - single-user Rust/TypeScript editor. Nothing there provides multi-user - storage, Microsoft sign-in or polling, so this would be a standalone - codebase. The "doesn't prescribe how the code is organized" claim (4) also - softens once polling, a cancellable server job, and stable ids are - effectively required.~~ +* **Matching on the email claim lets one person pass as another** (lines + 122–124 and 398). Anyone with any work or school account can sign in, and + the spec matches students by their account's email address. In Microsoft + Entra the `email` claim is set by the user's own organization's admin and + may be unverified. Someone controlling their own tenant can set it to + `victim@uni.edu`. Because the first account to match keeps that userid for + good (line 127), the impostor also locks the real student out. This is the + known "nOAuth" class of bug. Either match on sign-in name only, or accept + email only when the domain is verified (the `xms_edov` claim), or restrict + which tenants can sign in. +* **The organizer's own identity isn't defined.** Students are bound to their + stable account on first sign-in, but the organizer is identified only as + "the organizer" (lines 38–40). If that means the organizer's sign-in name, + the same mutable-identifier problem applies. +* **It's unclear which machine the 60-second limit applies to** (lines 307–310 + and 407–408). The supported browsers include phones (line 423). If forming + runs in the browser, 500 × 100 has to finish on a two-year-old phone. If it + runs on the server, the spec needs to cover a job that survives a page + reload, and what the page shows after a reload during forming. The same + choice decides what **Cancel** does and whether "on any computer" refers to + clients or servers. Since the result may not depend on speed, the search has + to stop on a fixed criterion. So "within 60 seconds" needs a reference + machine, or it's untestable. +* **The test oracle in the acceptance criteria can be infeasible** (lines + 438–439). "Random lists of at most 8 students" puts no bound on projects. + With 8 students, *k* = 1 and 100 projects, checking every valid assignment + means about 100!/92! ≈ 7.5 × 10¹⁵ project assignments. The criterion should + bound *P*, for example to 4 or fewer. ##### What's strong -The scoring model is stated exactly, the sizing rules are clear, the CSV format -is precise, and the example table is correct and covers useful edge cases. The -acceptance criteria can be checked, the out-of-scope list is explicit, and the -accessibility, theme and security requirements are concrete. Fixing items 1–6 -and the identity issue would put it at about 9. +The scoring is normalized and fully stated, and the sizing rules are exact, +with examples that check out. The Expected results table is correct and every +row has exactly one best assignment. Rename versus remove-plus-add is clearly +separated, the CSV format is precise, the statement that teammate preferences +can't be fully hidden is honest, and the out-of-scope list is concrete. Fixing +items 1–3 and the email-claim issue would make it a solid 9. ### (Team member 2 name) From 124445914584d78a96b28686e1748ae8f6ee6518 Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Sat, 28 Nov 2026 00:25:01 +0500 Subject: [PATCH 04/10] Fixed Round 2 findings, starting Round 3 --- group-creation-tool/specification.md | 86 +++++++++++++++++----------- group-creation-tool/submission.md | 2 +- 2 files changed, 55 insertions(+), 33 deletions(-) diff --git a/group-creation-tool/specification.md b/group-creation-tool/specification.md index 3c6cd8ac..85f41c76 100644 --- a/group-creation-tool/specification.md +++ b/group-creation-tool/specification.md @@ -37,8 +37,9 @@ that its link no longer works. The organizer is the only person who can see or change a session's organizer pages. Anyone who signs in can create sessions and becomes the organizer of -the sessions they create. An organizer may also be on the student list of -their own session. +the sessions they create. The tool recognizes an organizer by their account, +not by their sign-in name, so a change to their sign-in name keeps their +sessions. An organizer may also be on the student list of their own session. Organizer pages --------------- @@ -119,13 +120,14 @@ because the session was deleted, the page says so without asking the student to sign in. Otherwise, the page asks the student to sign in, unless they are already signed in. Then: -* A student is **on the list** when their sign-in name or their account's - email address matches a userid on the student list. They see the - preferences page. +* A student is **on the list** when their sign-in name matches a userid on + the student list. They see the preferences page. Only the sign-in name is + used, since an account's email address can be set to someone else's; if a + student's sign-in name differs from the userid the organizer entered, the + organizer corrects it with **Rename**. * The first time a student opens the session, it links that userid to their account. From then on, the session recognizes them by their account even if - its sign-in name or email address changes, and no other account can use that - userid. + its sign-in name changes, and no other account can use that userid. * Anyone else sees a message naming their sign-in name and the organizer, saying they are not on this session's list and should contact the organizer, with a **Sign out** button so they can switch accounts. @@ -171,18 +173,23 @@ the page is closed or reloaded. Each save replaces all of the student's saved preferences, so if the student has the page open in two tabs, the last save wins. An open page shows preferences saved from another tab within a minute, unless it has unsaved -changes of its own. +changes of its own. A save never applies to an entry that was added to the +lists after the page last loaded them, even if it has the same name as an +entry the page shows; preferences about such an entry are dropped, and the +page then shows the current lists. A student has *saved preferences* once any change of theirs has been saved. While the session is Closed, the page shows the student's saved preferences read-only, with a notice that preferences are closed. A change that reaches -the tool after the session closed is not saved, and the page says so. +the tool after the session closed is refused and not retried, even if the +session is reopened later: the page says the change was not saved and +switches to read-only. ### Privacy between students A student sees only their own preferences. No page or file shows a student's -teammate preferences, or any figure computed from them, to anyone but that +teammate preferences, or any number computed from them, to anyone but that student. The organizer sees how each student's project preference was met (see Results). @@ -195,7 +202,7 @@ Forming groups ### Group sizes -The organizer sets the **group size**, *k*. With *S* students: +The organizer sets the **minimum group size**, *k*. With *S* students: * *k* ranges from 1 to *S*. Until the organizer changes it, it is √*S* rounded to the nearest whole number, with halves rounded up, but at least 2 @@ -206,9 +213,12 @@ The organizer sets the **group size**, *k*. With *S* students: either ⌊*S*/*G*⌋ or ⌈*S*/*G*⌉ students, so the students left over after filling groups of *k* are spread over the groups. Every student is in exactly one group. +* So every group has at least *k* students, unless there are fewer than *k* + students in all, and fewer than 2*k*. The help text says so. -For example, 50 students give a group size of 7 and 7 groups: six of 7 -students and one of 8. 500 students give 22 groups of 22 or 23. +For example, 50 students give a minimum group size of 7 and 7 groups: six of +7 students and one of 8. 500 students give 22 groups of 22 or 23. With 13 +students and a minimum group size of 7, there is one group of 13. Projects are spread evenly over the groups. With *P* projects, each project gets ⌊*G*/*P*⌋ or ⌈*G*/*P*⌉ groups. So several groups can work on the same @@ -242,10 +252,13 @@ project. Preferred category, divided by the largest sum any *m* members could give: the sum of the first *m* values of that category, or of all of them if it holds fewer than *m*. -* The *not-preferred share* is worked out the same way from their Not - preferred category, and is 0 or negative. -* An empty category's share is 0. The teammate part is the sum of the two - shares. +* The *not-preferred share* is the sum of the values of the members in their + Not preferred category, divided by the size, without its minus sign, of the + most negative sum any *m* members could give: the sum of the first *m* + values of that category, or of all of them if it holds fewer than *m*. So + it is 0 or negative. +* A share is 0 when its category is empty or when the student is alone in + their group (*m* = 0). The teammate part is the sum of the two shares. So the project part and the teammate part each range from −1 to 1, however many items a student ranks. @@ -274,7 +287,7 @@ These teammate parts show the scaling, for a student `a`: | Option | Control | Range | Default | | --- | --- | --- | --- | -| Group size (*k*) | number | 1 to the number of students | see Group sizes | +| Minimum group size (*k*) | number | 1 to the number of students | see Group sizes | | Project preference weight (*W*p) | number | 0–5 | 1 | | Teammate preference weight (*W*t) | number | 0–5 | 1 | @@ -296,6 +309,10 @@ formed, the page says so, shows the time elapsed, and offers **Cancel**, which keeps any earlier results. Forming again replaces the earlier results, after the organizer confirms. +Groups are formed by the tool's server, not on the organizer's device. +Forming carries on if the organizer closes or reloads the page, and the +session page shows it as under way when opened again, with **Cancel**. + The result must be: * **Valid:** it follows every rule under Group sizes. @@ -346,8 +363,8 @@ The file is meant to be read by programs, such as the next project. Values are written exactly as entered, even ones that a spreadsheet would treat as formulas. -For example, three groups, the first two working on a project called -`Parser, part 2`: +For example, six students in three groups of 2, the first two groups working on +a project called `Parser, part 2`: ``` student_id,group,project @@ -355,6 +372,8 @@ a@uni.edu,1,"Parser, part 2" b@uni.edu,2,"Parser, part 2" c@uni.edu,1,"Parser, part 2" d@uni.edu,3,Linter +e@uni.edu,2,"Parser, part 2" +f@uni.edu,3,Linter ``` Expected results @@ -367,10 +386,10 @@ score is not shown in the tool; it is given here for tests. Each row has students `a`–`d` and projects `X` and `Y`, in that order, unless the Preferences column says otherwise, and every option is at its default unless the Settings column says otherwise. With 4 to 6 students the default -group size is 2. Preferences are written as `PP` (preferred projects), `NP` -(not-preferred projects), `PT` (preferred teammates) and `NT` (not-preferred -teammates), each listed strongest feeling first; anything not listed is -Unspecified. +minimum group size is 2. Preferences are written as `PP` (preferred +projects), `NP` (not-preferred projects), `PT` (preferred teammates) and `NT` +(not-preferred teammates), each listed strongest feeling first; anything not +listed is Unspecified. | Preferences | Settings | Groups | Score | | --- | --- | --- | --- | @@ -386,17 +405,17 @@ Unspecified. | projects `X`, `Y`, `Z`; a PP Z; b PP Z; c PP Y; d PP Y | | Y: c, d; Z: a, b | 4 | | project `X` only; a PT b; c PT d | | X: a, b; X: c, d | 2 | | students `a`–`f`; a PP X PT b; b PP X; c PP X PT d; d PP X; e PP Y; f PP Y | | X: a, b; X: c, d; Y: e, f | 8 | -| students `a`–`f`; a PT b, c; b PP X; d PT e | group size 3 | X: a, b, c; Y: d, e, f | 3 | +| students `a`–`f`; a PT b, c; b PP X; d PT e | minimum group size 3 | X: a, b, c; Y: d, e, f | 3 | The fifth and sixth rows differ only in the two not-preferred teammates, which -split `a` and `b`. With 7 students and no preferences, the default group size -is 3, giving 2 groups, of 4 and 3 students. +split `a` and `b`. With 7 students and no preferences, the default minimum +group size is 3, giving 2 groups, of 4 and 3 students. Limits and failures ------------------- -* **Sign-in.** Signing in asks only for permission to read the user's name, - sign-in name, and email address. If sign-in fails or is cancelled, the page +* **Sign-in.** Signing in asks only for permission to read the user's name + and sign-in name. If sign-in fails or is cancelled, the page says so and offers to try again. If the user's organization requires an administrator to approve the tool first, the page says so and suggests asking the organization's IT administrator. @@ -405,7 +424,9 @@ Limits and failures organizer pages keep what the organizer has entered while the page stays open. * **Forming time.** Forming groups for 500 students and 100 projects finishes - within 60 seconds. + within 60 seconds on a server with 2 processor cores. Since the result may + not depend on how fast forming runs (see Forming), this is a limit on the + work forming does, not a deadline at which it stops. * **Concurrent changes.** If the organizer edits the lists while a student's page is open, the student's page shows the new lists within a minute. Preferences about removed items are dropped as described under Session @@ -435,8 +456,9 @@ Acceptance criteria * Every row of Expected results gives the stated groups and score, and every row of the teammate-part table under What "best" means gives the stated value. -* With random lists of at most 8 students and preferences, the result's score - equals the best score found by checking every valid assignment. +* With random lists of at most 8 students and at most 4 projects, and random + preferences, the result's score equals the best score found by checking + every valid assignment. * End to end: an organizer creates a session with four students and two projects; three of the students sign in through the link and save preferences, and the fourth never signs in; the organizer closes the diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index c19c97d8..4b42f800 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -29,7 +29,7 @@ Build and run tests are not included, as current project stage only required the | Round | Findings | Main Changes Made | | --- | --- | --- | | 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | -| 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | | +| 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | Fixed the 11 High and Medium findings and CodeRabbit's 2 comments on the pull request, which repeat items 1 and 3; left the 9 Low vague terms as they are. The not-preferred share divides by the size of the most negative sum, and both shares are 0 for a student alone in a group. The CSV example now has 6 students in 3 groups. Students are matched on sign-in name only, not email, and organizers are recognized by their account. A save refused because the session closed is final, and a save from a stale page never applies to a re-added entry. The privacy rule says "number" instead of "figure". The option is renamed "Minimum group size", with sizes from *k* to under 2*k*. Forming runs on the server, survives a page reload, and its 60-second limit names a 2-core server. The small-class acceptance test is limited to 4 projects. Expected results rechecked by brute force. | #### Last specification review From 01924bfa7ec070b473773cc8ce790a8302fcb3f5 Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Sat, 28 Nov 2026 00:48:50 +0500 Subject: [PATCH 05/10] Added Round 3 of specification review --- group-creation-tool/submission.md | 215 +++++++++++++++--------------- 1 file changed, 105 insertions(+), 110 deletions(-) diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index 4b42f800..10e95be1 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -30,6 +30,7 @@ Build and run tests are not included, as current project stage only required the | --- | --- | --- | | 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | | 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | Fixed the 11 High and Medium findings and CodeRabbit's 2 comments on the pull request, which repeat items 1 and 3; left the 9 Low vague terms as they are. The not-preferred share divides by the size of the most negative sum, and both shares are 0 for a student alone in a group. The CSV example now has 6 students in 3 groups. Students are matched on sign-in name only, not email, and organizers are recognized by their account. A save refused because the session closed is final, and a save from a stale page never applies to a re-added entry. The privacy rule says "number" instead of "figure". The option is renamed "Minimum group size", with sizes from *k* to under 2*k*. Forming runs on the server, survives a page reload, and its 60-second limit names a 2-core server. The small-class acceptance test is limited to 4 projects. Expected results rechecked by brute force. | +| 3 | Rated 9/10; 15 new findings in total, plus the 9 Low vague terms carried over from round 2. **Medium:** "after the session closed" can be read as refusing every change even after a reopen, saves refused because the session was deleted or the student was removed still retry forever, an extra Unspecified teammate lowers the teammate part, the spec doesn't require exact score comparison (floating-point ties break "best", "not improvable" and the acceptance test), "Repeatable" has no version boundary. **Low:** a "fewer than *k* students" clause that can never apply, dragging vs. "goes to its end", 6 vague terms (moves while filtered, how list edits are applied, editing the title, "out of date", the 2-core server, page speed including sign-in), slow correction of mismatched sign-in names, no quotas on sessions. Expected results table, teammate-part table and default group sizes verified correct by brute force. | | #### Last specification review @@ -38,133 +39,127 @@ desktop app. Prompt: -> Review a specification at @group-creation-tool/specification.md . Rate it -> from 1 to 10. Do not modify the file. Find logical inconsistencies, vague -> terms, architectural mismatch. +> Review a specification at @group-creation-tool/specification.md . Output (line numbers refer to [specification.md](specification.md) as it was reviewed, before this round's changes; strikethrough marks findings judged incorrect): -I'd rate it **8/10**, up from 7 in round 1. Most of round 1's findings are -fixed and the scoring model is now tight. I brute-forced all 13 Expected -results rows. Each one gives exactly the stated groups and score, and each has -exactly one best assignment. The default group sizes for 4–7, 50 and 500 -students also match the text. Three things keep it from a 9: a sign error in -the teammate formula, a CSV example that the spec's own rules can't produce, -and an identity rule that lets one person pass as another. +I'd rate it **9/10**, up from 8 in round 2. All the High and Medium findings +from round 2 are fixed, and the fixes don't contradict each other. I +brute-forced all 13 Expected results rows with exact fractions. Each one gives +exactly the stated groups and score, and each has exactly one best assignment. +All 5 rows of the teammate-part table come out as stated. The default sizes +for 4–9, 13, 50 and 500 students match the text. What keeps it from a 10 is +mostly the edges of the save rules and one hidden decision about how scores +are compared. I didn't modify the file. ##### Logical inconsistencies -1. **The not-preferred share has the wrong sign as written** (lines 241–247). - The share is "the sum of the values … divided by the largest sum", and the - not-preferred share is "worked out the same way". For not-preferred - teammates both of those sums are negative, so dividing one by the other - gives a positive number. Taken literally, table row 4 gives **+2/3** instead - of −2/3, and row 5 gives **4/3** instead of −2/3. The text needs "divided by - the absolute value of" (or "by the size of") the largest sum. The table and - the Expected results only come out right with that reading. -2. **The CSV example can't happen** (lines 349–358). It shows 4 students in 3 - groups. But G = ⌊4/*k*⌋ gives 4, 2, 1, 1 for *k* = 1…4, so 3 groups is - impossible with 4 students. Use 5 or 6 students, or 2 groups. -3. **Group size 1 divides by zero** (lines 200 and 239–248). *k* can be 1, - which leaves *m* = 0 other members. The denominator is then "the sum of the - first 0 values", which is 0. "An empty category's share is 0" covers an - empty category, not a group with no other members. -4. **A save rejected because the session closed collides with the retry - rule** (lines 165–167 and 178–180). "While a save is failing, the page - retries every 10 seconds." A save refused because the session is Closed - counts as failing, so the page would retry forever, keep the leave-page - warning on, and could succeed later if the organizer reopens. Say that a - closed-session refusal is final and the page switches to read-only. -5. **A stale tab can bring back preferences that should have been dropped** - (lines 96–102, 171–174 and 409–412). "Each save replaces all of the - student's saved preferences." Suppose the organizer removes project `Foo` - and adds it again; it is now a new entry that "starts over". A student page - loaded before that edit still ranks the old `Foo`. Its next save can attach - that ranking to the new `Foo` unless saves are checked against the current - list version. -6. **The privacy rule contradicts itself** (lines 184–191). "No page or file - shows … any figure computed from them", yet the groups are computed from - teammate preferences and are shown. The next paragraph admits this. Say "no - figure other than the groups themselves". -7. **The "group size" isn't the size of a group.** With 13 students and *k* = - 7, G = ⌊13/7⌋ = 1, so the organizer gets one group of 13. The real size - ranges from *k* up to almost 2*k*−1. The help text should say *k* is the - minimum size, or the control should be renamed. +1. **"After the session closed" can be read as "ever after"** (lines 184–187). + Once a session has been closed even once, every later change reaches the + tool "after the session closed". Read literally, that includes changes made + after the session is reopened. It also doesn't say what happens to a change + made before a Close that arrives only after the Reopen, for example after a + network outage. A clearer wording: "a change that reaches the tool while the + session is Closed is refused". The spec should also say whether a read-only + page becomes editable again when the session is reopened. +2. **Saves refused for other reasons still retry forever** (lines 166–169). + Round 2's fix covers only a Closed session. A save can also be refused + because: + * the session was deleted; + * the student was removed from the list; + * the student was removed and added again, so their entry is a new one and + "*not signed in*". + + Each of these falls under "while a save is failing, the page retries every + 10 seconds". The page would retry forever and keep the leave-page warning + on. In the third case, the rule on line 176 ("never applies to an entry that + was added after the page last loaded") is about the entries a save mentions. + It doesn't say whether a stale page can save for the student's own new + entry. +3. **Unspecified isn't neutral for teammates** (lines 251–261). Unspecified is + worth 0, but adding an Unspecified teammate can lower a student's score. + Take a student with Preferred `b`, `c`, `d`: + * in a group with `b` and `c`, their preferred share is + (1 + 2/3)/(1 + 2/3) = **1**; + * with an extra Unspecified member `x` it is (5/3)/2 = **5/6**. + + The same extra member softens a not-preferred penalty from −1 to −5/6. This + only happens when the category holds more than *m* items. A student who + lists just `b` gets 1 either way. So the scoring tends to put students with + long lists into the smaller groups. If that's intended, say so; if not, + scale the shares by the group's best possible sum. +4. **"Unless there are fewer than *k* students in all" can never apply** (line + 216). *k* is limited to 1…*S* (line 207) and is clamped when the list + changes, so *S* ≥ *k* always holds. +5. **Dragging conflicts with "goes to its end"** (lines 152–156). An item moved + into Preferred or Not preferred goes to the end, yet "every move can be made + by dragging". Dragging normally drops an item where you let go. Say which + one wins. ##### Vague terms -* **"Last change"** (line 33): deletion comes 365 days after the last change. - Does a student's save, a sign-in, or an organizer just viewing the session - count? -* **"Until the organizer changes it"** (line 202): does typing the default - value into the field count as a change? -* **Number fields** (lines 282–284): "rounded to the nearest whole number" - doesn't say how halves round. Line 201 does say it for √*S*. -* **File name** (line 334): does "a letter" mean ASCII letters only, or - Unicode letters? That decides whether `Проект` keeps its letters or becomes - `______`. -* **Userid syntax** (lines 66–67): `a@b.` and `a@.edu` both pass ("contains at - least one `.`"). The case-insensitive comparison (line 19) also doesn't say - whether it uses full Unicode case folding. -* **Separators** (line 58): semicolons and tabs aren't separators. A list - pasted from Outlook (`Jane Doe ;`) is dropped entry by entry. -* **Title** (line 57): trimming is stated only for list entries, so a title - made only of spaces seems valid. -* **Rename collisions** (lines 104–108): what happens when a project or userid - is renamed to one already on the list, ignoring case? Also, the lists are - edited "as text", but Rename is a per-entry action; how the textarea and the - status table coexist isn't described. After a case-only edit, it's unclear - whether the CSV's userid "as entered" (line 342) uses the new or the - original casing. If one account's sign-in name matches one entry and its - email matches another (lines 122–128), which userid gets linked? -* **Propagation of Close, Reopen, Delete and removal:** list edits reach open - student pages "within a minute" (line 410), but nothing says how fast a - student page notices a Close, a Reopen, a deletion, or that the student was - removed. Nor does the spec say what happens if the organizer reopens the - session, edits the lists or changes the options while groups are being - formed (lines 293–297). +* **Moves while filtered** (lines 157–158). It isn't clear whether "up one + place" moves past items the filter hides, or where a dragged item lands + between two visible items that have hidden ones between them. It also + doesn't say whether the filter ignores case. +* **List edits on the session page** (lines 97–111). Nothing says how an edit + is applied: is there an Apply button, or is it saved on blur? Nor does it say + what happens when an edit breaks the limits, such as 0 students or 501. At + setup, **Create** is simply unavailable, but the session page has no + equivalent. +* **Title after creation.** The spec doesn't say whether the title can be + edited, and it decides the CSV file name. +* **"Out of date"** (lines 299–302). If an option is changed and then set back + to the value used for forming, are the results still out of date? +* **"2 processor cores"** (line 427) still names no processor speed or + generation, so the 60-second limit can't be tested exactly. +* **Page speed** (line 450): it isn't clear whether "shows its content within 2 + seconds" includes the Microsoft sign-in redirect, which the tool doesn't + control. +* **Carried over from round 2**, left open on purpose: "last change", "changes + it", rounding of halves, "letter" in file names, userid syntax and case + folding, separators, title trimming, Rename collisions, and how fast Close, + Reopen, Delete and removal reach open pages. Two of these now matter more. + Reopening or editing during forming is undefined. And how a student page + learns of a Reopen affects item 1. ##### Architectural mismatch -* **Matching on the email claim lets one person pass as another** (lines - 122–124 and 398). Anyone with any work or school account can sign in, and - the spec matches students by their account's email address. In Microsoft - Entra the `email` claim is set by the user's own organization's admin and - may be unverified. Someone controlling their own tenant can set it to - `victim@uni.edu`. Because the first account to match keeps that userid for - good (line 127), the impostor also locks the real student out. This is the - known "nOAuth" class of bug. Either match on sign-in name only, or accept - email only when the domain is verified (the `xms_edov` claim), or restrict - which tenants can sign in. -* **The organizer's own identity isn't defined.** Students are bound to their - stable account on first sign-in, but the organizer is identified only as - "the organizer" (lines 38–40). If that means the organizer's sign-in name, - the same mutable-identifier problem applies. -* **It's unclear which machine the 60-second limit applies to** (lines 307–310 - and 407–408). The supported browsers include phones (line 423). If forming - runs in the browser, 500 × 100 has to finish on a two-year-old phone. If it - runs on the server, the spec needs to cover a job that survives a page - reload, and what the page shows after a reload during forming. The same - choice decides what **Cancel** does and whether "on any computer" refers to - clients or servers. Since the result may not depend on speed, the search has - to stop on a fixed criterion. So "within 60 seconds" needs a reference - machine, or it's untestable. -* **The test oracle in the acceptance criteria can be infeasible** (lines - 438–439). "Random lists of at most 8 students" puts no bound on projects. - With 8 students, *k* = 1 and 100 projects, checking every valid assignment - means about 100!/92! ≈ 7.5 × 10¹⁵ project assignments. The criterion should - bound *P*, for example to 4 or fewer. +* **The spec doesn't say how scores are compared** (lines 316–327 and + 459–461). Scores are fractions such as 1/3 and 5/6. With floating-point + numbers, two assignments that should tie can differ by a tiny rounding + error. That can break three things: + * "no valid assignment has a higher score"; + * "Not improvable" (a neutral swap looks like an improvement, and the search + can loop); + * the acceptance test's "equals the best score". + + The spec should require exact arithmetic or a stated tolerance. Exact + arithmetic is easy here, because every value is *j*/*n* with *n* ≤ 500. +* **"Repeatable" has no version boundary** (line 325). As written, a later + release with a better algorithm would break the rule. Limit it to "the same + version of the tool", or record the version with the results. +* **Fixing mismatched sign-in names is slow.** At many universities the + sign-in name differs from the email address the organizer knows, for + example `s1234567@uni.edu` instead of `jane.doe@uni.edu`. Each such student + must contact the organizer, who renames entries one at a time. A list of + refused sign-ins on the session page, with a one-click Rename, would solve + this without the email-matching risk from round 2. +* **There are no quotas.** Anyone with any work or school account can create + any number of sessions of up to 500 × 100 entries, and each one is kept for + 365 days. The spec should cap sessions per organizer, or restrict sign-in to + particular organizations. ##### What's strong -The scoring is normalized and fully stated, and the sizing rules are exact, -with examples that check out. The Expected results table is correct and every -row has exactly one best assignment. Rename versus remove-plus-add is clearly -separated, the CSV format is precise, the statement that teammate preferences -can't be fully hidden is honest, and the out-of-scope list is concrete. Fixing -items 1–3 and the email-claim issue would make it a solid 9. +The scoring is fully stated and every example checks out exactly. The size +rules are tight and the "fewer than 2*k*" claim holds. The rules for stale tabs +and closed sessions are now close to complete. Forming on the server, with +Cancel and reload behavior, is well defined. The privacy section is honest +about what it can't hide. Fixing items 1 and 2 and stating exact arithmetic +would make it a 10. ### (Team member 2 name) From 6ed8861e1dd2371c6d20b3e3e6b3299bc62ce9cf Mon Sep 17 00:00:00 2001 From: Aruzhan Akhanayeva Date: Sat, 28 Nov 2026 01:18:05 +0500 Subject: [PATCH 06/10] Aruzhan: spec review round 4 --- group-creation-tool/submission.md | 378 +++++++++++++++++++++++------- 1 file changed, 288 insertions(+), 90 deletions(-) diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index c19c97d8..7fe64489 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -18,18 +18,21 @@ Git userid: dkaimekin #### Contributions -Generated initial specification for the project, conducted multiple calls to clarify requirements. +Generated initial specification for the project, conducted multiple calls to +clarify requirements. #### Build and run test -Build and run tests are not included, as current project stage only required the specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) is not directly related to the project, and only used for pull request tracking. +Build and run tests are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. #### Specification review rounds -| Round | Findings | Main Changes Made | -| --- | --- | --- | -| 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | -| 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | | +| Round | Findings | Main Changes Made | +| ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| 1 | Rated 7/10; 25 findings in total. High: teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. Medium: deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. Low: 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | +| 2 | Rated 8/10; 20 findings in total. High: not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. Medium: closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. Low: 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. |
| #### Last specification review @@ -38,137 +41,332 @@ desktop app. Prompt: -> Review a specification at @group-creation-tool/specification.md . Rate it -> from 1 to 10. Do not modify the file. Find logical inconsistencies, vague -> terms, architectural mismatch. +> Review a specification at @group-creation-tool/specification.md . Rate it from +> 1 to 10. Do not modify the file. Find logical inconsistencies, vague terms, +> architectural mismatch. Output (line numbers refer to [specification.md](specification.md) as it was reviewed, before this round's changes; strikethrough marks findings judged incorrect): -I'd rate it **8/10**, up from 7 in round 1. Most of round 1's findings are -fixed and the scoring model is now tight. I brute-forced all 13 Expected -results rows. Each one gives exactly the stated groups and score, and each has -exactly one best assignment. The default group sizes for 4–7, 50 and 500 -students also match the text. Three things keep it from a 9: a sign error in -the teammate formula, a CSV example that the spec's own rules can't produce, -and an identity rule that lets one person pass as another. +I'd rate it **8/10**, up from 7 in round 1. Most of round 1's findings are fixed +and the scoring model is now tight. I brute-forced all 13 Expected results rows. +Each one gives exactly the stated groups and score, and each has exactly one +best assignment. The default group sizes for 4–7, 50 and 500 students also match +the text. Three things keep it from a 9: a sign error in the teammate formula, a +CSV example that the spec's own rules can't produce, and an identity rule that +lets one person pass as another. ##### Logical inconsistencies 1. **The not-preferred share has the wrong sign as written** (lines 241–247). The share is "the sum of the values … divided by the largest sum", and the - not-preferred share is "worked out the same way". For not-preferred - teammates both of those sums are negative, so dividing one by the other - gives a positive number. Taken literally, table row 4 gives **+2/3** instead - of −2/3, and row 5 gives **4/3** instead of −2/3. The text needs "divided by - the absolute value of" (or "by the size of") the largest sum. The table and - the Expected results only come out right with that reading. + not-preferred share is "worked out the same way". For not-preferred teammates + both of those sums are negative, so dividing one by the other gives a + positive number. Taken literally, table row 4 gives +2/3 + instead of −2/3, and row 5 gives **4/3** instead of −2/3. The text needs + "divided by the absolute value of" (or "by the size of") the largest sum. The + table and the Expected results only come out right with that reading. 2. **The CSV example can't happen** (lines 349–358). It shows 4 students in 3 groups. But G = ⌊4/*k*⌋ gives 4, 2, 1, 1 for *k* = 1…4, so 3 groups is impossible with 4 students. Use 5 or 6 students, or 2 groups. -3. **Group size 1 divides by zero** (lines 200 and 239–248). *k* can be 1, - which leaves *m* = 0 other members. The denominator is then "the sum of the - first 0 values", which is 0. "An empty category's share is 0" covers an - empty category, not a group with no other members. -4. **A save rejected because the session closed collides with the retry - rule** (lines 165–167 and 178–180). "While a save is failing, the page - retries every 10 seconds." A save refused because the session is Closed - counts as failing, so the page would retry forever, keep the leave-page - warning on, and could succeed later if the organizer reopens. Say that a - closed-session refusal is final and the page switches to read-only. +3. **Group size 1 divides by zero** (lines 200 and 239–248). *k* can be 1, which + leaves *m* = 0 other members. The denominator is then "the sum of the first 0 + values", which is 0. "An empty category's share is 0" covers an empty + category, not a group with no other members. +4. **A save rejected because the session closed collides with the retry rule** + (lines 165–167 and 178–180). "While a save is failing, the page retries every + 10 seconds." A save refused because the session is Closed counts as failing, + so the page would retry forever, keep the leave-page warning on, and could + succeed later if the organizer reopens. Say that a closed-session refusal is + final and the page switches to read-only. 5. **A stale tab can bring back preferences that should have been dropped** - (lines 96–102, 171–174 and 409–412). "Each save replaces all of the - student's saved preferences." Suppose the organizer removes project `Foo` - and adds it again; it is now a new entry that "starts over". A student page - loaded before that edit still ranks the old `Foo`. Its next save can attach - that ranking to the new `Foo` unless saves are checked against the current - list version. + (lines 96–102, 171–174 and 409–412). "Each save replaces all of the student's + saved preferences." Suppose the organizer removes project `Foo` and adds it + again; it is now a new entry that "starts over". A student page loaded before + that edit still ranks the old `Foo`. Its next save can attach that ranking to + the new `Foo` unless saves are checked against the current list version. 6. **The privacy rule contradicts itself** (lines 184–191). "No page or file shows … any figure computed from them", yet the groups are computed from teammate preferences and are shown. The next paragraph admits this. Say "no figure other than the groups themselves". -7. **The "group size" isn't the size of a group.** With 13 students and *k* = - 7, G = ⌊13/7⌋ = 1, so the organizer gets one group of 13. The real size - ranges from *k* up to almost 2*k*−1. The help text should say *k* is the +7. The "group size" isn't the size of a group. With 13 students + and *k* = 7, G = ⌊13/7⌋ = 1, so the organizer gets one group of 13. The real + size ranges from *k* up to almost 2*k*−1. The help text should say *k* is the minimum size, or the control should be renamed. ##### Vague terms -* **"Last change"** (line 33): deletion comes 365 days after the last change. - Does a student's save, a sign-in, or an organizer just viewing the session - count? -* **"Until the organizer changes it"** (line 202): does typing the default - value into the field count as a change? +* "Last change" (line 33): deletion comes 365 days after the + last change. Does a student's save, a sign-in, or an organizer just viewing + the session count? +* "Until the organizer changes it" (line 202): does typing the + default value into the field count as a change? * **Number fields** (lines 282–284): "rounded to the nearest whole number" doesn't say how halves round. Line 201 does say it for √*S*. -* **File name** (line 334): does "a letter" mean ASCII letters only, or - Unicode letters? That decides whether `Проект` keeps its letters or becomes - `______`. +* **File name** (line 334): does "a letter" mean ASCII letters only, or Unicode + letters? That decides whether `Проект` keeps its letters or becomes `______`. * **Userid syntax** (lines 66–67): `a@b.` and `a@.edu` both pass ("contains at least one `.`"). The case-insensitive comparison (line 19) also doesn't say whether it uses full Unicode case folding. -* **Separators** (line 58): semicolons and tabs aren't separators. A list - pasted from Outlook (`Jane Doe ;`) is dropped entry by entry. -* **Title** (line 57): trimming is stated only for list entries, so a title - made only of spaces seems valid. +* **Separators** (line 58): semicolons and tabs aren't separators. A list pasted + from Outlook (`Jane Doe ;`) is dropped entry by entry. +* **Title** (line 57): trimming is stated only for list entries, so a title made + only of spaces seems valid. * **Rename collisions** (lines 104–108): what happens when a project or userid is renamed to one already on the list, ignoring case? Also, the lists are edited "as text", but Rename is a per-entry action; how the textarea and the status table coexist isn't described. After a case-only edit, it's unclear - whether the CSV's userid "as entered" (line 342) uses the new or the - original casing. If one account's sign-in name matches one entry and its - email matches another (lines 122–128), which userid gets linked? -* **Propagation of Close, Reopen, Delete and removal:** list edits reach open - student pages "within a minute" (line 410), but nothing says how fast a - student page notices a Close, a Reopen, a deletion, or that the student was - removed. Nor does the spec say what happens if the organizer reopens the - session, edits the lists or changes the options while groups are being - formed (lines 293–297). + whether the CSV's userid "as entered" (line 342) uses the new or the original + casing. If one account's sign-in name matches one entry and its email matches + another (lines 122–128), which userid gets linked? +* Propagation of Close, Reopen, Delete and removal: list edits + reach open student pages "within a minute" (line 410), but nothing says how + fast a student page notices a Close, a Reopen, a deletion, or that the student + was removed. Nor does the spec say what happens if the organizer reopens the + session, edits the lists or changes the options while groups are being formed + (lines 293–297). ##### Architectural mismatch -* **Matching on the email claim lets one person pass as another** (lines - 122–124 and 398). Anyone with any work or school account can sign in, and - the spec matches students by their account's email address. In Microsoft - Entra the `email` claim is set by the user's own organization's admin and - may be unverified. Someone controlling their own tenant can set it to +* **Matching on the email claim lets one person pass as another** (lines 122–124 + and 398). Anyone with any work or school account can sign in, and the spec + matches students by their account's email address. In Microsoft Entra the + `email` claim is set by the user's own organization's admin and may be + unverified. Someone controlling their own tenant can set it to `victim@uni.edu`. Because the first account to match keeps that userid for good (line 127), the impostor also locks the real student out. This is the known "nOAuth" class of bug. Either match on sign-in name only, or accept email only when the domain is verified (the `xms_edov` claim), or restrict which tenants can sign in. -* **The organizer's own identity isn't defined.** Students are bound to their - stable account on first sign-in, but the organizer is identified only as - "the organizer" (lines 38–40). If that means the organizer's sign-in name, - the same mutable-identifier problem applies. +* The organizer's own identity isn't defined. Students are + bound to their stable account on first sign-in, but the organizer is + identified only as "the organizer" (lines 38–40). If that means the + organizer's sign-in name, the same mutable-identifier problem applies. * **It's unclear which machine the 60-second limit applies to** (lines 307–310 and 407–408). The supported browsers include phones (line 423). If forming runs in the browser, 500 × 100 has to finish on a two-year-old phone. If it - runs on the server, the spec needs to cover a job that survives a page - reload, and what the page shows after a reload during forming. The same - choice decides what **Cancel** does and whether "on any computer" refers to - clients or servers. Since the result may not depend on speed, the search has - to stop on a fixed criterion. So "within 60 seconds" needs a reference - machine, or it's untestable. + runs on the server, the spec needs to cover a job that survives a page reload, + and what the page shows after a reload during forming. The same choice decides + what **Cancel** does and whether "on any computer" refers to clients or + servers. Since the result may not depend on speed, the search has to stop on a + fixed criterion. So "within 60 seconds" needs a reference machine, or it's + untestable. * **The test oracle in the acceptance criteria can be infeasible** (lines - 438–439). "Random lists of at most 8 students" puts no bound on projects. - With 8 students, *k* = 1 and 100 projects, checking every valid assignment - means about 100!/92! ≈ 7.5 × 10¹⁵ project assignments. The criterion should - bound *P*, for example to 4 or fewer. + 438–439). "Random lists of at most 8 students" puts no bound on projects. With + 8 students, *k* = 1 and 100 projects, checking every valid assignment means + about 100!/92! ≈ 7.5 × 10¹⁵ project assignments. The criterion should bound + *P*, for example to 4 or fewer. ##### What's strong -The scoring is normalized and fully stated, and the sizing rules are exact, -with examples that check out. The Expected results table is correct and every -row has exactly one best assignment. Rename versus remove-plus-add is clearly -separated, the CSV format is precise, the statement that teammate preferences -can't be fully hidden is honest, and the out-of-scope list is concrete. Fixing -items 1–3 and the email-claim issue would make it a solid 9. +The scoring is normalized and fully stated, and the sizing rules are exact, with +examples that check out. The Expected results table is correct and every row has +exactly one best assignment. Rename versus remove-plus-add is clearly separated, +the CSV format is precise, the statement that teammate preferences can't be +fully hidden is honest, and the out-of-scope list is concrete. Fixing items 1–3 +and the email-claim issue would make it a solid 9. -### (Team member 2 name) +### Aruzhan Akhanayeva -(Same sections as Team member 1) +Github userid: akhanayeva + +Git userid: akhanayeva + +#### Contributions + +Added backend configuration and architecture + +#### Build and run test + +Build and run tests are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +#### Specification review rounds + +| Round | Findings | Main Changes Made | +| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | +| 1 | Rated 8/10; 27 findings in total, 8 of them new; the other 19 are still open from Daniil's round 2, since the spec hasn't changed since then. High: not-preferred share has the wrong sign as written (taken literally, it puts together the two students who asked to be kept apart), CSV example needs 3 groups from 4 students, *m* = 0 divides by zero (a 1-student session reaches it with the default group size), matching on the email claim lets one person pass as another, a stale organizer tab can silently remove students and their preferences. Medium: closed-session save rejection loops on retry, a stale student tab restores preferences for a re-added entry, session-page edits have no limits or save rule, moves in a filtered list are undefined, reordering list entries is undefined, privacy wording contradicts itself, **Sign out** doesn't let users switch Microsoft accounts, no quotas on sessions or forming jobs, the 60-second limit names no machine, organizer identity is undefined, the ≤8-student test oracle is unbounded in projects, repeatability across tool versions and tie-breaking are unstated. Low: 10 vague terms ("last change", Unicode normalization and case folding, rounding of halves and "changes it", "letter" in file names, userid syntax, Rename collisions, title trimming, separators, propagation of Close/Reopen/Delete, "group size" not being the actual size). Expected results table, teammate-part table and default group sizes verified correct by brute force. |
| + +#### Last specification review + +LLM: Claude Opus 5.5 (`claude-opus-5-5`), in Claude Code. + +Prompt: + +> Review a specification at @group-creation-tool/specification.md , add your +> findings into the @group-creation-tool/submission.md Specification Review +> Rounds under Aruzhan Akhanayeva. Leave the Main Changes Made part empty for +> now, just the findings and round number. Also, add the Last Specification +> Review part with your current review under Aruzhan Akhanayeva's name, just +> like Daniil Kaimekin did. + +Output (line numbers refer to [specification.md](specification.md) as it was +reviewed, before this round's changes): + +I'd rate it **8/10**. The spec hasn't changed since Daniil's round 2, so most of +those findings still stand. They're repeated below and marked (open since +round 2), so this review stands on its own. Eight findings are new; they're +marked **New**. I wrote an independent brute-force checker using exact +fractions. All 13 Expected results rows give exactly the stated groups and +score, and each has exactly one best assignment. All 5 teammate-part table rows +give the stated value. The default group sizes for 4–7, 50 and 500 students +match the text. Those results hold only if the not-preferred share is read as +negative (item 1). Fixing the sign error, the impossible CSV example, the *m* = +0 case, the email-claim identity rule and the stale organizer tab would make it +a 9. + +##### Logical inconsistencies + +1. **The not-preferred share has the wrong sign as written** (lines 241–247). + (Open since round 2.) "Worked out the same way" divides a negative + sum by a negative maximum, which gives a positive share. Taken literally, + table row 5 gives 4/3, not −2/3. In Expected results row 6, the best + assignment becomes `X: a, b; Y: c, d` with a score of 6. That puts together + exactly the two students who asked to be kept apart. Say "divided by the + absolute value of the largest sum". +2. **The CSV example can't happen** (lines 349–358). (Open since round + 2.) 4 students give G = 4, 2, 1 or 1 groups for *k* = 1…4, never 3. +3. **A group with no other members divides by zero** (lines 200–202 and + 239–248). (Open since round 2, with a new detail.) The organizer + doesn't even have to pick *k* = 1. A session may have 1 student (line 72). + √1 = 1, and the "at least 2" rule applies only from 2 students. So the + default gives *k* = 1 and *m* = 0, and the denominator is the sum of the + first 0 values, which is 0. Say that the teammate part is 0 when *m* = 0. +4. **A save refused because the session closed collides with the retry rule** + (lines 165–167 and 178–180). (Open since round 2.) The page would + retry every 10 seconds forever and keep the leave-page warning on. It would + also save after a Reopen, which the organizer didn't expect. +5. **A stale student tab can bring back preferences that should have been + dropped** (lines 96–102 and 171–174). (Open since round 2.) Suppose + a page was loaded before the organizer removed project `Foo` and added it + again. Its next save attaches the old `Foo` ranking to the new entry, which + was supposed to "start over". +6. **New. A stale organizer page can silently remove students** (lines 96–102 + and 403–406). List edits are decided by comparing the new text with the + stored list. Suppose the organizer adds students in one tab and then saves an + older copy of the list from another tab. Or suppose they edit while offline: + the page "keeps what the organizer has entered". Either way, the students + missing from that text count as removed. Their sign-in links and preferences + are dropped, and adding them back makes them start over. Students get a + last-save-wins rule (line 171); organizers get no rule at all. Either reject + an edit made against an outdated list, or show the organizer what will be + removed before saving. +7. **New. Edits on the session page have no limits or save rule** (lines 72–74 + and 96). Setup makes **Create** unavailable until the title and list limits + hold, but the session page has no **Create**. Nothing says whether an edit + that empties the student list, or brings it to 501 students, is refused. + Nothing says when an edit takes effect, either: on a **Save** button, on + leaving the field, or as the organizer types. The title also can't be edited + after creation by any stated means, yet a typo in it ends up in the CSV file + name. +8. **New. Reordering entries is undefined** (lines 70, 96–102, 109). List order + decides the order of Unspecified items (line 145), group numbering (lines + 318–320) and the CSV row order (line 341). An edit that only moves entries is + neither a case change nor a remove-and-add. Nothing says whether it's + allowed, whether it discards formed groups ("editing … discards", line 109), + or whether the lists still count as "the same lists" under Repeatable (line + 308). +9. **The privacy rule contradicts itself** (lines 184–191). (Open since + round 2.) "No … figure computed from them" also forbids the groups, + which the next paragraph admits are computed from teammate preferences. +10. **New. Moving items while the list is filtered is undefined** (lines + 150–156). Items "can be moved while the section is filtered", but "up or + down one place" could mean past the next visible item, or past the next item + in the full ranking, which may be hidden. Dropping an item between two + visible items doesn't say where it lands among the hidden items between + them. The readings give different rankings, and so different scores. + +##### Vague terms + +* "Last change" (line 33). (Open since round 2.) Does + a student's save move the date shown on the sessions list (line 51)? Does the + organizer just opening the session move it? +* **New. Unicode normalization and case folding** (lines 19–20 and 63). Lengths + are counted in code points, but no normalization form is named. `é` is 1 code + point in NFC and 2 in NFD, the form text pasted from macOS often arrives in. + So two names that look identical are not duplicates, and a 200-character name + can pass or fail depending on how it was typed. "Ignoring case" also doesn't + say whether it means simple or full case folding (`ß` versus `SS`). + Implementers should also be warned that HTML `maxlength` and JavaScript + `.length` count UTF-16 code units, where an emoji counts as 2. +* **New. Repeatable** (lines 308–310). "On any computer" doesn't say "on any + version of the tool". If the search is improved in a later release, forming an + old session again gives different groups. Nothing says which of several + equally good assignments is chosen, either. Ties are routine: a class where + nobody saved preferences, or *W*p = *W*t = 0, which the + options allow, makes every valid assignment best. Say whether tests may check + the groups in such cases or only the score. +* **Number fields** (lines 200–204 and 281–284). (Open since round 2.) + How do halves round? Does typing the default value count as "changing" the + group size? +* "A letter" in the file name (line 334). (Open since round + 2.) Is it ASCII only, or Unicode letters, so that `Проект` stays + `Проект`? +* **Userid syntax** (lines 66–67). (Open since round 2.) `a@b.` and + `a@.edu` both pass. +* **Rename collisions** (lines 104–108). (Open since round 2.) What + happens when an entry is renamed to one already on the list? How do the text + field and the per-entry **Rename** action coexist? After a case-only edit, + does the CSV use the old or the new casing? +* **Title trimming** (line 57). (Open since round 2.) A title made only + of spaces looks valid. +* **Separators** (line 58). (Open since round 2.) Semicolons and tabs + aren't separators, so a list pasted from Outlook is dropped entry by entry. +* **Propagation** (lines 293–297 and 409–410). (Open since round 2.) + How soon does an open student page notice a Close, a Reopen, a deletion, or + that the student was removed? What happens when the organizer edits the lists + or options while groups are being formed? +* "Group size" isn't the size of a group (lines 198–208). + (Open since round 2.) With 13 students and *k* = 7, there is one + group of 13. The help text should call *k* the minimum size. + +##### Architectural mismatch + +* **Matching on the email claim lets one person pass as another** (lines + 122–128). (Open since round 2.) The `email` claim is set by the + user's own organization and may be unverified. Since the first matching + account keeps the userid for good, an impostor also locks the real student + out. There's a further tension. Line 18 defines the userid as the sign-in + name, but organizers will usually paste email addresses from Teams. At many + universities these differ: the sign-in name is `s1234567@uni.edu` and the + email is `jane.doe@uni.edu`. Dropping email matching to fix the impostor + problem would break such lists. Accepting email only when its domain is + verified (`xms_edov`), or only from allowed tenants, keeps both working. +* **New. Sign out doesn't let users switch accounts** (lines 129–131). With + Microsoft single sign-on, signing out of the tool alone leaves the Microsoft + session in place. The next sign-in silently returns the same account. To + switch, the tool must either ask Microsoft for its account picker + (`prompt=select_account`) or sign the user out of Microsoft entirely, which + also signs them out of Teams and Outlook in that browser. The spec should say + which. +* **New. No quotas** (lines 33, 39–40 and 407–408). Anyone with any work or + school account, in any organization, can create sessions. Each can hold 500 + students and 100 projects, run a 60-second forming job, and be stored for 365 + days. There's no limit on sessions per organizer, forming jobs running at + once, or tenants allowed, so one user can exhaust the server's CPU and + storage. Set per-organizer limits, or restrict which tenants can sign in. + Restricting tenants would also help with the email claim above. +* **Which machine the 60-second limit applies to** (lines 407–408). (Open + since round 2.) Phones are supported browsers. If forming runs on the + server, the spec must cover a page reload during forming and what **Cancel** + does. +* **The organizer's identity is undefined** (lines 38–40). (Open since round + 2.) Students are bound to a stable account; the organizer isn't. +* **The ≤8-student test oracle is unbounded in projects** (lines 438–439). + (Open since round 2.) 8 students, *k* = 1 and 100 projects give about + 7.5 × 10¹⁵ project assignments to check. Bound *P*. + +##### What's strong + +The scoring model is fully stated and normalized. With the sign fixed, it +reproduces every Expected results row exactly, and each row has a unique best +assignment, so the table works as a real test oracle. The sizing rules are +exact, and their examples (50 and 500 students, 7 students) check out. Rename +versus remove-and-add is cleanly separated. The CSV format is precise down to +line endings and quoting. The privacy section honestly admits what can't be +hidden, and the out-of-scope list is concrete. ### (Team member 3 name) @@ -219,4 +417,4 @@ GitHub userid: (team member 1's GitHub userid) ### (Team member 4 name) -(Same sections as Team member 1) \ No newline at end of file +(Same sections as Team member 1) From bb9fab1e11258ce554ec6df450233b79b7ee2239 Mon Sep 17 00:00:00 2001 From: Aruzhan Akhanayeva Date: Sat, 28 Nov 2026 01:44:21 +0500 Subject: [PATCH 07/10] Aruzhan: spec review round 5 --- group-creation-tool/specification.md | 341 +++++++++++++++++++++++++++ 1 file changed, 341 insertions(+) diff --git a/group-creation-tool/specification.md b/group-creation-tool/specification.md index 3c6cd8ac..7d76db55 100644 --- a/group-creation-tool/specification.md +++ b/group-creation-tool/specification.md @@ -392,6 +392,345 @@ The fifth and sixth rows differ only in the two not-preferred teammates, which split `a` and `b`. With 7 students and no preferences, the default group size is 3, giving 2 groups, of 4 and 3 students. +Stack +----- + +| Part | Choice | Used for | +| --- | --- | --- | +| Front end | Single-page web app in TypeScript, built with Vite | Every page in the specification | +| Hosting | Firebase Hosting | Serving the app, rewrites for session links, security headers | +| Sign-in | Microsoft Entra ID, through MSAL.js (`@azure/msal-browser`) | Signing in with the account used for Teams | +| Session with the back end | Firebase Authentication, signed in with custom tokens | Giving each account a stable Firebase user id | +| Database | Cloud Firestore | All stored data, and live updates to open pages | +| Server code | Cloud Functions for Firebase (2nd gen), in TypeScript | Sign-in, every organizer action, forming groups, deletion | +| Shared code | A TypeScript package used by the app, the functions and the tests | List rules, group sizes, scoring | +| Local testing | Firebase Local Emulator Suite | Testing security rules and functions without the cloud | +| Deployment | GitHub Actions, deploying on every push to `main` | Hosting, Firestore rules and indexes, functions | + +Cloud Functions need Firebase's pay-as-you-go **Blaze** plan, so the project +needs a billing account. At the specification's sizes, use should stay within +the free monthly allowance. + +The UI framework is not chosen yet; nothing below depends on it. + +### Why these choices + +* **Firebase Hosting rather than GitHub Pages.** Hosting can send security + headers, rewrite session links to the app, and serve the app and its + back end from one Firebase project. +* **MSAL.js and custom tokens rather than Firebase's built-in Microsoft + provider.** The specification matches students on their sign-in name and + never on their email address (Signing in), and recognizes people by their + account, not their sign-in name. Firebase's provider centers on the email + address. With MSAL.js, the app gets the Microsoft ID token itself, a + function checks it, and the Firebase user id is built from the account's + stable Microsoft ids. Sign-in also never depends on third-party storage, + which some browsers block. +* **Cloud Functions for everything the organizer changes.** Security rules + cannot check the specification's list rules on 500 entries, keep several + documents consistent, or keep secrets. Students' saves are the exception: + they go straight to Firestore, guarded by rules, so that a save lands within + 2 seconds without waiting for a function to start (Saving). +* **One shared package for the rules of the specification.** The list rules + (Session setup), the group sizes (Group sizes) and the scoring (What "best" + means) run in the browser for instant feedback, in the functions as the + rule that counts, and in the tests that check Expected results. + +Microsoft Entra setup +--------------------- + +* Register one app in the university's Entra tenant, as a **single-tenant** + app. Students and organizers then sign in only with university accounts. + Ask the university's IT to grant admin consent if users cannot consent to + apps themselves (Limits and failures: Sign-in). +* Request only the `openid` and `profile` scopes. The ID token then holds the + name (`name`), the sign-in name (`preferred_username`), the account id + (`oid`) and the tenant id (`tid`), and nothing else is requested, as the + specification requires. +* Add the Hosting domain as a redirect URI for a single-page app. + +Request flow +------------ + +### Signing in + +1. The app signs in with MSAL.js: a popup on desktop, a redirect on phones. +2. It sends the Microsoft ID token to the `signIn` function. +3. `signIn` checks the token's signature against Entra's published keys, its + issuer, its audience (the app's client id), its tenant, and its expiry. +4. `signIn` returns a Firebase custom token for the user id + `ms__`, with the claims `signInName` (the sign-in name, case + folded) and `name`. +5. The app signs in to Firebase with that token. Firebase keeps the user + signed in and puts the claims in every request, where security rules and + functions read them. + +The user id never changes for an account, so it is how the tool recognizes +organizers and students, even when a sign-in name changes (Sessions, Signing +in). The functions' service account needs the *Service Account Token Creator* +role to create custom tokens. + +### Opening a student link + +1. Before sign-in, the app reads `links/{sessionId}`, which anyone can read. + If it does not exist, the page says the link is not valid (Signing in). +2. After sign-in, the app calls `openSession`. The function looks in + `members/{uid}` for an earlier link to an entry. Otherwise it looks for a + student entry whose case-folded userid equals the caller's `signInName` + and that no account has used yet, and links it in a transaction. +3. If no entry matches, the function returns the organizer's name, and the + page shows the "not on this session's list" message. + +### Saving preferences + +The student page writes `preferences/{entryId}` straight to Firestore, as one +whole document, so each save replaces the last (Saving). The security rules +accept the write only if: + +* the caller is linked to that entry in `members/{uid}`; +* the session is Open, read from the `roster` document; +* the document's `listVersion` equals the roster's, so a page that loaded the + lists before an entry was added cannot save preferences about it; +* every id is a current project or another current student, no id is listed + twice, and `savedAt` is the server's time. + +A refusal because the session is Closed is a permission error, which the +Firestore SDK does not retry, as the specification requires. A refusal +because of an old `listVersion` makes the page reload the lists, drop ids +that are no longer on them, and save again. + +The `onPreferencesWritten` function marks the entry as *saved preferences* +the first time it saves. + +### Organizer actions + +The organizer pages read their session's documents directly, with live +updates, but change them only by calling functions: + +| Function | Does | +| --- | --- | +| `createSession` | Checks the title and lists with the shared rules, and creates the session, its entries, its roster and its link | +| `updateLists` | Applies edited list text: an entry whose text differs only in case keeps its id; any other change removes the entry and adds a new one; deletes a removed student's `members` and `preferences` documents; increments `listVersion`; discards results | +| `renameEntry` | Changes a userid or project name and keeps the entry's id, so every preference stays; discards results | +| `setState` | Closes or reopens the session; reopening discards results | +| `setOptions` | Saves the grouping options and marks results as out of date | +| `formGroups` | Checks that the session is Closed and creates a forming job | +| `cancelForming` | Asks a running job to stop | +| `deleteSession` | Deletes the session and everything under it | + +Functions that discard results ask for the organizer's confirmation in the +page first, as the specification requires. + +### Forming groups + +`formGroups` writes a job document; the `runForming` function starts when the +job appears and runs on the server, so it carries on if the organizer closes +or reloads the page (Forming). It: + +1. reads the lists, options and every preferences document, ignoring ids no + longer on the lists; +2. searches for groups, checking the job's `cancelRequested` field between + steps; +3. writes the results and marks the job as done, cancelled or failed. + +The search does a fixed amount of work, seeded from the inputs, so the same +inputs always give the same groups on any machine (Forming: Repeatable). It +runs with 2 CPUs, the machine named in Limits and failures: Forming time. + +### Deleting + +`deleteSession` and the daily `deleteExpiredSessions` function delete the +session document with all its subcollections, and its `links` document. A +session expires 365 days after its last change: the later of its +`updatedAt`, set by every organizer action, and its `lastStudentSaveAt`. +Firestore's own time-to-live feature is not used, since it does not delete +subcollections. + +Data storage +------------ + +### Collections + +``` +links/{sessionId} +sessions/{sessionId} +sessions/{sessionId}/roster/current +sessions/{sessionId}/students/{entryId} +sessions/{sessionId}/members/{uid} +sessions/{sessionId}/preferences/{entryId} +sessions/{sessionId}/jobs/{jobId} +sessions/{sessionId}/results/current +``` + +Session ids and entry ids are Firestore's random 20-character ids, so a +session link cannot be guessed (Session page). Entries are identified by id, +never by their text: a renamed entry keeps its id, and an entry removed and +added again gets a new one, which is what keeps preferences across a +**Rename** and drops them across a remove and add (Session page). + +### `links/{sessionId}` + +Lets a student's page tell whether a link is valid before sign-in. It holds +no other data. + +| Field | Type | Meaning | +| --- | --- | --- | +| `createdAt` | timestamp | When the session was created | + +### `sessions/{sessionId}` + +The session as the organizer sees it. + +| Field | Type | Meaning | +| --- | --- | --- | +| `organizerUid` | string | The organizer's user id | +| `organizerName` | string | The organizer's name, shown to students | +| `title` | string | 1–100 characters | +| `state` | `open` or `closed` | Session state | +| `projects` | array of `{id, name}` | The project list, in order | +| `options` | map | `minGroupSize` (a number, or null while it is the default), `projectWeight` and `teammateWeight` (0–5) | +| `listVersion` | number | Incremented whenever an entry is added or removed | +| `studentCount`, `savedCount` | number | For the sessions list | +| `resultsState` | `none`, `current` or `outOfDate` | Whether groups are formed, and whether options changed since | +| `createdAt`, `updatedAt` | timestamp | `updatedAt` changes on every organizer action | +| `lastStudentSaveAt` | timestamp | Updated at most once an hour, for deletion | + +The deletion date shown in the sessions list is computed from `updatedAt` and +`lastStudentSaveAt`. + +### `sessions/{sessionId}/roster/current` + +What a linked student's page needs to show the lists. Kept apart from the +session document so that students cannot read other students' statuses or +the organizer's options. + +| Field | Type | Meaning | +| --- | --- | --- | +| `title`, `organizerName`, `state`, `listVersion` | | Copies of the session's fields | +| `projects` | array of `{id, name}` | The project list, in order | +| `students` | array of `{id, userid, displayName}` | The student list, in order; `displayName` is null until the student signs in | +| `projectIds`, `studentIds` | array of strings | The ids alone, for the security rules | + +At the largest size this document is about 150 KB, well under Firestore's 1 +MiB limit. Sign-ins update it one at a time; if 500 students sign in within a +few minutes, the writes stay near Firestore's guideline of one write per +second to a document. + +### `sessions/{sessionId}/students/{entryId}` + +One document per student entry, for the organizer's student list. + +| Field | Type | Meaning | +| --- | --- | --- | +| `order` | number | Position in the student list | +| `userid` | string | As entered by the organizer, with the latest casing | +| `useridFolded` | string | Case folded, for matching at sign-in | +| `accountUid` | string or null | The account linked to this entry | +| `displayName` | string or null | From the account, at its last sign-in | +| `status` | `notSignedIn`, `signedIn` or `saved` | As shown on the session page | + +### `sessions/{sessionId}/members/{uid}` + +Links an account to its entry, so that rules can check a save with one read. + +| Field | Type | Meaning | +| --- | --- | --- | +| `entryId` | string | The student entry this account uses | + +### `sessions/{sessionId}/preferences/{entryId}` + +One student's preferences, readable and writable only by that student. The +organizer cannot read it (Privacy between students); only functions do. + +| Field | Type | Meaning | +| --- | --- | --- | +| `projectsPreferred`, `projectsNotPreferred` | array of entry ids | Strongest feeling first | +| `teammatesPreferred`, `teammatesNotPreferred` | array of entry ids | Strongest feeling first | +| `listVersion` | number | The roster version the page had loaded | +| `savedAt` | timestamp | Set to the server's time | + +Unspecified items are not stored: an id in neither array of a section is +Unspecified, and the page shows Unspecified items in list order (Preferences +page). A student with no document has everything Unspecified (What "best" +means: Score). + +### `sessions/{sessionId}/jobs/{jobId}` + +One forming run. + +| Field | Type | Meaning | +| --- | --- | --- | +| `status` | `queued`, `running`, `done`, `cancelled` or `failed` | Shown on the session page | +| `requestedAt`, `startedAt`, `finishedAt` | timestamp | For the time elapsed | +| `cancelRequested` | boolean | Set by `cancelForming` | +| `listVersion`, `options` | | The inputs the run used | + +### `sessions/{sessionId}/results/current` + +The formed groups, for the results view and the CSV file. + +| Field | Type | Meaning | +| --- | --- | --- | +| `formedAt` | timestamp | When the run finished | +| `options` | map | The options used, shown with the results | +| `groups` | array of `{number, projectId, memberIds}` | Numbered as in Results view | +| `projectOutcomes` | map from entry id to `{category, rank}` | How each student's project preference was met | +| `unusedProjectIds` | array of strings | Projects without a group | + +The score is not stored here. The organizer can read this document, and +anything the organizer can read counts as shown to them, so it holds nothing +computed from teammate preferences except the groups themselves (Privacy +between students). The CSV file is built in the organizer's browser from this +document and the student list. + +### Who can read and write + +| Data | Organizer | Linked student | Anyone signed in | Not signed in | +| --- | --- | --- | --- | --- | +| `links` | read | read | read | read | +| `sessions`, `students`, `jobs`, `results` | read | — | — | — | +| `roster` | read | read | — | — | +| `members` | — | read their own | — | — | +| `preferences` | — | read and write their own | — | — | + +Only functions write anything not marked "write" above. An organizer who is +also on their own student list has both columns' access. + +Security headers +---------------- + +Firebase Hosting sends, for every page: + +* a content security policy that allows scripts only from the app itself and + connections only to Firebase and `login.microsoftonline.com`, and forbids + framing the app; +* `X-Content-Type-Options: nosniff` and `Referrer-Policy: no-referrer`. + +Hosting also sends HSTS, so all traffic uses HTTPS (Constraints: Security). +Session links (`/s/{sessionId}`) are rewritten to the app. + +Testing +------- + +* **Shared package:** unit tests for every Expected results row, the + teammate-part table, and the random small classes in Acceptance criteria, + each against a brute-force search. +* **Security rules and functions:** tests against the emulators for every + row of "Who can read and write", for a save after the session closes, and + for a save with an old `listVersion`. +* **End to end:** the Acceptance criteria scenario, run in a browser against + the emulators, with sign-in replaced by test custom tokens. + +Open decisions +-------------- + +* The UI framework. +* The Firestore and Functions region, which cannot be changed later; one near + the university keeps pages fast. +* Whether the university's IT will register the app and grant admin consent, + or the team registers it in a test tenant until then. + + Limits and failures ------------------- @@ -411,6 +750,8 @@ Limits and failures Preferences about removed items are dropped as described under Session page. + + Constraints ----------- From 66ea10d6441ec94751abe4ff725ecf6f5981430f Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Sat, 28 Nov 2026 02:12:06 +0500 Subject: [PATCH 08/10] Extracted the architecture from the main specification to a separate file architecture.md, filled LLM review #5 --- group-creation-tool/architecture.md | 378 ++++++++++++++++++++++ group-creation-tool/specification.md | 452 +++++---------------------- group-creation-tool/submission.md | 235 +++++++------- 3 files changed, 570 insertions(+), 495 deletions(-) create mode 100644 group-creation-tool/architecture.md diff --git a/group-creation-tool/architecture.md b/group-creation-tool/architecture.md new file mode 100644 index 00000000..3d0c96fd --- /dev/null +++ b/group-creation-tool/architecture.md @@ -0,0 +1,378 @@ +Project group creation tool: architecture +========================================= + +This document describes how the tool in [specification.md](specification.md) +is built: the services it runs on, how requests flow between them, and the +data it stores. The specification says what the tool does; where the two +disagree, the specification wins and this document is corrected. + +Stack +----- + +| Part | Choice | Used for | +| --- | --- | --- | +| Front end | Single-page web app in TypeScript, built with Vite | Every page in the specification | +| Hosting | Firebase Hosting | Serving the app, rewrites for session links, security headers | +| Sign-in | Microsoft Entra ID, through MSAL.js (`@azure/msal-browser`) | Signing in with the account used for Teams | +| Session with the back end | Firebase Authentication, signed in with custom tokens | Giving each account a stable Firebase user id | +| Database | Cloud Firestore | All stored data, and live updates to open pages | +| Server code | Cloud Functions for Firebase (2nd gen), in TypeScript | Sign-in, every organizer action, forming groups, deletion | +| Shared code | A TypeScript package used by the app, the functions and the tests | List rules, group sizes, scoring | +| Local testing | Firebase Local Emulator Suite | Testing security rules and functions without the cloud | +| Deployment | GitHub Actions, deploying on every push to `main` | Hosting, Firestore rules and indexes, functions | + +Cloud Functions need Firebase's pay-as-you-go **Blaze** plan, so the project +needs a billing account. At the specification's sizes, use should stay within +the free monthly allowance. + +The UI framework is not chosen yet; nothing below depends on it. + +### Why these choices + +* **Firebase Hosting rather than GitHub Pages.** Hosting can send security + headers, rewrite session links to the app, and serve the app and its + back end from one Firebase project. +* **MSAL.js and custom tokens rather than Firebase's built-in Microsoft + provider.** The specification matches students on their sign-in name and + never on their email address (Signing in), and recognizes people by their + account, not their sign-in name. Firebase's provider centers on the email + address. With MSAL.js, the app gets the Microsoft ID token itself, a + function checks it, and the Firebase user id is built from the account's + stable Microsoft ids. Sign-in also never depends on third-party storage, + which some browsers block. +* **Cloud Functions for everything the organizer changes.** Security rules + cannot check the specification's list rules on 500 entries, keep several + documents consistent, or keep secrets. Students' saves are the exception: + they go straight to Firestore, guarded by rules, so that a save lands within + 2 seconds without waiting for a function to start (Saving). +* **One shared package for the rules of the specification.** The list rules + (Session setup), the group sizes (Group sizes) and the scoring (What "best" + means) run in the browser for instant feedback, in the functions as the + rule that counts, and in the tests that check Expected results. + +Microsoft Entra setup +--------------------- + +* Register one app in the university's Entra tenant, as a **single-tenant** + app, so that only the organization's accounts can sign in (Purpose). Entra + rejects accounts of other tenants, and the app shows the specification's + message for them. Ask the university's IT to grant admin consent if users + cannot consent to apps themselves (Limits and failures: Sign-in). +* Request only the `openid` and `profile` scopes. The ID token then holds the + name (`name`), the sign-in name (`preferred_username`), the account id + (`oid`) and the tenant id (`tid`), and nothing else is requested, as the + specification requires. +* Add the Hosting domain as a redirect URI for a single-page app. + +Request flow +------------ + +### Signing in + +1. The app signs in with MSAL.js: a popup on desktop, a redirect on phones. +2. It sends the Microsoft ID token to the `signIn` function. +3. `signIn` checks the token's signature against Entra's published keys, its + issuer, its audience (the app's client id), its tenant, and its expiry. +4. `signIn` returns a Firebase custom token for the user id + `ms__`, with the claims `signInName` (the sign-in name, case + folded) and `name`. +5. The app signs in to Firebase with that token. Firebase keeps the user + signed in and puts the claims in every request, where security rules and + functions read them. + +The user id never changes for an account, so it is how the tool recognizes +organizers and students, even when a sign-in name changes (Sessions, Signing +in). The functions' service account needs the *Service Account Token Creator* +role to create custom tokens. + +### Opening a student link + +1. Before sign-in, the app reads `links/{sessionId}`, which anyone can read. + If it does not exist, the page says the link is not valid (Signing in). +2. After sign-in, the app calls `openSession`. The function looks in + `members/{uid}` for an earlier link to an entry. Otherwise it looks for a + student entry whose case-folded userid equals the caller's `signInName` + and that no account has used yet, and links it in a transaction. +3. If no entry matches, the function returns the organizer's name, and the + page shows the "not on this session's list" message. + +### Saving preferences + +The student page writes `preferences/{entryId}` straight to Firestore, as one +whole document, so each save replaces the last (Saving). The security rules +accept the write only if: + +* the caller is linked to that entry in `members/{uid}`; +* the session is Open, read from the `roster` document; +* the document's `listVersion` equals the roster's, so a page that loaded the + lists before an entry was added cannot save preferences about it; +* every id is a current project or another current student, no id is listed + twice, and `savedAt` is the server's time. + +Every refusal is a permission error, which the Firestore SDK does not retry, +while a write that cannot reach Firestore stays queued and is retried. After a +permission error the page reads, in this order: + +1. `links/{sessionId}`: if it is gone, the session was deleted; +2. its own `members/{uid}` document: if it is gone, the student was removed; +3. the roster: if the session is Closed, the save was refused for that; +4. otherwise the save carried an old `listVersion`, so the page reloads the + lists, drops ids that are no longer on them, and saves again. + +The first three give the three messages under Saving. + +The `onPreferencesWritten` function marks the entry as *saved preferences* +the first time it saves. + +### Organizer actions + +The organizer pages read their session's documents directly, with live +updates, but change them only by calling functions: + +| Function | Does | +| --- | --- | +| `createSession` | Checks the title and lists with the shared rules, and creates the session, its entries, its roster and its link | +| `updateLists` | Applies edited list text: an entry whose text differs only in case keeps its id; any other change removes the entry and adds a new one; deletes a removed student's `members` and `preferences` documents; increments `listVersion`; discards results | +| `renameEntry` | Changes a userid or project name and keeps the entry's id, so every preference stays; discards results | +| `setState` | Closes or reopens the session; reopening discards results | +| `setOptions` | Saves the grouping options and marks results as out of date | +| `formGroups` | Checks that the session is Closed and no job is under way, creates a forming job, and sets `formingJobId` | +| `cancelForming` | Asks a running job to stop | +| `deleteSession` | Deletes the session and everything under it, including any job | + +Functions that discard results ask for the organizer's confirmation in the +page first, as the specification requires. + +While `formingJobId` is set, `updateLists`, `renameEntry`, `setOptions`, and +`setState` when reopening refuse to run (Forming). Each of them, and +`formGroups`, reads `formingJobId` in the same transaction as its change, so +an edit and the start of a job cannot both succeed. + +### Forming groups + +`formGroups` writes a job document; the `runForming` function starts when the +job appears and runs on the server, so it carries on if the organizer closes +or reloads the page (Forming). It: + +1. reads the lists, options and every preferences document, ignoring ids no + longer on the lists; +2. searches for groups, checking the job's `cancelRequested` field between + steps; +3. in one transaction, checks that the session still exists, that the job + was not cancelled, and that the session's `listVersion` and options equal + the ones the job recorded; then writes the results, marks the job as done + and clears `formingJobId`. If a check fails, it writes no results and + marks the job as cancelled or failed. + +The refusals under Organizer actions should make the checks in step 3 always +pass; they guard against a bug that lets an edit through. + +The search starts from an assignment built from the inputs alone, with any +random choices drawn from a generator seeded from them. It then applies the +four simple changes under Forming until none raises the score. It never reads +the clock, so the same inputs give the same groups on any machine with the +same version of the code (Forming: Repeatable). Scores are exact fractions, +with `BigInt` numerators and denominators, never floating-point numbers (What +"best" means: Score). It runs with 2 CPUs, the machine named in Limits and +failures: Forming time. + +### Deleting + +`deleteSession` and the daily `deleteExpiredSessions` function delete the +session document with all its subcollections, and its `links` document. A +session expires 365 days after its last change: the later of its +`updatedAt`, set by every organizer action, and its `lastStudentSaveAt`. +Firestore's own time-to-live feature is not used, since it does not delete +subcollections. + +Data storage +------------ + +### Collections + +``` +links/{sessionId} +sessions/{sessionId} +sessions/{sessionId}/roster/current +sessions/{sessionId}/students/{entryId} +sessions/{sessionId}/members/{uid} +sessions/{sessionId}/preferences/{entryId} +sessions/{sessionId}/jobs/{jobId} +sessions/{sessionId}/results/current +``` + +Session ids and entry ids are Firestore's random 20-character ids, so a +session link cannot be guessed (Session page). Entries are identified by id, +never by their text: a renamed entry keeps its id, and an entry removed and +added again gets a new one, which is what keeps preferences across a +**Rename** and drops them across a remove and add (Session page). + +### `links/{sessionId}` + +Lets a student's page tell whether a link is valid before sign-in. It holds +no other data. + +| Field | Type | Meaning | +| --- | --- | --- | +| `createdAt` | timestamp | When the session was created | + +### `sessions/{sessionId}` + +The session as the organizer sees it. + +| Field | Type | Meaning | +| --- | --- | --- | +| `organizerUid` | string | The organizer's user id | +| `organizerName` | string | The organizer's name, shown to students | +| `title` | string | 1–100 characters | +| `state` | `open` or `closed` | Session state | +| `projects` | array of `{id, name}` | The project list, in order | +| `options` | map | `minGroupSize` (a number, or null while it is the default), `projectWeight` and `teammateWeight` (0–5) | +| `listVersion` | number | Incremented whenever an entry is added or removed | +| `studentCount`, `savedCount` | number | For the sessions list | +| `resultsState` | `none`, `current` or `outOfDate` | Whether groups are formed, and whether options changed since | +| `formingJobId` | string or null | The job that is queued or running, if any | +| `createdAt`, `updatedAt` | timestamp | `updatedAt` changes on every organizer action | +| `lastStudentSaveAt` | timestamp | Updated at most once an hour, for deletion | + +The deletion date shown in the sessions list is computed from `updatedAt` and +`lastStudentSaveAt`. + +### `sessions/{sessionId}/roster/current` + +What a linked student's page needs to show the lists. Kept apart from the +session document so that students cannot read whether classmates have saved +preferences, or the organizer's options. A classmate's `displayName` does show +that they have signed in, which the specification accepts (Privacy between +students). + +| Field | Type | Meaning | +| --- | --- | --- | +| `title`, `organizerName`, `state`, `listVersion` | | Copies of the session's fields | +| `projects` | array of `{id, name}` | The project list, in order | +| `students` | array of `{id, userid, displayName}` | The student list, in order; `displayName` is null until the student signs in | +| `projectIds`, `studentIds` | array of strings | The ids alone, for the security rules | + +At the largest size this document is about 150 KB, well under Firestore's 1 +MiB limit. Sign-ins update it one at a time; if 500 students sign in within a +few minutes, the writes stay near Firestore's guideline of one write per +second to a document. + +### `sessions/{sessionId}/students/{entryId}` + +One document per student entry, for the organizer's student list. + +| Field | Type | Meaning | +| --- | --- | --- | +| `order` | number | Position in the student list | +| `userid` | string | As entered by the organizer, with the latest casing | +| `useridFolded` | string | Case folded, for matching at sign-in | +| `accountUid` | string or null | The account linked to this entry | +| `displayName` | string or null | From the account, at its last sign-in | +| `status` | `notSignedIn`, `signedIn` or `saved` | As shown on the session page | + +### `sessions/{sessionId}/members/{uid}` + +Links an account to its entry, so that rules can check a save with one read. + +| Field | Type | Meaning | +| --- | --- | --- | +| `entryId` | string | The student entry this account uses | + +### `sessions/{sessionId}/preferences/{entryId}` + +One student's preferences, readable and writable only by that student. The +organizer cannot read it (Privacy between students); only functions do. + +| Field | Type | Meaning | +| --- | --- | --- | +| `projectsPreferred`, `projectsNotPreferred` | array of entry ids | Strongest feeling first | +| `teammatesPreferred`, `teammatesNotPreferred` | array of entry ids | Strongest feeling first | +| `listVersion` | number | The roster version the page had loaded | +| `savedAt` | timestamp | Set to the server's time | + +Unspecified items are not stored: an id in neither array of a section is +Unspecified, and the page shows Unspecified items in list order (Preferences +page). A student with no document has everything Unspecified (What "best" +means: Score). + +### `sessions/{sessionId}/jobs/{jobId}` + +One forming run. + +| Field | Type | Meaning | +| --- | --- | --- | +| `status` | `queued`, `running`, `done`, `cancelled` or `failed` | Shown on the session page | +| `requestedAt`, `startedAt`, `finishedAt` | timestamp | For the time elapsed | +| `cancelRequested` | boolean | Set by `cancelForming` | +| `listVersion`, `options` | | The inputs the run used | + +### `sessions/{sessionId}/results/current` + +The formed groups, for the results view and the CSV file. + +| Field | Type | Meaning | +| --- | --- | --- | +| `formedAt` | timestamp | When the run finished | +| `options` | map | The options used, shown with the results | +| `groups` | array of `{number, projectId, memberIds}` | Numbered as in Results view | +| `projectOutcomes` | map from entry id to `{category, rank}` | How each student's project preference was met | +| `unusedProjectIds` | array of strings | Projects without a group | + +The score is not stored here. The organizer can read this document, and +anything the organizer can read counts as shown to them, so it holds nothing +computed from teammate preferences except the groups and what follows from +them (Privacy between students). The CSV file is built in the organizer's +browser from this document and the student list. + +### Who can read and write + +| Data | Organizer | Linked student | Anyone signed in | Not signed in | +| --- | --- | --- | --- | --- | +| `links` | read | read | read | read | +| `sessions`, `students`, `jobs`, `results` | read | — | — | — | +| `roster` | read | read | — | — | +| `members` | — | read their own | — | — | +| `preferences` | — | read and write their own | — | — | + +Only functions write anything not marked "write" above. An organizer who is +also on their own student list has both columns' access. + +Security headers +---------------- + +Firebase Hosting sends, for every page: + +* a content security policy that allows scripts only from the app itself and + connections only to Firebase and `login.microsoftonline.com`, and forbids + framing the app; +* `X-Content-Type-Options: nosniff` and `Referrer-Policy: no-referrer`. + +Hosting also sends HSTS, so all traffic uses HTTPS (Constraints: Security). +Session links (`/s/{sessionId}`) are rewritten to the app. + +Testing +------- + +* **Shared package:** unit tests for every Expected results row, the + teammate-part table, and the random small classes in Acceptance criteria, + each against a brute-force search. +* **Security rules and functions:** tests against the emulators for every + row of "Who can read and write"; for a save after the session closes, after + it is deleted, after the student is removed, and with an old `listVersion`; + and for every organizer action while a job is under way. +* **End to end:** the Acceptance criteria scenario, run in a browser against + the emulators, with sign-in replaced by test custom tokens. + +Open decisions +-------------- + +* The UI framework. +* The Firestore and Functions region, which cannot be changed later; one near + the university keeps pages fast. +* Whether the university's IT will register the app and grant admin consent, + or the team registers it in a test tenant until then. +* Whether exact fractions are fast enough for the 60-second limit at 500 + students. If not, the search can compare floating-point scores first and + fall back to exact fractions only when two scores are too close for + floating point to tell apart. diff --git a/group-creation-tool/specification.md b/group-creation-tool/specification.md index 9f1eb802..39cd01fa 100644 --- a/group-creation-tool/specification.md +++ b/group-creation-tool/specification.md @@ -1,8 +1,8 @@ Project group creation tool =========================== -This document specifies what the tool does, as seen by its users. It does not -prescribe how the code is organized. +This document specifies what the tool does, as seen by its users. How it is +built is described in [architecture.md](architecture.md). Purpose ------- @@ -14,10 +14,13 @@ would like, or would rather avoid. The organizer then asks the tool to form the groups that best satisfy these preferences and downloads the result as a `.csv` file, which is the input to the next project. -Everyone signs in with the Microsoft 365 work or school account they use for -Microsoft Teams. A person's **userid** is the sign-in name of that account, -such as `student@university.edu`. Userids are compared without regard to case. -Lengths in this document are counted in Unicode code points. +The tool serves one organization, such as a university, and is used mainly +within a faculty, whose students largely know each other. Everyone signs in +with the organization's Microsoft 365 work or school account that they use for +Microsoft Teams; accounts of other organizations cannot sign in. A person's +**userid** is the sign-in name of that account, such as +`student@university.edu`. Userids are compared without regard to case. Lengths +in this document are counted in Unicode code points. Sessions -------- @@ -36,7 +39,7 @@ undone. Deleting removes everything the session holds; the tool remembers only that its link no longer works. The organizer is the only person who can see or change a session's organizer -pages. Anyone who signs in can create sessions and becomes the organizer of +pages. Anyone who can sign in can create sessions and becomes the organizer of the sessions they create. The tool recognizes an organizer by their account, not by their sign-in name, so a change to their sign-in name keeps their sessions. An organizer may also be on the student list of their own session. @@ -105,7 +108,11 @@ a student, as *not signed in*. To correct a userid or a project name without losing preferences, the organizer uses the entry's **Rename** action instead. A renamed entry keeps every preference by it and about it, and a renamed student who had signed in -stays recognized, as described under Signing in. +stays linked to their account, as described under Signing in. So Rename +cannot hand an entry to a different person: if the wrong person signed in with +an entry, for example because the organizer typed someone else's userid, the +organizer removes the entry and adds the correct userid, which starts over as +described above. Editing or renaming entries discards formed groups, after the organizer confirms. @@ -165,10 +172,11 @@ On narrow screens (under 800 px wide) the categories stack, Preferred first. Each change is saved automatically within 2 seconds; no button is needed. A save indicator shows *Saving…*, *Saved*, or *Not saved*. While a save is -failing, the page retries every 10 seconds, and *Not saved* has a **Retry** -button that retries at once. Leaving the page with unsaved changes asks the -student to confirm, in browsers that allow this; unsaved changes are lost when -the page is closed or reloaded. +failing because the tool cannot be reached, the page retries every 10 seconds, +and *Not saved* has a **Retry** button that retries at once. A save the tool +refuses is never retried; see below. Leaving the page with unsaved changes +asks the student to confirm, in browsers that allow this; unsaved changes are +lost when the page is closed or reloaded. Each save replaces all of the student's saved preferences, so if the student has the page open in two tabs, the last save wins. An open page shows @@ -181,21 +189,36 @@ page then shows the current lists. A student has *saved preferences* once any change of theirs has been saved. While the session is Closed, the page shows the student's saved preferences -read-only, with a notice that preferences are closed. A change that reaches -the tool after the session closed is refused and not retried, even if the -session is reopened later: the page says the change was not saved and -switches to read-only. +read-only, with a notice that preferences are closed; when the session is +reopened, the page can be edited again and new changes are saved as usual. + +The tool refuses a save in three cases, each with its own message: + +* **The session is Closed.** The page says the change was not saved and + switches to read-only. The refused change is dropped, not kept for a later + reopening. +* **The session was deleted.** The page says the session no longer exists. +* **The student was removed from the student list.** The page shows the + message for someone who is not on this session's list (see Signing in). ### Privacy between students A student sees only their own preferences. No page or file shows a student's -teammate preferences, or any number computed from them, to anyone but that -student. The organizer sees how each student's project preference was met -(see Results). - -The groups themselves follow from the teammate preferences, so these cannot be -hidden completely: an organizer who compares groups formed with different -weights, or who knows a very small class, may infer some of them. +teammate preferences, or anything computed from them, to anyone but that +student, except the groups themselves and what follows from them: each +group's members and project, how each student's project preference was met, +and the summary counts (see Results). + +The groups follow from the teammate preferences, so these cannot be hidden +completely: an organizer who compares groups formed with different weights, +or who knows a very small class, may infer some of them. + +Other students' sign-in status is not hidden. The Teammates list shows a +classmate's display name only once they have signed in, so a student can tell +which classmates have signed in, though not whether they have saved +preferences. This is accepted: within a faculty, where students largely know +each other, this reveals little, and names make classmates much easier to +find than userids alone. Forming groups -------------- @@ -261,7 +284,11 @@ project. their group (*m* = 0). The teammate part is the sum of the two shares. So the project part and the teammate part each range from −1 to 1, however -many items a student ranks. +many items a student ranks. Each share measures how close the group comes to +the best one of its size for that student. So a student who prefers more +teammates than their group holds gets a lower preferred share in a larger +group, even when the extra member is Unspecified: a group of that size could +have held one more of their preferred teammates. This is intended. **Student satisfaction** is: @@ -271,7 +298,10 @@ where *W*p and *W*t are the weights below. **Score.** An assignment's score is the sum of every student's satisfaction. A student who never saved preferences counts as having everything -Unspecified, but other students' preferences about them still count. +Unspecified, but other students' preferences about them still count. Scores +are computed and compared exactly, as fractions, never as rounded numbers: one +assignment is better than another only when its score is strictly higher, and +equal scores are equal. These teammate parts show the scaling, for a student `a`: @@ -313,6 +343,11 @@ Groups are formed by the tool's server, not on the organizer's device. Forming carries on if the organizer closes or reloads the page, and the session page shows it as under way when opened again, with **Cancel**. +While groups are being formed, the organizer cannot edit or rename entries, +reopen the session, or change the options; these controls say to cancel +forming first. So the results always match the lists and options they show. +Deleting the session cancels forming. + The result must be: * **Valid:** it follows every rule under Group sizes. @@ -321,10 +356,13 @@ The result must be: * **Not improvable by a simple change** for any class size: none of these gives a higher score while keeping the assignment valid: moving one student to another group, swapping two students in different groups, swapping the - projects of two groups, or giving one group a different project. -* **Repeatable:** forming again with the same lists, preferences, and options - gives the same groups, on any computer; the result does not depend on how - fast forming runs. + projects of two groups, or giving one group a different project. Forming + ends only once no simple change helps. +* **Repeatable:** forming again with the same lists, preferences, and options, + on the same version of the tool, gives the same groups on any computer. So + forming never stops because time runs out, and its result does not depend + on how fast it runs. A new version of the tool may form different groups + from the same inputs. Results ------- @@ -411,368 +449,28 @@ The fifth and sixth rows differ only in the two not-preferred teammates, which split `a` and `b`. With 7 students and no preferences, the default minimum group size is 3, giving 2 groups, of 4 and 3 students. -Stack ------ - -| Part | Choice | Used for | -| --- | --- | --- | -| Front end | Single-page web app in TypeScript, built with Vite | Every page in the specification | -| Hosting | Firebase Hosting | Serving the app, rewrites for session links, security headers | -| Sign-in | Microsoft Entra ID, through MSAL.js (`@azure/msal-browser`) | Signing in with the account used for Teams | -| Session with the back end | Firebase Authentication, signed in with custom tokens | Giving each account a stable Firebase user id | -| Database | Cloud Firestore | All stored data, and live updates to open pages | -| Server code | Cloud Functions for Firebase (2nd gen), in TypeScript | Sign-in, every organizer action, forming groups, deletion | -| Shared code | A TypeScript package used by the app, the functions and the tests | List rules, group sizes, scoring | -| Local testing | Firebase Local Emulator Suite | Testing security rules and functions without the cloud | -| Deployment | GitHub Actions, deploying on every push to `main` | Hosting, Firestore rules and indexes, functions | - -Cloud Functions need Firebase's pay-as-you-go **Blaze** plan, so the project -needs a billing account. At the specification's sizes, use should stay within -the free monthly allowance. - -The UI framework is not chosen yet; nothing below depends on it. - -### Why these choices - -* **Firebase Hosting rather than GitHub Pages.** Hosting can send security - headers, rewrite session links to the app, and serve the app and its - back end from one Firebase project. -* **MSAL.js and custom tokens rather than Firebase's built-in Microsoft - provider.** The specification matches students on their sign-in name and - never on their email address (Signing in), and recognizes people by their - account, not their sign-in name. Firebase's provider centers on the email - address. With MSAL.js, the app gets the Microsoft ID token itself, a - function checks it, and the Firebase user id is built from the account's - stable Microsoft ids. Sign-in also never depends on third-party storage, - which some browsers block. -* **Cloud Functions for everything the organizer changes.** Security rules - cannot check the specification's list rules on 500 entries, keep several - documents consistent, or keep secrets. Students' saves are the exception: - they go straight to Firestore, guarded by rules, so that a save lands within - 2 seconds without waiting for a function to start (Saving). -* **One shared package for the rules of the specification.** The list rules - (Session setup), the group sizes (Group sizes) and the scoring (What "best" - means) run in the browser for instant feedback, in the functions as the - rule that counts, and in the tests that check Expected results. - -Microsoft Entra setup ---------------------- - -* Register one app in the university's Entra tenant, as a **single-tenant** - app. Students and organizers then sign in only with university accounts. - Ask the university's IT to grant admin consent if users cannot consent to - apps themselves (Limits and failures: Sign-in). -* Request only the `openid` and `profile` scopes. The ID token then holds the - name (`name`), the sign-in name (`preferred_username`), the account id - (`oid`) and the tenant id (`tid`), and nothing else is requested, as the - specification requires. -* Add the Hosting domain as a redirect URI for a single-page app. - -Request flow ------------- - -### Signing in - -1. The app signs in with MSAL.js: a popup on desktop, a redirect on phones. -2. It sends the Microsoft ID token to the `signIn` function. -3. `signIn` checks the token's signature against Entra's published keys, its - issuer, its audience (the app's client id), its tenant, and its expiry. -4. `signIn` returns a Firebase custom token for the user id - `ms__`, with the claims `signInName` (the sign-in name, case - folded) and `name`. -5. The app signs in to Firebase with that token. Firebase keeps the user - signed in and puts the claims in every request, where security rules and - functions read them. - -The user id never changes for an account, so it is how the tool recognizes -organizers and students, even when a sign-in name changes (Sessions, Signing -in). The functions' service account needs the *Service Account Token Creator* -role to create custom tokens. - -### Opening a student link - -1. Before sign-in, the app reads `links/{sessionId}`, which anyone can read. - If it does not exist, the page says the link is not valid (Signing in). -2. After sign-in, the app calls `openSession`. The function looks in - `members/{uid}` for an earlier link to an entry. Otherwise it looks for a - student entry whose case-folded userid equals the caller's `signInName` - and that no account has used yet, and links it in a transaction. -3. If no entry matches, the function returns the organizer's name, and the - page shows the "not on this session's list" message. - -### Saving preferences - -The student page writes `preferences/{entryId}` straight to Firestore, as one -whole document, so each save replaces the last (Saving). The security rules -accept the write only if: - -* the caller is linked to that entry in `members/{uid}`; -* the session is Open, read from the `roster` document; -* the document's `listVersion` equals the roster's, so a page that loaded the - lists before an entry was added cannot save preferences about it; -* every id is a current project or another current student, no id is listed - twice, and `savedAt` is the server's time. - -A refusal because the session is Closed is a permission error, which the -Firestore SDK does not retry, as the specification requires. A refusal -because of an old `listVersion` makes the page reload the lists, drop ids -that are no longer on them, and save again. - -The `onPreferencesWritten` function marks the entry as *saved preferences* -the first time it saves. - -### Organizer actions - -The organizer pages read their session's documents directly, with live -updates, but change them only by calling functions: - -| Function | Does | -| --- | --- | -| `createSession` | Checks the title and lists with the shared rules, and creates the session, its entries, its roster and its link | -| `updateLists` | Applies edited list text: an entry whose text differs only in case keeps its id; any other change removes the entry and adds a new one; deletes a removed student's `members` and `preferences` documents; increments `listVersion`; discards results | -| `renameEntry` | Changes a userid or project name and keeps the entry's id, so every preference stays; discards results | -| `setState` | Closes or reopens the session; reopening discards results | -| `setOptions` | Saves the grouping options and marks results as out of date | -| `formGroups` | Checks that the session is Closed and creates a forming job | -| `cancelForming` | Asks a running job to stop | -| `deleteSession` | Deletes the session and everything under it | - -Functions that discard results ask for the organizer's confirmation in the -page first, as the specification requires. - -### Forming groups - -`formGroups` writes a job document; the `runForming` function starts when the -job appears and runs on the server, so it carries on if the organizer closes -or reloads the page (Forming). It: - -1. reads the lists, options and every preferences document, ignoring ids no - longer on the lists; -2. searches for groups, checking the job's `cancelRequested` field between - steps; -3. writes the results and marks the job as done, cancelled or failed. - -The search does a fixed amount of work, seeded from the inputs, so the same -inputs always give the same groups on any machine (Forming: Repeatable). It -runs with 2 CPUs, the machine named in Limits and failures: Forming time. - -### Deleting - -`deleteSession` and the daily `deleteExpiredSessions` function delete the -session document with all its subcollections, and its `links` document. A -session expires 365 days after its last change: the later of its -`updatedAt`, set by every organizer action, and its `lastStudentSaveAt`. -Firestore's own time-to-live feature is not used, since it does not delete -subcollections. - -Data storage ------------- - -### Collections - -``` -links/{sessionId} -sessions/{sessionId} -sessions/{sessionId}/roster/current -sessions/{sessionId}/students/{entryId} -sessions/{sessionId}/members/{uid} -sessions/{sessionId}/preferences/{entryId} -sessions/{sessionId}/jobs/{jobId} -sessions/{sessionId}/results/current -``` - -Session ids and entry ids are Firestore's random 20-character ids, so a -session link cannot be guessed (Session page). Entries are identified by id, -never by their text: a renamed entry keeps its id, and an entry removed and -added again gets a new one, which is what keeps preferences across a -**Rename** and drops them across a remove and add (Session page). - -### `links/{sessionId}` - -Lets a student's page tell whether a link is valid before sign-in. It holds -no other data. - -| Field | Type | Meaning | -| --- | --- | --- | -| `createdAt` | timestamp | When the session was created | - -### `sessions/{sessionId}` - -The session as the organizer sees it. - -| Field | Type | Meaning | -| --- | --- | --- | -| `organizerUid` | string | The organizer's user id | -| `organizerName` | string | The organizer's name, shown to students | -| `title` | string | 1–100 characters | -| `state` | `open` or `closed` | Session state | -| `projects` | array of `{id, name}` | The project list, in order | -| `options` | map | `minGroupSize` (a number, or null while it is the default), `projectWeight` and `teammateWeight` (0–5) | -| `listVersion` | number | Incremented whenever an entry is added or removed | -| `studentCount`, `savedCount` | number | For the sessions list | -| `resultsState` | `none`, `current` or `outOfDate` | Whether groups are formed, and whether options changed since | -| `createdAt`, `updatedAt` | timestamp | `updatedAt` changes on every organizer action | -| `lastStudentSaveAt` | timestamp | Updated at most once an hour, for deletion | - -The deletion date shown in the sessions list is computed from `updatedAt` and -`lastStudentSaveAt`. - -### `sessions/{sessionId}/roster/current` - -What a linked student's page needs to show the lists. Kept apart from the -session document so that students cannot read other students' statuses or -the organizer's options. - -| Field | Type | Meaning | -| --- | --- | --- | -| `title`, `organizerName`, `state`, `listVersion` | | Copies of the session's fields | -| `projects` | array of `{id, name}` | The project list, in order | -| `students` | array of `{id, userid, displayName}` | The student list, in order; `displayName` is null until the student signs in | -| `projectIds`, `studentIds` | array of strings | The ids alone, for the security rules | - -At the largest size this document is about 150 KB, well under Firestore's 1 -MiB limit. Sign-ins update it one at a time; if 500 students sign in within a -few minutes, the writes stay near Firestore's guideline of one write per -second to a document. - -### `sessions/{sessionId}/students/{entryId}` - -One document per student entry, for the organizer's student list. - -| Field | Type | Meaning | -| --- | --- | --- | -| `order` | number | Position in the student list | -| `userid` | string | As entered by the organizer, with the latest casing | -| `useridFolded` | string | Case folded, for matching at sign-in | -| `accountUid` | string or null | The account linked to this entry | -| `displayName` | string or null | From the account, at its last sign-in | -| `status` | `notSignedIn`, `signedIn` or `saved` | As shown on the session page | - -### `sessions/{sessionId}/members/{uid}` - -Links an account to its entry, so that rules can check a save with one read. - -| Field | Type | Meaning | -| --- | --- | --- | -| `entryId` | string | The student entry this account uses | - -### `sessions/{sessionId}/preferences/{entryId}` - -One student's preferences, readable and writable only by that student. The -organizer cannot read it (Privacy between students); only functions do. - -| Field | Type | Meaning | -| --- | --- | --- | -| `projectsPreferred`, `projectsNotPreferred` | array of entry ids | Strongest feeling first | -| `teammatesPreferred`, `teammatesNotPreferred` | array of entry ids | Strongest feeling first | -| `listVersion` | number | The roster version the page had loaded | -| `savedAt` | timestamp | Set to the server's time | - -Unspecified items are not stored: an id in neither array of a section is -Unspecified, and the page shows Unspecified items in list order (Preferences -page). A student with no document has everything Unspecified (What "best" -means: Score). - -### `sessions/{sessionId}/jobs/{jobId}` - -One forming run. - -| Field | Type | Meaning | -| --- | --- | --- | -| `status` | `queued`, `running`, `done`, `cancelled` or `failed` | Shown on the session page | -| `requestedAt`, `startedAt`, `finishedAt` | timestamp | For the time elapsed | -| `cancelRequested` | boolean | Set by `cancelForming` | -| `listVersion`, `options` | | The inputs the run used | - -### `sessions/{sessionId}/results/current` - -The formed groups, for the results view and the CSV file. - -| Field | Type | Meaning | -| --- | --- | --- | -| `formedAt` | timestamp | When the run finished | -| `options` | map | The options used, shown with the results | -| `groups` | array of `{number, projectId, memberIds}` | Numbered as in Results view | -| `projectOutcomes` | map from entry id to `{category, rank}` | How each student's project preference was met | -| `unusedProjectIds` | array of strings | Projects without a group | - -The score is not stored here. The organizer can read this document, and -anything the organizer can read counts as shown to them, so it holds nothing -computed from teammate preferences except the groups themselves (Privacy -between students). The CSV file is built in the organizer's browser from this -document and the student list. - -### Who can read and write - -| Data | Organizer | Linked student | Anyone signed in | Not signed in | -| --- | --- | --- | --- | --- | -| `links` | read | read | read | read | -| `sessions`, `students`, `jobs`, `results` | read | — | — | — | -| `roster` | read | read | — | — | -| `members` | — | read their own | — | — | -| `preferences` | — | read and write their own | — | — | - -Only functions write anything not marked "write" above. An organizer who is -also on their own student list has both columns' access. - -Security headers ----------------- - -Firebase Hosting sends, for every page: - -* a content security policy that allows scripts only from the app itself and - connections only to Firebase and `login.microsoftonline.com`, and forbids - framing the app; -* `X-Content-Type-Options: nosniff` and `Referrer-Policy: no-referrer`. - -Hosting also sends HSTS, so all traffic uses HTTPS (Constraints: Security). -Session links (`/s/{sessionId}`) are rewritten to the app. - -Testing -------- - -* **Shared package:** unit tests for every Expected results row, the - teammate-part table, and the random small classes in Acceptance criteria, - each against a brute-force search. -* **Security rules and functions:** tests against the emulators for every - row of "Who can read and write", for a save after the session closes, and - for a save with an old `listVersion`. -* **End to end:** the Acceptance criteria scenario, run in a browser against - the emulators, with sign-in replaced by test custom tokens. - -Open decisions --------------- - -* The UI framework. -* The Firestore and Functions region, which cannot be changed later; one near - the university keeps pages fast. -* Whether the university's IT will register the app and grant admin consent, - or the team registers it in a test tenant until then. - - Limits and failures ------------------- * **Sign-in.** Signing in asks only for permission to read the user's name - and sign-in name. If sign-in fails or is cancelled, the page - says so and offers to try again. If the user's organization requires an - administrator to approve the tool first, the page says so and suggests - asking the organization's IT administrator. + and sign-in name. If sign-in fails or is cancelled, the page says so and + offers to try again. Someone who signs in with an account of another + organization is told that only the organization's accounts can sign in. If + the organization requires an administrator to approve the tool first, the + page says so and suggests asking its IT administrator. * **Lost connection.** If the tool cannot reach its server, every page says so. The student page keeps retrying, as described under Saving; the organizer pages keep what the organizer has entered while the page stays open. * **Forming time.** Forming groups for 500 students and 100 projects finishes - within 60 seconds on a server with 2 processor cores. Since the result may - not depend on how fast forming runs (see Forming), this is a limit on the - work forming does, not a deadline at which it stops. + within 60 seconds on a server with 2 processor cores. This is a requirement + on how fast forming is, not a deadline: forming never stops early because + time runs out (see Forming: Repeatable). * **Concurrent changes.** If the organizer edits the lists while a student's page is open, the student's page shows the new lists within a minute. Preferences about removed items are dropped as described under Session page. - - Constraints ----------- diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index c5abd68b..bf5e3d47 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -3,10 +3,11 @@ Project 2 submission Team name: Project Group Creation Tool 2 -The specification consists of the file [specification.md](specification.md). +The specification consists of the file [specification.md](specification.md), with links to the architecture file. The submission consists of the file [submission.md](submission.md). +The architecture consists of the file [architecture.md](architecture.md). Draft submission ---------------- @@ -34,6 +35,7 @@ is not directly related to the project, and only used for pull request tracking. | 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | | 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | Fixed the 11 High and Medium findings and CodeRabbit's 2 comments on the pull request, which repeat items 1 and 3; left the 9 Low vague terms as they are. The not-preferred share divides by the size of the most negative sum, and both shares are 0 for a student alone in a group. The CSV example now has 6 students in 3 groups. Students are matched on sign-in name only, not email, and organizers are recognized by their account. A save refused because the session closed is final, and a save from a stale page never applies to a re-added entry. The privacy rule says "number" instead of "figure". The option is renamed "Minimum group size", with sizes from *k* to under 2*k*. Forming runs on the server, survives a page reload, and its 60-second limit names a 2-core server. The small-class acceptance test is limited to 4 projects. Expected results rechecked by brute force. | | 3 | Rated 9/10; 15 new findings in total, plus the 9 Low vague terms carried over from round 2. **Medium:** "after the session closed" can be read as refusing every change even after a reopen, saves refused because the session was deleted or the student was removed still retry forever, an extra Unspecified teammate lowers the teammate part, the spec doesn't require exact score comparison (floating-point ties break "best", "not improvable" and the acceptance test), "Repeatable" has no version boundary. **Low:** a "fewer than *k* students" clause that can never apply, dragging vs. "goes to its end", 6 vague terms (moves while filtered, how list edits are applied, editing the title, "out of date", the 2-core server, page speed including sign-in), slow correction of mismatched sign-in names, no quotas on sessions. Expected results table, teammate-part table and default group sizes verified correct by brute force. | | +| 5 | Rated 7/10 (9/10 without the pasted architecture); 11 new findings in total, plus every round-3 finding, all still open since the behavior text hasn't changed. **High:** the architecture document was pasted into the spec (lines 414–751), against the spec's own scope, splitting its behavior sections, with self-references that no longer make sense and a second copy that will drift. **Medium:** single-tenant sign-in vs. "anyone who signs in" and "the user's organization", display names in the Teammates list show who has signed in, a fixed amount of search work vs. "not improvable", forming races with list edits, Reopen and option changes, one permission error for a closed session, a deleted session and a removed student, Rename can't fix a link to the wrong person, the privacy wording still forbids the result counts. **Low:** "on the list" doesn't cover linked accounts whose sign-in name changed, the acceptance criteria skip the hardest guarantees, "but at least 1" can never apply. Expected results table, teammate-part table and default group sizes verified correct by brute force with exact fractions. | Fixed the High and Medium findings, including the round-3 Medium findings still open, and left the Low ones (items 8–10, the dead "fewer than *k*" clause, dragging, and the vague terms) as they are. Removed the pasted architecture from the spec; [architecture.md](architecture.md) is now the only copy, and the spec's opening points to it instead of the clause about code organization. The spec now says the tool serves one organization and only its accounts sign in, matching the single-tenant design. Students still see classmates' display names: the spec now says this shows who has signed in, and that this is accepted, since the tool is used within a faculty whose students largely know each other and names are easier to find than userids. Forming improves until no simple change helps and never stops because time runs out; Repeatable holds for one version of the tool; scores are compared exactly as fractions. While forming runs, the organizer cannot edit or rename entries, reopen the session or change options, and the architecture refuses these in the same transaction that starts a job. A closed session, a deleted session and a removed student each get their own message, and none is retried; after a reopen the page is editable again. The spec says removing and re-adding an entry, not Rename, gives it to a different person. The privacy rule now allows the groups and what follows from them. The finding that an extra Unspecified teammate lowers the teammate part is struck through: this is intended, and the spec now explains why. The architecture was updated to match each change. | #### Last specification review @@ -42,127 +44,124 @@ desktop app. Prompt: -> Review a specification at @group-creation-tool/specification.md . +> My teammate has added new changes to the repo and specification. Review a +> specification at @group-creation-tool/specification.md . Output (line numbers refer to [specification.md](specification.md) as it was reviewed, before this round's changes; strikethrough marks findings judged incorrect): -I'd rate it **9/10**, up from 8 in round 2. All the High and Medium findings -from round 2 are fixed, and the fixes don't contradict each other. I -brute-forced all 13 Expected results rows with exact fractions. Each one gives -exactly the stated groups and score, and each has exactly one best assignment. -All 5 rows of the teammate-part table come out as stated. The default sizes -for 4–9, 13, 50 and 500 students match the text. What keeps it from a 10 is -mostly the edges of the save rules and one hidden decision about how scores -are compared. I didn't modify the file. - -##### Logical inconsistencies - -1. **"After the session closed" can be read as "ever after"** (lines 184–187). - Once a session has been closed even once, every later change reaches the - tool "after the session closed". Read literally, that includes changes made - after the session is reopened. It also doesn't say what happens to a change - made before a Close that arrives only after the Reopen, for example after a - network outage. A clearer wording: "a change that reaches the tool while the - session is Closed is refused". The spec should also say whether a read-only - page becomes editable again when the session is reopened. -2. **Saves refused for other reasons still retry forever** (lines 166–169). - Round 2's fix covers only a Closed session. A save can also be refused - because: - * the session was deleted; - * the student was removed from the list; - * the student was removed and added again, so their entry is a new one and - "*not signed in*". - - Each of these falls under "while a save is failing, the page retries every - 10 seconds". The page would retry forever and keep the leave-page warning - on. In the third case, the rule on line 176 ("never applies to an entry that - was added after the page last loaded") is about the entries a save mentions. - It doesn't say whether a stale page can save for the student's own new - entry. -3. **Unspecified isn't neutral for teammates** (lines 251–261). Unspecified is - worth 0, but adding an Unspecified teammate can lower a student's score. - Take a student with Preferred `b`, `c`, `d`: - * in a group with `b` and `c`, their preferred share is - (1 + 2/3)/(1 + 2/3) = **1**; - * with an extra Unspecified member `x` it is (5/3)/2 = **5/6**. - - The same extra member softens a not-preferred penalty from −1 to −5/6. This - only happens when the category holds more than *m* items. A student who - lists just `b` gets 1 either way. So the scoring tends to put students with - long lists into the smaller groups. If that's intended, say so; if not, - scale the shares by the group's best possible sum. -4. **"Unless there are fewer than *k* students in all" can never apply** (line - 216). *k* is limited to 1…*S* (line 207) and is clamped when the list - changes, so *S* ≥ *k* always holds. -5. **Dragging conflicts with "goes to its end"** (lines 152–156). An item moved - into Preferred or Not preferred goes to the end, yet "every move can be made - by dragging". Dragging normally drops an item where you let go. Say which - one wins. - -##### Vague terms - -* **Moves while filtered** (lines 157–158). It isn't clear whether "up one - place" moves past items the filter hides, or where a dragged item lands - between two visible items that have hidden ones between them. It also - doesn't say whether the filter ignores case. -* **List edits on the session page** (lines 97–111). Nothing says how an edit - is applied: is there an Apply button, or is it saved on blur? Nor does it say - what happens when an edit breaks the limits, such as 0 students or 501. At - setup, **Create** is simply unavailable, but the session page has no - equivalent. -* **Title after creation.** The spec doesn't say whether the title can be - edited, and it decides the CSV file name. -* **"Out of date"** (lines 299–302). If an option is changed and then set back - to the value used for forming, are the results still out of date? -* **"2 processor cores"** (line 427) still names no processor speed or - generation, so the 60-second limit can't be tested exactly. -* **Page speed** (line 450): it isn't clear whether "shows its content within 2 - seconds" includes the Microsoft sign-in redirect, which the tool doesn't - control. -* **Carried over from round 2**, left open on purpose: "last change", "changes - it", rounding of halves, "letter" in file names, userid syntax and case - folding, separators, title trimming, Rename collisions, and how fast Close, - Reopen, Delete and removal reach open pages. Two of these now matter more. - Reopening or editing during forming is undefined. And how a student page - learns of a Reopen affects item 1. - -##### Architectural mismatch - -* **The spec doesn't say how scores are compared** (lines 316–327 and - 459–461). Scores are fractions such as 1/3 and 5/6. With floating-point - numbers, two assignments that should tie can differ by a tiny rounding - error. That can break three things: - * "no valid assignment has a higher score"; - * "Not improvable" (a neutral swap looks like an improvement, and the search - can loop); - * the acceptance test's "equals the best score". - - The spec should require exact arithmetic or a stated tolerance. Exact - arithmetic is easy here, because every value is *j*/*n* with *n* ≤ 500. -* **"Repeatable" has no version boundary** (line 325). As written, a later - release with a better algorithm would break the rule. Limit it to "the same - version of the tool", or record the version with the results. -* **Fixing mismatched sign-in names is slow.** At many universities the - sign-in name differs from the email address the organizer knows, for - example `s1234567@uni.edu` instead of `jane.doe@uni.edu`. Each such student - must contact the organizer, who renames entries one at a time. A list of - refused sign-ins on the session page, with a one-click Rename, would solve - this without the email-matching risk from round 2. -* **There are no quotas.** Anyone with any work or school account can create - any number of sessions of up to 500 × 100 entries, and each one is kept for - 365 days. The spec should cap sessions per organizer, or restrict sign-in to - particular organizations. - -##### What's strong - -The scoring is fully stated and every example checks out exactly. The size -rules are tight and the "fewer than 2*k*" claim holds. The rules for stale tabs -and closed sessions are now close to complete. Forming on the server, with -Cancel and reload behavior, is well defined. The privacy section is honest -about what it can't hide. Fixing items 1 and 2 and stating exact arithmetic -would make it a 10. +I'd rate it **7/10**, down from 9 in round 3. None of the behavior text has +changed since round 3. The only change is commit `bb9fab1`, which pastes the +whole architecture document into the spec, at lines 414–751. That block is +identical to lines 9–345 of `architecture.md`. Without the paste the spec +would still be a 9. + +I checked the 13 Expected results rows by testing every valid assignment with +exact fractions. Each gives exactly the stated groups and score, and each has +exactly one best assignment. All 5 teammate-part rows are correct, and the +default group sizes for 1–7, 13, 50 and 500 students match the text. I didn't +modify the file. + +##### The pasted architecture + +* **It contradicts the spec's own scope.** Lines 4–5 say the spec "does not + prescribe how the code is organized". It now names Firestore collections, + Cloud Functions and security rules. +* **It breaks the reading order.** It sits between Expected results and Limits + and failures, so the behavior sections are split by 340 lines of + implementation detail. +* **Its references no longer make sense.** + * "As the specification requires" (lines 468, 517, 541) now points the spec + at itself. + * "Nothing below depends on it" (line 433) now covers Limits, Constraints + and Acceptance. + * The paste left out the opening paragraph of `architecture.md`, which says + the spec wins when the two disagree. +* **There are now two copies** (this one and `architecture.md`) that will + drift apart. There are also stray blank lines at 751–752 and 773–775. + +Fix: remove lines 414–752, commit `architecture.md` as its own file, and link +to it from the spec. The paste does have one benefit: it shows where the spec +and the design disagree. Those disagreements need fixing wherever the +architecture ends up. + +##### Spec and architecture disagree + +1. **Which organizations can sign in.** Line 461 makes the app single-tenant, + for university accounts only. The spec says "Anyone who signs in can create + sessions" (line 39), and lines 758–760 handle "the user's organization", + which implies many organizations. Decide this in the spec. Single-tenant + would also solve the missing-quotas finding from round 3. +2. **Students can see who has signed in.** The spec has the Teammates list + show a classmate's display name "when known" (lines 143–145). The roster + holds `displayName = null` until that student signs in (line 630). So any + student can tell which classmates have signed in, which is exactly what + lines 622–624 say the roster is designed to hide. The spec should either + accept this or show only userids to students. +3. **A fixed amount of work vs. "not improvable".** Lines 555–556 give the + search a fixed amount of work so that results repeat. Lines 321–324 require + that no simple change improves the result. If the work runs out before no + simple change helps, the second guarantee fails. If the search keeps going + until then, the amount of work isn't fixed. The spec should say that + repeatable means a fixed process followed by improvement until no simple + change helps. +4. **Forming can race with edits.** The job records its `listVersion` (line + 685), but no rule throws its results away if the lists are edited, the + session is reopened, or the options change while it runs. `updateLists` and + `setState` discard the results first (lines 532 and 534), and then the job + writes stale groups that look current. The spec has left editing during + forming open since round 2; the design now shows it's a real bug. +5. **One error for three different refusals.** Lines 516–517 treat every + refused save as a permission error. A closed session, a deleted session and + a removed student all look the same, so a removed student is told that + preferences are closed. This is round 3's item 2 again: the spec should + give each case its own behavior. + +##### New spec findings + +6. **Rename can't fix a link to the wrong person** (lines 105–108 and + 128–130). Suppose the organizer typed a userid that belongs to another real + person, and that person signs in first. Rename keeps them linked, and the + intended student is locked out. Only removing and re-adding the entry + breaks the link, and the spec never says so. Say that, or add an **Unlink** + action. +7. **The privacy wording still contradicts itself** (lines 191–193). The + result counts (lines 341–342) and *preferred #i* depend on the assignment, + which depends on teammate preferences. So these are a "number computed from + them". Lines 699–701 already read the rule as "except the groups + themselves". Put that wording in the spec, covering everything that follows + from the groups. +8. **The definition of "on the list" is incomplete** (lines 123–124). It + doesn't cover a linked account whose sign-in name has changed. Nor does it + say which entry wins if an account linked to `x` is renamed to match an + unlinked `y`. +9. **The acceptance criteria skip the hardest guarantees** (lines 794–808). + Nothing tests that a large class can't be improved by a simple change, that + results repeat, the 60-second limit, privacy, the CSV format or file name, + or refusal after a close. +10. **"But at least 1"** (line 212) can never apply, since *k* ≤ *S*. It's the + same kind of dead clause as round 3's item 4. + +##### Still open from round 3 + +Every round-3 finding still stands, because the behavior text hasn't changed: + +* "after the session closed" can be read as "ever after"; +* refused saves retry forever; +* ~~an extra Unspecified teammate lowers the teammate part;~~ +* the "fewer than *k*" clause can never apply; +* dragging vs. "goes to its end"; +* how scores are compared (exact arithmetic); +* "Repeatable" has no version boundary; +* the 6 vague terms and the 9 carried over from round 2. + +Some of these are already decided in the architecture and could move up into +the spec: + +* "last change" (lines 563–564); +* case-only edits keep the latest casing (line 645); +* a stale save is refused and saved again (lines 518–519). ### Aruzhan Akhanayeva @@ -184,7 +183,7 @@ is not directly related to the project, and only used for pull request tracking. | Round | Findings | Main Changes Made | | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | -| 1 | Rated 8/10; 27 findings in total, 8 of them new; the other 19 are still open from Daniil's round 2, since the spec hasn't changed since then. High: not-preferred share has the wrong sign as written (taken literally, it puts together the two students who asked to be kept apart), CSV example needs 3 groups from 4 students, *m* = 0 divides by zero (a 1-student session reaches it with the default group size), matching on the email claim lets one person pass as another, a stale organizer tab can silently remove students and their preferences. Medium: closed-session save rejection loops on retry, a stale student tab restores preferences for a re-added entry, session-page edits have no limits or save rule, moves in a filtered list are undefined, reordering list entries is undefined, privacy wording contradicts itself, **Sign out** doesn't let users switch Microsoft accounts, no quotas on sessions or forming jobs, the 60-second limit names no machine, organizer identity is undefined, the ≤8-student test oracle is unbounded in projects, repeatability across tool versions and tie-breaking are unstated. Low: 10 vague terms ("last change", Unicode normalization and case folding, rounding of halves and "changes it", "letter" in file names, userid syntax, Rename collisions, title trimming, separators, propagation of Close/Reopen/Delete, "group size" not being the actual size). Expected results table, teammate-part table and default group sizes verified correct by brute force. |
| +| 4 | Rated 8/10; 27 findings in total, 8 of them new; the other 19 are still open from Daniil's round 2, since the spec hasn't changed since then. High: not-preferred share has the wrong sign as written (taken literally, it puts together the two students who asked to be kept apart), CSV example needs 3 groups from 4 students, *m* = 0 divides by zero (a 1-student session reaches it with the default group size), matching on the email claim lets one person pass as another, a stale organizer tab can silently remove students and their preferences. Medium: closed-session save rejection loops on retry, a stale student tab restores preferences for a re-added entry, session-page edits have no limits or save rule, moves in a filtered list are undefined, reordering list entries is undefined, privacy wording contradicts itself, **Sign out** doesn't let users switch Microsoft accounts, no quotas on sessions or forming jobs, the 60-second limit names no machine, organizer identity is undefined, the ≤8-student test oracle is unbounded in projects, repeatability across tool versions and tie-breaking are unstated. Low: 10 vague terms ("last change", Unicode normalization and case folding, rounding of halves and "changes it", "letter" in file names, userid syntax, Rename collisions, title trimming, separators, propagation of Close/Reopen/Delete, "group size" not being the actual size). Expected results table, teammate-part table and default group sizes verified correct by brute force. |
| #### Last specification review From 105b42980479af612388379312d407e003df21ef Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Sat, 28 Nov 2026 02:25:59 +0500 Subject: [PATCH 09/10] Preparing for final submission editing by Aruzhan and Daniil, polishing the specification --- group-creation-tool/submission.md | 260 ++++++++++++++++-------------- 1 file changed, 142 insertions(+), 118 deletions(-) diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index bf5e3d47..3dc059b5 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -36,6 +36,7 @@ is not directly related to the project, and only used for pull request tracking. | 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | Fixed the 11 High and Medium findings and CodeRabbit's 2 comments on the pull request, which repeat items 1 and 3; left the 9 Low vague terms as they are. The not-preferred share divides by the size of the most negative sum, and both shares are 0 for a student alone in a group. The CSV example now has 6 students in 3 groups. Students are matched on sign-in name only, not email, and organizers are recognized by their account. A save refused because the session closed is final, and a save from a stale page never applies to a re-added entry. The privacy rule says "number" instead of "figure". The option is renamed "Minimum group size", with sizes from *k* to under 2*k*. Forming runs on the server, survives a page reload, and its 60-second limit names a 2-core server. The small-class acceptance test is limited to 4 projects. Expected results rechecked by brute force. | | 3 | Rated 9/10; 15 new findings in total, plus the 9 Low vague terms carried over from round 2. **Medium:** "after the session closed" can be read as refusing every change even after a reopen, saves refused because the session was deleted or the student was removed still retry forever, an extra Unspecified teammate lowers the teammate part, the spec doesn't require exact score comparison (floating-point ties break "best", "not improvable" and the acceptance test), "Repeatable" has no version boundary. **Low:** a "fewer than *k* students" clause that can never apply, dragging vs. "goes to its end", 6 vague terms (moves while filtered, how list edits are applied, editing the title, "out of date", the 2-core server, page speed including sign-in), slow correction of mismatched sign-in names, no quotas on sessions. Expected results table, teammate-part table and default group sizes verified correct by brute force. | | | 5 | Rated 7/10 (9/10 without the pasted architecture); 11 new findings in total, plus every round-3 finding, all still open since the behavior text hasn't changed. **High:** the architecture document was pasted into the spec (lines 414–751), against the spec's own scope, splitting its behavior sections, with self-references that no longer make sense and a second copy that will drift. **Medium:** single-tenant sign-in vs. "anyone who signs in" and "the user's organization", display names in the Teammates list show who has signed in, a fixed amount of search work vs. "not improvable", forming races with list edits, Reopen and option changes, one permission error for a closed session, a deleted session and a removed student, Rename can't fix a link to the wrong person, the privacy wording still forbids the result counts. **Low:** "on the list" doesn't cover linked accounts whose sign-in name changed, the acceptance criteria skip the hardest guarantees, "but at least 1" can never apply. Expected results table, teammate-part table and default group sizes verified correct by brute force with exact fractions. | Fixed the High and Medium findings, including the round-3 Medium findings still open, and left the Low ones (items 8–10, the dead "fewer than *k*" clause, dragging, and the vague terms) as they are. Removed the pasted architecture from the spec; [architecture.md](architecture.md) is now the only copy, and the spec's opening points to it instead of the clause about code organization. The spec now says the tool serves one organization and only its accounts sign in, matching the single-tenant design. Students still see classmates' display names: the spec now says this shows who has signed in, and that this is accepted, since the tool is used within a faculty whose students largely know each other and names are easier to find than userids. Forming improves until no simple change helps and never stops because time runs out; Repeatable holds for one version of the tool; scores are compared exactly as fractions. While forming runs, the organizer cannot edit or rename entries, reopen the session or change options, and the architecture refuses these in the same transaction that starts a job. A closed session, a deleted session and a removed student each get their own message, and none is retried; after a reopen the page is editable again. The spec says removing and re-adding an entry, not Rename, gives it to a different person. The privacy rule now allows the groups and what follows from them. The finding that an extra Unspecified teammate lowers the teammate part is struck through: this is intended, and the spec now explains why. The architecture was updated to match each change. | +| 6 | Rated 9/10; 7 new findings in total, plus the Low findings left open in round 5. **High:** the architecture's search, which improves until no simple change helps, can stop short of the best assignment for 8 students or fewer (a 4-student, 3-project counterexample stops at a score of 7 where the best is 22/3). **Medium:** a single-tenant Entra app still lets B2B guest accounts sign in, against "accounts of other organizations cannot sign in"; a save refused for any reason other than the three checked ones is saved again forever, and a close-then-reopen race saves a change the spec says is dropped; the 60-second limit names no input preferences and the search has no bound on its steps. **Low:** "the same lists" under Repeatable vs. a new entry id after a remove and re-add, the 10-second retry and **Retry** don't match how the Firestore SDK resends writes, the filter doesn't say whether it ignores case or what "name" means for teammates. Expected results table, teammate-part table and default group sizes verified correct by brute force with exact fractions. | | #### Last specification review @@ -44,124 +45,127 @@ desktop app. Prompt: -> My teammate has added new changes to the repo and specification. Review a -> specification at @group-creation-tool/specification.md . +> Review a specification at @group-creation-tool/specification.md . -Output (line numbers refer to [specification.md](specification.md) as it was -reviewed, before this round's changes; strikethrough marks findings judged -incorrect): - -I'd rate it **7/10**, down from 9 in round 3. None of the behavior text has -changed since round 3. The only change is commit `bb9fab1`, which pastes the -whole architecture document into the spec, at lines 414–751. That block is -identical to lines 9–345 of `architecture.md`. Without the paste the spec -would still be a 9. - -I checked the 13 Expected results rows by testing every valid assignment with -exact fractions. Each gives exactly the stated groups and score, and each has -exactly one best assignment. All 5 teammate-part rows are correct, and the -default group sizes for 1–7, 13, 50 and 500 students match the text. I didn't -modify the file. - -##### The pasted architecture - -* **It contradicts the spec's own scope.** Lines 4–5 say the spec "does not - prescribe how the code is organized". It now names Firestore collections, - Cloud Functions and security rules. -* **It breaks the reading order.** It sits between Expected results and Limits - and failures, so the behavior sections are split by 340 lines of - implementation detail. -* **Its references no longer make sense.** - * "As the specification requires" (lines 468, 517, 541) now points the spec - at itself. - * "Nothing below depends on it" (line 433) now covers Limits, Constraints - and Acceptance. - * The paste left out the opening paragraph of `architecture.md`, which says - the spec wins when the two disagree. -* **There are now two copies** (this one and `architecture.md`) that will - drift apart. There are also stray blank lines at 751–752 and 773–775. - -Fix: remove lines 414–752, commit `architecture.md` as its own file, and link -to it from the spec. The paste does have one benefit: it shows where the spec -and the design disagree. Those disagreements need fixing wherever the -architecture ends up. +Output (line numbers refer to [specification.md](specification.md) and +[architecture.md](architecture.md) as they were reviewed, before this round's +changes): + +I'd rate the spec **9/10**, up from 7 in round 5. The pasted architecture is +gone, and every High and Medium finding from round 5 has been fixed in the +text. The most serious problem left is in `architecture.md`: its search can't +keep the spec's "best for small classes" promise. I didn't modify any files. + +I tested all 13 Expected results rows against every valid assignment, using +exact fractions. Each one gives exactly the stated groups and score, and each +has exactly one best assignment. All 5 teammate-part rows are correct. The +group sizes in the text are right for 50, 500, 13 (with *k* = 7), 7, and 1–6 +students. ##### Spec and architecture disagree -1. **Which organizations can sign in.** Line 461 makes the app single-tenant, - for university accounts only. The spec says "Anyone who signs in can create - sessions" (line 39), and lines 758–760 handle "the user's organization", - which implies many organizations. Decide this in the spec. Single-tenant - would also solve the missing-quotas finding from round 3. -2. **Students can see who has signed in.** The spec has the Teammates list - show a classmate's display name "when known" (lines 143–145). The roster - holds `displayName = null` until that student signs in (line 630). So any - student can tell which classmates have signed in, which is exactly what - lines 622–624 say the roster is designed to hide. The spec should either - accept this or show only userids to students. -3. **A fixed amount of work vs. "not improvable".** Lines 555–556 give the - search a fixed amount of work so that results repeat. Lines 321–324 require - that no simple change improves the result. If the work runs out before no - simple change helps, the second guarantee fails. If the search keeps going - until then, the amount of work isn't fixed. The spec should say that - repeatable means a fixed process followed by improvement until no simple - change helps. -4. **Forming can race with edits.** The job records its `listVersion` (line - 685), but no rule throws its results away if the lists are edited, the - session is reopened, or the options change while it runs. `updateLists` and - `setState` discard the results first (lines 532 and 534), and then the job - writes stale groups that look current. The spec has left editing during - forming open since round 2; the design now shows it's a real bug. -5. **One error for three different refusals.** Lines 516–517 treat every - refused save as a permission error. A closed session, a deleted session and - a removed student all look the same, so a removed student is told that - preferences are closed. This is round 3's item 2 again: the spec should - give each case its own behavior. +1. **The search can stop short of the best answer for small classes** (spec + lines 354–355; architecture lines 170–174). The design starts from one + assignment and makes simple changes until none helps. That reaches a point + no simple change can improve, but not always the best assignment. Here is a + counterexample I verified: + * 4 students and projects `X`, `Y`, `Z`. + * a PP Z, Y, PT b; b PP Z, Y, PT a. + * c PP Z, X, Y, PT d; d PP Z, X, Y, PT c. + * **Y: a, b; Z: c, d** scores 7, and every simple change from it lowers the + score. The best of them is 20/3. + * The best assignment is **Z: a, b; X: c, d**, at 22/3. Reaching it means + changing both groups' projects at once. + + For 8 students or fewer, the architecture needs an exact method. There are + at most 105 ways to split the students into groups. For each split, + choosing the projects is small: + * When *P* ≤ *G*, every allowed spread of projects can be tried. + * When *P* > *G*, each project gets at most one group, so it's an + assignment problem (for example, the Hungarian algorithm). This covers up + to 100 projects. + + Local search alone should be used only above 8 students. +2. **Guest accounts can sign in** (spec lines 19–21 and 457–458; architecture + lines 56–60 and 74–75). A single-tenant Entra app accepts B2B guests. + Guests are common in Teams, and their tokens carry the university's tenant + id, so the `tid` check lets them through. The spec says accounts of other + organizations can't sign in. Decide in the spec whether guests are allowed. + If not, have `signIn` reject them, for example through the `acct` optional + claim, or an `idp` claim that differs from the issuer. +3. **A refused save can loop** (spec line 177; architecture lines 112–120). + Step 4 assumes any other refusal means an old `listVersion`, and saves + again. A refusal for any other reason repeats forever, against "a save the + tool refuses is never retried". Examples: a duplicate id, or an id the + rules reject because of a bug. + * There's also a race. If the session closes and reopens between the save + and the check, step 4 saves the change, which the spec says must be + dropped (lines 197–199). + * Fix: save again only if the roster's `listVersion` differs from the one + that was sent. Otherwise show *Not saved*. ##### New spec findings -6. **Rename can't fix a link to the wrong person** (lines 105–108 and - 128–130). Suppose the organizer typed a userid that belongs to another real - person, and that person signs in first. Rename keeps them linked, and the - intended student is locked out. Only removing and re-adding the entry - breaks the link, and the spec never says so. Say that, or add an **Unlink** - action. -7. **The privacy wording still contradicts itself** (lines 191–193). The - result counts (lines 341–342) and *preferred #i* depend on the assignment, - which depends on teammate preferences. So these are a "number computed from - them". Lines 699–701 already read the rule as "except the groups - themselves". Put that wording in the spec, covering everything that follows - from the groups. -8. **The definition of "on the list" is incomplete** (lines 123–124). It - doesn't cover a linked account whose sign-in name has changed. Nor does it - say which entry wins if an account linked to `x` is renamed to match an - unlinked `y`. -9. **The acceptance criteria skip the hardest guarantees** (lines 794–808). - Nothing tests that a large class can't be improved by a simple change, that - results repeat, the 60-second limit, privacy, the CSV format or file name, - or refusal after a close. -10. **"But at least 1"** (line 212) can never apply, since *k* ≤ *S*. It's the - same kind of dead clause as round 3's item 4. - -##### Still open from round 3 - -Every round-3 finding still stands, because the behavior text hasn't changed: - -* "after the session closed" can be read as "ever after"; -* refused saves retry forever; -* ~~an extra Unspecified teammate lowers the teammate part;~~ -* the "fewer than *k*" clause can never apply; -* dragging vs. "goes to its end"; -* how scores are compared (exact arithmetic); -* "Repeatable" has no version boundary; -* the 6 vague terms and the 9 carried over from round 2. - -Some of these are already decided in the architecture and could move up into -the spec: - -* "last change" (lines 563–564); -* case-only edits keep the latest casing (line 645); -* a stale save is refused and saved again (lines 518–519). +4. **The 60-second limit has no test input** (lines 465–468). "500 students + and 100 projects" doesn't say what preferences to use. Improving until no + simple change helps has no bound on how many steps it takes, so the limit + can't be checked as written. + * Name a benchmark, for example random preferences in which every student + ranks a set number of projects and teammates. + * Say what happens when forming runs long: it still finishes, it only + misses the target. +5. **"Repeatable" depends on what "same lists" means** (lines 361–365). + Remove a student who never saved anything and add them back. The lists and + preferences read the same, but the entry has a new random id. If the + architecture's seed (line 171) includes entry ids, the groups change. + * Either say the seed comes from the list text and order, or define "same + lists" as the same entries. +6. **The 10-second retry doesn't fit the Firestore SDK** (lines 175–177). The + SDK queues writes and sends them on its own schedule when it reconnects. A + write it can't send never fails, so the page has no event for *Not saved*. + * The architecture should say how the page detects that the tool can't be + reached and how **Retry** forces a resend. Or the spec should describe + only what users see, such as "saved as soon as the connection returns". +7. **The filter isn't fully defined** (lines 164–165). It doesn't say whether + matching ignores case, or whether "name" means the display name for + teammates. + +##### Still open (Low, left as is in round 5) + +* "On the list" doesn't say which entry wins when a linked account's new + sign-in name matches another, unlinked entry. +* The acceptance criteria don't test: + * that a simple change can't improve the result; + * that results repeat; + * the 60-second limit; + * privacy; + * the CSV format; + * that saves are refused after a close. +* Three clauses can never apply: + * "but at least 1" (line 235); + * "unless there are fewer than *k* students in all" (lines 239–240); + * "halves rounded up" (line 231), since √*S* is never a half. It does no + harm. +* Dragging can contradict "goes to its end", and some vague terms remain: + * "last change"; + * whether typing the default *k* counts as changing it; + * "letter" in file names; + * title trimming and editing; + * separators; + * Rename collisions; + * whether the 1–500 and 1–100 limits apply to edits on the session page; + * how fast Close, Reopen and Delete reach open pages. + +##### What's strong + +* Each of the three save refusals now has its own message, and the text says + plainly that a change refused because the session closed is dropped. +* The privacy section is now consistent with itself. It states openly what it + can't hide: the groups themselves, and who has signed in. +* Forming during edits is closed off in both documents, with the check in the + same transaction as the edit. +* Exact fraction scoring and the version limit on Repeatable remove the tie and + drift problems from round 3. ### Aruzhan Akhanayeva @@ -364,18 +368,38 @@ versus remove-and-add is cleanly separated. The CSV format is precise down to line endings and quoting. The privacy section honestly admits what can't be hidden, and the out-of-scope list is concrete. -### (Team member 3 name) +### Ademi Bakhytova -(Same sections as Team member 1) +Github user id: + +Git user id: + +#### Contributions -### (Team member 4 name) -(Same sections as Team member 1) + +#### Build and run test + +Build and run tests are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +#### Specification review rounds + +| Round | Findings | Main Changes Made | +| --- | --- | --- | + + +#### Last specification review + +### Alisher Akim + +Couldn't contact them, unfortunately. Final submission ---------------- -### (Team member 1 name) +Danii Kaimekin GitHub userid: (team member 1's GitHub userid) @@ -403,11 +427,11 @@ GitHub userid: (team member 1's GitHub userid) (LLM output, possibly with strikethrough) -### (Team member 2 name) +### Aruzhan Akhanayeva (Same sections as Team member 1) -### (Team member 3 name) +### Ademi Bakhytova (Same sections as Team member 1) From d37b93c23036911ab78151c07b6c8c7d746f91f5 Mon Sep 17 00:00:00 2001 From: dkaimekin Date: Sat, 28 Nov 2026 02:33:33 +0500 Subject: [PATCH 10/10] Added final submission section --- group-creation-tool/submission.md | 412 +++++++++++++++++++++++++++++- 1 file changed, 399 insertions(+), 13 deletions(-) diff --git a/group-creation-tool/submission.md b/group-creation-tool/submission.md index 3dc059b5..fb82f359 100644 --- a/group-creation-tool/submission.md +++ b/group-creation-tool/submission.md @@ -3,11 +3,14 @@ Project 2 submission Team name: Project Group Creation Tool 2 +Team members: Daniil Kaimekin, Aruzhan Akhanayeva, Ademi Bakhytova, Alisher Akim. + The specification consists of the file [specification.md](specification.md), with links to the architecture file. The submission consists of the file [submission.md](submission.md). The architecture consists of the file [architecture.md](architecture.md). + Draft submission ---------------- @@ -399,42 +402,425 @@ Couldn't contact them, unfortunately. Final submission ---------------- -Danii Kaimekin +### Daniil Kaimekin -GitHub userid: (team member 1's GitHub userid) +GitHub userid: dkaimekinmasters + +Git userid: dkaimekin #### Contributions -(Team member 1's contributions) +Generated initial specification for the project, conducted multiple calls to +clarify requirements. + +#### Build and run test + +Build and run tests are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. #### Specification review rounds -(Table showing spec review rounds) +| Round | Findings | Main Changes Made | +| --- | --- | --- | +| 1 | Rated 7/10; 25 findings in total. **High:** teammate scoring contradicts the "no extra weight" claim, Unspecified ordering rules conflict, teammate privacy can't be guaranteed, default group count gives solo groups when projects outnumber students, userid relies on a mutable sign-in claim. **Medium:** deleted-session message vs. deleting all data, two-tab save rule, repeatability vs. time limit, stale results after option changes. **Low:** 7 vague terms and minor gaps (over-long names, CSV, retention, terminology). Expected results table verified correct. | Fixed every finding except the 2 struck through below and the tie-break part of item 9, plus 2 findings from CodeRabbit's review of the pull request. Group size is now about √S (an organizer option, at least 2), projects are spread evenly and a project can have several groups, and the teammate part of satisfaction is scaled to −1…1. Results no longer show the score or teammate counts, and the privacy promise now covers only showing teammate preferences. Unspecified always keeps list order. Added Rename, filter fields, and move to top or bottom. Students are matched by sign-in name or email, then by account. Added automatic save retries, last-save-wins across tabs, out-of-date results after option changes, 365-day retention, and testable timings and browser versions. Added Expected results rows and a teammate-part table, all rechecked by brute force. | +| 2 | Rated 8/10; 20 findings in total. **High:** not-preferred share has the wrong sign as written, CSV example needs 3 groups from 4 students (impossible), group size 1 divides by zero, matching on the email claim lets one person pass as another and lock out the real student. **Medium:** closed-session save rejection loops on retry, a stale tab can restore preferences for a removed and re-added entry, privacy wording contradicts itself, "group size" isn't the actual size, organizer identity is undefined, the 60-second limit names no machine, the ≤8-student test oracle is unbounded in projects. **Low:** 9 vague terms ("last change", "changes it", rounding of halves, "letter" in file names, userid syntax, separators, title trimming, Rename collisions, propagation of Close/Reopen/Delete). Expected results table and default group sizes verified correct by brute force. | Fixed the 11 High and Medium findings and CodeRabbit's 2 comments on the pull request, which repeat items 1 and 3; left the 9 Low vague terms as they are. The not-preferred share divides by the size of the most negative sum, and both shares are 0 for a student alone in a group. The CSV example now has 6 students in 3 groups. Students are matched on sign-in name only, not email, and organizers are recognized by their account. A save refused because the session closed is final, and a save from a stale page never applies to a re-added entry. The privacy rule says "number" instead of "figure". The option is renamed "Minimum group size", with sizes from *k* to under 2*k*. Forming runs on the server, survives a page reload, and its 60-second limit names a 2-core server. The small-class acceptance test is limited to 4 projects. Expected results rechecked by brute force. | +| 3 | Rated 9/10; 15 new findings in total, plus the 9 Low vague terms carried over from round 2. **Medium:** "after the session closed" can be read as refusing every change even after a reopen, saves refused because the session was deleted or the student was removed still retry forever, an extra Unspecified teammate lowers the teammate part, the spec doesn't require exact score comparison (floating-point ties break "best", "not improvable" and the acceptance test), "Repeatable" has no version boundary. **Low:** a "fewer than *k* students" clause that can never apply, dragging vs. "goes to its end", 6 vague terms (moves while filtered, how list edits are applied, editing the title, "out of date", the 2-core server, page speed including sign-in), slow correction of mismatched sign-in names, no quotas on sessions. Expected results table, teammate-part table and default group sizes verified correct by brute force. | | +| 5 | Rated 7/10 (9/10 without the pasted architecture); 11 new findings in total, plus every round-3 finding, all still open since the behavior text hasn't changed. **High:** the architecture document was pasted into the spec (lines 414–751), against the spec's own scope, splitting its behavior sections, with self-references that no longer make sense and a second copy that will drift. **Medium:** single-tenant sign-in vs. "anyone who signs in" and "the user's organization", display names in the Teammates list show who has signed in, a fixed amount of search work vs. "not improvable", forming races with list edits, Reopen and option changes, one permission error for a closed session, a deleted session and a removed student, Rename can't fix a link to the wrong person, the privacy wording still forbids the result counts. **Low:** "on the list" doesn't cover linked accounts whose sign-in name changed, the acceptance criteria skip the hardest guarantees, "but at least 1" can never apply. Expected results table, teammate-part table and default group sizes verified correct by brute force with exact fractions. | Fixed the High and Medium findings, including the round-3 Medium findings still open, and left the Low ones (items 8–10, the dead "fewer than *k*" clause, dragging, and the vague terms) as they are. Removed the pasted architecture from the spec; [architecture.md](architecture.md) is now the only copy, and the spec's opening points to it instead of the clause about code organization. The spec now says the tool serves one organization and only its accounts sign in, matching the single-tenant design. Students still see classmates' display names: the spec now says this shows who has signed in, and that this is accepted, since the tool is used within a faculty whose students largely know each other and names are easier to find than userids. Forming improves until no simple change helps and never stops because time runs out; Repeatable holds for one version of the tool; scores are compared exactly as fractions. While forming runs, the organizer cannot edit or rename entries, reopen the session or change options, and the architecture refuses these in the same transaction that starts a job. A closed session, a deleted session and a removed student each get their own message, and none is retried; after a reopen the page is editable again. The spec says removing and re-adding an entry, not Rename, gives it to a different person. The privacy rule now allows the groups and what follows from them. The finding that an extra Unspecified teammate lowers the teammate part is struck through: this is intended, and the spec now explains why. The architecture was updated to match each change. | +| 6 | Rated 9/10; 7 new findings in total, plus the Low findings left open in round 5. **High:** the architecture's search, which improves until no simple change helps, can stop short of the best assignment for 8 students or fewer (a 4-student, 3-project counterexample stops at a score of 7 where the best is 22/3). **Medium:** a single-tenant Entra app still lets B2B guest accounts sign in, against "accounts of other organizations cannot sign in"; a save refused for any reason other than the three checked ones is saved again forever, and a close-then-reopen race saves a change the spec says is dropped; the 60-second limit names no input preferences and the search has no bound on its steps. **Low:** "the same lists" under Repeatable vs. a new entry id after a remove and re-add, the 10-second retry and **Retry** don't match how the Firestore SDK resends writes, the filter doesn't say whether it ignores case or what "name" means for teammates. Expected results table, teammate-part table and default group sizes verified correct by brute force with exact fractions. | | #### Last specification review -(LLM and prompt used) +LLM: Claude Opus 5.5 (`claude-opus-5-5`), in the Claude Code tab of the Claude +desktop app. + +Prompt: + +> Review a specification at @group-creation-tool/specification.md . + +Output (line numbers refer to [specification.md](specification.md) and +[architecture.md](architecture.md) as they were reviewed, before this round's +changes): + +I'd rate the spec **9/10**, up from 7 in round 5. The pasted architecture is +gone, and every High and Medium finding from round 5 has been fixed in the +text. The most serious problem left is in `architecture.md`: its search can't +keep the spec's "best for small classes" promise. I didn't modify any files. + +I tested all 13 Expected results rows against every valid assignment, using +exact fractions. Each one gives exactly the stated groups and score, and each +has exactly one best assignment. All 5 teammate-part rows are correct. The +group sizes in the text are right for 50, 500, 13 (with *k* = 7), 7, and 1–6 +students. + +##### Spec and architecture disagree + +1. **The search can stop short of the best answer for small classes** (spec + lines 354–355; architecture lines 170–174). The design starts from one + assignment and makes simple changes until none helps. That reaches a point + no simple change can improve, but not always the best assignment. Here is a + counterexample I verified: + * 4 students and projects `X`, `Y`, `Z`. + * a PP Z, Y, PT b; b PP Z, Y, PT a. + * c PP Z, X, Y, PT d; d PP Z, X, Y, PT c. + * **Y: a, b; Z: c, d** scores 7, and every simple change from it lowers the + score. The best of them is 20/3. + * The best assignment is **Z: a, b; X: c, d**, at 22/3. Reaching it means + changing both groups' projects at once. + + For 8 students or fewer, the architecture needs an exact method. There are + at most 105 ways to split the students into groups. For each split, + choosing the projects is small: + * When *P* ≤ *G*, every allowed spread of projects can be tried. + * When *P* > *G*, each project gets at most one group, so it's an + assignment problem (for example, the Hungarian algorithm). This covers up + to 100 projects. + + Local search alone should be used only above 8 students. +2. **Guest accounts can sign in** (spec lines 19–21 and 457–458; architecture + lines 56–60 and 74–75). A single-tenant Entra app accepts B2B guests. + Guests are common in Teams, and their tokens carry the university's tenant + id, so the `tid` check lets them through. The spec says accounts of other + organizations can't sign in. Decide in the spec whether guests are allowed. + If not, have `signIn` reject them, for example through the `acct` optional + claim, or an `idp` claim that differs from the issuer. +3. **A refused save can loop** (spec line 177; architecture lines 112–120). + Step 4 assumes any other refusal means an old `listVersion`, and saves + again. A refusal for any other reason repeats forever, against "a save the + tool refuses is never retried". Examples: a duplicate id, or an id the + rules reject because of a bug. + * There's also a race. If the session closes and reopens between the save + and the check, step 4 saves the change, which the spec says must be + dropped (lines 197–199). + * Fix: save again only if the roster's `listVersion` differs from the one + that was sent. Otherwise show *Not saved*. + +##### New spec findings + +4. **The 60-second limit has no test input** (lines 465–468). "500 students + and 100 projects" doesn't say what preferences to use. Improving until no + simple change helps has no bound on how many steps it takes, so the limit + can't be checked as written. + * Name a benchmark, for example random preferences in which every student + ranks a set number of projects and teammates. + * Say what happens when forming runs long: it still finishes, it only + misses the target. +5. **"Repeatable" depends on what "same lists" means** (lines 361–365). + Remove a student who never saved anything and add them back. The lists and + preferences read the same, but the entry has a new random id. If the + architecture's seed (line 171) includes entry ids, the groups change. + * Either say the seed comes from the list text and order, or define "same + lists" as the same entries. +6. **The 10-second retry doesn't fit the Firestore SDK** (lines 175–177). The + SDK queues writes and sends them on its own schedule when it reconnects. A + write it can't send never fails, so the page has no event for *Not saved*. + * The architecture should say how the page detects that the tool can't be + reached and how **Retry** forces a resend. Or the spec should describe + only what users see, such as "saved as soon as the connection returns". +7. **The filter isn't fully defined** (lines 164–165). It doesn't say whether + matching ignores case, or whether "name" means the display name for + teammates. + +##### Still open (Low, left as is in round 5) -(LLM output, possibly with strikethrough) +* "On the list" doesn't say which entry wins when a linked account's new + sign-in name matches another, unlinked entry. +* The acceptance criteria don't test: + * that a simple change can't improve the result; + * that results repeat; + * the 60-second limit; + * privacy; + * the CSV format; + * that saves are refused after a close. +* Three clauses can never apply: + * "but at least 1" (line 235); + * "unless there are fewer than *k* students in all" (lines 239–240); + * "halves rounded up" (line 231), since √*S* is never a half. It does no + harm. +* Dragging can contradict "goes to its end", and some vague terms remain: + * "last change"; + * whether typing the default *k* counts as changing it; + * "letter" in file names; + * title trimming and editing; + * separators; + * Rename collisions; + * whether the 1–500 and 1–100 limits apply to edits on the session page; + * how fast Close, Reopen and Delete reach open pages. + +##### What's strong + +* Each of the three save refusals now has its own message, and the text says + plainly that a change refused because the session closed is dropped. +* The privacy section is now consistent with itself. It states openly what it + can't hide: the groups themselves, and who has signed in. +* Forming during edits is closed off in both documents, with the check in the + same transaction as the edit. +* Exact fraction scoring and the version limit on Repeatable remove the tie and + drift problems from round 3. #### Implementation review rounds -(Table showing implementation review rounds) +Implementation rounds are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. #### Last implementation review -(LLM and prompt used) +Implementation rounds are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. -(LLM output, possibly with strikethrough) +### Aruzhan Akhanayeva ### Aruzhan Akhanayeva -(Same sections as Team member 1) +Github userid: akhanayeva + +Git userid: akhanayeva + +#### Contributions + +Added backend configuration and architecture + +#### Build and run test + +Build and run tests are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +#### Specification review rounds + +| Round | Findings | Main Changes Made | +| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | +| 4 | Rated 8/10; 27 findings in total, 8 of them new; the other 19 are still open from Daniil's round 2, since the spec hasn't changed since then. High: not-preferred share has the wrong sign as written (taken literally, it puts together the two students who asked to be kept apart), CSV example needs 3 groups from 4 students, *m* = 0 divides by zero (a 1-student session reaches it with the default group size), matching on the email claim lets one person pass as another, a stale organizer tab can silently remove students and their preferences. Medium: closed-session save rejection loops on retry, a stale student tab restores preferences for a re-added entry, session-page edits have no limits or save rule, moves in a filtered list are undefined, reordering list entries is undefined, privacy wording contradicts itself, **Sign out** doesn't let users switch Microsoft accounts, no quotas on sessions or forming jobs, the 60-second limit names no machine, organizer identity is undefined, the ≤8-student test oracle is unbounded in projects, repeatability across tool versions and tie-breaking are unstated. Low: 10 vague terms ("last change", Unicode normalization and case folding, rounding of halves and "changes it", "letter" in file names, userid syntax, Rename collisions, title trimming, separators, propagation of Close/Reopen/Delete, "group size" not being the actual size). Expected results table, teammate-part table and default group sizes verified correct by brute force. |
| + +#### Last specification review + +LLM: Claude Opus 5.5 (`claude-opus-5-5`), in Claude Code. + +Prompt: + +> Review a specification at @group-creation-tool/specification.md , add your +> findings into the @group-creation-tool/submission.md Specification Review +> Rounds under Aruzhan Akhanayeva. Leave the Main Changes Made part empty for +> now, just the findings and round number. Also, add the Last Specification +> Review part with your current review under Aruzhan Akhanayeva's name, just +> like Daniil Kaimekin did. + +Output (line numbers refer to [specification.md](specification.md) as it was +reviewed, before this round's changes): + +I'd rate it **8/10**. The spec hasn't changed since Daniil's round 2, so most of +those findings still stand. They're repeated below and marked (open since +round 2), so this review stands on its own. Eight findings are new; they're +marked **New**. I wrote an independent brute-force checker using exact +fractions. All 13 Expected results rows give exactly the stated groups and +score, and each has exactly one best assignment. All 5 teammate-part table rows +give the stated value. The default group sizes for 4–7, 50 and 500 students +match the text. Those results hold only if the not-preferred share is read as +negative (item 1). Fixing the sign error, the impossible CSV example, the *m* = +0 case, the email-claim identity rule and the stale organizer tab would make it +a 9. + +##### Logical inconsistencies + +1. **The not-preferred share has the wrong sign as written** (lines 241–247). + (Open since round 2.) "Worked out the same way" divides a negative + sum by a negative maximum, which gives a positive share. Taken literally, + table row 5 gives 4/3, not −2/3. In Expected results row 6, the best + assignment becomes `X: a, b; Y: c, d` with a score of 6. That puts together + exactly the two students who asked to be kept apart. Say "divided by the + absolute value of the largest sum". +2. **The CSV example can't happen** (lines 349–358). (Open since round + 2.) 4 students give G = 4, 2, 1 or 1 groups for *k* = 1…4, never 3. +3. **A group with no other members divides by zero** (lines 200–202 and + 239–248). (Open since round 2, with a new detail.) The organizer + doesn't even have to pick *k* = 1. A session may have 1 student (line 72). + √1 = 1, and the "at least 2" rule applies only from 2 students. So the + default gives *k* = 1 and *m* = 0, and the denominator is the sum of the + first 0 values, which is 0. Say that the teammate part is 0 when *m* = 0. +4. **A save refused because the session closed collides with the retry rule** + (lines 165–167 and 178–180). (Open since round 2.) The page would + retry every 10 seconds forever and keep the leave-page warning on. It would + also save after a Reopen, which the organizer didn't expect. +5. **A stale student tab can bring back preferences that should have been + dropped** (lines 96–102 and 171–174). (Open since round 2.) Suppose + a page was loaded before the organizer removed project `Foo` and added it + again. Its next save attaches the old `Foo` ranking to the new entry, which + was supposed to "start over". +6. **New. A stale organizer page can silently remove students** (lines 96–102 + and 403–406). List edits are decided by comparing the new text with the + stored list. Suppose the organizer adds students in one tab and then saves an + older copy of the list from another tab. Or suppose they edit while offline: + the page "keeps what the organizer has entered". Either way, the students + missing from that text count as removed. Their sign-in links and preferences + are dropped, and adding them back makes them start over. Students get a + last-save-wins rule (line 171); organizers get no rule at all. Either reject + an edit made against an outdated list, or show the organizer what will be + removed before saving. +7. **New. Edits on the session page have no limits or save rule** (lines 72–74 + and 96). Setup makes **Create** unavailable until the title and list limits + hold, but the session page has no **Create**. Nothing says whether an edit + that empties the student list, or brings it to 501 students, is refused. + Nothing says when an edit takes effect, either: on a **Save** button, on + leaving the field, or as the organizer types. The title also can't be edited + after creation by any stated means, yet a typo in it ends up in the CSV file + name. +8. **New. Reordering entries is undefined** (lines 70, 96–102, 109). List order + decides the order of Unspecified items (line 145), group numbering (lines + 318–320) and the CSV row order (line 341). An edit that only moves entries is + neither a case change nor a remove-and-add. Nothing says whether it's + allowed, whether it discards formed groups ("editing … discards", line 109), + or whether the lists still count as "the same lists" under Repeatable (line + 308). +9. **The privacy rule contradicts itself** (lines 184–191). (Open since + round 2.) "No … figure computed from them" also forbids the groups, + which the next paragraph admits are computed from teammate preferences. +10. **New. Moving items while the list is filtered is undefined** (lines + 150–156). Items "can be moved while the section is filtered", but "up or + down one place" could mean past the next visible item, or past the next item + in the full ranking, which may be hidden. Dropping an item between two + visible items doesn't say where it lands among the hidden items between + them. The readings give different rankings, and so different scores. + +##### Vague terms + +* "Last change" (line 33). (Open since round 2.) Does + a student's save move the date shown on the sessions list (line 51)? Does the + organizer just opening the session move it? +* **New. Unicode normalization and case folding** (lines 19–20 and 63). Lengths + are counted in code points, but no normalization form is named. `é` is 1 code + point in NFC and 2 in NFD, the form text pasted from macOS often arrives in. + So two names that look identical are not duplicates, and a 200-character name + can pass or fail depending on how it was typed. "Ignoring case" also doesn't + say whether it means simple or full case folding (`ß` versus `SS`). + Implementers should also be warned that HTML `maxlength` and JavaScript + `.length` count UTF-16 code units, where an emoji counts as 2. +* **New. Repeatable** (lines 308–310). "On any computer" doesn't say "on any + version of the tool". If the search is improved in a later release, forming an + old session again gives different groups. Nothing says which of several + equally good assignments is chosen, either. Ties are routine: a class where + nobody saved preferences, or *W*p = *W*t = 0, which the + options allow, makes every valid assignment best. Say whether tests may check + the groups in such cases or only the score. +* **Number fields** (lines 200–204 and 281–284). (Open since round 2.) + How do halves round? Does typing the default value count as "changing" the + group size? +* "A letter" in the file name (line 334). (Open since round + 2.) Is it ASCII only, or Unicode letters, so that `Проект` stays + `Проект`? +* **Userid syntax** (lines 66–67). (Open since round 2.) `a@b.` and + `a@.edu` both pass. +* **Rename collisions** (lines 104–108). (Open since round 2.) What + happens when an entry is renamed to one already on the list? How do the text + field and the per-entry **Rename** action coexist? After a case-only edit, + does the CSV use the old or the new casing? +* **Title trimming** (line 57). (Open since round 2.) A title made only + of spaces looks valid. +* **Separators** (line 58). (Open since round 2.) Semicolons and tabs + aren't separators, so a list pasted from Outlook is dropped entry by entry. +* **Propagation** (lines 293–297 and 409–410). (Open since round 2.) + How soon does an open student page notice a Close, a Reopen, a deletion, or + that the student was removed? What happens when the organizer edits the lists + or options while groups are being formed? +* "Group size" isn't the size of a group (lines 198–208). + (Open since round 2.) With 13 students and *k* = 7, there is one + group of 13. The help text should call *k* the minimum size. + +##### Architectural mismatch + +* **Matching on the email claim lets one person pass as another** (lines + 122–128). (Open since round 2.) The `email` claim is set by the + user's own organization and may be unverified. Since the first matching + account keeps the userid for good, an impostor also locks the real student + out. There's a further tension. Line 18 defines the userid as the sign-in + name, but organizers will usually paste email addresses from Teams. At many + universities these differ: the sign-in name is `s1234567@uni.edu` and the + email is `jane.doe@uni.edu`. Dropping email matching to fix the impostor + problem would break such lists. Accepting email only when its domain is + verified (`xms_edov`), or only from allowed tenants, keeps both working. +* **New. Sign out doesn't let users switch accounts** (lines 129–131). With + Microsoft single sign-on, signing out of the tool alone leaves the Microsoft + session in place. The next sign-in silently returns the same account. To + switch, the tool must either ask Microsoft for its account picker + (`prompt=select_account`) or sign the user out of Microsoft entirely, which + also signs them out of Teams and Outlook in that browser. The spec should say + which. +* **New. No quotas** (lines 33, 39–40 and 407–408). Anyone with any work or + school account, in any organization, can create sessions. Each can hold 500 + students and 100 projects, run a 60-second forming job, and be stored for 365 + days. There's no limit on sessions per organizer, forming jobs running at + once, or tenants allowed, so one user can exhaust the server's CPU and + storage. Set per-organizer limits, or restrict which tenants can sign in. + Restricting tenants would also help with the email claim above. +* **Which machine the 60-second limit applies to** (lines 407–408). (Open + since round 2.) Phones are supported browsers. If forming runs on the + server, the spec must cover a page reload during forming and what **Cancel** + does. +* **The organizer's identity is undefined** (lines 38–40). (Open since round + 2.) Students are bound to a stable account; the organizer isn't. +* **The ≤8-student test oracle is unbounded in projects** (lines 438–439). + (Open since round 2.) 8 students, *k* = 1 and 100 projects give about + 7.5 × 10¹⁵ project assignments to check. Bound *P*. + +##### What's strong + +The scoring model is fully stated and normalized. With the sign fixed, it +reproduces every Expected results row exactly, and each row has a unique best +assignment, so the table works as a real test oracle. The sizing rules are +exact, and their examples (50 and 500 students, 7 students) check out. Rename +versus remove-and-add is cleanly separated. The CSV format is precise down to +line endings and quoting. The privacy section honestly admits what can't be +hidden, and the out-of-scope list is concrete. + +#### Implementation review rounds + +Implementation rounds are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +#### Last implementation review + +Implementation rounds are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. ### Ademi Bakhytova -(Same sections as Team member 1) +Github user id: + +Git user id: + +#### Contributions + -### (Team member 4 name) -(Same sections as Team member 1) +#### Build and run test + +Build and run tests are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +#### Specification review rounds + +#### Implementation review rounds + +Implementation rounds are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +#### Last implementation review + +Implementation rounds are not included, as current project stage only required the +specification (as of Nov. 28, 2026). Also, current repository (CodeChat Editor) +is not directly related to the project, and only used for pull request tracking. + +| Round | Findings | Main Changes Made | +| --- | --- | --- | + + +#### Last specification review + +### Alisher Akim + +Couldn't contact them, unfortunately.