# Features — dms_archive (WCA Archive)

Evidence date: 2026-10-17.

Source: `git@bitbucket.org:overdrive/dms_archive.git`, `main` at `2bcf278` (2026-10-16).

Status labels:

- **Current** — code and routes exist on `main`.
- **Completed** — a dated implementation note or migration exists and the code is still present.
- **In development** — a plan or partial commit exists and the feature is still moving. Nothing on `main` was marked in-progress by a branch; `main` is the only branch inspected.
- **Planned** — described as future work and not found as a finished controller.
- **Changed** — recent commits alter behaviour.
- **Deprecated / removed** — present earlier and absent now, or left as routes without classes.
- **Not in this tree** — named by routes or old docs, class file missing.

## Current features

### Authentication and session

| Feature | Status | Evidence |
|---|---|---|
| Login form at `/` | Current | `Welcome::index`, route `GetLogin` |
| Email 2FA, toggled by setting `2FA` | Current | `Welcome.php`, seed `TwoFactorAuthSetting` |
| Forgot / reset password | Current | `forgot-password`, `resetPassword` |
| Login history | Current | `LoginHistory` controller, migration `AddLoginHistoryTable` |
| IP block list | Current | `BlockedUsersModel`, migration `AddBlockedUsersListTable` |
| Session timing on the user profile | Current | `users/getSessionInfo`, `docs/README.md` |

### Users, roles, menus

| Feature | Status | Evidence |
|---|---|---|
| User CRUD | Current | `Users` routes `createUser`, `updateUser`, `deleteUser` |
| Role CRUD and menu matrix | Current | `users/createRole`, `changeMenuPermission`, `changeSubMenuPermission` |
| Assignable-role matrix | Current | `UserModel::getAssignableRoleIDs`, `scope/Task_role_dropdown_rules.md` |
| Menu management | Current | `Developers\MenuManagement` |
| CRUD generator | Current | `Developers\CRUDGenerator` |
| System users screen (company active flags) | Current routes; company tables exist; company controller does not | `SystemUsers.php`, migrations `CreateCompaniesTable`, `CreateCompanyUsersTable`. `Company` controller **Not in this tree** |

### Documents

| Feature | Status | Evidence |
|---|---|---|
| Upload PDF / JPG / PNG, 100 MB application cap | Current | `Documents::upload` |
| OCR via Poppler and Tesseract | Current | `OcrLibrary`, `docs/README.md` |
| Types Legislation, Labels, Minutes | Current | `DocumentTypes` seeder |
| Per-user type tabs with year | Current | `UserDocumentTypeTabModel`, migrations 2026-05-25 to 2026-05-28 |
| Organisation folders | Current | `documents/folders/*`, `DocumentCategoryModel` |
| Personal vault folders, shares, RLS | Current | `documents/vault/*`, `VaultFolderShareModel`, `DocumentModel` vault tests |
| Unified search and RAG index | Current | `documents/search`, `document_helper.php`, `MySQLVectorStore` |
| Vault excluded from RAG | Current | `shouldIndexDocumentInRAG` |
| View, display, edit, delete, download | Current | `documents/view`, `display`, `edit`, `delete`, `download` |
| Share a document to a Viewer with a time limit | Current | `documents/shareToViewer`, `users/assignDocument` |
| Audit log of document operations | Current | `AuditLogModel`, `admin/documents/auditLogs` |
| Admin category maintenance | Current | `Admin\Documents` |
| Folder mutation rate limit (30 / 60s) | Current | comment and throttler use in `Documents.php` |

### AI

| Feature | Status | Evidence |
|---|---|---|
| Document chat with history and streaming | Current | `Chat::send`, `Chat::stream` |
| Conversation memory embeddings | Current | `chat_memory_helper.php`, `ChatMemoryModel` |
| Document context summaries | Current | `document_context_helper.php` |
| Standalone ChatGPT page | Current | `ChatGPT` controller |
| RAG status and reindex | Current | `RagStatus` |
| Bulk-email HTML builder AI | Current | `BulkEmail::aiTemplateMessage`, `BulkEmailAiTemplateAssistant`, `docs/superpowers/specs/2026-04-24-c1-html-builder-ai-design.md` |

### Bulk email

| Feature | Status | Evidence |
|---|---|---|
| Recipients, CSV import, groups | Current | `BulkEmail` routes, `docs/bulk_email_spec.md` |
| GrapeJS template builder | Current | `bulk_email/template_builder` |
| Campaigns with audience and attachments | Current | `saveCampaign`, `attachCampaignDocument`, `uploadCampaignAttachment` |
| Per-recipient queue and batch sender | Current | `BulkEmailCampaignQueueService`, `send:bulk-email-campaigns` |
| Queue UI and progress | Current | `getQueue`, `getCampaignQueueProgress`, commit `678f946` |
| Resend / sending control for failed campaigns | Current | `setCampaignSending`, commit `8bbede0` |
| Open, click, unsubscribe tracking | Current | `EmailTracking` |
| Custom tracking tokens | Current | `customTrackingCreate`, migration `CreateCustomEmailTrackingTables` |
| Log preview from template + substitutions, not a stored full copy | Current | commit `ec1b940` |

### Mailbox

| Feature | Status | Evidence |
|---|---|---|
| Ticket list, reply, compose, close | Current | `Mailbox` controller |
| IMAP poll | Current | `php spark mailbox:poll` |
| HTML sanitising and threading | Current | `MailboxHtmlSanitizer`, `MailboxThreadingService`, unit tests |
| Attachment download | Current | `mailbox/attachment/{id}` |

### Operations

| Feature | Status | Evidence |
|---|---|---|
| System settings (cron, holidays, email logs, ChatGPT settings, writable logs) | Current | `SystemSettings` |
| Sent-queue processor via `cronJobs` | Current | `CronJobs`, `docs/EMAIL_QUEUE_AND_CRON_SETUP.md` |
| Server monitoring page and CLI | Current | `ServerMonitoring`, `monitor:system` |
| FTP deploy + webhook + finish email | Current | `bitbucket-pipelines.yml`, `DeployWebhook`, `deploy:notify-log` |
| HTML scope / user guide | Current | `Scope` controller, `scope/html/` |
| PHPUnit suite | Current | `tests/unit`, `tests/feature`, `tests/database` |
| SonarQube on `main` | Current, with broad exclusions | `sonar-project.properties` |

## Completed features

Treated as completed because migrations and controllers remain, not because a release checklist was signed.

- 2025-01 viewer profile and `user_documents` (`docs/README.md`).
- 2025-11-07 DMS upload, OCR, tabs, audit, RAG (`docs/README.md`).
- 2025-11 vector embeddings, chat memories, document contexts.
- 2026-04 bulk email core tables.
- 2026-05 mailbox tickets and custom tracking.
- 2026-07 personal vault (folder CRUD, shares, RLS). Commit series `727c0e5` through `180f4c1`.
- 2026-09-16 campaign queue table.

## In development

No long-lived feature branch was inspected. The newest commits on `main` (2026-10-15 and 2026-10-16) are still adjusting the campaign worker: batch size moved to 30 and back to 50 on the same day, queue UI, failed-campaign sending button, and attachment memory. Treat the queue worker as **Current** but recently unstable in configuration.

## Planned

| Item | Evidence | Note |
|---|---|---|
| HTML builder AI design | `docs/superpowers/plans/2026-04-24-c1-html-builder-ai.md` and the matching spec | An assistant endpoint exists (`aiTemplateMessage`) and has a unit test. Whether every item in the plan is done was not checked line by line. **Requires Confirmation** if the plan is still open. |
| Jira board linked from `docs/README.md` | `https://siliconsoftware.atlassian.net/jira/software/projects/SI/boards/12` | Not readable from this repository. Open tickets are **Unknown**. |
| Confluence space | `https://siliconsoftware.atlassian.net/wiki/spaces/AO/overview` | The space key AO matches Admin Overdrive, the sibling product. Whether it still describes this archive is **Unknown**. |

`docs/overview.md` "Recommendations" (API docs, caching, backups) are generic advice, not a backlog.

## Changed recently

From `main` history ending at `2bcf278`:

| Change | Commit | Product effect |
|---|---|---|
| Campaign worker batch size set to 50 | `2bcf278` after `82f4726` had set 30 | `Config\BulkEmail::$batchSize = 50`. ETA copy uses a 5-minute cron interval. |
| Clear campaign attachment after each send | `207ecde` | Avoids holding every attachment in memory for the whole batch. |
| Queue UI | `678f946` | Operators can see the queue. |
| Sending button for failed campaigns | `8bbede0` | Failed campaigns can be put back into sending. |
| Do not send a new campaign by mistake; ETA calc | `c4cf1fb` | Queueing rules tightened. Exact rule is in `BulkEmailCampaignQueueService`. |
| Batch sender introduced | `55ac428` | Campaigns are no longer one synchronous send of the whole audience. |
| Email logs no longer store the full body and attachments | `ec1b940` | Preview is reconstructed. |
| Recipient import changes | `ed1b000` | CSV import behaviour changed. Diff not re-read. |
| Campaign attachments | `3453ac8` | Documents from the archive or an upload can be attached. |
| Shared access restrictions | `4c64efb` | Vault/share read-only behaviour. |
| Vault write ownership | `180f4c1` | Upload and move into a vault folder require ownership. |
| Upload limitation changes | `08cbc4b` | Precedes the 100 MB check now in `Documents.php`. |
| Folder permission changes | `4bca284` | Folder management limited by role and Categories menu. |

## Deprecated / removed / not in this tree

| Item | Evidence |
|---|---|
| `app_old`, `docs_old`, `public_old`, `htaccess_old` | Listed in the 2026-09-28 onboarding snapshot. Absent at `2bcf278`. |
| Footer buttons removed | Commit message recorded in the onboarding issue (`45627d3`, 2026-04-02). That commit is older than the 30-commit window inspected here. The buttons themselves were not identified. |
| Products, orders, invoices, label status, label groups, label email templates, fault finder, get XML, company vendor numbers, store API, organisations resource | Routes in `Routes.php`. Controller files are **not** in `app/Controllers`. `Reports.php` exists; the uninvoiced-orders route is commented out. |
| `docs/overview.md` dependency list | Says PHP `^8.0` and does not mention Neuron, PDF parser, or HTMLPurifier. Superseded by `composer.json`. |

## Feature map to requirements

| Feature | PRD |
|---|---|
| Login and 2FA | FR-001 |
| Password reset | FR-002 |
| Dashboard | FR-003 |
| Document upload and library | FR-004 |
| Types and year tabs | FR-005 |
| Folders and vault | FR-006 |
| Viewer share and time window | FR-007 |
| Search / RAG | FR-008 |
| Chat | FR-009 |
| Bulk email | FR-010 |
| Sent queue | FR-011 |
| Mailbox | FR-012 |
| Users | FR-013 |
| Settings | FR-014 |
| Monitoring | FR-015 |
| Deploy | FR-016 |
| Scope site | FR-017 |
