This repository was archived by the owner on Sep 2, 2026. It is now read-only.
Repository navigation
[Spec #22] Stage derivation engine - #57
Merged
Merged
Conversation
… neutral fact-source interface (#33)
…-skip, and serialization criteria (#33)
…ral stage facts (#38) Implements the WorkflowStageFactSource boundary for GitHub over client-side cached PRInfo/IssueInfo: draft maps to open, fact ids are raw PR numbers so persisted consumed-merge markers round-trip into the engine's consumedMergeIds, and a snapshot loader keeps the async interface intact for future remote/RPC loaders.
…cts in staged-exclusivity read path (#38) deriveEffectiveWorkflowStage folds branch-scoped prCache entries and linkedIssue state into the engine per row; local/ssh/runtime host scopes all hit their own cache keys, merged-PR entries stale for the current head carry no signal, and folder rows run the manual regime. The classic drawer projector consumes effective stages so fact-staged workspaces leave the drawer without any declared write.
…s meta plumbing (#38) consumedMergedPRNumbers rides the existing updateMeta paths: WorktreeMeta, FolderWorkspace, folder scope branch, IPC boundary guard, store sanitization, read-time degradation in mergeWorktree, runtime worktree.set and folderWorkspace.update schemas. Nothing writes it yet; derivation only reads it into consumedMergeIds.
…ype-aware lint (#38)
…the fact-source seam (#38) deriveEffectiveWorkflowStage no longer folds GitHub snapshots inline; createGitHubStageFactSource gains a synchronous factsForSubject face sharing the same snapshot loader as the async loadTaskTreeFacts, and the renderer projector reads facts through a source instance (injectable for alternate providers). Engine untouched.
…ing (#38) Review finding on #38: deriving effective stages into the classic-drawer filter made rows vanish from both boards before the feature board exists, and the two-board model is out of scope for spec 22. isStagedWorkspace and computeClassicDrawerWorktreeIds read only the declared stage again; the hook stops subscribing prCache/issueCache for this purpose. deriveEffectiveWorkflowStage stays exported with its pure logic intact for the upcoming board/sidebar specs, now fed through the GitHub fact source.
64ix
marked this pull request as ready for review
August 23, 2026 10:10
This was referenced Aug 24, 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Implements the stage derivation engine (Spec #22): one pure function turns GitHub facts across a task tree (root + children, most-recent activity wins) into the effective workflow stage — any open PR →
review, unconsumed merged PR →shipped, closed unmerged PR →triage, an open spec issue →speconly from idea/exploring/unstaged, otherwise the declared stage applies. The engine never derivesimplementing; folder workspaces run a manual regime; a merge ships a card exactly once (consumed-merge guard keeps a human de-ship stable). Facts reach the engine through a neutral fact-source interface whose GitHub implementation reads client-side caches, so local, SSH, and runtime-host workspaces all derive identically. Derived stages are computed at read time and never persisted.Spec & Tickets
Closes #22
Acceptance Criteria
deriveWorkflowStage; precedence describe-block covers every ranking pairreviewimplementingSPEC_ISSUE_ALLOWED_BASES= idea/exploring/unstaged;it.eachover implementing/review/shipped/triage/specimplementingworkspaceKind: 'folder'short-circuits to declared stage (folder-manual-regime)deriveEffectiveWorkflowStagefolds branch-scopedprCache/issueCacheentries into engine facts through theGitHubStageFactSourceseam; consumer surfaces arrive with the board specsapplyGitHubPRRefreshEventswapsprCacheidentity on every found outcomegetGitHubPRCacheKey/issueCacheKeyso local,ssh:andruntime:scopes each read their own entries (per-host test)Problem → Resolution
activityAt(epoch ms or ISO string, compared same-typed only).GitHubStageFactSourceexposes both faces over one loader: asyncloadTaskTreeFactsfor loaders, syncfactsForSubjectfor in-memory caches (pending async reads as "no facts").number[]while the engine compares string ids → fact id = decimal PR number string;consumedMergeIdsFromNumbersis the single conversion point (ids not repo-qualified; adequate while derivation covers self-only facts — task-tree rollup deferred to the board tickets).isCachedMergedBranchPRCurrentForWorktree) or carry no signal. Open entries need no gate: an open PR on the branch is an open PR for this line of work.workflowStagefield, zero behavior impact (folder rows take the manual-regime branch).Changes by theme
src/shared/stage-derivation/stage-derivation.tsstage-derivation.test.tssrc/shared/stage-derivation/stage-fact-source.tsgithub-stage-fact-source.tsPRInfo/IssueInfo→ facts), dual-face sourcesrc/renderer/src/components/sidebar/effective-workflow-stage.tsmeta-types.ts,folder-workspace-types.ts,worktree-metadata-merge.ts,loading-store/store.ts,ipc/worktrees.ts, runtime RPC schema/preload/repos sliceconsumedMergedPRNumbersfield mirroring theworkflowStagecontract; field added, no writer yet (de-ship UI is a later ticket)QA plan
pnpm vitest run src/shared/stage-derivationpasses locally (engine + seam + GitHub translation)reviewwithout manual refresh; after merge showsshipped; de-ship survives re-reads until a new fact arrives