> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase17-session02-server-notice-manager-persistence-and-context/tasks.md).

# Task Checklist

**Session ID**: `phase17-session02-server-notice-manager-persistence-and-context` **Total Tasks**: 24 **Estimated Duration**: 3-4 hours **Created**: 2026-06-05

***

## Legend

* `[x]` = Completed
* `[ ]` = Pending
* `[P]` = Parallelizable (can run with other \[P] tasks)
* `[SNNMM]` = Session reference (NN=phase number, MM=session number)
* `TNNN` = Task ID

***

## Progress Summary

| Category       | Total  | Done   | Remaining |
| -------------- | ------ | ------ | --------- |
| Setup          | 3      | 3      | 0         |
| Foundation     | 7      | 7      | 0         |
| Implementation | 11     | 11     | 0         |
| Testing        | 3      | 3      | 0         |
| **Total**      | **24** | **24** | **0**     |

***

## Setup (3 tasks)

Initial configuration and evidence review.

* [x] T001 \[S1702] Verify Session 01 protocol contracts, Session 02 stub, current manager callers, and quarantined manager evidence (`.spec_system/PRD/phase_17/session_02_server_notice_manager_persistence_and_context.md`)
* [x] T002 \[S1702] Verify server package scripts, Vitest entry points, and temporary `FACTIONOS_HOME` test setup (`apps/server/package.json`)
* [x] T003 \[S1702] \[P] Create focused Notice Board manager test scaffold with temp directory cleanup and timer cleanup hooks (`apps/server/tests/noticeBoard.test.ts`)

***

## Foundation (7 tasks)

Core manager structures and local persistence foundations.

* [x] T004 \[S1702] Define Notice Board manager options, store schema, default local room id, storage path resolution, and clock hooks (`apps/server/src/managers/noticeBoard.ts`)
* [x] T005 \[S1702] Implement startup load and malformed store fallback with schema-validated input and explicit error mapping (`apps/server/src/managers/noticeBoard.ts`)
* [x] T006 \[S1702] Implement debounced local save with atomic temp-file write, directory creation, and failure-path handling (`apps/server/src/managers/noticeBoard.ts`)
* [x] T007 \[S1702] Implement destroy and flush lifecycle cleanup for debounce and prune timers with cleanup on scope exit for all acquired resources (`apps/server/src/managers/noticeBoard.ts`)
* [x] T008 \[S1702] Add notice cloning, canonical alias normalization, and compatibility shape preservation with types matching declared contract (`apps/server/src/managers/noticeBoard.ts`)
* [x] T009 \[S1702] Add room resolution and room-scoped internal filtering helpers with authorization enforced at the manager boundary closest to the resource (`apps/server/src/managers/noticeBoard.ts`)
* [x] T010 \[S1702] Add bounded query defaults for list and context operations with bounded pagination, validated filters, and deterministic ordering (`apps/server/src/managers/noticeBoard.ts`)

***

## Implementation (11 tasks)

Main persistent manager behavior.

* [x] T011 \[S1702] Replace compatibility `post` with canonical post storage, alias preservation, save scheduling, cap enforcement, and context cache invalidation (`apps/server/src/managers/noticeBoard.ts`)
* [x] T012 \[S1702] Implement `getMessages` and compatibility `list` for room, type, `since`, target session, expiration, include-resolved, offset, and limit filters with bounded pagination, validated filters, and deterministic ordering (`apps/server/src/managers/noticeBoard.ts`)
* [x] T013 \[S1702] Implement `resolveForRoom` and compatibility `resolve` with room boundary checks, resolution timestamps, save scheduling, and cache invalidation (`apps/server/src/managers/noticeBoard.ts`)
* [x] T014 \[S1702] Implement `ingest` dedupe by notice id with alias normalization, cap enforcement, save scheduling, and cache invalidation (`apps/server/src/managers/noticeBoard.ts`)
* [x] T015 \[S1702] Implement `ingestBatch` duplicate filtering with transaction-like batch boundaries and a single save/cache invalidation on mutation (`apps/server/src/managers/noticeBoard.ts`)
* [x] T016 \[S1702] Implement `getContextForSession` with recovered heading, same-author exclusion, target filtering, expiration filtering, last-fetch tracking, and five-second cache behavior (`apps/server/src/managers/noticeBoard.ts`)
* [x] T017 \[S1702] Implement context cache invalidation on post, ingest, batch ingest, resolve, prune, and load changes (`apps/server/src/managers/noticeBoard.ts`)
* [x] T018 \[S1702] Implement `autoPost` with same-room, same-author-session, same-type 30-second dedupe and duplicate-trigger prevention while in-flight (`apps/server/src/managers/noticeBoard.ts`)
* [x] T019 \[S1702] Implement pruning for expired notices, stale non-critical notices, resolved stale notices, critical retention, and the 500-message cap with cleanup on scope exit for all acquired resources (`apps/server/src/managers/noticeBoard.ts`)
* [x] T020 \[S1702] Wire Notice Board destroy/flush into server shutdown while preserving existing mock, WebSocket, and HTTP cleanup order (`apps/server/src/server.ts`)
* [x] T021 \[S1702] Preserve current `/notice`, `/notices`, mock event, and WebSocket hydration compatibility after manager signature changes (`apps/server/src/managers/noticeBoard.ts`)

***

## Testing (3 tasks)

Verification and quality assurance.

* [x] T022 \[S1702] Add manager tests for persistence, malformed load, debounce flush, atomic save, restart survival, and shutdown cleanup (`apps/server/tests/noticeBoard.test.ts`)
* [x] T023 \[S1702] Add manager tests for cap, pruning, filters, target visibility, resolution, context cache, context last-fetch, ingest, batch ingest, and auto-post dedupe (`apps/server/tests/noticeBoard.test.ts`)
* [x] T024 \[S1702] Run focused Notice Board tests, server typecheck, compatibility route/WebSocket tests, ASCII/LF validation, and record implementation notes (`.spec_system/specs/phase17-session02-server-notice-manager-persistence-and-context/implementation-notes.md`)

***

## Completion Checklist

Before marking session complete:

* [x] All tasks marked `[x]`
* [x] All tests passing
* [x] All files ASCII-encoded
* [x] implementation-notes.md updated
* [x] Ready for the validate workflow step

***

## Next Steps

Run the validate workflow step to verify session completeness.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase17-session02-server-notice-manager-persistence-and-context/tasks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
