Skip to content

docs(core): mark the three archived STATE literals as deliberate - #2887

Closed
gsxdsm wants to merge 1 commit into
mainfrom
docs/archived-state-literals
Closed

docs(core): mark the three archived STATE literals as deliberate#2887
gsxdsm wants to merge 1 commit into
mainfrom
docs/archived-state-literals

Conversation

@gsxdsm

@gsxdsm gsxdsm commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Comments only, no behaviour change. Records a conclusion I re-derived three times across as many turns, each pass starting from scratch — which is the actual cost this fixes.

The three sites

site purpose
workflow-definitions.tsmigrateActiveArchivedTasksToArchiveDbImpl migrates live archived rows into the archive DB
workflow-definitions.ts — agent-log pruning deletes logs for inactive tasks
async-maintenance.ts — orphan sweep collects deleted-or-archived rows

All three search the live table for rows Fusion's own archive path stamped — archive-lifecycle-2.ts and serialization.ts both hardcode column: "archived".

Why the literal is correct here

A workflow may also declare an archived-trait lane under any id. Both halves of that are verified, not assumed: resolveLifecycleColumns(ir).archived resolves to the custom id, and moveTask into such a lane succeeds (probes on #2839).

But a card sitting there was never archived by Fusion. It has no archive-store row and it is live work. Resolving the set at these three sites would migrate it out of the board, sweep it as an orphan, or delete its agent logs — so the "conversion" would be data loss, not a fix.

Why this kept looking unanswerable

The other eight 'archived' literals are live-VIEW exclusions where the resolved set is probably right. Treated as one decision, every answer was wrong for half the sites. Split by intent, three are settled and eight have a clear, narrower question — see #2839.

I have deliberately not touched the eight: reads.ts:522 sits behind an includeArchived flag and liveParentFilter gates lineage checks on destructive archive operations, so widening those changes what counts as live for deletion-adjacent logic. That failure mode is data loss rather than a wrong number, and it wants an owner's eye.

Verification

tsc -p packages/core 0 · lint 0. (The SQL gate is red on main pending #2878, unrelated to this change and unaffected by it — comments are not AST nodes.)

🤖 Generated with Claude Code

Three of the eleven `'archived'` SQL literals from #2839 are correct as literals and must NOT be
widened to the resolved archived columns. Recording that at the sites, because I re-investigated this
question three times across as many turns and each pass started from scratch.

  workflow-definitions.ts  migrateActiveArchivedTasksToArchiveDbImpl  (archive-DB migration)
  workflow-definitions.ts  agent-log pruning                          (inactive-task log cleanup)
  async-maintenance.ts     orphan sweep                               (deleted-or-archived rows)

All three search the LIVE table for rows Fusion's own archive path stamped — archive-lifecycle-2.ts
and serialization.ts both hardcode `column: "archived"`. A workflow may ALSO declare an
archived-trait lane under any id (`resolveLifecycleColumns` resolves it, and a card can be moved
there, both verified), but such a card was never archived by Fusion: it has no archive-store row, it
is live work, and resolving the set here would migrate it out of the board, sweep it as an orphan, or
delete its agent logs.

That is the opposite conclusion from the eight live-VIEW exclusions sharing the same literal, where
the resolved set is probably right — which is exactly why the question kept reading as unanswerable
while treated as one decision. Comments only; no behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@gsxdsm, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5e8f87fd-e5b1-41aa-a3d9-3ef91a0d7733

📥 Commits

Reviewing files that changed from the base of the PR and between b85e5f9 and b0d4a94.

📒 Files selected for processing (2)
  • packages/core/src/task-store/async-maintenance.ts
  • packages/core/src/task-store/workflow-definitions.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds FNXC comments documenting why three archive-maintenance queries intentionally use the literal archived state marker rather than workflow-resolved archived-trait lane IDs.

Confidence Score: 5/5

The PR appears safe to merge because it changes comments only, and the documented archive-state distinction agrees with the relevant lifecycle behavior.

The added comments accurately explain that Fusion’s archive paths stamp the literal archived, while workflow-resolved archived-trait columns may represent live cards and must not be included in destructive maintenance queries.

Important Files Changed

Filename Overview
packages/core/src/task-store/async-maintenance.ts Documents why the asynchronous orphan/log-file sweep must select Fusion-archived rows by the literal state marker.
packages/core/src/task-store/workflow-definitions.ts Documents the same invariant for archived-row migration and synchronous agent-log pruning.

Reviews (1): Last reviewed commit: "docs(core): mark the three archived STAT..." | Re-trigger Greptile

@gsxdsm

gsxdsm commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #2942 (batch-docs), per the consolidation directive: the u9/e2e docs family is folded into one branch and one CI run.

Your commits were cherry-picked in original order with authorship preserved and applied clean — nothing was rewritten or dropped. The batch is five commits across five files, comment and markdown only, verified with scoped checks (lint, the SQL ratchet, the census, and the sync-resolver allow-list) rather than a full suite.

Closing here so the queue drops; the content ships in #2942.

@gsxdsm gsxdsm closed this Jul 31, 2026
gsxdsm added a commit that referenced this pull request Jul 31, 2026
…one (#2942)

## Family batch — replaces #2926, #2892, #2887

Per the consolidation directive: the u9/e2e **docs family**, folded into
one branch and one CI run. Three PRs, five commits, **five files,
comment and markdown only**.

| folded PR | commits |
|---|---|
| #2892 `docs/union-vs-per-task` | the project union and the per-task
answer are not ranked; date correction |
| #2926 `docs/date-my-measured-claims` | date the measured claims (one
was wrong); date the grep-vs-AST measurement in the SQL gate header |
| #2887 `docs/archived-state-literals` | mark the three archived STATE
literals as deliberate |

Cherry-picked in original order with authorship preserved; all five
applied clean, no conflicts.

## Scope is provably comment-only

```
docs/solutions/workflow-learnings/lifecycle-conversions-that-score-as-wins.md
docs/solutions/workflow-learnings/project-union-versus-per-task-lanes.md
packages/core/src/task-store/async-maintenance.ts        ← FNXC DELIBERATE-LITERAL annotation
packages/core/src/task-store/workflow-definitions.ts     ← FNXC DELIBERATE-LITERAL annotation
scripts/check-sql-column-literals.mjs                    ← header prose only
```

Every added line in `packages/` and `scripts/` is inside a comment —
checked by filtering the diff for declarations, conditionals and
returns, which returns nothing. The two core files gain
`DELIBERATE-LITERAL` markers explaining that `'archived'` is a **state**
marker there, not a lane: the sweep collects rows Fusion itself archived
or soft-deleted, so widening to the resolved archived set would pull
live cards into a cleanup pass.

## Verification (scoped, per the directive — not the full suite)

- `pnpm lint` — clean
- `check-sql-column-literals` — exit 0 (the file it annotates)
- `check:lifecycle-columns` — exit 0 (the markers it adds are
census-visible)
- `sync-workflow-ir-callsite-allowlist.test.ts` — 3/3

## A correction worth recording

Mid-fold I saw a changeset, `self-healing.ts` and a test file in `git
diff origin/main..HEAD` and nearly reported the batch as impure. They
were **main's own commits** — `origin/main` advanced between branch
creation and the diff, so the comparison was against a stale base.
Rebasing onto current `main` reduced it to the five files above. Worth
flagging for anyone else folding a family today: with `main` moving this
fast, diff the branch **after** rebasing or the file list will lie to
you.

## Closing the originals

#2926, #2892 and #2887 are superseded by this and are being closed. I
hold no PRs of my own in this family — all mine merged — so this fold is
on behalf of the family rather than a rollup of my own work.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant