Repository navigation
feat(api): flag assets whose latest register is older than registerMaxAgeDays - #1374
royalTreasure merged 2 commits into
Conversation
…d#561) Concord reconciles on demand, so a missed daily upload went unnoticed. Each asset now carries an optional registerMaxAgeDays; assetSummary reports registerStale: { ageDays } once the latest register's as-of time is older than that limit, and null while the check is off or no register exists. The age is measured from an injectable clock so tests pin the boundary exactly. Adds assets.register_max_age_days (migration v4) with an upgrade fixture, and lets watchAsset and PATCH /api/assets/:id set or clear the limit. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@ayooluwa123455 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! 🚀 |
royalTreasure
left a comment
There was a problem hiding this comment.
Thanks @ayooluwa123455. The register-staleness flag fits #561. CI is green, but it can't be merged yet: migration v4 is now taken. #1353 (per-asset matching windows) just landed on main as ORG_MIGRATIONS v4, so this branch conflicts and its v4 migration and org-v4.db fixture no longer line up.
To fix:
git fetch upstream && git rebase upstream/main(please rebase, don't mergemainin).- Renumber your migration to the next free version (v5 today). Several open PRs add a migration, so whichever merges first takes v5 and the rest move up again.
- Regenerate the fixture with
services/api/test/fixtures/make-db-fixtures.tsasorg-v5.db(keepmain'sorg-v4.dbunchanged), and update the pinned schema digest and migration tests. - Update the version in `docs/schema.md` to match. Run
pnpm build && pnpm typecheck && pnpm lint && pnpm testand force-push.
|
Thanks @ayooluwa123455! Setting |
closes #561
Summary
Nothing reconciles on a timer, so a missed daily register upload goes unnoticed. This PR adds a per-asset
registerMaxAgeDayssetting. When an asset's latest register is older than that,assetSummaryreturnsregisterStale: { ageDays }and counts it as an attention item.What changed
services/api/src/schema.ts: new per-assetregisterMaxAgeDayssetting, with a migration[migration name]. It defaults to off (null), so existing assets are unaffected.services/api/src/concord.ts:assetSummaryreturnsregisterStale: { ageDays }when the age of the latest register exceedsregisterMaxAgeDays, and doesn't include it otherwise.[define: whole days since the latest register's date/time, and which timestamp is used].[How registerMaxAgeDays is set and validated, e.g. a positive integer, rejected if zero or negative.]services/api/test/service.test.ts: tests below.Behavior
registerMaxAgeDaysnot setregisterStale, no change to attention itemsregisterStale: { ageDays }, counted as an attention item[behavior, e.g. not flagged / flagged, with the reason]Existing fields in
assetSummaryare unchanged.Tests
With the clock injected:
registerMaxAgeDaysis unsetageDays[Edge case: asset with no register, invalid setting values]How to test
[command, e.g. npm test -w services/api]Checklist