@1agh/maude 2.0.4 → 2.0.8
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.
- package/apps/hub/src/project-transactions/kernel.mjs +10 -1
- package/apps/studio/access/closure.ts +156 -16
- package/apps/studio/access/filters.ts +39 -5
- package/apps/studio/access/known-canvases.ts +24 -1
- package/apps/studio/access/refused-inputs.ts +89 -0
- package/apps/studio/actions/agents.ts +59 -0
- package/apps/studio/actions/ctx.ts +3 -0
- package/apps/studio/actions/defs/app.ts +12 -0
- package/apps/studio/actions/defs/sync.ts +13 -0
- package/apps/studio/actions/defs/view.ts +59 -3
- package/apps/studio/actions/keymap.gen.ts +35 -0
- package/apps/studio/actions/menu.ts +2 -0
- package/apps/studio/actions/types.ts +3 -1
- package/apps/studio/actions.manifest.json +148 -1
- package/apps/studio/actions.parity.json +31 -1
- package/apps/studio/annotations/ui/ai-seen.tsx +4 -3
- package/apps/studio/annotations/ui/element-node.tsx +139 -54
- package/apps/studio/annotations/ui/lod.tsx +1 -1
- package/apps/studio/annotations/ui/ride.ts +2 -1
- package/apps/studio/annotations/ui/text-style.ts +1 -1
- package/apps/studio/annotations-context-toolbar.tsx +5 -4
- package/apps/studio/annotations-layer.tsx +4 -15
- package/apps/studio/api.ts +425 -128
- package/apps/studio/artboard-activity-overlay.tsx +4 -4
- package/apps/studio/artboard-ai-copies.tsx +4 -4
- package/apps/studio/artboard-freeze.ts +108 -0
- package/apps/studio/artboard-live-gate.tsx +636 -0
- package/apps/studio/artboard-live.ts +831 -0
- package/apps/studio/artboard-placeholder.ts +197 -0
- package/apps/studio/artboard-still-raster.ts +485 -0
- package/apps/studio/artboard-still-warmup.ts +221 -0
- package/apps/studio/artboard-still.ts +1188 -0
- package/apps/studio/artboard-webgl.ts +669 -0
- package/apps/studio/asset-placeholder.tsx +237 -132
- package/apps/studio/asset-upload-bars.tsx +4 -4
- package/apps/studio/bin/_agent-browser-bin.mjs +8 -0
- package/apps/studio/bin/_agent-browser-safe.mjs +2 -1
- package/apps/studio/bin/_canvas-reasons.mjs +34 -0
- package/apps/studio/bin/_ds-check-live.mjs +37 -0
- package/apps/studio/bin/_ds-check.mjs +4 -1
- package/apps/studio/bin/_ds-prove-judge.mjs +167 -0
- package/apps/studio/bin/_ds-prove-playwright.mjs +183 -105
- package/apps/studio/bin/_import-asset.mjs +2 -1
- package/apps/studio/bin/_perf-probe-open.mjs +364 -0
- package/apps/studio/bin/_perf-probe.mjs +2 -1
- package/apps/studio/bin/_perf-shared.mjs +12 -7
- package/apps/studio/bin/_pw-launch.mjs +26 -1
- package/apps/studio/bin/_studio-verb.mjs +24 -3
- package/apps/studio/bin/_thumb-blank.mjs +70 -0
- package/apps/studio/bin/_thumb-cover.mjs +35 -0
- package/apps/studio/bin/_thumbs-playwright.mjs +89 -12
- package/apps/studio/bin/ds-check.sh +5 -1
- package/apps/studio/bin/perf.sh +30 -1
- package/apps/studio/bin/server-up.sh +7 -2
- package/apps/studio/bin/smoke.sh +19 -0
- package/apps/studio/bridge/dgn-protocol.ts +35 -0
- package/apps/studio/canvas-build-sandbox.ts +69 -13
- package/apps/studio/canvas-camera.ts +90 -0
- package/apps/studio/canvas-comment-mount.tsx +9 -9
- package/apps/studio/canvas-lib.tsx +289 -44
- package/apps/studio/canvas-pages-view.tsx +465 -0
- package/apps/studio/canvas-pages.ts +305 -0
- package/apps/studio/canvas-rows.ts +62 -0
- package/apps/studio/canvas-shell.tsx +62 -16
- package/apps/studio/canvas-theme-icons.tsx +41 -0
- package/apps/studio/canvas-theme-pill.tsx +15 -6
- package/apps/studio/canvas-theme.ts +12 -11
- package/apps/studio/client/app.jsx +7 -0
- package/apps/studio/client/canvas-url.js +36 -1
- package/apps/studio/client/home/HomeAccounts.jsx +262 -0
- package/apps/studio/client/home/Shelves.jsx +4 -3
- package/apps/studio/client/home/home-accounts-model.js +121 -0
- package/apps/studio/client/home/home-api.js +6 -0
- package/apps/studio/client/home/home-app.jsx +141 -40
- package/apps/studio/client/home/home-model.js +172 -6
- package/apps/studio/client/home/home.css +169 -5
- package/apps/studio/client/home/shell-mode.js +8 -1
- package/apps/studio/client/hooks/canvas-origin-probe.js +34 -0
- package/apps/studio/client/hooks/use-action-keys.jsx +3 -1
- package/apps/studio/client/hooks/use-canvas-bridge.jsx +1 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +23 -6
- package/apps/studio/client/hooks/use-photo-and-timeline.jsx +16 -8
- package/apps/studio/client/hooks/use-project-data.jsx +13 -2
- package/apps/studio/client/hooks/use-shell-core.jsx +19 -9
- package/apps/studio/client/index-loader.ts +41 -21
- package/apps/studio/client/inspector/inspector-panel.jsx +35 -14
- package/apps/studio/client/panels/ChatPanel.jsx +27 -20
- package/apps/studio/client/panels/CreateProject.jsx +19 -5
- package/apps/studio/client/panels/caps-cache.js +46 -0
- package/apps/studio/client/shell/viewport.jsx +66 -22
- package/apps/studio/client/tree/tree.jsx +17 -0
- package/apps/studio/client/v2/access/access-client.js +2 -0
- package/apps/studio/client/v2/access/access-host.jsx +12 -1
- package/apps/studio/client/v2/access/trashed-banner.jsx +6 -3
- package/apps/studio/client/v2/ai/Advanced.jsx +12 -0
- package/apps/studio/client/v2/ai/Composer.jsx +27 -10
- package/apps/studio/client/v2/canvases/canvases-panel.jsx +24 -0
- package/apps/studio/client/v2/canvases/use-canvas-index.js +24 -1
- package/apps/studio/client/v2/code/canvas-error-card.jsx +14 -2
- package/apps/studio/client/v2/code/canvas-imports-card.jsx +19 -14
- package/apps/studio/client/v2/code/canvas-imports-words.js +60 -0
- package/apps/studio/client/v2/code/canvas-waiting-card.jsx +59 -5
- package/apps/studio/client/v2/code/canvas-waiting.js +18 -1
- package/apps/studio/client/v2/code/code-bus.js +5 -0
- package/apps/studio/client/v2/code/code-consent-sheet.jsx +87 -0
- package/apps/studio/client/v2/code/code-consent.js +67 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +62 -10
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +314 -5
- package/apps/studio/client/v2/ds/advanced-host.jsx +11 -26
- package/apps/studio/client/v2/ds/ds-refresh.js +161 -0
- package/apps/studio/client/v2/ds/library-host.jsx +45 -45
- package/apps/studio/client/v2/ds/make-host.jsx +13 -15
- package/apps/studio/client/v2/ds/off-system-host.jsx +18 -19
- package/apps/studio/client/v2/ds/review-host.jsx +7 -1
- package/apps/studio/client/v2/ds/truth-host.jsx +15 -17
- package/apps/studio/client/v2/ds/upgrade-host.jsx +26 -10
- package/apps/studio/client/v2/history/branch-actions.js +13 -9
- package/apps/studio/client/v2/history/git-advanced.jsx +8 -1
- package/apps/studio/client/v2/history/git-model.js +3 -1
- package/apps/studio/client/v2/history/git-parts.jsx +16 -1
- package/apps/studio/client/v2/layers/artboard-layers.jsx +24 -5
- package/apps/studio/client/v2/layers/layers-request.js +49 -0
- package/apps/studio/client/v2/left-panel/canvases-pinned.jsx +93 -3
- package/apps/studio/client/v2/left-panel/ds-boards.js +39 -0
- package/apps/studio/client/v2/left-panel/left-panel-model.js +13 -0
- package/apps/studio/client/v2/left-panel/left-panel.css +24 -0
- package/apps/studio/client/v2/presence/faces.jsx +42 -14
- package/apps/studio/client/v2/shell/account-card.jsx +10 -4
- package/apps/studio/client/v2/shell/canvas-crash-guard.js +172 -0
- package/apps/studio/client/v2/shell/canvas-mode.js +17 -1
- package/apps/studio/client/v2/shell/floating-panels.css +37 -1
- package/apps/studio/client/v2/shell/github-signin-host.jsx +42 -0
- package/apps/studio/client/v2/shell/menu-runner.js +11 -0
- package/apps/studio/client/v2/shell/mode-switch.jsx +14 -3
- package/apps/studio/client/v2/shell/opening-skeleton.js +118 -0
- package/apps/studio/client/v2/shell/opening-skeleton.jsx +103 -0
- package/apps/studio/client/v2/shell/pages-pick.js +49 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +203 -0
- package/apps/studio/client/v2/shell/project-account-model.js +182 -0
- package/apps/studio/client/v2/shell/project-menu-model.js +3 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +140 -11
- package/apps/studio/client/v2/shell/share-cluster.css +58 -0
- package/apps/studio/client/v2/shell/share-cluster.jsx +26 -7
- package/apps/studio/client/v2/shell/shell-parity.json +8 -0
- package/apps/studio/client/v2/shell/team-switch.js +94 -0
- package/apps/studio/client/v2/shell/too-heavy-card.jsx +38 -0
- package/apps/studio/client/v2/shell/use-account.js +8 -1
- package/apps/studio/client/v2/shell/use-canvas-mode-lane.js +30 -0
- package/apps/studio/collab/persistence.ts +9 -1
- package/apps/studio/collab/registry.ts +32 -0
- package/apps/studio/collab/room.ts +8 -0
- package/apps/studio/comments-overlay.tsx +12 -11
- package/apps/studio/config-reload-wire.ts +56 -0
- package/apps/studio/config.schema.json +6 -0
- package/apps/studio/context.ts +37 -1
- package/apps/studio/dist/client.bundle.js +1198 -1198
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/ds/board/board.css +6 -0
- package/apps/studio/ds/board/ds-bar.tsx +21 -3
- package/apps/studio/ds/board/specimen.tsx +16 -2
- package/apps/studio/ds/board/template.ts +39 -19
- package/apps/studio/ds/canvas-cli.ts +58 -2
- package/apps/studio/ds/check.ts +26 -1
- package/apps/studio/ds/cli.ts +14 -4
- package/apps/studio/ds/component-list.ts +2 -1
- package/apps/studio/ds/convert.ts +34 -6
- package/apps/studio/ds/default.ts +6 -1
- package/apps/studio/ds/ds-resolver.ts +58 -8
- package/apps/studio/ds/ds-verb.ts +13 -0
- package/apps/studio/ds/engine.ts +3 -1
- package/apps/studio/ds/folder-systems.ts +199 -0
- package/apps/studio/ds/pairing-css.ts +2 -1
- package/apps/studio/ds/post-build.ts +38 -0
- package/apps/studio/ds/rename.ts +10 -3
- package/apps/studio/ds/shell-fallbacks.ts +2 -1
- package/apps/studio/ds/upgrade-apply.ts +27 -5
- package/apps/studio/ds/upgrade-cli.ts +22 -2
- package/apps/studio/ds/upgrade-prove.ts +198 -15
- package/apps/studio/ds/upgrade-stage.ts +10 -3
- package/apps/studio/editing/ai-point-ring.tsx +4 -4
- package/apps/studio/editing/ai-scope-outline.tsx +4 -4
- package/apps/studio/editing/align-bar.tsx +4 -4
- package/apps/studio/editing/anchor-report.ts +3 -2
- package/apps/studio/editing/artboard-handles.tsx +4 -4
- package/apps/studio/editing/corner-dots.tsx +4 -4
- package/apps/studio/editing/crop-mode.tsx +4 -4
- package/apps/studio/editing/drop-chip.tsx +4 -4
- package/apps/studio/editing/empty-report.ts +3 -2
- package/apps/studio/editing/focus-model.tsx +4 -4
- package/apps/studio/editing/gap-bands.tsx +3 -3
- package/apps/studio/editing/hold-rings.tsx +4 -4
- package/apps/studio/editing/lock-badge.tsx +3 -3
- package/apps/studio/editing/long-page.ts +23 -1
- package/apps/studio/editing/nudge.tsx +2 -2
- package/apps/studio/editing/page-activity.ts +4 -3
- package/apps/studio/editing/paste-bar.tsx +4 -4
- package/apps/studio/editing/pen/overlay.tsx +4 -3
- package/apps/studio/editing/place-freely.tsx +3 -3
- package/apps/studio/editing/reorder-slot.tsx +3 -3
- package/apps/studio/editing/selection.tsx +4 -4
- package/apps/studio/editing/size-ghost.tsx +4 -4
- package/apps/studio/editing/tab-order.tsx +4 -4
- package/apps/studio/editing/text-in-place.tsx +4 -4
- package/apps/studio/editing/undo-preview.tsx +3 -3
- package/apps/studio/equal-spacing-handles.tsx +3 -3
- package/apps/studio/frame-clock.ts +89 -0
- package/apps/studio/history/trash.ts +6 -0
- package/apps/studio/home/accounts.ts +87 -0
- package/apps/studio/home/index-reader.ts +24 -2
- package/apps/studio/home/routes.ts +19 -0
- package/apps/studio/http.ts +80 -34
- package/apps/studio/index/ds-usage.ts +4 -1
- package/apps/studio/index-cache.ts +272 -0
- package/apps/studio/inspect-overlay.tsx +4 -3
- package/apps/studio/inspect.ts +7 -2
- package/apps/studio/link-chip-overlay.tsx +4 -3
- package/apps/studio/measure-overlay.tsx +4 -3
- package/apps/studio/present/pointer-dot.tsx +3 -2
- package/apps/studio/present/present-media.ts +6 -2
- package/apps/studio/present/present-stage.tsx +3 -2
- package/apps/studio/preview/preview-camera.tsx +3 -2
- package/apps/studio/routes/ds-convert.ts +18 -0
- package/apps/studio/routes/sync.ts +176 -0
- package/apps/studio/routes/trash.ts +16 -1
- package/apps/studio/safe-zones-overlay.tsx +3 -2
- package/apps/studio/server.ts +8 -10
- package/apps/studio/skip-dirs.ts +103 -47
- package/apps/studio/studio-page-host.ts +70 -0
- package/apps/studio/sync/accepted-cold-start.ts +28 -13
- package/apps/studio/sync/asset-push.ts +146 -23
- package/apps/studio/sync/asset-state.ts +3 -2
- package/apps/studio/sync/code-module-consent.ts +86 -0
- package/apps/studio/sync/file-ledger.ts +24 -0
- package/apps/studio/sync/file-membership.ts +28 -3
- package/apps/studio/sync/file-plane.ts +497 -61
- package/apps/studio/sync/file-pull.ts +304 -33
- package/apps/studio/sync/held-deletes.ts +230 -0
- package/apps/studio/sync/hub-link.ts +1 -2
- package/apps/studio/sync/hubs-config.ts +59 -2
- package/apps/studio/sync/index.ts +405 -163
- package/apps/studio/sync/journal-client.ts +94 -5
- package/apps/studio/sync/pending-deletes.ts +100 -0
- package/apps/studio/sync/projection.ts +77 -12
- package/apps/studio/sync/seed-progress.ts +104 -3
- package/apps/studio/sync/settings.ts +36 -1
- package/apps/studio/sync/status.ts +17 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/text-caret.ts +5 -3
- package/apps/studio/thumbs/service.ts +12 -2
- package/apps/studio/thumbs/validate.ts +7 -0
- package/apps/studio/toolbars/toolbar-rect.ts +3 -2
- package/apps/studio/ui-prefs-migrate.ts +4 -0
- package/apps/studio/use-annotation-resize.tsx +4 -3
- package/apps/studio/use-artboard-drag.tsx +3 -2
- package/apps/studio/use-element-resize.tsx +7 -6
- package/apps/studio/use-grid-track-handles.tsx +5 -4
- package/apps/studio/use-selection-set.tsx +64 -4
- package/apps/studio/use-spacing-handles.tsx +7 -6
- package/apps/studio/video-comp.tsx +75 -39
- package/apps/studio/video-play-overlay.tsx +4 -3
- package/apps/studio/whats-new.json +99 -0
- package/cli/commands/design.mjs +5 -2
- package/cli/commands/hub.mjs +10 -1
- package/cli/lib/bash-guard.mjs +27 -1
- package/cli/lib/design-help.gen.mjs +1 -1
- package/cli/lib/design-hook.mjs +20 -0
- package/cli/lib/design-link.mjs +42 -17
- package/cli/lib/hub-purge.mjs +183 -0
- package/cli/lib/studio-locate.mjs +35 -10
- package/package.json +8 -8
- package/plugins/design/templates/_shell.html +164 -1
|
@@ -165,6 +165,13 @@ export interface AcceptedColdStartInput {
|
|
|
165
165
|
* is the base — the recovery slot still holds the value before it.
|
|
166
166
|
*/
|
|
167
167
|
ownAccepted?: string | null;
|
|
168
|
+
/**
|
|
169
|
+
* #14 (2.0.5) — the css twin's `ownAccepted`: this disk's own css proposal a previous run left
|
|
170
|
+
* unanswered (an edit made offline, or just before quitting), which the drain has just had
|
|
171
|
+
* accepted. Without it a css edited while the studio was closed was judged against the css
|
|
172
|
+
* before that save, and refused as a conflict with the person's own older css.
|
|
173
|
+
*/
|
|
174
|
+
ownAcceptedCss?: string | null;
|
|
168
175
|
/**
|
|
169
176
|
* Did the project ever accept exactly this value? A disk with no record of
|
|
170
177
|
* its base that holds a value the store accepted at some revision holds an
|
|
@@ -286,19 +293,27 @@ export async function acceptedColdStart(
|
|
|
286
293
|
// ---- css — opaque text, journal-checkpointed
|
|
287
294
|
if (i.paths.css) {
|
|
288
295
|
const localCss = readText(i.paths.css);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
296
|
+
if (i.ownAcceptedCss != null && localCss === i.ownAcceptedCss) {
|
|
297
|
+
// Disk IS the drained, accepted css; its publication may still be on the way.
|
|
298
|
+
verdicts.push({ lane: 'css', decision: 'agreed', local: localCss });
|
|
299
|
+
i.projection.adoptOwnAcceptedCss(i.ownAcceptedCss);
|
|
300
|
+
} else {
|
|
301
|
+
const d = decideSourceLane({
|
|
302
|
+
local: localCss,
|
|
303
|
+
accepted: cssFromDoc(i.doc) ?? '',
|
|
304
|
+
knownBase:
|
|
305
|
+
i.ownAcceptedCss ??
|
|
306
|
+
(i.historyDir ? readRecoveryBody(i.historyDir, i.paths.css, 'base') : null),
|
|
307
|
+
baseHash: i.journal?.get(i.slug)?.cssHash ?? null,
|
|
308
|
+
});
|
|
309
|
+
const older =
|
|
310
|
+
d.decision === 'hold' && localCss !== null && (await i.wasAccepted?.(localCss)) === true;
|
|
311
|
+
verdicts.push({
|
|
312
|
+
lane: 'css',
|
|
313
|
+
...(older ? { decision: 'materialize' as const } : d),
|
|
314
|
+
...(localCss !== null ? { local: localCss } : {}),
|
|
315
|
+
});
|
|
316
|
+
}
|
|
302
317
|
}
|
|
303
318
|
|
|
304
319
|
// ---- meta — the shared layout keys (viewport never travels)
|
|
@@ -44,12 +44,18 @@ import { randomBytes } from 'node:crypto';
|
|
|
44
44
|
import { type Dirent, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
45
45
|
import path from 'node:path';
|
|
46
46
|
|
|
47
|
-
import {
|
|
47
|
+
import {
|
|
48
|
+
type CanvasGroupLike,
|
|
49
|
+
classifyProjectFile,
|
|
50
|
+
isFilePlaneClass,
|
|
51
|
+
MAX_SEGMENTS,
|
|
52
|
+
OLDER_HUB_DEPTH_REASON,
|
|
53
|
+
olderDoorRefusesDepth,
|
|
54
|
+
} from './file-membership.ts';
|
|
48
55
|
import { readLfsPointer } from './lfs-pointer.ts';
|
|
49
56
|
import { failureReason, retryAfterMs } from './retry-after.ts';
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
const MAX_SEGMENTS = 8;
|
|
58
|
+
export { OLDER_HUB_DEPTH_REASON };
|
|
53
59
|
|
|
54
60
|
/** A 2 GB file in an assets dir is a mistake — don't move it silently. */
|
|
55
61
|
const MAX_PUSH_BYTES = 512 * 1024 * 1024;
|
|
@@ -273,11 +279,21 @@ export function listPushableAssets(
|
|
|
273
279
|
.sort();
|
|
274
280
|
}
|
|
275
281
|
|
|
282
|
+
/**
|
|
283
|
+
* The hub's bucket key shape (`apps/hub/src/assets.mjs` ASSET_KEY): at most five
|
|
284
|
+
* segments under `assets/`, no spaces, each segment ≤ 64 characters. A top-level
|
|
285
|
+
* path it cannot key — an asset pack's `Models/GLTF format/…` — was sent to the
|
|
286
|
+
* bucket route anyway and refused `400` every boot (fix/205); it goes to the
|
|
287
|
+
* checkout route, which takes any classifier-admitted path.
|
|
288
|
+
*/
|
|
289
|
+
const BUCKET_KEY =
|
|
290
|
+
/^(?!.*(?:^|\/)\.\.(?:\/|$))[A-Za-z0-9][A-Za-z0-9._-]{0,63}(?:\/[A-Za-z0-9][A-Za-z0-9._-]{0,63}){0,4}$/;
|
|
291
|
+
|
|
276
292
|
/** Where a given asset pushes: the bucket-backed route (top-level `assets/`) or
|
|
277
293
|
* the checkout route (a nested `…/assets/…` served from disk). */
|
|
278
294
|
function routeFor(rel: string): { url: string } {
|
|
279
295
|
const parts = rel.split('/');
|
|
280
|
-
if (parts[0] === 'assets') {
|
|
296
|
+
if (parts[0] === 'assets' && BUCKET_KEY.test(parts.slice(1).join('/'))) {
|
|
281
297
|
// Top-level content-addressed → the bucket `/assets/<key>` route.
|
|
282
298
|
return { url: `/assets/${parts.slice(1).join('/')}` };
|
|
283
299
|
}
|
|
@@ -361,6 +377,8 @@ async function putWithRetry(ctx: {
|
|
|
361
377
|
/** Mutable per-sweep pause budget, shared across every asset. */
|
|
362
378
|
backoff: { remainingMs: number };
|
|
363
379
|
timeoutFor: (bytes: number) => number;
|
|
380
|
+
/** Told when the hub answered 429 — the caller narrows the sweep. */
|
|
381
|
+
onThrottled?: () => void;
|
|
364
382
|
}): Promise<Response> {
|
|
365
383
|
const send = (): Promise<Response> => {
|
|
366
384
|
const body = Bun.file(ctx.file);
|
|
@@ -379,6 +397,7 @@ async function putWithRetry(ctx: {
|
|
|
379
397
|
};
|
|
380
398
|
const first = await send();
|
|
381
399
|
if (first.status === 429) {
|
|
400
|
+
ctx.onThrottled?.();
|
|
382
401
|
const wait = retryAfterMs(first.headers?.get?.('retry-after') ?? null);
|
|
383
402
|
if (wait > ctx.backoff.remainingMs) return first;
|
|
384
403
|
ctx.backoff.remainingMs -= wait;
|
|
@@ -390,11 +409,52 @@ async function putWithRetry(ctx: {
|
|
|
390
409
|
}
|
|
391
410
|
|
|
392
411
|
/**
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
397
|
-
*
|
|
412
|
+
* How many uploads one sweep keeps on the wire (fix/205-sync-assets).
|
|
413
|
+
*
|
|
414
|
+
* It was ONE, "sequential on purpose" so a video upload could not starve the
|
|
415
|
+
* handshakes a fresh sync rides on. That made one hung PUT the whole lane's
|
|
416
|
+
* problem: the studyfi first sync (5,534 assets) sat on one SVG for its full
|
|
417
|
+
* budget. Four is enough that a slow file no longer stalls the rest and still
|
|
418
|
+
* far from saturating a link — the text lanes keep their share.
|
|
419
|
+
*/
|
|
420
|
+
export const UPLOAD_WIDTH_MAX = 4;
|
|
421
|
+
/** Reads per minute (the hub's advertised `readsPerMinute`) one upload lane is worth. */
|
|
422
|
+
const READS_PER_UPLOAD_LANE = 120;
|
|
423
|
+
const LIMITS_TIMEOUT_MS = 10_000;
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* The sweep's width: UPLOAD_WIDTH_MAX, narrowed when the hub says its rate is
|
|
427
|
+
* low (`/api/file-limits` `readsPerMinute`, #204). Hub-supplied (DDR-054), so
|
|
428
|
+
* it can only slow us down — to one — never widen past the maximum. A hub
|
|
429
|
+
* without the route (every journal-less hub this lane serves, most likely), or
|
|
430
|
+
* one that does not answer, gets the default: its 429s narrow the sweep anyway.
|
|
431
|
+
*/
|
|
432
|
+
async function uploadWidth(ctx: {
|
|
433
|
+
fetchImpl: typeof fetch;
|
|
434
|
+
base: string;
|
|
435
|
+
token: () => string;
|
|
436
|
+
}): Promise<number> {
|
|
437
|
+
try {
|
|
438
|
+
const res = await ctx.fetchImpl(`${ctx.base}/api/file-limits`, {
|
|
439
|
+
headers: { authorization: `Bearer ${ctx.token()}` },
|
|
440
|
+
signal: AbortSignal.timeout(LIMITS_TIMEOUT_MS),
|
|
441
|
+
});
|
|
442
|
+
if (!res.ok) return UPLOAD_WIDTH_MAX;
|
|
443
|
+
const body = (await res.json()) as { readsPerMinute?: unknown };
|
|
444
|
+
const rpm = body?.readsPerMinute;
|
|
445
|
+
if (typeof rpm !== 'number' || !Number.isFinite(rpm) || rpm <= 0) return UPLOAD_WIDTH_MAX;
|
|
446
|
+
return Math.max(1, Math.min(UPLOAD_WIDTH_MAX, Math.floor(rpm / READS_PER_UPLOAD_LANE)));
|
|
447
|
+
} catch {
|
|
448
|
+
return UPLOAD_WIDTH_MAX;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Mirror local assets up to the hub. Idempotent and skip-first (one batch probe
|
|
454
|
+
* per boot, per-file HEAD only on a hub without it; upload only on a miss), a
|
|
455
|
+
* few at a time (UPLOAD_WIDTH_MAX). A first-attempt timeout is tried once more
|
|
456
|
+
* after the rest of the sweep. Never throws; a failed upload is retried for
|
|
457
|
+
* free on the next boot.
|
|
398
458
|
*/
|
|
399
459
|
export async function pushAssets(opts: {
|
|
400
460
|
designRoot: string;
|
|
@@ -406,6 +466,12 @@ export async function pushAssets(opts: {
|
|
|
406
466
|
canvasGroups?: readonly CanvasGroupLike[];
|
|
407
467
|
/** The file-plane flag; absent ⇒ read from config/env the same way. */
|
|
408
468
|
syncFiles?: boolean;
|
|
469
|
+
/**
|
|
470
|
+
* fix/205 — the hub advertises `file-depth-v2`. False ⇒ a path deeper than 8 segments is not
|
|
471
|
+
* sent (an older hub answers `400 invalid path`, and one such path in the batch probe refuses
|
|
472
|
+
* the whole probe): it is reported as failed with OLDER_HUB_DEPTH_REASON, by name. Absent ⇒ true.
|
|
473
|
+
*/
|
|
474
|
+
hubTakesDeepPaths?: boolean;
|
|
409
475
|
fetchImpl?: typeof fetch;
|
|
410
476
|
log?: Pick<Console, 'log' | 'warn'>;
|
|
411
477
|
/** feature-sync-progress-modal — incremental progress (throttled; failures
|
|
@@ -474,30 +540,48 @@ export async function pushAssets(opts: {
|
|
|
474
540
|
|
|
475
541
|
// One question for the whole set, when the hub can answer it. Null = this hub
|
|
476
542
|
// predates the route, so every file falls back to its own probe below.
|
|
543
|
+
// fix/205 — a hub older than `file-depth-v2` refuses a path deeper than 8 segments. Never sent,
|
|
544
|
+
// never silent: each is named with the reason (the panel lists failures by path).
|
|
545
|
+
const tooDeep =
|
|
546
|
+
opts.hubTakesDeepPaths === false ? assets.filter((rel) => olderDoorRefusesDepth(rel)) : [];
|
|
547
|
+
for (const rel of tooDeep) out.failed.push({ key: rel, reason: OLDER_HUB_DEPTH_REASON });
|
|
548
|
+
const sendable =
|
|
549
|
+
tooDeep.length > 0 ? assets.filter((rel) => !olderDoorRefusesDepth(rel)) : assets;
|
|
550
|
+
if (tooDeep.length > 0)
|
|
551
|
+
log.warn?.(
|
|
552
|
+
`[sync/assets] ${tooDeep.length} file(s) sit deeper than ${base} takes (8 folders) — update the hub`
|
|
553
|
+
);
|
|
554
|
+
|
|
477
555
|
const known =
|
|
478
|
-
|
|
556
|
+
sendable.length > 0
|
|
479
557
|
? await probePresent({
|
|
480
558
|
fetchImpl,
|
|
481
559
|
base,
|
|
482
560
|
headers: { authorization: `Bearer ${opts.token()}` },
|
|
483
|
-
paths:
|
|
561
|
+
paths: sendable,
|
|
484
562
|
})
|
|
485
563
|
: null;
|
|
486
564
|
|
|
487
|
-
|
|
488
|
-
|
|
565
|
+
// fix/205 — what the batch already answered is settled NOW, not lazily in
|
|
566
|
+
// loop order: "5463 moving" for a set the hub held all but 74 of was the
|
|
567
|
+
// panel counting files nobody was going to send.
|
|
568
|
+
const queue = known ? sendable.filter((rel) => !known.has(rel)) : sendable;
|
|
569
|
+
if (known) out.skipped = sendable.length - queue.length;
|
|
570
|
+
if (assets.length > 0) emitProgress(queue[0] ?? null, false, true);
|
|
571
|
+
|
|
572
|
+
// How many uploads may be on the wire at once. See UPLOAD_WIDTH_MAX.
|
|
573
|
+
let width = queue.length > 0 ? await uploadWidth({ fetchImpl, base, token: opts.token }) : 1;
|
|
574
|
+
let stop = false;
|
|
575
|
+
/** Files whose FIRST attempt timed out — they get one more go after the rest of the sweep. */
|
|
576
|
+
const timedOut: string[] = [];
|
|
577
|
+
|
|
578
|
+
const one = async (rel: string, lastTry: boolean): Promise<void> => {
|
|
489
579
|
emitProgress(rel, false);
|
|
490
580
|
const url = `${base}${routeFor(rel).url}`;
|
|
491
581
|
const headers = { authorization: `Bearer ${opts.token()}` };
|
|
492
|
-
|
|
493
|
-
if (known.has(rel)) {
|
|
494
|
-
out.skipped += 1;
|
|
495
|
-
continue;
|
|
496
|
-
}
|
|
582
|
+
try {
|
|
497
583
|
// The batch answered, and it said this one is missing — no per-file probe
|
|
498
584
|
// can add anything, so go straight to the upload.
|
|
499
|
-
}
|
|
500
|
-
try {
|
|
501
585
|
const head = known
|
|
502
586
|
? null
|
|
503
587
|
: await fetchImpl(url, {
|
|
@@ -507,7 +591,7 @@ export async function pushAssets(opts: {
|
|
|
507
591
|
});
|
|
508
592
|
if (head?.ok) {
|
|
509
593
|
out.skipped += 1;
|
|
510
|
-
|
|
594
|
+
return;
|
|
511
595
|
}
|
|
512
596
|
// A hub that refuses the PROBE refuses the upload — pushing the body
|
|
513
597
|
// anyway just streams megabytes at a door that already said no. The
|
|
@@ -521,7 +605,12 @@ export async function pushAssets(opts: {
|
|
|
521
605
|
if (head && (head.status === 401 || head.status === 403)) {
|
|
522
606
|
out.failed.push({ key: rel, reason: await failureReason(head) });
|
|
523
607
|
emitProgress(rel, false, true);
|
|
524
|
-
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
// The cancel may land while the probe was out — never start a body after it.
|
|
611
|
+
if (stop || opts.cancelled?.()) {
|
|
612
|
+
stop = true;
|
|
613
|
+
return;
|
|
525
614
|
}
|
|
526
615
|
const put = await putWithRetry({
|
|
527
616
|
fetchImpl,
|
|
@@ -531,19 +620,30 @@ export async function pushAssets(opts: {
|
|
|
531
620
|
sleep,
|
|
532
621
|
backoff,
|
|
533
622
|
timeoutFor,
|
|
623
|
+
// The hub is pacing us: the rest of this sweep goes one file at a time.
|
|
624
|
+
onThrottled: () => {
|
|
625
|
+
width = 1;
|
|
626
|
+
},
|
|
534
627
|
});
|
|
535
628
|
if (put.ok) out.pushed.push(rel);
|
|
536
629
|
else if (put.status === 405) {
|
|
537
630
|
// `this hub does not accept file writes`: no checkout, so no file can ever land here. Stop the pass — the
|
|
538
631
|
// next file would get the same answer — and say it is not a failure; the media stays on this Mac.
|
|
539
632
|
out.refused = 'no-checkout';
|
|
540
|
-
|
|
633
|
+
stop = true;
|
|
541
634
|
} else {
|
|
542
635
|
out.failed.push({ key: rel, reason: await failureReason(put) });
|
|
543
636
|
emitProgress(rel, false, true);
|
|
544
637
|
}
|
|
545
638
|
} catch (err) {
|
|
546
639
|
const e = err as Error;
|
|
640
|
+
// One hung request used to cost the file its whole boot. A timeout is the
|
|
641
|
+
// likeliest refusal to be transient, so it waits for the end of the sweep
|
|
642
|
+
// and goes once more (lastTry) — a second timeout is reported.
|
|
643
|
+
if (e.name === 'TimeoutError' && !lastTry) {
|
|
644
|
+
timedOut.push(rel);
|
|
645
|
+
return;
|
|
646
|
+
}
|
|
547
647
|
out.failed.push({
|
|
548
648
|
key: rel,
|
|
549
649
|
// "TimeoutError: The operation timed out" tells a person nothing about
|
|
@@ -552,6 +652,29 @@ export async function pushAssets(opts: {
|
|
|
552
652
|
});
|
|
553
653
|
emitProgress(rel, false, true);
|
|
554
654
|
}
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
let next = 0;
|
|
658
|
+
const worker = async (id: number): Promise<void> => {
|
|
659
|
+
// A worker past the current width retires (a 429 narrows the sweep to one).
|
|
660
|
+
while (!stop && id < width && next < queue.length) {
|
|
661
|
+
if (opts.cancelled?.()) {
|
|
662
|
+
stop = true;
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
const rel = queue[next++] as string;
|
|
666
|
+
await one(rel, false);
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
// The sweep's FIRST upload goes alone: the door's answer to it — 405 (no checkout: nothing can
|
|
670
|
+
// ever land, the media gate stops the lane), a 429 (pace us) — is known before the pool opens,
|
|
671
|
+
// so a door that says no gets one body, not `width` bodies already on the wire.
|
|
672
|
+
if (!stop && next < queue.length && !opts.cancelled?.())
|
|
673
|
+
await one(queue[next++] as string, false);
|
|
674
|
+
await Promise.all(Array.from({ length: width }, (_, id) => worker(id)));
|
|
675
|
+
for (const rel of timedOut) {
|
|
676
|
+
if (stop || opts.cancelled?.()) break;
|
|
677
|
+
await one(rel, true);
|
|
555
678
|
}
|
|
556
679
|
// No assets → no emits at all: a project without an assets/ dir should not
|
|
557
680
|
// grow an empty assets section in its Sync panel.
|
|
@@ -26,7 +26,7 @@ import { existsSync, lstatSync } from 'node:fs';
|
|
|
26
26
|
import path from 'node:path';
|
|
27
27
|
|
|
28
28
|
import { listPushableAssets } from './asset-push.ts';
|
|
29
|
-
import { type CanvasGroupLike, classifyProjectFile } from './file-membership.ts';
|
|
29
|
+
import { type CanvasGroupLike, classifyProjectFile, MAX_SEGMENTS } from './file-membership.ts';
|
|
30
30
|
import { hasLfsObject, lfsObjectsDir, readLfsPointer } from './lfs-pointer.ts';
|
|
31
31
|
|
|
32
32
|
export interface AssetWho {
|
|
@@ -73,7 +73,8 @@ export function isAssetStateRel(rel: unknown): rel is string {
|
|
|
73
73
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: refusing them is the point.
|
|
74
74
|
if (/[\u0000-\u001f\u007f]/.test(rel)) return false;
|
|
75
75
|
const parts = rel.split('/');
|
|
76
|
-
|
|
76
|
+
// The classifier's depth cap (32 since fix/205) — a deep asset must be askable too.
|
|
77
|
+
if (parts.length < 2 || parts.length > MAX_SEGMENTS) return false;
|
|
77
78
|
return parts.every((p) => p && p !== '.' && p !== '..' && !p.startsWith('_'));
|
|
78
79
|
}
|
|
79
80
|
|
|
@@ -26,8 +26,15 @@
|
|
|
26
26
|
// - there is no per-hub consent row in Settings › Connections to keep in step with.
|
|
27
27
|
//
|
|
28
28
|
// An explicit recorded `false` still wins: a person who said no on this Mac keeps their no.
|
|
29
|
+
//
|
|
30
|
+
// fix/207 — and that person can now change their answer IN THE APP (`createCodeConsentControl`
|
|
31
|
+
// below, behind `POST /_api/sync/code-consent/set`): before it, the only writer was the terminal's
|
|
32
|
+
// `maude design link`, which never asked again once a `false` was recorded, so "re-link and answer
|
|
33
|
+
// yes" could not be followed. The answer is still LOCAL and still the person's: the route is
|
|
34
|
+
// main-origin only, window-only and Can edit, and nothing a hub says reaches it.
|
|
29
35
|
|
|
30
36
|
import { CELL_ZONE, cellDoorUrl } from '../client/v2/cloud/browser-door.js';
|
|
37
|
+
import { getHubRecord, recordCodeModulesAllowed } from './hubs-config.ts';
|
|
31
38
|
import { normHub } from './link-consent.ts';
|
|
32
39
|
|
|
33
40
|
export type CodeModuleConsentHow = 'cell' | 'recorded' | 'cloud';
|
|
@@ -72,3 +79,82 @@ export function codeModuleConsent(o: CodeModuleConsentInput): CodeModuleConsentH
|
|
|
72
79
|
if (hub && normHub(env.MAUDE_APP_BOUND_HUB) === hub && isMaudeCloudCell(hub)) return 'cloud';
|
|
73
80
|
return null;
|
|
74
81
|
}
|
|
82
|
+
|
|
83
|
+
/** What the consent sheet and Sync details show about this Mac's answer for the linked hub. */
|
|
84
|
+
export interface CodeConsentView {
|
|
85
|
+
/** the hub's host, the only name of it the UI shows */
|
|
86
|
+
host: string;
|
|
87
|
+
/** may code modules land here right now */
|
|
88
|
+
allowed: boolean;
|
|
89
|
+
/** why (null = they may not) */
|
|
90
|
+
how: CodeModuleConsentHow | null;
|
|
91
|
+
/** the answer recorded on this Mac (null = none recorded) */
|
|
92
|
+
recorded: boolean | null;
|
|
93
|
+
/** may the person change it here: a signed-in record exists and this is not a cell */
|
|
94
|
+
changeable: boolean;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type CodeConsentSetResult =
|
|
98
|
+
| { ok: true; changed: boolean; view: CodeConsentView }
|
|
99
|
+
| { ok: false; reason: 'cell' | 'not-signed-in' };
|
|
100
|
+
|
|
101
|
+
export interface CodeConsentControl {
|
|
102
|
+
/** The cached answer the file plane reads at every gate (cheap: no disk read). */
|
|
103
|
+
allowed(): boolean;
|
|
104
|
+
/** Re-read hubs.json; true when the answer changed (a CLI re-link, another window). */
|
|
105
|
+
refresh(): boolean;
|
|
106
|
+
view(): CodeConsentView;
|
|
107
|
+
/** Record the person's answer on this Mac and take it at once. */
|
|
108
|
+
set(allow: boolean): CodeConsentSetResult;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The live receive consent of one sync runtime (fix/207). `codeModuleConsent` decides; this keeps
|
|
113
|
+
* its answer in memory, re-reads it when hubs.json changes, and writes the person's answer through
|
|
114
|
+
* `recordCodeModulesAllowed` into the PROFILE's hubs.json (`hubsConfigPath()` at call time).
|
|
115
|
+
*/
|
|
116
|
+
export function createCodeConsentControl(o: {
|
|
117
|
+
cellPairing: boolean;
|
|
118
|
+
hubUrl: string;
|
|
119
|
+
env?: Record<string, string | undefined>;
|
|
120
|
+
/** the profile's hubs.json; absent = `hubsConfigPath()` at each read (the process's profile) */
|
|
121
|
+
hubsPath?: string;
|
|
122
|
+
}): CodeConsentControl {
|
|
123
|
+
const record = () => (o.cellPairing ? null : getHubRecord(o.hubUrl, o.hubsPath));
|
|
124
|
+
const decide = () =>
|
|
125
|
+
codeModuleConsent({
|
|
126
|
+
cellPairing: o.cellPairing,
|
|
127
|
+
hubUrl: o.hubUrl,
|
|
128
|
+
storedRecord: record(),
|
|
129
|
+
env: o.env ?? process.env,
|
|
130
|
+
});
|
|
131
|
+
let how = decide();
|
|
132
|
+
let host = '';
|
|
133
|
+
try {
|
|
134
|
+
host = new URL(o.hubUrl).host;
|
|
135
|
+
} catch {
|
|
136
|
+
host = '';
|
|
137
|
+
}
|
|
138
|
+
const view = (): CodeConsentView => {
|
|
139
|
+
const rec = record();
|
|
140
|
+
const recorded = typeof rec?.codeModulesAllowed === 'boolean' ? rec.codeModulesAllowed : null;
|
|
141
|
+
return { host, allowed: how !== null, how, recorded, changeable: !o.cellPairing && !!rec };
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
allowed: () => how !== null,
|
|
145
|
+
refresh() {
|
|
146
|
+
const before = how !== null;
|
|
147
|
+
how = decide();
|
|
148
|
+
return (how !== null) !== before;
|
|
149
|
+
},
|
|
150
|
+
view,
|
|
151
|
+
set(allow) {
|
|
152
|
+
if (o.cellPairing) return { ok: false, reason: 'cell' };
|
|
153
|
+
if (!recordCodeModulesAllowed(o.hubUrl, allow === true, o.hubsPath))
|
|
154
|
+
return { ok: false, reason: 'not-signed-in' };
|
|
155
|
+
const before = how !== null;
|
|
156
|
+
how = decide();
|
|
157
|
+
return { ok: true, changed: (how !== null) !== before, view: view() };
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
}
|
|
@@ -100,6 +100,20 @@ export type DeliveryState =
|
|
|
100
100
|
| 'referenced-but-unoffered'
|
|
101
101
|
/** On this disk, and the hub has not acknowledged it. */
|
|
102
102
|
| 'local-only'
|
|
103
|
+
/** Issue #207 — in a folder the project does not sync (`linkedHub.ignoreFolders`). Not waiting. */
|
|
104
|
+
| 'ignored'
|
|
105
|
+
/**
|
|
106
|
+
* Issue #207 (7b) — DELETED ON THIS MAC, HELD: gone from here as part of a batch larger than sync
|
|
107
|
+
* removes from the project unasked (the outbound delete breaker). Waits for the person's answer in
|
|
108
|
+
* Sync details — Delete on the hub too, or Keep on the hub. Never sent, never downloaded meanwhile.
|
|
109
|
+
*/
|
|
110
|
+
| 'delete-held'
|
|
111
|
+
/**
|
|
112
|
+
* Issue #207 (7b) — ON THE HUB ONLY: deleted on this Mac, and the person chose to keep it on the
|
|
113
|
+
* hub. No delete is proposed and the same bytes are never downloaded again; bound to the hash this
|
|
114
|
+
* Mac last saw (`syncedHash ?? lastSeenHash`), so a teammate's new version is a new decision.
|
|
115
|
+
*/
|
|
116
|
+
| 'hub-only'
|
|
103
117
|
/** Upload in flight. */
|
|
104
118
|
| 'pushing'
|
|
105
119
|
/** The hub answered 2xx and gave it a seq. */
|
|
@@ -143,6 +157,14 @@ export interface LedgerRow {
|
|
|
143
157
|
* the ancestor-LEADS failure the whole ordering rule exists to prevent.
|
|
144
158
|
*/
|
|
145
159
|
localHash?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Issue #207 — the last bytes this Mac SAW at this path (set with `localHash`, but never cleared
|
|
162
|
+
* by `noteChanged`). An observation, not an ancestor: it lets a file that is gone from here, and
|
|
163
|
+
* whose bytes the hub holds unchanged, read as deleted HERE rather than offered by the hub — an
|
|
164
|
+
* upload that landed while its answer was lost left no ancestor, and the next pass downloaded
|
|
165
|
+
* the moved-out renders again.
|
|
166
|
+
*/
|
|
167
|
+
lastSeenHash?: string;
|
|
146
168
|
/** Stat cache: the size `localHash` was computed for. */
|
|
147
169
|
size?: number;
|
|
148
170
|
/** Stat cache: the mtime `localHash` was computed for. */
|
|
@@ -420,6 +442,7 @@ export function createFileLedger(opts: FileLedgerOptions): FileLedger {
|
|
|
420
442
|
out[rel] = {
|
|
421
443
|
syncedHash: typeof r.syncedHash === 'string' ? r.syncedHash : null,
|
|
422
444
|
...(typeof r.localHash === 'string' ? { localHash: r.localHash } : {}),
|
|
445
|
+
...(typeof r.lastSeenHash === 'string' ? { lastSeenHash: r.lastSeenHash } : {}),
|
|
423
446
|
...(Number.isInteger(r.remoteSeq) ? { remoteSeq: r.remoteSeq } : {}),
|
|
424
447
|
...(typeof r.remoteHash === 'string' || r.remoteHash === null
|
|
425
448
|
? { remoteHash: r.remoteHash }
|
|
@@ -618,6 +641,7 @@ export function createFileLedger(opts: FileLedgerOptions): FileLedger {
|
|
|
618
641
|
// match is not read at all.
|
|
619
642
|
const r = rowFor(rel);
|
|
620
643
|
r.localHash = hash;
|
|
644
|
+
r.lastSeenHash = hash;
|
|
621
645
|
r.size = size;
|
|
622
646
|
r.mtimeMs = mtimeMs;
|
|
623
647
|
// A file whose bytes differ from the ancestor has unsent work on it, and
|
|
@@ -78,8 +78,23 @@ export function isFilePlaneClass(c: FileClass): c is FilePlaneClass {
|
|
|
78
78
|
/** Max relative-path length (matches the hub's checkout shape cap). */
|
|
79
79
|
export const MAX_REL_LEN = 512;
|
|
80
80
|
|
|
81
|
-
/**
|
|
82
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Max designRoot-relative depth, in segments — the hub mirror carries the same figure.
|
|
83
|
+
*
|
|
84
|
+
* It was 8 until fix/205-sync-assets: a 3D asset pack (`assets/kenney/…/Models/GLTF format/
|
|
85
|
+
* Textures/…`) sat deeper, both classifiers answered `never`, and the files were dropped with no
|
|
86
|
+
* row anywhere. The depth cap never guarded anything the shape rules do not (no `..`, no
|
|
87
|
+
* absolute, a conservative charset, MAX_REL_LEN); it only keeps a key from being absurd. 32 still
|
|
88
|
+
* does, and every walk that mirrors it stays bounded.
|
|
89
|
+
*/
|
|
90
|
+
export const MAX_SEGMENTS = 32;
|
|
91
|
+
|
|
92
|
+
/** The cap every hub before `file-depth-v2` refuses past (`olderDoorRefusesDepth`). */
|
|
93
|
+
export const LEGACY_MAX_SEGMENTS = 8;
|
|
94
|
+
|
|
95
|
+
/** The ledger / panel reason for a file held back from a hub without `file-depth-v2`. */
|
|
96
|
+
export const OLDER_HUB_DEPTH_REASON =
|
|
97
|
+
'The project’s server runs an older Maude that takes files at most 8 folders deep — update it to sync this file';
|
|
83
98
|
|
|
84
99
|
// The positive extension enumerations. Everything is lowercase; the lookup
|
|
85
100
|
// lowercases first — a DS legitimately ships `…P1020428.JPG`.
|
|
@@ -264,7 +279,7 @@ export interface ClassifyOptions {
|
|
|
264
279
|
* deliberately the same answer, so no caller can tell them apart and leak an
|
|
265
280
|
* oracle.
|
|
266
281
|
*
|
|
267
|
-
* Shape gates (all refusals → `never`): relative, `/`-separated, ≤
|
|
282
|
+
* Shape gates (all refusals → `never`): relative, `/`-separated, ≤ 32
|
|
268
283
|
* segments, ≤ 512 chars, no `..`/`.`/empty segment, no backslash, no drive
|
|
269
284
|
* letter, no control characters, no trailing-space segment, no
|
|
270
285
|
* `node_modules`, directory segments start alphanumeric, the final segment
|
|
@@ -373,6 +388,16 @@ export function olderDoorRefuses(rel: string): boolean {
|
|
|
373
388
|
return lower.endsWith('.json') && !OLDER_DOOR_JSON_SUFFIXES.some((s) => lower.endsWith(s));
|
|
374
389
|
}
|
|
375
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Would a hub without `file-depth-v2` refuse this path for its depth alone? (fix/205)
|
|
393
|
+
*
|
|
394
|
+
* Every hub before it caps a path at LEGACY_MAX_SEGMENTS and answers anything deeper
|
|
395
|
+
* `400 invalid path`. Asked only about a path this side already admits. Studio-only.
|
|
396
|
+
*/
|
|
397
|
+
export function olderDoorRefusesDepth(rel: string): boolean {
|
|
398
|
+
return rel.split('/').length > LEGACY_MAX_SEGMENTS;
|
|
399
|
+
}
|
|
400
|
+
|
|
376
401
|
/** The segment shape rules alone — split parts, or null on refusal. */
|
|
377
402
|
|
|
378
403
|
/**
|