@oss-autopilot/core 3.39.0 → 3.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,10 +39,6 @@ export declare class GistSyncCoordinator {
39
39
  /** Push-before-pull (#1417): an un-pushed mutation would be silently
40
40
  * reverted by the next Gist pull. Retry the checkpoint first so a recovered
41
41
  * network turns the pending warning into a real push before any pull runs.
42
- * Also pushes saves that never recorded a warning: fetchDashboardData
43
- * writes the digest and merged/closed caches through save() with no
44
- * checkpoint, and the pull right after it reverted them and raised the
45
- * "un-pushed changes" stale banner on every refresh.
46
42
  * No-op when nothing is pending. */
47
43
  flushPendingGistSync(): Promise<void>;
48
44
  /** One health snapshot from the one source (#1444). Defensive: this is an
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { getStateManager, getGitHubToken, maybeCheckpoint, ensureGistPersistence, } from '../core/index.js';
11
11
  import { errorMessage, ConfigurationError } from '../core/errors.js';
12
- import { warn } from '../core/logger.js';
12
+ import { debug, warn } from '../core/logger.js';
13
13
  const GIST_DEGRADED_WARNING = 'Gist persistence is configured but this dashboard process is running LOCAL-ONLY; ' +
14
14
  'changes made here will NOT sync and may be overwritten by the next successful Gist read. ' +
15
15
  'Recovery is retried automatically.';
@@ -110,15 +110,24 @@ export class GistSyncCoordinator {
110
110
  /** Push-before-pull (#1417): an un-pushed mutation would be silently
111
111
  * reverted by the next Gist pull. Retry the checkpoint first so a recovered
112
112
  * network turns the pending warning into a real push before any pull runs.
113
- * Also pushes saves that never recorded a warning: fetchDashboardData
114
- * writes the digest and merged/closed caches through save() with no
115
- * checkpoint, and the pull right after it reverted them and raised the
116
- * "un-pushed changes" stale banner on every refresh.
117
113
  * No-op when nothing is pending. */
118
114
  async flushPendingGistSync() {
119
- if (this.pendingGistSyncWarnings.length === 0 && !this.manager.hasUnpushedChanges())
115
+ if (this.pendingGistSyncWarnings.length > 0) {
116
+ this.recordGistSyncOutcome(await maybeCheckpoint(this.manager, this.module));
120
117
  return;
121
- this.recordGistSyncOutcome(await maybeCheckpoint(this.manager, this.module));
118
+ }
119
+ if (!this.manager.hasUnpushedChanges())
120
+ return;
121
+ // No mutation warning is pending, so the un-pushed saves are
122
+ // fetchDashboardData's GitHub-derived digest and merged/closed caches,
123
+ // which every refresh rebuilds. Push them best-effort; on failure (e.g. a
124
+ // concurrent Gist write) let the pull revert them quietly instead of
125
+ // raising a loss banner for data nobody entered.
126
+ const failure = await maybeCheckpoint(this.manager, this.module);
127
+ if (failure === null)
128
+ return;
129
+ debug(this.module, `Dropping un-pushed refresh data before the Gist pull: ${failure}`);
130
+ this.manager.forgetUnpushedChanges();
122
131
  }
123
132
  /** One health snapshot from the one source (#1444). Defensive: this is an
124
133
  * advisory probe that runs on EVERY request path (rebuilds, recovery
@@ -229,6 +229,10 @@ export declare class StateManager {
229
229
  get refreshGeneration(): number;
230
230
  /** Gist mode: whether a saved mutation has not reached the Gist yet. */
231
231
  hasUnpushedChanges(): boolean;
232
+ /** Gist mode: treat the current un-pushed saves as disposable, so the next
233
+ * refresh replaces them without raising the lost-changes staleness marker.
234
+ * Only for re-derivable data (the dashboard's GitHub fetch caches). */
235
+ forgetUnpushedChanges(): void;
232
236
  /**
233
237
  * Re-fetch state from the backing Gist (if in Gist mode).
234
238
  * Throttled to once per 30 seconds by GistStateStore unless `force` is set.
@@ -554,6 +554,12 @@ export class StateManager {
554
554
  hasUnpushedChanges() {
555
555
  return this.unpushed;
556
556
  }
557
+ /** Gist mode: treat the current un-pushed saves as disposable, so the next
558
+ * refresh replaces them without raising the lost-changes staleness marker.
559
+ * Only for re-derivable data (the dashboard's GitHub fetch caches). */
560
+ forgetUnpushedChanges() {
561
+ this.unpushed = false;
562
+ }
557
563
  /**
558
564
  * Re-fetch state from the backing Gist (if in Gist mode).
559
565
  * Throttled to once per 30 seconds by GistStateStore unless `force` is set.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.39.0",
3
+ "version": "3.39.1",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {