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 new file mode 100644 index 00000000..39cd01fa --- /dev/null +++ b/group-creation-tool/specification.md @@ -0,0 +1,517 @@ +Project group creation tool +=========================== + +This document specifies what the tool does, as seen by its users. How it is +built is described in [architecture.md](architecture.md). + +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. + +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 +-------- + +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 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 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. + +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, whether groups are formed, and the date it +will be deleted. 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 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 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. + +### 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* + (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 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 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. + +Student page +------------ + +### Signing in + +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 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 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 + +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 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 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. + +On narrow screens (under 800 px wide) the categories stack, Preferred first. + +### Saving + +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 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 +preferences saved from another tab within a minute, unless it has unsaved +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; 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 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 +-------------- + +### Group sizes + +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 + 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. +* 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 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 +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 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 +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. + +**Project part.** A student's project part is the value of their group's +project. + +**Teammate part.** For a student whose group has *m* 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 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. 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: + +> *W*p × project part + *W*t × teammate part + +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. 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`: + +| `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 | +| --- | --- | --- | --- | +| 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 | + +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. 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. + +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. +* **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: 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. 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 +------- + +### Results view + +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 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 + 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. + +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, six students in three groups of 2, the first two groups working on +a project called `Parser, part 2`: + +``` +student_id,group,project +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 +---------------- + +These rows are the reference behavior for forming groups. Each was checked by +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 +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 | +| --- | --- | --- | --- | +| 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 | +| 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 | 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 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 + 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. 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 +----------- + +* **Security.** All traffic uses HTTPS. Only the organizer can open a + 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 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 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, 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 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 + 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 +------------ + +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; 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 new file mode 100644 index 00000000..fb82f359 --- /dev/null +++ b/group-creation-tool/submission.md @@ -0,0 +1,826 @@ +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 +---------------- + +### Daniil Kaimekin + +GitHub userid: dkaimekinmasters + +Git userid: dkaimekin + +#### 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 + +| 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: 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) + +* "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 + +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. + +### Ademi Bakhytova + +Github user id: + +Git user id: + +#### Contributions + + + +#### 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 +---------------- + +### Daniil Kaimekin + +GitHub userid: dkaimekinmasters + +Git userid: dkaimekin + +#### 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 + +| 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: 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) + +* "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 + +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. + +### Aruzhan Akhanayeva + +### Aruzhan Akhanayeva + +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 + +Github user id: + +Git user id: + +#### Contributions + + + +#### 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.