fix(milestones): enforce valid status transitions with state machine …#199
Open
AnoukRImola wants to merge 2 commits intoDisciplr-Org:mainfrom
Open
fix(milestones): enforce valid status transitions with state machine …#199AnoukRImola wants to merge 2 commits intoDisciplr-Org:mainfrom
AnoukRImola wants to merge 2 commits intoDisciplr-Org:mainfrom
Conversation
|
@AnoukRImola Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Please resolve the conflicts |
Author
Ready |
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.
fix(milestones): enforce valid status transitions with state machine and logging
Closes: #121
Summary
milestoneTransitions.ts) withchain-aligned statuses:
pending | in_progress | completed | failedmilestones.tsservice to be repository-backed (async, DB-driven)instead of in-memory
milestoneRepository.tswithgetByIdandallCompletedByVaultmethods
PATCH /:id/transitionendpoint with RBAC (VERIFIER/ADMIN forterminal states)
PATCH /:id/verifyas legacy alias that transitions tocompletedvaultTransitions.tsto useallMilestonesCompleted()(async,DB-backed)
20260226014238_create_milestones_table.cjswithout leaking PII
vaults.ts,vault.service.ts, andknex.ts(dead code, duplicate exports, bad merge artifacts)
Valid transitions
pending → [in_progress]
in_progress → [completed, failed, pending]
completed → [] (terminal)
failed → [] (terminal)
Files changed
src/types/milestone.tsVALID_TRANSITIONS,TERMINAL_STATUSESsrc/services/milestoneTransitions.tssrc/repositories/milestoneRepository.tsgetById,allCompletedByVaultsrc/services/milestones.tssrc/routes/milestones.tssrc/services/vaultTransitions.tsallMilestonesCompleted()src/services/expirationScheduler.tssrc/routes/vaults.tssrc/services/vault.service.tssrc/db/knex.tssrc/tests/milestoneTransitions.test.tssrc/tests/vaultTransitions.test.tsdb/migrations/20260226014238_create_milestones_table.cjsTest plan
milestoneTransitions.test.ts— 13/13 passing (valid, invalid,terminal, unknown)
vaultTransitions.test.ts— 18/18 unit tests passing (state machine +helpers)
session.tsdb mock issue, unrelated to this PR)