@floless/app 0.125.0 → 0.125.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.
- package/dist/floless-server.cjs +102 -43
- package/dist/schemas/steel.model.v2.schema.json +3 -1
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +56 -7
- package/dist/web/app.css +38 -0
- package/dist/web/aware.js +144 -3
- package/dist/web/steel-3d-core.js +29 -0
- package/dist/web/steel-3d-view.js +36 -8
- package/dist/web/steel-editor.html +174 -68
- package/dist/web/workspaces.js +82 -13
- package/package.json +1 -1
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
#detOpacity{flex:1;min-width:0} /* SIZING only — the theming is the global input[type=range] rule below */
|
|
53
53
|
#zoombar #zPct{min-width:40px;text-align:right;color:var(--mut);font-variant-numeric:tabular-nums}
|
|
54
54
|
/* Connection Component breadcrumb (Slice A) — a floating chip over the 3D canvas, same recipe as #zoombar. */
|
|
55
|
-
#connCrumb{position:absolute;left:50%;top:48px;transform:translateX(-50%);display:none;align-items:center;gap:1px;max-width:min(72%,560px);background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:4px 10px;box-shadow:0 4px 14px rgba(0,0,0,.45);z-index:58;font-size:12px;white-space:nowrap;overflow:hidden} /* below #m3dBar (top:12,h~29,z:59); z:58 keeps it clickable above the
|
|
55
|
+
#connCrumb{position:absolute;left:50%;top:48px;transform:translateX(-50%);display:none;align-items:center;gap:1px;max-width:min(72%,560px);background:var(--panel);border:1px solid var(--line);border-radius:8px;padding:4px 10px;box-shadow:0 4px 14px rgba(0,0,0,.45);z-index:58;font-size:12px;white-space:nowrap;overflow:hidden} /* below #m3dBar (top:12,h~29,z:59); z:58 keeps it clickable above the model-glued label chips, which sit under the 3D chrome at z:3-4 (#614) */
|
|
56
56
|
#connCrumb .seg{color:var(--mut);cursor:pointer;padding:1px 4px;border-radius:4px;background:none;border:0;font:inherit;max-width:260px;overflow:hidden;text-overflow:ellipsis}
|
|
57
57
|
#connCrumb .seg:hover{color:var(--text);text-decoration:underline}
|
|
58
58
|
#connCrumb .seg.cur{color:var(--brand);font-weight:600;cursor:default;text-decoration:none}
|
|
@@ -804,7 +804,7 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
804
804
|
circle.handle.ep-end{fill:#f472b6;stroke:#0b1220;stroke-width:2}
|
|
805
805
|
.epdot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:5px;vertical-align:middle}
|
|
806
806
|
/* 3D-only floating chrome (parity with AWARE viewer-3d): toolbar TL, legend BL, ViewCube BR */
|
|
807
|
-
#m3dBar{position:absolute;top:12px;left:12px;right:12px;display:none;flex-wrap:wrap;gap:6px;align-items:center;z-index:59} /* bounded to the stage so narrow windows wrap this local toolbar instead of widening the whole document; above
|
|
807
|
+
#m3dBar{position:absolute;top:12px;left:12px;right:12px;display:none;flex-wrap:wrap;gap:6px;align-items:center;z-index:59} /* bounded to the stage so narrow windows wrap this local toolbar instead of widening the whole document; above the model-glued label chips (z:3-4, under the 3D chrome — #614), below toasts (60) */
|
|
808
808
|
#m3dBar .seg-group,#m3dBar>button{box-shadow:0 4px 14px rgba(0,0,0,.45)}
|
|
809
809
|
#m3dBar>button{font-size:12px;padding:5px 9px}
|
|
810
810
|
#m3dBar .m3dwrap{position:relative;display:inline-flex}
|
|
@@ -2535,8 +2535,7 @@ function main() {
|
|
|
2535
2535
|
*
|
|
2536
2536
|
* v2's schema CLOSED both of those. Running v1's repair pass over a v2 document therefore does exactly the
|
|
2537
2537
|
* wrong thing in both directions, and it is not theoretical — it is what the schema check measured:
|
|
2538
|
-
* - it ADDS keys v2 forbids: `
|
|
2539
|
-
* `views[].projection` (v2 keeps the projection inside `camera.proj`);
|
|
2538
|
+
* - it ADDS keys v2 forbids: `views[].projection` (v2 keeps the projection inside `camera.proj`);
|
|
2540
2539
|
* - it DROPS a key v2 requires: `views[].generated.axisId`, because v1's generated-view provenance is
|
|
2541
2540
|
* keyed by label and elevation, and a canonical grid is referenced by stable axis id instead.
|
|
2542
2541
|
* The second is data loss, and both land before the user has done anything — so the first save is refused
|
|
@@ -2544,6 +2543,12 @@ function main() {
|
|
|
2544
2543
|
*
|
|
2545
2544
|
* A v2 document does not need the pass: it arrives SERVER-VALIDATED (P7b validates schema plus referential
|
|
2546
2545
|
* integrity on every PUT), which is a stronger guarantee than any of these clamps.
|
|
2546
|
+
*
|
|
2547
|
+
* EXCEPT `sanitizePropLabels`, WHICH NOW RUNS ON BOTH (#614). It was on this list for one key —
|
|
2548
|
+
* `prop_labels.vis2d`/`vis3d`, v1's per-view label visibility, which v2's closed `propLabels` refused.
|
|
2549
|
+
* The schema carries both now, so nothing it writes is forbidden, and skipping it is what left
|
|
2550
|
+
* `C.prop_labels` possibly absent on a v2 document while the label readers dereference `pl.props`. See
|
|
2551
|
+
* its call site for the full argument.
|
|
2547
2552
|
*/
|
|
2548
2553
|
if(!MODEL_V2)C.member_styles=sanitizeMemberStyles(C.member_styles); // v2 arrives closed + validated; v1 needs repair
|
|
2549
2554
|
let P, X0,Y0,X1,Y1, FT, RB64, EXTX, EXTY, profs, NO_PLAN_VIEW=false; // per-plan, set by setPlan()
|
|
@@ -3390,6 +3395,14 @@ function applyDraftFields(d){
|
|
|
3390
3395
|
const candidate=structuredClone(C);
|
|
3391
3396
|
const rootKeys=['members','grid','custom_details','profile_colors','member_styles','member_types','target_confidence','dims3d','dim_overlays','dim_style','prop_labels','joints','connections','detail_placements','views'];
|
|
3392
3397
|
for(const key of rootKeys)if(key in d)candidate[key]=structuredClone(d[key]);
|
|
3398
|
+
// …EXCEPT `prop_labels`, WHICH IS SANITISED LIKE THE v1 ARM DOES (#614). A draft is unvalidated
|
|
3399
|
+
// localStorage, and this restore runs AFTER the boot-time sanitise — so a raw copy re-introduces
|
|
3400
|
+
// exactly the shape that sanitise exists to prevent: `prop_labels` with no `props`, which
|
|
3401
|
+
// `renderPropLabels` dereferences on the next repaint. Reachable today, not hypothetically: a
|
|
3402
|
+
// migrated document legitimately has no `props` (remapPropLabels emits it only when the v1 side had
|
|
3403
|
+
// an array), and any draft written by a build that did not sanitise on v2 carries that shape
|
|
3404
|
+
// forward. The v1 arm below has always done this; the asymmetry was the bug. (Found by review.)
|
|
3405
|
+
if('prop_labels' in d)candidate.prop_labels=sanitizePropLabels(d.prop_labels);
|
|
3393
3406
|
// REFERENCES ARE RECONCILED, NEVER REPLACED — and this is not tidiness, it is a reference that
|
|
3394
3407
|
// vanished in front of me. Which references EXIST is the server's answer: insert and remove are
|
|
3395
3408
|
// routes that write the contract themselves, and `adoptReferenceWrite` then re-points this draft at
|
|
@@ -4972,13 +4985,13 @@ function updateBadges(){const R=12/zoom,F=13/zoom,ox=el=>(+el.dataset.fi-(+el.da
|
|
|
4972
4985
|
// threshold live (data-mlen × zoom), so zooming reveals/hides labels as members cross ~24px on screen.
|
|
4973
4986
|
{const plG=svg.querySelector('g.pllabels');if(plG){let hid=0;
|
|
4974
4987
|
plG.querySelectorAll('rect.plchip').forEach(r=>{const w=(+r.dataset.tw*6.4+12)/zoom,h=15/zoom,cy=(+r.dataset.ay)+(+r.dataset.off)/zoom;
|
|
4975
|
-
const show=(+r.dataset.mlen)
|
|
4988
|
+
const show=plabelVisible(+r.dataset.mlen);r.style.display=show?'':'none';if(!show)hid++;
|
|
4976
4989
|
r.setAttribute('width',w);r.setAttribute('height',h);r.setAttribute('x',(+r.dataset.ax)-w/2);r.setAttribute('y',cy-h/2);});
|
|
4977
|
-
plG.querySelectorAll('text.pltx').forEach(t=>{const show=(+t.dataset.mlen)
|
|
4990
|
+
plG.querySelectorAll('text.pltx').forEach(t=>{const show=plabelVisible(+t.dataset.mlen);t.style.display=show?'':'none';t.setAttribute('y',(+t.dataset.ay)+(+t.dataset.off)/zoom);t.style.fontSize=(11/zoom)+'px';});
|
|
4978
4991
|
propLabelsHidden=hid;updatePropHint();}} // hid counts hidden chip ROWS (>0 ⇒ note shows) — the note only needs the boolean
|
|
4979
4992
|
{const mlG=svg.querySelector('g.mlenlabels');if(mlG){ // on-select length chips: same zoom-rescale + threshold as the property chips
|
|
4980
|
-
mlG.querySelectorAll('rect.mlenchip').forEach(r=>{const w=(+r.dataset.tw*6.4+12)/zoom,h=15/zoom,cx=(+r.dataset.mx)+(+r.dataset.nx)*(+r.dataset.base)/zoom,cy=(+r.dataset.my)+(+r.dataset.ny)*(+r.dataset.base)/zoom,show=(+r.dataset.mlen)
|
|
4981
|
-
mlG.querySelectorAll('text.mlentx').forEach(t=>{const show=(+t.dataset.mlen)
|
|
4993
|
+
mlG.querySelectorAll('rect.mlenchip').forEach(r=>{const w=(+r.dataset.tw*6.4+12)/zoom,h=15/zoom,cx=(+r.dataset.mx)+(+r.dataset.nx)*(+r.dataset.base)/zoom,cy=(+r.dataset.my)+(+r.dataset.ny)*(+r.dataset.base)/zoom,show=plabelVisible(+r.dataset.mlen);r.style.display=show?'':'none';r.setAttribute('width',w);r.setAttribute('height',h);r.setAttribute('x',cx-w/2);r.setAttribute('y',cy-h/2);});
|
|
4994
|
+
mlG.querySelectorAll('text.mlentx').forEach(t=>{const show=plabelVisible(+t.dataset.mlen);t.style.display=show?'':'none';t.setAttribute('x',(+t.dataset.mx)+(+t.dataset.nx)*(+t.dataset.base)/zoom);t.setAttribute('y',(+t.dataset.my)+(+t.dataset.ny)*(+t.dataset.base)/zoom);t.style.fontSize=(11/zoom)+'px';});}}
|
|
4982
4995
|
const cg=svg.querySelector('g.csglyph');if(cg&&P.frame)cg.outerHTML=axisGlyphSvg(P.frame.o,P.frame.u,false);} // glyph is sized in 1/zoom → regenerate on zoom (like the dim chips)
|
|
4983
4996
|
function updateHandles(m){svg.querySelectorAll(`circle.handle[data-mid="${m.id}"]`).forEach(h=>{const i=+h.dataset.h;h.setAttribute('cx',m.wp[i][0]);h.setAttribute('cy',m.wp[i][1]);});}
|
|
4984
4997
|
function updateLine(m){
|
|
@@ -6254,13 +6267,39 @@ function v2CanonicalMember(id){
|
|
|
6254
6267
|
function _lenFt(m){
|
|
6255
6268
|
if(MODEL_V2&&m){const canon=v2CanonicalMember(m.id);if(canon)return modelReadsV2().lengthFt(canon);}
|
|
6256
6269
|
return _len3dFt(m,FT,defaultTOS);}
|
|
6270
|
+
/*
|
|
6271
|
+
* THE LABEL'S LENGTH, WHICH IS `undefined` WHERE THERE ISN'T ONE.
|
|
6272
|
+
*
|
|
6273
|
+
* `_lenFt` answers 0 for a member whose geometry cannot be resolved — a v2 member with an
|
|
6274
|
+
* `{unknown:true}` elevation has no third dimension to measure. That is a defensible number for a total
|
|
6275
|
+
* (the header adds it), and a lie in a chip: measured by the independent QA, a beam with a 25 ft plan run
|
|
6276
|
+
* and unresolved elevations printed `Length: 0.0 ft` and `Weight: 0 lb` beside it, as fact. The TOS rows
|
|
6277
|
+
* already refuse this by returning `undefined` for an unknown elevation, and the schema's own `elevation`
|
|
6278
|
+
* note says an unknown must never be substituted with a default — this is the same rule, one property
|
|
6279
|
+
* over.
|
|
6280
|
+
*
|
|
6281
|
+
* SCOPED TO THE LABELS deliberately: the header total, the Inspect readout and the BOM all read `_lenFt`
|
|
6282
|
+
* and all report the same 0 today. That is a wider question about what a total should say when part of
|
|
6283
|
+
* it is unknown, and it is not this change's to answer — a chip stating a length that was never read is.
|
|
6284
|
+
*
|
|
6285
|
+
* WHICH IS WHY IT IS A `labelGet`, NOT THE ROW'S `get`. `PROP_DEFS[].get` has a second consumer:
|
|
6286
|
+
* `propAggRow` aggregates it across the selection, and `renderPropPop` DISABLES the row when every
|
|
6287
|
+
* member answers undefined. Wiring this into `get` therefore greyed out Length and Weight whenever the
|
|
6288
|
+
* selection was exactly the member that could not be measured — which is the natural member to
|
|
6289
|
+
* right-click, and the checkbox it blocks is plan-wide. Found by review, one round after the QA run that
|
|
6290
|
+
* produced this helper. The popup keeps aggregating the measurable answer; only the chip refuses.
|
|
6291
|
+
*/
|
|
6292
|
+
function _lenFtLabel(m){
|
|
6293
|
+
if(MODEL_V2&&m){const canon=v2CanonicalMember(m.id);if(canon&&!SteelCore.memberGeometryV2(canon))return undefined;}
|
|
6294
|
+
const v=_lenFt(m);
|
|
6295
|
+
return (Number.isFinite(v)&&v>0)?v:undefined;}
|
|
6257
6296
|
const PROP_DEFS=[
|
|
6258
6297
|
{key:'id', label:'Mark', get:m=>m.id, fmt:v=>v==null?'':String(v)},
|
|
6259
6298
|
{key:'profile', label:'Profile', get:m=>m.profile, fmt:v=>v==null?'':String(v)},
|
|
6260
6299
|
{key:'type', label:'Type', get:m=>memberTypeLabel(memberTypeOf(m)), fmt:v=>v==null?'':String(v)},
|
|
6261
6300
|
{key:'role', label:'Role', get:m=>m.role==='column'?'Column':'Beam', fmt:v=>v||''},
|
|
6262
|
-
{key:'length', label:'Length', get:m=>_lenFt(m),
|
|
6263
|
-
{key:'weight', label:'Weight', get:m=>{const w=_wt(m.profile);return w==null?undefined:_lenFt(m)*w;}, fmt:v=>v==null?'':Math.round(v).toLocaleString()+' lb'},
|
|
6301
|
+
{key:'length', label:'Length', get:m=>_lenFt(m), labelGet:m=>_lenFtLabel(m), fmt:v=>v==null?'':v.toFixed(1)+' ft'},
|
|
6302
|
+
{key:'weight', label:'Weight', get:m=>{const w=_wt(m.profile);return w==null?undefined:_lenFt(m)*w;}, labelGet:m=>{const w=_wt(m.profile),l=_lenFtLabel(m);return (w==null||l==null)?undefined:l*w;}, fmt:v=>v==null?'':Math.round(v).toLocaleString()+' lb'},
|
|
6264
6303
|
{key:'position', label:'Position', get:m=>m.role==='column'?undefined:posDefault(m), fmt:v=>v?v[0].toUpperCase()+v.slice(1):''},
|
|
6265
6304
|
// undefined wherever the concept itself is undefined (a column, a plumb member, an unresolved profile) —
|
|
6266
6305
|
// the label must never print a justification the bake ignores.
|
|
@@ -6288,23 +6327,37 @@ function sanitizePropLabels(x){const o=(x&&typeof x==='object'&&!Array.isArray(x
|
|
|
6288
6327
|
selected_only:o.selected_only===true,
|
|
6289
6328
|
vis2d:o.vis2d!==false,vis3d:o.vis3d!==false, // per-view label VISIBILITY (B1): default ON; the property SELECTION (props) stays shared across 2D+3D — only show/hide is independent
|
|
6290
6329
|
ids:Array.isArray(o.ids)?o.ids.filter(v=>typeof v==='string'):[]};}
|
|
6291
|
-
//
|
|
6292
|
-
//
|
|
6293
|
-
//
|
|
6294
|
-
|
|
6330
|
+
// PROP_LABELS IS SANITISED ON BOTH FORMATS (#614), and it is the ONE member of the repair-pass family
|
|
6331
|
+
// that is — see the note at the top of main() for why the others stay v1-only. It was excluded for one
|
|
6332
|
+
// reason: it materialises `vis2d`/`vis3d`, which v2's closed `prop_labels` refused, so running it added
|
|
6333
|
+
// keys that made the user's first save fail for an edit they never made. Now that the schema carries both
|
|
6334
|
+
// flags, every key it writes is legal on v2, and NOT running it is the defect — `propLabelLinesFor` and
|
|
6335
|
+
// `renderPropLabels` read `pl.props.length` on a document that may carry no `prop_labels` at all, which
|
|
6336
|
+
// is the TypeError the original v2 attempt hit and mis-attributed to the label derivation.
|
|
6337
|
+
//
|
|
6338
|
+
// Its siblings are still refused, and the reason is unchanged: `sanitizeViews` DROPS `views[].generated
|
|
6339
|
+
// .axisId` (v2 requires it — data loss) and adds `views[].projection` (v2 keeps that in `camera.proj`).
|
|
6295
6340
|
C.prop_labels=sanitizePropLabels(C.prop_labels); // normalise the contract's incoming value now (PROP_KEYS is initialised above; runs before main's bootstrap render + restoreSaved override)
|
|
6341
|
+
if(!MODEL_V2){
|
|
6296
6342
|
C.views=sanitizeViews(C.views); // normalise the incoming saved views now — inside main() where sanitizeViews is in scope (boot() only guaranteed an array); runs before the bootstrap render + restoreSaved override, same pattern as prop_labels above
|
|
6297
6343
|
if(SteelCore)C.dims3d=SteelCore.sanitizeDims3d(C.dims3d); // UCS Stage 5: canonicalise each 3D dim's axisDir (drop junk / normalise non-unit) so a bad value can't wedge the schema-validated save — the SERVER contract copy; restoreSaved re-sanitises the localStorage draft below
|
|
6298
6344
|
}
|
|
6299
6345
|
// the "Label: value" lines a member contributes for the currently-checked props (registry order; skips N/A + empty)
|
|
6300
6346
|
function propLabelLinesFor(m){const pl=C.prop_labels;if(!pl||!pl.props.length)return [];ensureMeta(m);
|
|
6301
|
-
const out=[];for(const def of PROP_DEFS){if(!pl.props.includes(def.key))continue;const raw=def.get(m);if(raw===undefined)continue;const t=def.fmt(raw);if(t==='')continue;out.push(def.label+': '+t);}return out;}
|
|
6347
|
+
const out=[];for(const def of PROP_DEFS){if(!pl.props.includes(def.key))continue;const raw=(def.labelGet||def.get)(m);if(raw===undefined)continue;const t=def.fmt(raw);if(t==='')continue;out.push(def.label+': '+t);}return out;}
|
|
6302
6348
|
// members that actually get a label, honouring the plan-wide-vs-selected-only scope
|
|
6303
6349
|
function propLabelMembers(){const pl=C.prop_labels;if(!pl||!pl.props.length)return [];
|
|
6304
|
-
// PER-SHEET
|
|
6305
|
-
// plan-local PIXEL coordinates into the ACTIVE sheet's SVG, so an off-sheet member would be
|
|
6306
|
-
// the wrong place on any multi-sheet project. A repair briefly widened this to allMembers()
|
|
6307
|
-
// v2 TypeError and introduced exactly that regression
|
|
6350
|
+
// PER-SHEET ON BOTH FORMATS, and that is not incidental: renderPropLabels draws each chip at the
|
|
6351
|
+
// member's plan-local PIXEL coordinates into the ACTIVE sheet's SVG, so an off-sheet member would be
|
|
6352
|
+
// painted in the wrong place on any multi-sheet project. A repair briefly widened this to allMembers()
|
|
6353
|
+
// to stop a v2 TypeError and introduced exactly that regression.
|
|
6354
|
+
//
|
|
6355
|
+
// ON v2 `P` IS THE PROJECTION, so `P.members` is the active sheet's projected members — the same scope,
|
|
6356
|
+
// reached a different way. That has a consequence worth naming rather than leaving to be discovered:
|
|
6357
|
+
// the 3D view's own member list IS model-wide, so on a multi-sheet v2 model the 3D chips cover only the
|
|
6358
|
+
// active sheet's members. v1 behaves identically (`getMembers` returns `P.members` there too), so it is
|
|
6359
|
+
// parity, not a v2 regression — but it is a limit, and an earlier version of this comment implied the
|
|
6360
|
+
// v2 arm had been given a model-wide list, which it has not. (Found by review.)
|
|
6308
6361
|
let base=P.members;
|
|
6309
6362
|
if(pl.selected_only){const ids=new Set(pl.ids||[]);base=base.filter(m=>ids.has(m.id));}
|
|
6310
6363
|
return base.filter(m=>propLabelLinesFor(m).length>0);}
|
|
@@ -6321,6 +6374,32 @@ let propLabelsHidden=0;
|
|
|
6321
6374
|
// A member's labels hide when its on-screen length < this (px) — the density guard (§5.5). Kept as one
|
|
6322
6375
|
// constant so renderPropLabels (initial paint) and updateBadges (live on zoom) agree.
|
|
6323
6376
|
const PLABEL_MIN_PX=24;
|
|
6377
|
+
/*
|
|
6378
|
+
* …AND A MEMBER WITH NO PLAN RUN IS EXEMPT FROM IT. The ORDINARY column — authored as a coincident point
|
|
6379
|
+
* symbol, which is what the reader emits and what the plan draws — has a drawn line of length 0, so
|
|
6380
|
+
* `mlen * zoom` is 0 at every zoom and it could never carry a 2D chip. It also fed the "Labels hidden —
|
|
6381
|
+
* zoom in" pill, which therefore stayed up permanently while zooming did nothing about it. Measured by
|
|
6382
|
+
* the independent QA at 119 / 156 / 291 / 400% (the maximum): still hidden.
|
|
6383
|
+
*
|
|
6384
|
+
* "ordinary", not "every" — the same absolute review caught two commits ago on this branch. A raking or
|
|
6385
|
+
* battered column has two distinct plan points and a real run, and takes the ordinary arm.
|
|
6386
|
+
*
|
|
6387
|
+
* The threshold exists to hide a label on a member too SHORT TO READ ALONG. A point is not short; it has
|
|
6388
|
+
* no length to be short. So the rule is "if it has a run, the run must be legible", and a member without
|
|
6389
|
+
* one is drawn.
|
|
6390
|
+
*
|
|
6391
|
+
* ONE PREDICATE FOR ALL FIVE CALL SITES — the property chips (initial paint + both halves of
|
|
6392
|
+
* updateBadges' live re-apply) and the on-select member-length chips (the same three, minus one that
|
|
6393
|
+
* gates on 3D length instead). They were five copies of one inequality; converting three would have left
|
|
6394
|
+
* a column labelled by ⋯ Display → Property labels and unlabelled by ⋯ Display → Show member length, in
|
|
6395
|
+
* the same view, having already shown its length in 3D (refreshSelLen3d gates on the 3D length, which is
|
|
6396
|
+
* why the inconsistency was visible rather than merely latent).
|
|
6397
|
+
*
|
|
6398
|
+
* WHAT THIS DOES NOT FIX, stated because the pill's copy promises it: a member with a real but tiny run
|
|
6399
|
+
* still hides below `PLABEL_MIN_PX / ZMAX` = 6 plan px, and "zoom in" cannot rescue it. The class is now
|
|
6400
|
+
* "a stub under ~6 px" instead of "every column".
|
|
6401
|
+
*/
|
|
6402
|
+
const plabelVisible=mlen=>!(mlen>0)||mlen*zoom>=PLABEL_MIN_PX;
|
|
6324
6403
|
// On-select member-length chips (2D): when the ⋯ Display "Show member length" toggle is on, paint each selected
|
|
6325
6404
|
// member's true 3D length at its midpoint, nudged perpendicular off the line (fixed relative to member direction).
|
|
6326
6405
|
// Cyan dimension chips; the member being end-dragged is skipped (its live overlay covers it); coincident midpoints
|
|
@@ -6334,7 +6413,7 @@ function renderSelLenLabels(){if(!showSelLen)return '';const selM=sel2d();if(!se
|
|
|
6334
6413
|
const lenFt=_lenFt(m);if(!(lenFt>0)||!isFinite(lenFt))return; // skip degenerate/NaN geometry — never paint an empty "len " chip
|
|
6335
6414
|
const dx=b[0]-a[0],dy=b[1]-a[1],dl=Math.hypot(dx,dy)||1,nx=-dy/dl,ny=dx/dl,base=18+(j-(n-1)/2)*16,mlen=len(a,b);
|
|
6336
6415
|
const txt='len '+fmtFtIn(lenFt*12),tw=txt.length,w=(tw*6.4+12)/zoom,hh=15/zoom,cx=mid[0]+nx*base/zoom,cy=mid[1]+ny*base/zoom;
|
|
6337
|
-
const show=mlen
|
|
6416
|
+
const show=plabelVisible(mlen),hide=show?'':';display:none',dd=`data-mx="${mid[0]}" data-my="${mid[1]}" data-nx="${nx}" data-ny="${ny}" data-base="${base}" data-mlen="${mlen}"`;
|
|
6338
6417
|
s+=`<rect class=mlenchip ${dd} data-tw="${tw}" x="${cx-w/2}" y="${cy-hh/2}" width="${w}" height="${hh}" rx="${3/zoom}" style="${hide}"/>`
|
|
6339
6418
|
+`<text class=mlentx ${dd} x="${cx}" y="${cy}" style="font-size:${11/zoom}px${hide}">${esc(txt)}</text>`;});}
|
|
6340
6419
|
return s?`<g class="mlenlabels">${s}</g>`:'';}
|
|
@@ -6345,7 +6424,7 @@ function renderPropLabels(){const pl=C.prop_labels;propLabelsHidden=0;if(!pl||!p
|
|
|
6345
6424
|
// only sets each chip's initial visibility. updateBadges re-applies it live as the user zooms — so
|
|
6346
6425
|
// zooming in reveals a hidden label and zooming out hides it (they're in the DOM either way).
|
|
6347
6426
|
for(const m of ms){const lines=propLabelLinesFor(m);if(!lines.length)continue;
|
|
6348
|
-
const vl=memberViewLine(m),a=vl[0],b=vl[1],mlen=len(a,b);const show=mlen
|
|
6427
|
+
const vl=memberViewLine(m),a=vl[0],b=vl[1],mlen=len(a,b);const show=plabelVisible(mlen);if(!show)hidden++; // chips ride the DRAWN line (offset brace included)
|
|
6349
6428
|
const anc=pl.placement==='start'?a:pl.placement==='end'?b:[(a[0]+b[0])/2,(a[1]+b[1])/2];
|
|
6350
6429
|
const n=lines.length,hide=show?'':';display:none';
|
|
6351
6430
|
lines.forEach((txt,i)=>{const off=(i-(n-1)/2)*15,tw=txt.length,w=(tw*6.4+12)/zoom,h=15/zoom,cy=anc[1]+off/zoom;
|
|
@@ -6354,6 +6433,15 @@ function renderPropLabels(){const pl=C.prop_labels;propLabelsHidden=0;if(!pl||!p
|
|
|
6354
6433
|
propLabelsHidden=hidden;
|
|
6355
6434
|
return `<g class="pllabels">${s}</g>`;}
|
|
6356
6435
|
// fixed-screen corner note when the zoom threshold is hiding labels (an HTML pill, outside the zoomed SVG)
|
|
6436
|
+
//
|
|
6437
|
+
// A SECOND MESSAGE WAS ADDED HERE AND REMOVED, and the reason is worth keeping. The UX review noted that
|
|
6438
|
+
// "visibility on, no properties ticked" leaves a toggle reading on over a canvas with no chips — true, and
|
|
6439
|
+
// "Clear all" reaches it in one click. But `props: []` with visibility on is not an anomaly, it is the
|
|
6440
|
+
// RESTING STATE OF EVERY DOCUMENT: `sanitizePropLabels` writes `props: []` and defaults both flags on, and
|
|
6441
|
+
// the reader emits the same empty skeleton. So the predicate that was supposed to explain a rare state
|
|
6442
|
+
// matched every project that had never used the feature, and parked a permanent pill telling the user to
|
|
6443
|
+
// right-click a member. Measured by review, not reasoned about. The honest place for that explanation is
|
|
6444
|
+
// the popup where "Clear all" lives, not the canvas.
|
|
6357
6445
|
function updatePropHint(){let el=document.getElementById('plHint');
|
|
6358
6446
|
const show=!view3d&&propLabelsHidden>0;
|
|
6359
6447
|
if(!show){if(el)el.style.display='none';return;}
|
|
@@ -7472,9 +7560,11 @@ document.getElementById('calloutToggleB').onclick=e=>{e.stopPropagation();if(MOD
|
|
|
7472
7560
|
// first repaint after boot — the row would silently go live and lose its screen-reader reason. A
|
|
7473
7561
|
// mutation run proved the shape passes the suite unless it is asserted after an op, which is why
|
|
7474
7562
|
// steel-editor-v2.test.ts re-asserts this row's whole state following a render.
|
|
7475
|
-
//
|
|
7476
|
-
//
|
|
7477
|
-
//
|
|
7563
|
+
// The `C.prop_labels &&` term is not belt-and-braces: sanitizePropLabels materialises the object on
|
|
7564
|
+
// every document now (#614), but this runs on EVERY render and a future path that replaces the contract
|
|
7565
|
+
// wholesale would reach it first. (It used to be load-bearing for a different reason — the sanitiser was
|
|
7566
|
+
// v1-only, so a v2 document arrived with no `prop_labels` at all. That is no longer the case, and the
|
|
7567
|
+
// paragraph claiming plVis short-circuits to false on v2 went with it: plVis now reads the flag.)
|
|
7478
7568
|
function updPlToggle(){const b=document.getElementById('plToggleB');if(b){const on=!!(C.prop_labels&&plVis(false));b.classList.toggle('on',on);b.setAttribute('aria-checked',String(on));}} // B1: 2D property-label visibility (independent of 3D)
|
|
7479
7569
|
document.getElementById('plToggleB').onclick=e=>{e.stopPropagation();if(!canWritePropLabelVis())return;C.prop_labels.vis2d=!C.prop_labels.vis2d;updPlToggle();refreshPropLabels();}; // refreshPropLabels → scheduleSave()+render(): repaints the 2D chips (gated by vis2d) and persists the choice
|
|
7480
7570
|
// MODEL_RO is a term here in its own right, NOT covered by !hasOverlay(): `filter` is a legal v2 root key
|
|
@@ -7566,26 +7656,30 @@ function roLock(el){
|
|
|
7566
7656
|
el.style.opacity='.4';el.style.pointerEvents='none';el.style.cursor='default';
|
|
7567
7657
|
return el;}
|
|
7568
7658
|
/**
|
|
7569
|
-
* The two controls that set the per-view label flag
|
|
7659
|
+
* The two controls that set the per-view label flag: make each REPORT the flag, and disable it only when
|
|
7660
|
+
* the document cannot take the write.
|
|
7570
7661
|
*
|
|
7571
7662
|
* Separate from applyReadOnlyChrome's anchor list because `m3dPropLabels` lives in the 3D legend, which is
|
|
7572
7663
|
* built lazily by build3DLegend() long after boot; disabling it once at boot would miss it.
|
|
7573
7664
|
*/
|
|
7574
7665
|
function roDisablePropLabelToggles(){
|
|
7575
|
-
// MODEL_V2, not MODEL_RO: the flag has no home in v2's closed `prop_labels` whether or not the document
|
|
7576
|
-
// is writable, so a live v2 model must disable these two exactly as a read-only one did. Leaving them
|
|
7577
|
-
// enabled over a refused write is the silent no-op this whole mode exists to avoid.
|
|
7578
|
-
if(!MODEL_V2)return;
|
|
7579
7666
|
for(const id of ['plToggleB','m3dPropLabels']){
|
|
7580
7667
|
const el=document.getElementById(id);
|
|
7581
7668
|
if(!el)continue;
|
|
7582
|
-
|
|
7583
|
-
//
|
|
7584
|
-
//
|
|
7585
|
-
//
|
|
7586
|
-
//
|
|
7587
|
-
//
|
|
7669
|
+
// THE STATE SYNC IS UNCONDITIONAL, and an early `if(canWritePropLabelVis())return;` was the first cut
|
|
7670
|
+
// of this repair — which quietly DELETED the one thing keeping `m3dPropLabels` honest at boot (#614).
|
|
7671
|
+
// It is static markup carrying `checked`, and nothing else syncs it until the user opens the View
|
|
7672
|
+
// menu, so a document holding `vis3d:false` would render its first frame — and answer a screen reader —
|
|
7673
|
+
// "checked" for a flag plVis reads false. That lie used to be impossible only because every v2
|
|
7674
|
+
// document reached the disabled branch; making them writable is exactly what exposed it. The 2D row
|
|
7675
|
+
// needs no help here (updPlToggle derives `on` and aria-checked from plVis on every render), but it
|
|
7676
|
+
// costs nothing and keeps the two controls under one rule. (Found by the UX review of this change.)
|
|
7588
7677
|
if(el.type==='checkbox')el.checked=plVis(id==='m3dPropLabels');
|
|
7678
|
+
// WRITABILITY, not format. This read `MODEL_V2` while v2's closed `prop_labels` had no home for the
|
|
7679
|
+
// flag — a live v2 model had to disable these two exactly as a read-only one did, because leaving them
|
|
7680
|
+
// enabled over a refused write is the silent no-op that mode exists to avoid. v2 has the home now, so
|
|
7681
|
+
// the only remaining reason to grey them is a document that refuses every write.
|
|
7682
|
+
el.disabled=!canWritePropLabelVis();
|
|
7589
7683
|
// The ribbon only renders under `body.model-ro`, so pointing a LIVE v2 control at it would name an
|
|
7590
7684
|
// element that is not on the page — and its text says the whole model is read-only, which is no longer
|
|
7591
7685
|
// true here. Describe it only where the ribbon actually exists.
|
|
@@ -8129,37 +8223,43 @@ async function sendSelectionToHost(host,ids,hostPid){
|
|
|
8129
8223
|
* and it is worse here, because a wrong position looks right.
|
|
8130
8224
|
*/
|
|
8131
8225
|
/**
|
|
8132
|
-
* PROPERTY-LABEL VISIBILITY
|
|
8133
|
-
*
|
|
8134
|
-
*
|
|
8135
|
-
*
|
|
8136
|
-
*
|
|
8137
|
-
*
|
|
8138
|
-
*
|
|
8139
|
-
*
|
|
8140
|
-
*
|
|
8141
|
-
*
|
|
8142
|
-
*
|
|
8143
|
-
*
|
|
8144
|
-
*
|
|
8145
|
-
*
|
|
8146
|
-
*
|
|
8147
|
-
*
|
|
8148
|
-
*
|
|
8149
|
-
*
|
|
8150
|
-
*
|
|
8151
|
-
*
|
|
8152
|
-
*
|
|
8153
|
-
*
|
|
8154
|
-
*
|
|
8155
|
-
*
|
|
8156
|
-
*
|
|
8157
|
-
*
|
|
8158
|
-
*
|
|
8159
|
-
*
|
|
8226
|
+
* PROPERTY-LABEL VISIBILITY — one flag, both formats (#614).
|
|
8227
|
+
*
|
|
8228
|
+
* HISTORY, because the shape of the repair follows from it. v1's `prop_labels` is
|
|
8229
|
+
* `additionalProperties: true` and the editor stores a per-view `vis2d`/`vis3d` there. v2 CLOSED that
|
|
8230
|
+
* object to `props`/`placement`/`selected_only`/`ids`, so unit 5 (P7d) refused the write and disabled the
|
|
8231
|
+
* two controls: leaving a live-looking toggle over a refused write is the silent no-op that mode existed
|
|
8232
|
+
* to remove, and writing the key anyway would corrupt the document so the NEXT save is refused for a
|
|
8233
|
+
* toggle the user flicked.
|
|
8234
|
+
*
|
|
8235
|
+
* That was right about the schema and wrong about the feature. Two causes were tangled in one flag and
|
|
8236
|
+
* only one was real:
|
|
8237
|
+
*
|
|
8238
|
+
* 1. REAL — v2 had nowhere to keep the flag. Fixed where it belonged, in the schema: `propLabels` now
|
|
8239
|
+
* carries `vis2d`/`vis3d`. It is closed to keep `ids` accountable to identity migration, not to
|
|
8240
|
+
* withhold display state, and `props`/`placement`/`selected_only`/`ids` were always accepted.
|
|
8241
|
+
* A browser-local store was the cheaper alternative and was rejected: the property SELECTION already
|
|
8242
|
+
* travels in the document, so keeping only show/hide per machine would open the same project on
|
|
8243
|
+
* another machine with the props ticked and the chips missing.
|
|
8244
|
+
* 2. NOT REAL — "nothing behind the flag can produce a correct label for a v2 member". The label
|
|
8245
|
+
* derivation reads `m.profile`, `m.role`, `m.ends[].tos`, `m.col`, and the ACTIVE PLAN's member
|
|
8246
|
+
* list; on v2 the active plan IS `V2_PROJECTION.plan`, and `projectMember()` emits exactly that v1
|
|
8247
|
+
* vocabulary (`web/steel-model-v2-projection.js`). The TypeError that killed the first attempt came
|
|
8248
|
+
* from answering ON while `sanitizePropLabels` was skipped, so `pl.props` was undefined — a missing
|
|
8249
|
+
* normalisation, not a missing derivation. That sanitiser now runs on both formats.
|
|
8250
|
+
*
|
|
8251
|
+
* ABSENT MEANS ON, and the `!== false` below is what says so. Both formats normalise at boot, so the
|
|
8252
|
+
* default is not what an ordinary open depends on — it is defence for the values that reach `plVis`
|
|
8253
|
+
* around that: the v2 draft restore (whose own sanitise this change also added), and a MIGRATED
|
|
8254
|
+
* document, since v1 only persists these flags once its editor has saved and migration cannot carry
|
|
8255
|
+
* what was never written. Reading either as "off" hides chips for properties the user has ticked.
|
|
8256
|
+
*
|
|
8257
|
+
* THE GATE ASKS WRITABILITY, WHICH IS NOW THE ONLY QUESTION LEFT. It shipped as `canWriteModel()`, was
|
|
8258
|
+
* narrowed to `&& !MODEL_V2` when v2 had no home for the flag, and goes back now that it does — the
|
|
8259
|
+
* format no longer decides anything here.
|
|
8160
8260
|
*/
|
|
8161
|
-
function canWritePropLabelVis(){return canWriteModel()
|
|
8162
|
-
function plVis(is3d){
|
|
8261
|
+
function canWritePropLabelVis(){return canWriteModel();}
|
|
8262
|
+
function plVis(is3d){const pl=C&&C.prop_labels;if(!pl)return false;return (is3d?pl.vis3d:pl.vis2d)!==false;}
|
|
8163
8263
|
/** v2's ONE root member array. Not a plan property — see §8.3 on why reading `C.plans[].members` is worse than useless here. */
|
|
8164
8264
|
function modelMembersV2(){return (C&&Array.isArray(C.members))?C.members:[];}
|
|
8165
8265
|
/** Refuse a read the v2 arm cannot answer truthfully. THROWS — never a default, never a silent empty. */
|
|
@@ -8205,7 +8305,7 @@ function modelReadsV2(){
|
|
|
8205
8305
|
invalidate(){}, // nothing is cached: a v2 member carries its own world-mm coordinates, so there is no per-plan scale to index
|
|
8206
8306
|
geometryOf,
|
|
8207
8307
|
lengthFt(m){const g=geometryOf(m),a=g&&g.line&&g.line[0],b=g&&g.line&&g.line[1];
|
|
8208
|
-
return (a&&b)?Math.hypot(b[0]-a[0],b[1]-a[1],b[2]-a[2])/V2_PT_PER_FT:0;}, // stored world mm → true 3D feet
|
|
8308
|
+
return (a&&b)?Math.hypot(b[0]-a[0],b[1]-a[1],b[2]-a[2])/V2_PT_PER_FT:0;}, // stored world mm → true 3D feet. Unknown/malformed elevations answer 0 here, which the header sums; it is `_lenFtLabel` that turns that into an ABSENT chip rather than a fabricated one (this comment claimed the absence and did not deliver it — #614)
|
|
8209
8309
|
// A v2 member has no owning plan and no scale. This is only ever asked by a WRITE path (the member
|
|
8210
8310
|
// drag, the endpoint drag, split), every one of which is refused — so reaching it is a bug, and a
|
|
8211
8311
|
// throw says so instead of inverting a commit through a fabricated scale.
|
|
@@ -8272,8 +8372,14 @@ const view3dApi={
|
|
|
8272
8372
|
onSelectBatch:({memberIds=[],gridIds=[]},additive)=>{const mids=memberIds.filter(selIdOK),gridAllowed=selGridOK(),gids=gridAllowed?gridIds:[];if(!additive&&(memberIds.length||gridIds.length)&&!mids.length&&!gids.length)return;selDimIds.clear();sel3dDimIds.clear();if(additive){for(const id of mids)selIds.has(id)?selIds.delete(id):selIds.add(id);for(const id of gids)selGridIds.has(id)?selGridIds.delete(id):selGridIds.add(id);}else{selIds=new Set(mids);selGridIds=new Set(gids);if(window.Steel3DView&&window.Steel3DView.setSelectedClips)window.Steel3DView.setSelectedClips([]);}render();if(window.Steel3DView&&window.Steel3DView.refreshDims)window.Steel3DView.refreshDims();}, // Atomic 3D area/direct pick for members + logical grids: filter each class, toggle additively, otherwise replace both selections together.
|
|
8273
8373
|
// THE MEMBER LIST. v1 keeps one per sheet; v2 keeps ONE at the document root, which IS the whole model —
|
|
8274
8374
|
// so for v2 both of these answer the same list, truthfully, rather than the silent [] that reading
|
|
8275
|
-
// `C.plans[].members` would give (§8.3). The view
|
|
8276
|
-
// `model().geometryOf`,
|
|
8375
|
+
// `C.plans[].members` would give (§8.3). The view takes ids and hands the records back to
|
|
8376
|
+
// `model().geometryOf`, which is what makes a v2 record safe to pass through here.
|
|
8377
|
+
//
|
|
8378
|
+
// "read by nothing that assumes `wp`" is what this said, and it was FALSE for two call sites: both 3D
|
|
8379
|
+
// label pools (`syncMemberLabels`, `syncPropLabels`) gated on `Array.isArray(m.wp)` and so skipped
|
|
8380
|
+
// every canonical member — the mark/id labels AND the property labels drew nothing on a v2 model, each
|
|
8381
|
+
// silently. Fixed at those sites (#614) by asking for the work line, the same repair P7d applied to the
|
|
8382
|
+
// reference lines. Stated rather than quietly corrected: the claim was the reason nobody looked.
|
|
8277
8383
|
getMembers:()=>MODEL_V2?modelMembersV2():P.members, // v1: active-sheet members (wp); v2 3D reads canonical world members.
|
|
8278
8384
|
allMembers, // EVERY member in the model — already format-aware (see its definition); the 3D box-select tests all visible meshes, not just the active sheet's
|
|
8279
8385
|
// ── The three reads §8.3 names as plausible-but-FALSE for v2. Each is a v1 PLAN concept, and each has a
|
package/dist/web/workspaces.js
CHANGED
|
@@ -1607,7 +1607,7 @@
|
|
|
1607
1607
|
hostReadinessStates = {};
|
|
1608
1608
|
renderReadinessState = null;
|
|
1609
1609
|
track('workspace_project_opened', { app: p.app }); // a real open (card click or post-create landing)
|
|
1610
|
-
|
|
1610
|
+
resetRevisionState(); closeRevReview(); // fresh project — drop any prior revision state and any open review
|
|
1611
1611
|
// …and any open CONVERSION, for the same reason. The header project combo reaches `openProject`
|
|
1612
1612
|
// without going through `closeProject`, so switching projects under an open migrate modal would
|
|
1613
1613
|
// otherwise leave it on screen bound to `migState.projectId` — the project just navigated away
|
|
@@ -1679,7 +1679,7 @@
|
|
|
1679
1679
|
exportState = null;
|
|
1680
1680
|
hostReadinessStates = {};
|
|
1681
1681
|
renderReadinessState = null;
|
|
1682
|
-
|
|
1682
|
+
resetRevisionState();
|
|
1683
1683
|
stopKnowledgePoll(); kbCloseConfirm(); kbResetViewer(); knowledgeState = null; // the KB pane is per-project — never carry it across
|
|
1684
1684
|
// A STAGED REVIEW IS PER-PROJECT TOO, and the line above is the precedent. Without this the modal
|
|
1685
1685
|
// survived leaving the project: it kept rendering the old project's proposals over the landing, and
|
|
@@ -1698,7 +1698,7 @@
|
|
|
1698
1698
|
// Reset with the rest of the per-project state — this file resets `histDiffSupported` for exactly
|
|
1699
1699
|
// this reason. Bumping the generation also voids any probe still in flight for the closing project.
|
|
1700
1700
|
exportsHasModel = true; modelPresenceGen++;
|
|
1701
|
-
|
|
1701
|
+
closeProjMenu(); applyMode(); syncWorkspaceGuide(); // revision state cleared by resetRevisionState() above
|
|
1702
1702
|
}
|
|
1703
1703
|
document.getElementById('ws-back').addEventListener('click', closeProject);
|
|
1704
1704
|
|
|
@@ -5250,9 +5250,41 @@
|
|
|
5250
5250
|
// no SSE hook — and refreshes History on completion. Cards are DOM-built (textContent, never
|
|
5251
5251
|
// innerHTML) so an AI-supplied error string can never reach the DOM as markup.
|
|
5252
5252
|
let lastRevState = 'none';
|
|
5253
|
-
let revBaseVersion = 0;
|
|
5253
|
+
let revBaseVersion = 0; // the ledger head captured at attach — success = the head advances past it
|
|
5254
|
+
let revBaseProject = null; // …and WHICH project it was captured in; a baseline means nothing anywhere else
|
|
5254
5255
|
let revCardReq = null;
|
|
5255
5256
|
let revisionPoll = null;
|
|
5257
|
+
let revisionGen = 0; // bumped per render AND by openProject/closeProject — see renderRevisionCard
|
|
5258
|
+
let revRequestsFailed = false; // one log per outage, not one per 3-second poll tick
|
|
5259
|
+
/**
|
|
5260
|
+
* Every piece of revision state above is PER-PROJECT, so opening or closing one must clear all of
|
|
5261
|
+
* it — and until this existed only `lastRevState` was. What the other three left behind:
|
|
5262
|
+
*
|
|
5263
|
+
* - `$revisionCard` / `revCardReq`: `openProject` never touched the card, and the only thing that
|
|
5264
|
+
* used to wipe it on a switch was the stale render carrying on with the new project as `current`
|
|
5265
|
+
* — the very bug the guards in `renderRevisionCard` now stop. So the clearing has to be explicit
|
|
5266
|
+
* here, or one failed `/api/requests` for the newly opened project leaves the OLD project's card
|
|
5267
|
+
* standing over it with live buttons: "Review changes" resolving a foreign request id, "Dismiss"
|
|
5268
|
+
* DELETING the previous project's pending read.
|
|
5269
|
+
*
|
|
5270
|
+
* `revBaseVersion` is deliberately NOT reset here, and the reason is worth stating because zeroing
|
|
5271
|
+
* it looks like the same tidy-up. The completion check is `tip.n > revBaseVersion`, and its job (see
|
|
5272
|
+
* the comment at the check) is to keep a bare request DELETE — Dismiss, or the footer's Clear all —
|
|
5273
|
+
* from claiming a read completed. Zeroing on every open turns that into `tip.n > 0`, which ANY
|
|
5274
|
+
* previously committed revision-read satisfies: switch away and back, clear the request from a
|
|
5275
|
+
* second tab, and the card announces a completion that never happened and re-locks exports.
|
|
5276
|
+
* Scoping the baseline to the project it was captured in (`revBaseProject`) fixes the cross-project
|
|
5277
|
+
* miss without widening that window — an unknown project falls back to 0, exactly as a cold page
|
|
5278
|
+
* load always has.
|
|
5279
|
+
*/
|
|
5280
|
+
function resetRevisionState() {
|
|
5281
|
+
lastRevState = 'none';
|
|
5282
|
+
revCardReq = null;
|
|
5283
|
+
revisionGen++; // voids any render still in flight for the project being left
|
|
5284
|
+
stopRevisionPoll();
|
|
5285
|
+
$revisionCard.hidden = true;
|
|
5286
|
+
$revisionCard.replaceChildren();
|
|
5287
|
+
}
|
|
5256
5288
|
const isInitialRevisionRead = (req) => !req || !req.baseVersion || req.baseVersion <= 0;
|
|
5257
5289
|
function stopRevisionPoll() { if (revisionPoll) { clearInterval(revisionPoll); revisionPoll = null; } }
|
|
5258
5290
|
function startRevisionPoll() {
|
|
@@ -5298,6 +5330,7 @@
|
|
|
5298
5330
|
if (bridge.loadRequests) bridge.loadRequests().catch(() => {}); // refresh the footer Requests popover
|
|
5299
5331
|
if (current !== proj) return; // switched away while posting — don't drive the wrong project's card/poll
|
|
5300
5332
|
revBaseVersion = (req && typeof req.baseVersion === 'number') ? req.baseVersion : 0;
|
|
5333
|
+
revBaseProject = proj.id; // the baseline belongs to THIS project — see resetRevisionState
|
|
5301
5334
|
showToast(`${revBaseVersion <= 0 ? 'Initial' : 'Revised'} set queued — ${files.length} file${files.length > 1 ? 's' : ''} for your terminal AI`, 'ok');
|
|
5302
5335
|
lastRevState = 'pending';
|
|
5303
5336
|
startRevisionPoll();
|
|
@@ -5349,10 +5382,34 @@
|
|
|
5349
5382
|
}
|
|
5350
5383
|
|
|
5351
5384
|
async function renderRevisionCard() {
|
|
5352
|
-
|
|
5385
|
+
// GENERATION, not just the captured object — the idiom `refreshModelPresence`/`refreshApprovalState`
|
|
5386
|
+
// already use here, and for the reason `closeProject` bumps THEIR counters: a *close* has to void an
|
|
5387
|
+
// in-flight render, and comparing the project alone cannot see one. `openProject` re-uses the cached
|
|
5388
|
+
// `projects` entry, so closing a project and re-opening it hands back the SAME object — an identity
|
|
5389
|
+
// check passes and the stale render carries on. Bumping per render also settles two renders racing
|
|
5390
|
+
// for one project (the 3s poll can start a second while the first is still out): newest wins.
|
|
5391
|
+
const gen = ++revisionGen;
|
|
5392
|
+
const proj = current;
|
|
5393
|
+
if (!proj) { $revisionCard.hidden = true; return; }
|
|
5353
5394
|
let reqs = [];
|
|
5354
|
-
|
|
5355
|
-
|
|
5395
|
+
// ONCE PER OUTAGE, not once per tick. This runs on a 3-second poll, so an unguarded log turns a
|
|
5396
|
+
// server restart into a wall of red — the same "every open logs an error" noise #600 was written
|
|
5397
|
+
// to remove, and enough to fail the console-clean bar every E2E is held to. Silence was still
|
|
5398
|
+
// wrong (a stuck card had no trace at all), so the first failure speaks and the recovery resets it.
|
|
5399
|
+
try {
|
|
5400
|
+
const b = await api('/api/requests');
|
|
5401
|
+
reqs = Array.isArray(b) ? b : (b.requests || []);
|
|
5402
|
+
revRequestsFailed = false;
|
|
5403
|
+
} catch (e) {
|
|
5404
|
+
if (!revRequestsFailed) console.error('[workspaces] could not load requests for the revision card', e);
|
|
5405
|
+
revRequestsFailed = true;
|
|
5406
|
+
return;
|
|
5407
|
+
}
|
|
5408
|
+
// Superseded while the requests were in flight. Everything past here reads the project and paints
|
|
5409
|
+
// the ONE shared card, so resuming would either throw on a null `current` (the Workspaces
|
|
5410
|
+
// breadcrumb, mid-poll) or paint the old project's revision state over the newly opened one.
|
|
5411
|
+
if (gen !== revisionGen || !current || current.id !== proj.id) return;
|
|
5412
|
+
const mine = reqs.filter((r) => r && r.type === 'revision-read' && r.project === proj.id);
|
|
5356
5413
|
const failed = mine.find((r) => r.status === 'failed');
|
|
5357
5414
|
const staged = mine.find((r) => r.status === 'staged');
|
|
5358
5415
|
const pending = mine.find((r) => r.status === 'pending');
|
|
@@ -5364,23 +5421,35 @@
|
|
|
5364
5421
|
// must NOT show a false "complete" toast or re-lock exports.
|
|
5365
5422
|
if (lastRevState === 'pending' && state === 'none') {
|
|
5366
5423
|
let vr;
|
|
5367
|
-
try { vr = await api(`/api/projects/${encodeURIComponent(
|
|
5368
|
-
catch {
|
|
5424
|
+
try { vr = await api(`/api/projects/${encodeURIComponent(proj.id)}/versions`); }
|
|
5425
|
+
catch (e) { console.error('[workspaces] could not read versions to confirm the revision read', e); return; }
|
|
5426
|
+
// ^ transient — leave lastRevState 'pending'; the poll retries next tick.
|
|
5427
|
+
// THIS one is not transient and does not retry: `openProject`/`closeProject` have already reset
|
|
5428
|
+
// `lastRevState` and stopped the poll, so the pending→none EDGE below is gone for good and the
|
|
5429
|
+
// completion toast for `proj` is DROPPED, not deferred. That is the deliberate trade — the
|
|
5430
|
+
// alternative, which is what shipped before, was to fire "Revision read complete" while another
|
|
5431
|
+
// project is on screen and clear ITS `approvedAt`, attributing one project's read to another.
|
|
5432
|
+
if (gen !== revisionGen || !current || current.id !== proj.id) return;
|
|
5369
5433
|
const tip = (vr.versions || [])[0];
|
|
5370
|
-
|
|
5371
|
-
|
|
5434
|
+
// A baseline captured in ANOTHER project says nothing about this one's ledger, and reading it as
|
|
5435
|
+
// though it did suppressed real completions (attach at head 12 there, a read commits at 4 here —
|
|
5436
|
+
// `4 > 12` is false, so no toast, no re-lock, no repaint, and nothing said). Unknown falls back
|
|
5437
|
+
// to 0, which is what a cold page load has always used.
|
|
5438
|
+
const base = revBaseProject === proj.id ? revBaseVersion : 0;
|
|
5439
|
+
if (tip && tip.kind === 'revision-read' && tip.n > base) {
|
|
5440
|
+
proj.approvedAt = vr.approvedAt || undefined; // the AI read cleared the sign-off (exports re-lock)
|
|
5372
5441
|
// A model may have just come into existence, and the repaints below fire only for the VISIBLE
|
|
5373
5442
|
// pane — which on the drop-a-drawing flow is Drawings, neither of them. Without this the header
|
|
5374
5443
|
// stays gated, telling the user to read a drawing they just finished reading. (approveProject
|
|
5375
5444
|
// re-probes so the ACTION is never blocked; this stops the chrome lying in the meantime.)
|
|
5376
|
-
refreshModelPresence(
|
|
5445
|
+
refreshModelPresence(proj.id, proj.app).catch(() => { /* header stays as-is */ });
|
|
5377
5446
|
// AND the approval state, which model presence alone no longer covers. Before "not reviewable"
|
|
5378
5447
|
// was told apart from "the probe failed", an empty project sat in the ERROR state here and the
|
|
5379
5448
|
// header's click-to-retry quietly repaired it on the next click. That retry is gone by design —
|
|
5380
5449
|
// it cannot help a project that is simply too old — so the read completing, which is the event
|
|
5381
5450
|
// that just made `no-contract` false, has to say so itself. Without this the header keeps
|
|
5382
5451
|
// telling someone to read a drawing they have this second finished reading.
|
|
5383
|
-
refreshApprovalState(
|
|
5452
|
+
refreshApprovalState(proj.id).catch((e) => console.error('[workspaces] approval header did not refresh after the read', e));
|
|
5384
5453
|
if (!$wsHistory.hidden) renderHistory();
|
|
5385
5454
|
// …and the Exports pane, if it is the one showing. "Exports re-lock" was the intent, but
|
|
5386
5455
|
// nothing repainted them: the pane kept its live buttons and its per-destination Details
|