fix(heartbeat): Copilot-review follow-ups — inactive-staleness hint, zero-day thresholds, symlink dedup - #181
Open
abhinav-phi wants to merge 3 commits into
Open
Conversation
Staleness is opt-in via last_updated frontmatter, so a legacy scaffold where no file carries the field makes mex heartbeat report a healthy sweep that in fact checked nothing. When every scanned scaffold file lacks a parseable last_updated, the result now carries filesWithoutLastUpdated and the CLI (and doctor's Heartbeat line) say staleness checks are currently skipped and how to opt files in. The hint never turns a healthy heartbeat into a failure, and the field is absent once any file opts in, so existing v0.2 scaffolds and JSON consumers are unchanged. Resolves mex-memory#41
heartbeat.staleDays, memoryCleanupDays, and dailyMemoryRetentionDays used positive-number validation, so 0 was rejected and the default applied — config could not express 'stale as soon as older than today'. Day-based heartbeat thresholds now accept 0 while still rejecting negatives and other garbage (watch.intervalMinutes keeps its positive validation: a zero-minute watch poll makes no sense). Behavior is documented on HeartbeatConfig: staleDays 0 flags everything dated before today; dailyMemoryRetentionDays 0 flags yesterday's daily memory file. Resolves mex-memory#42
Contributor
Author
|
Added the #42 fix to this branch as a second commit — both issues come from the same Copilot review thread on PR #39 and touch the same heartbeat/config surface:
Resolves #42 as well. |
scaffoldHeartbeatFiles and the drift scanner glob with follow: true to support symlinked scaffold content, but a file reachable through two patterns (or a symlinked directory) could produce two scan entries — double heartbeat staleness lines and double drift checks. Both discovery paths now deduplicate by realpath before returning, and a focused test proves one file reached through two directories counts exactly once. Glob itself bounds symlink loops, so runaway scans were already impossible; the duplicate-entry risk was the real defect (mex-memory#40).
Contributor
Author
|
Third commit adds the #40 fix (same review thread, same surface):
Resolves #40 as well — this branch now closes all three Copilot-review follow-ups (#40, #41, #42). |
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.
Resolves #40, #41, and #42 — the three follow-ups from the Copilot review on PR #39, all touching the heartbeat/drift scan surface.
#41 — surface inactive staleness checks
checkHeartbeatreturnsfilesWithoutLastUpdated(additive, absent once any file opts in) when every scanned scaffold file lacks a parseablelast_updated.mex heartbeatprints the skip-hint with opt-in instructions;mex doctor's Heartbeat line notes the inactive checks. Exit codes andokuntouched.#42 — accept zero for day-based thresholds
staleDays,memoryCleanupDays,dailyMemoryRetentionDaysnow accept0("stale as soon as older than today"); negatives and garbage still fall back to the default.watch.intervalMinuteskeeps positive validation. Documented onHeartbeatConfig.#40 — deduplicate symlinked scaffold files
Both
scaffoldHeartbeatFilesandfindScaffoldFilesdeduplicate by realpath, so one file reachable through two patterns or a symlinked directory is scanned once. Glob bounds symlink loops; the duplicate-entry risk was the real defect.Tests
10 heartbeat tests (incl. symlink-dedup with a Windows no-privilege skip guard) + updated config parsing tests;
npm run typecheckgreen.