Repository navigation
feat(platform): keep archived work searchable and label it as archived - #3007
Merged
Merged
Conversation
An archived project's tasks and the project itself were filtered out of rag_search. They are returned now, with two data fields that say what is archived, so chat can cite a retired project and say it is retired. Two fields, because they are two different facts. `archived` means the result itself is archived. `projectArchived` means the project it belongs to is archived. A live task in a retired project may still be work nobody closed; an archived task is not. Both can be true at once, and each is omitted when false. A document has no archive state of its own, so `projectArchived` is the only field it can carry. That is the case this started from: a document filed under a retired project stays retrievable and citable, with the context attached. Nothing decides what the assistant says. The fields sit beside `status` and `priority` as data it may use. No sentence is appended and no rule is added to the persona, which `lib/chat/assistant.test.ts` forbids anyway. `resolveKnowledgeAccess` returns `archivedProjectIds` from the walk it already runs over every org project, so labelling costs no extra reads. It is always a subset of `projectIds`: a project the caller cannot read is named in neither, so the field cannot leak the existence of one. `KnowledgeSource` carries `projectId`, selected from the corpus row's existing scope stamp. Web pages select NULL for it. The `corpus.test.ts` assertion that no scope clause is emitted for an org-wide caller now checks for the predicate `d.project_id = ANY` rather than the bare column, since the column is selected either way and is not a clause. Closes the retrieval half of #2999.
This was referenced Sep 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An archived project's tasks, and the project itself, were filtered out of
rag_search. They are returned now, labelled as archived, so chat can cite a retired project and say it is retired.Why
Archiving a project made its work invisible to chat. A retired project is often the only record of a decision, so hiding it makes chat worse at the questions history answers.
The exclusion was mine, in #3002 (
convex/tasks/search_for_chat.ts:65,96). It followed the plan, which assumed archive should hide.What changed
Two fields on a search result, because they are two different facts:
archived— the result itself is archivedprojectArchived— the project it belongs to is archivedA live task in a retired project may still be work nobody closed. An archived task is not. Both fields can be true at once, and each is omitted when false, so a live result in a live project carries neither.
A document has no archive state of its own.
projectArchivedis the only field it can carry, which is accurate rather than a gap.Nothing decides what the assistant says. The fields sit beside
statusandpriorityas data it may use. No sentence is appended, and no rule is added to the persona —lib/chat/assistant.test.tsforbids that class of rule there.Two supporting changes:
resolveKnowledgeAccessreturnsarchivedProjectIds, collected in the walk it already runs over every org project. Labelling costs no extra reads.KnowledgeSourcecarriesprojectId, selected from the corpus row's existing scope stamp. Web pages selectNULL.Risk
archivedProjectIdsis always a subset ofprojectIds. A project the caller cannot read appears in neither, so the field cannot leak that such a project exists. There is a test for it.Retrieval scope is otherwise unchanged. The field is used for labelling only, never to narrow what a search returns.
Tests
Three layers, because the first draft tested only the top one:
searchTasksForChatandsearchProjectsForChatreturn archived rows through convex-testresolveKnowledgeAccessForUsercollects archived ids and keeps them a subsetMutations that turn tests red: collapsing the two fields into one, re-excluding archived tasks, re-excluding archived projects, dropping the archived-id collection, and labelling documents unconditionally.
Two mutations survived the first round — re-excluding archived tasks, and dropping the id collection. Both survived because the chat tests mock the query and the resolver. That is what the two lower layers now cover.
One existing assertion changed rather than being weakened.
corpus.test.tsasserted the SQL contains nod.project_idfor an org-wide caller, meaning no scope clause. The column is now selected either way, so the assertion checks for the predicated.project_id = ANY.Scope
Closes the retrieval half of #2999. The issue also asked whether archive should exclude; that is now answered as no, with labelling instead.
Not included: any UI change. The Documents list and the projects list still hide archived rows by their own rules, which is unaffected.
Gate: typecheck,
oxlint --type-aware, oxfmt, SAST 0 findings,migrations:check(no migration), platform 75,158 tests.