@floless/app 0.131.0 → 0.131.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.
@@ -54980,7 +54980,7 @@ function appVersion() {
54980
54980
  return resolveVersion({
54981
54981
  isSea: isSea2(),
54982
54982
  sqVersionXml: readSqVersionXml(),
54983
- define: true ? "0.131.0" : void 0,
54983
+ define: true ? "0.131.1" : void 0,
54984
54984
  pkgVersion: readPkgVersion()
54985
54985
  });
54986
54986
  }
@@ -54996,7 +54996,7 @@ function resolveChannel(s) {
54996
54996
  function appChannel() {
54997
54997
  return resolveChannel({
54998
54998
  isSea: isSea2(),
54999
- define: true ? "0.131.0" : void 0,
54999
+ define: true ? "0.131.1" : void 0,
55000
55000
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
55001
55001
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
55002
55002
  modulePath: process.argv[1]
@@ -71834,6 +71834,27 @@ function appendVersion(e, version, opts = {}) {
71834
71834
  const next = [...versions, version];
71835
71835
  return withMirror(base, version, next);
71836
71836
  }
71837
+ function rollbackTo(e, versionId, opts = {}) {
71838
+ const versions = chain(e);
71839
+ const target = versions.find((v) => v.id === versionId);
71840
+ if (!target) throw new Error(`version '${versionId}' is not one of this reference's versions`);
71841
+ if (currentVersionId(e) === versionId) return e;
71842
+ const id = opts.mintId?.() ?? cryptoId();
71843
+ refuseCollision(versions, id);
71844
+ const restored = {
71845
+ id,
71846
+ file: target.file,
71847
+ name: target.name,
71848
+ // THE CALLER MAY SUPPLY THE HASH OF THE BYTES IT ACTUALLY READ, and the route does. Copying
71849
+ // `target.sha256` unconditionally records a value that is knowably false whenever the file behind a
71850
+ // version has drifted on disk — and it propagates, because every later rollback to the restored row
71851
+ // copies it again. Absent, the old behaviour stands, which is what the pure-function tests pin.
71852
+ sha256: opts.sha256 ?? target.sha256,
71853
+ importedAt: opts.at ?? target.importedAt,
71854
+ ...target.filter === void 0 ? {} : { filter: target.filter }
71855
+ };
71856
+ return withMirror(e, restored, [...versions, restored]);
71857
+ }
71837
71858
  var newVersionId = () => `v-${globalThis.crypto.randomUUID()}`;
71838
71859
  var cryptoId = newVersionId;
71839
71860
 
@@ -71968,29 +71989,29 @@ var PreconditionError = class extends Error {
71968
71989
  status;
71969
71990
  body;
71970
71991
  };
71971
- function precondition(entry2, body, expect) {
71992
+ function precondition(entry2, body, expect, act = { verb: "load a new version of it", noun: "a new version" }) {
71972
71993
  const refuse = (status, error, code, extra = {}) => ({ status, body: { ok: false, error, code, ...extra } });
71973
71994
  if (entry2.display?.locked) {
71974
- return refuse(409, `"${entry2.name}" is locked \u2014 unlock it in the Reference models panel to load a new version of it`, "reference-locked");
71995
+ return refuse(409, `"${entry2.name}" is locked \u2014 unlock it in the Reference models panel to ${act.verb}`, "reference-locked");
71975
71996
  }
71976
71997
  if (!mirrorIsIntact(entry2)) {
71977
- return refuse(409, `"${entry2.name}" records a version history that disagrees with the file it currently points at, so a new version cannot safely be added to it`, "reference-mirror-diverged");
71998
+ return refuse(409, `"${entry2.name}" records a version history that disagrees with the file it currently points at, so ${act.noun} cannot safely be applied to it`, "reference-mirror-diverged");
71978
71999
  }
71979
72000
  if (!versionIdsAreUnique(entry2)) {
71980
- return refuse(409, `"${entry2.name}" records two versions under the same id, so a new version cannot safely be added to it`, "reference-versions-ambiguous");
72001
+ return refuse(409, `"${entry2.name}" records two versions under the same id, so ${act.noun} cannot safely be applied to it`, "reference-versions-ambiguous");
71981
72002
  }
71982
72003
  if (!("expectedVersionId" in body)) {
71983
- return refuse(400, "a new version must say which version it believes is current", "reference-version-expected-missing");
72004
+ return refuse(400, `${act.noun} must say which version it believes is current`, "reference-version-expected-missing");
71984
72005
  }
71985
72006
  const expected = body.expectedVersionId ?? null;
71986
72007
  if (expected !== null && typeof expected !== "string") {
71987
- return refuse(400, "a new version must say which version it believes is current", "reference-version-expected-missing");
72008
+ return refuse(400, `${act.noun} must say which version it believes is current`, "reference-version-expected-missing");
71988
72009
  }
71989
72010
  const actual = currentVersionId(entry2);
71990
72011
  if (expected !== actual) {
71991
72012
  return refuse(
71992
72013
  409,
71993
- actual === null ? `"${entry2.name}" has no version history yet, but this upload expected one \u2014 reload the project and try again` : `"${entry2.name}" moved on to another version while this one was being prepared \u2014 reload the project and try again`,
72014
+ actual === null ? `"${entry2.name}" has no version history yet, but ${act.noun} expected one \u2014 reload the project and try again` : `"${entry2.name}" moved on to another version while this was being prepared \u2014 reload the project and try again`,
71994
72015
  "reference-version-stale",
71995
72016
  { currentVersionId: actual }
71996
72017
  );
@@ -72005,6 +72026,7 @@ function precondition(entry2, body, expect) {
72005
72026
  }
72006
72027
  return null;
72007
72028
  }
72029
+ var ROLLBACK_ACT = { verb: "roll it back", noun: "a rollback" };
72008
72030
  function sameEmittedFilter(a, b) {
72009
72031
  const key = (f) => {
72010
72032
  const e = emittedFilter(f);
@@ -72594,6 +72616,274 @@ function registerReferenceRoutes(app, deps) {
72594
72616
  }
72595
72617
  }
72596
72618
  );
72619
+ app.post(
72620
+ "/api/steel/:appId/reference/:id/rollback",
72621
+ async (req, reply) => {
72622
+ const scope = runScope(deps, reply, { detachOnDisconnect: true });
72623
+ const g = gate2(deps, req.params.appId, req.query.project);
72624
+ if (!g.ok) return reply.status(g.refusal.status).send(g.refusal.body);
72625
+ const entry2 = referencesOf(g.doc).find((r) => r.id === req.params.id);
72626
+ if (!entry2) return reply.status(404).send({ ok: false, error: "no such reference model" });
72627
+ const pre = precondition(entry2, req.body ?? {}, void 0, ROLLBACK_ACT);
72628
+ if (pre) return reply.status(pre.status).send(pre.body);
72629
+ const versionId = req.body?.versionId;
72630
+ if (typeof versionId !== "string" || !versionId.trim()) {
72631
+ return reply.status(400).send({
72632
+ ok: false,
72633
+ code: "reference-rollback-version-missing",
72634
+ error: "say which version to go back to"
72635
+ });
72636
+ }
72637
+ const target = (entry2.versions ?? []).find((v) => v.id === versionId);
72638
+ if (!target) {
72639
+ return reply.status(409).send({
72640
+ ok: false,
72641
+ code: "reference-rollback-version-unknown",
72642
+ error: `"${entry2.name}" has no version by that name any more \u2014 reopen its history and try again`
72643
+ });
72644
+ }
72645
+ if (currentVersionId(entry2) === versionId) {
72646
+ scope.finish();
72647
+ return { ok: true, unchanged: true, reference: entry2, versions: entry2.versions ?? [], rolledBackTo: versionId };
72648
+ }
72649
+ if (target.filter && !emittedFilter(target.filter)) {
72650
+ return reply.status(409).send({
72651
+ ok: false,
72652
+ code: "reference-filter-unreadable",
72653
+ error: `Version "${target.name}" of "${entry2.name}" records which part of the file to load, but not in a form FloLess can read, so it cannot be restored.`
72654
+ });
72655
+ }
72656
+ const filter = target.filter;
72657
+ let abs;
72658
+ try {
72659
+ abs = originalPath(g.project, target.file);
72660
+ } catch (e) {
72661
+ const r = importRefusal(e);
72662
+ if (r) return reply.status(r.status).send(r.body);
72663
+ throw e;
72664
+ }
72665
+ if (!abs) {
72666
+ return reply.status(409).send({
72667
+ ok: false,
72668
+ code: "reference-rollback-file-missing",
72669
+ error: `The file behind version "${target.name}" is no longer in this project, so "${entry2.name}" cannot be rolled back to it.`
72670
+ });
72671
+ }
72672
+ try {
72673
+ const sourceHash = await hashFile(abs);
72674
+ const shaUnknown = target.sha256 === "0".repeat(64);
72675
+ const fileChanged = !shaUnknown && target.sha256 !== sourceHash;
72676
+ if (fileChanged) {
72677
+ app.log.warn(
72678
+ { project: g.project, id: entry2.id, versionId, recorded: target.sha256, actual: sourceHash },
72679
+ "the file behind a reference version no longer hashes to what the chain recorded"
72680
+ );
72681
+ }
72682
+ const geometry = await deps.reader.readModel(companion(g.appId), abs, { ticket: scope.ticket(), ...filter ? { filter } : {} });
72683
+ if (scope.gone()) throw new ReferenceImportError("cancelled");
72684
+ if (!geometry.objects.length && hasUnmatched(geometry.selected)) {
72685
+ return reply.status(409).send({
72686
+ ok: false,
72687
+ code: "reference-filter-unmatched",
72688
+ error: unmatchedMessage(entry2.name, unmatchedNames(geometry.selected), "remove the reference and add it again to pick from the current list.")
72689
+ });
72690
+ }
72691
+ if (!geometry.objects.length) {
72692
+ return reply.status(409).send({
72693
+ ok: false,
72694
+ code: "reference-empty",
72695
+ error: `Version "${target.name}" of "${entry2.name}" was re-read, but produced nothing we can draw` + (geometry.dropped ? ` (${geometry.dropped} object${geometry.dropped === 1 ? "" : "s"} had no usable mesh)` : "") + ", so it has not been restored."
72696
+ });
72697
+ }
72698
+ if (objectVerdict(geometry.objects.length) === "refuse") {
72699
+ return reply.status(409).send({
72700
+ ok: false,
72701
+ code: "reference-too-many-objects",
72702
+ error: `Version "${target.name}" now reads ${geometry.objects.length.toLocaleString("en-US")} objects, and the limit is ${MAX_OBJECTS.toLocaleString("en-US")}. The file behind it has grown since it was loaded.`
72703
+ });
72704
+ }
72705
+ writeCache2(g.project, entry2.id, { v: REFERENCE_CACHE_VERSION, sourceHash, dropped: geometry.dropped, colorsAvailable: geometry.colorsAvailable, colorsDropped: geometry.colorsDropped, propertySetsAvailable: geometry.propertySetsAvailable, ...filter ? { filter } : {}, objects: geometry.objects });
72706
+ let next;
72707
+ let restored;
72708
+ const etag = await withLifecycleLock("project", g.project, async () => {
72709
+ if (scope.gone()) throw new ReferenceImportError("cancelled");
72710
+ const current = readAcceptedForRequest(g.appId, g.project);
72711
+ if (current == null) throw new ReferenceImportError("this project has no model to roll a reference back in");
72712
+ const now = referencesOf(current).find((r) => r.id === entry2.id);
72713
+ if (!now) throw new ReferenceImportError(`"${entry2.name}" was removed while it was being rolled back`);
72714
+ const late = precondition(now, req.body ?? {}, { file: entry2.file, filter: entry2.filter }, ROLLBACK_ACT);
72715
+ if (late) throw new PreconditionError(late.status, late.body);
72716
+ const lateTarget = (now.versions ?? []).find((v) => v.id === versionId);
72717
+ if (!lateTarget) {
72718
+ throw new PreconditionError(409, {
72719
+ ok: false,
72720
+ code: "reference-rollback-version-unknown",
72721
+ error: `"${entry2.name}" has no version by that name any more \u2014 reopen its history and try again`
72722
+ });
72723
+ }
72724
+ if (lateTarget.file !== target.file || !sameEmittedFilter(lateTarget.filter, target.filter) || lateTarget.sha256 !== target.sha256) {
72725
+ throw new PreconditionError(409, {
72726
+ ok: false,
72727
+ code: "reference-rollback-version-changed",
72728
+ error: `Version "${target.name}" of "${entry2.name}" was rewritten while it was being restored, so what FloLess just read is no longer what that version says it is \u2014 reopen its history and try again.`
72729
+ });
72730
+ }
72731
+ next = rollbackTo(now, versionId, { at: (/* @__PURE__ */ new Date()).toISOString(), sha256: sourceHash });
72732
+ restored = next.versions[next.versions.length - 1];
72733
+ const written = await writeContractChecked(g.appId, {
72734
+ ...current,
72735
+ reference_models: referencesOf(current).map((r) => r.id === entry2.id ? next : r)
72736
+ }, g.project, {
72737
+ origin: "internal",
72738
+ why: "rolling a reference back rewrites one entry by id under a precondition the route re-checks inside this lock"
72739
+ });
72740
+ return written.etag;
72741
+ });
72742
+ deps.broadcast(contractChangedEvent(g.appId, g.project, etag, req.headers["x-floless-mutation-id"]));
72743
+ return {
72744
+ ok: true,
72745
+ etag,
72746
+ reference: next,
72747
+ version: restored,
72748
+ versions: next.versions,
72749
+ rolledBackTo: versionId,
72750
+ // SAID, not just logged. Whatever is now on screen is not the bytes this version was recorded
72751
+ // under, and the panel would otherwise assert "back on version 2" about a file the server has
72752
+ // already proved is not version 2's.
72753
+ ...fileChanged ? { fileChanged: true } : {},
72754
+ objects: geometry.objects,
72755
+ dropped: geometry.dropped,
72756
+ colorsAvailable: geometry.colorsAvailable,
72757
+ colorsDropped: geometry.colorsDropped,
72758
+ propertySetsAvailable: geometry.propertySetsAvailable,
72759
+ spanMm: spanOf(geometry.objects),
72760
+ ...hasUnmatched(geometry.selected) ? { unmatched: unmatchedNames(geometry.selected) } : {}
72761
+ };
72762
+ } catch (e) {
72763
+ if (e instanceof PreconditionError) return reply.status(e.status).send(e.body);
72764
+ const r = importRefusal(e);
72765
+ if (r) return reply.status(r.status).send(r.body);
72766
+ if (e instanceof ContractError) {
72767
+ return reply.status(400).send({ ok: false, error: e.message, ...e.code ? { code: e.code } : {} });
72768
+ }
72769
+ app.log.error({ appId: g.appId, id: entry2.id, versionId, expectedVersionId: req.body?.expectedVersionId, err: e }, "reference rollback failed");
72770
+ return reply.status(500).send({ ok: false, error: `could not roll "${entry2.name}" back to that version` });
72771
+ } finally {
72772
+ scope.finish();
72773
+ }
72774
+ }
72775
+ );
72776
+ app.post(
72777
+ "/api/steel/:appId/reference/:id/compare",
72778
+ async (req, reply) => {
72779
+ const scope = runScope(deps, reply);
72780
+ const g = gate2(deps, req.params.appId, req.query.project);
72781
+ if (!g.ok) return reply.status(g.refusal.status).send(g.refusal.body);
72782
+ const entry2 = referencesOf(g.doc).find((r) => r.id === req.params.id);
72783
+ if (!entry2) return reply.status(404).send({ ok: false, error: "no such reference model" });
72784
+ if (!versionIdsAreUnique(entry2)) {
72785
+ return reply.status(409).send({
72786
+ ok: false,
72787
+ code: "reference-versions-ambiguous",
72788
+ error: `"${entry2.name}" records two versions under the same id, so FloLess cannot tell which two you asked to compare`
72789
+ });
72790
+ }
72791
+ const pick = (id) => typeof id === "string" && id ? (entry2.versions ?? []).find((v) => v.id === id) : void 0;
72792
+ const base = pick(req.body?.baseVersionId);
72793
+ const revised = pick(req.body?.revisedVersionId);
72794
+ const unknownSide = !base ? "earlier" : !revised ? "later" : null;
72795
+ if (unknownSide) {
72796
+ return reply.status(409).send({
72797
+ ok: false,
72798
+ code: "reference-compare-version-unknown",
72799
+ error: `"${entry2.name}" has no ${unknownSide} version by that name any more \u2014 reopen its history and try again`
72800
+ });
72801
+ }
72802
+ for (const side2 of [base, revised]) {
72803
+ if (side2.filter && !emittedFilter(side2.filter)) {
72804
+ return reply.status(409).send({
72805
+ ok: false,
72806
+ code: "reference-filter-unreadable",
72807
+ error: `Version "${side2.name}" of "${entry2.name}" records which part of the file to load, but not in a form FloLess can read, so it cannot be compared.`
72808
+ });
72809
+ }
72810
+ }
72811
+ if (base.id === revised.id) {
72812
+ return reply.status(400).send({
72813
+ ok: false,
72814
+ code: "reference-compare-same-version",
72815
+ error: "choose two different versions to compare"
72816
+ });
72817
+ }
72818
+ try {
72819
+ const basePath = originalPath(g.project, base.file);
72820
+ const revisedPath = originalPath(g.project, revised.file);
72821
+ const goneSide = !basePath ? base : !revisedPath ? revised : null;
72822
+ if (goneSide) {
72823
+ return reply.status(409).send({
72824
+ ok: false,
72825
+ code: "reference-compare-file-missing",
72826
+ error: `The file behind version "${goneSide.name}" is no longer in this project, so there is nothing to compare it with.`
72827
+ });
72828
+ }
72829
+ let comparison;
72830
+ try {
72831
+ comparison = await deps.reader.compare(companion(g.appId), basePath, revisedPath, {
72832
+ ticket: scope.ticket(),
72833
+ // EACH SIDE UNDER THE FILTER IT WAS ACTUALLY READ WITH. Applying one side's filter to the
72834
+ // other asks a file for a storey it may never have had, resolves nothing, and reports every
72835
+ // object on the far side as added — the version route records the same reasoning.
72836
+ ...revised.filter ? { filter: revised.filter } : {},
72837
+ baseFilter: base.filter
72838
+ });
72839
+ } catch (e) {
72840
+ if (e instanceof CompareRefusedError) {
72841
+ return reply.status(409).send({
72842
+ ok: false,
72843
+ code: "reference-compare-refused",
72844
+ error: e.reason,
72845
+ refused: {
72846
+ reason: e.reason,
72847
+ baseObjects: e.baseObjects,
72848
+ revisedObjects: e.revisedObjects,
72849
+ skipped: e.skipped,
72850
+ uncomparable: e.uncomparable,
72851
+ baseName: base.name,
72852
+ revisedName: revised.name
72853
+ }
72854
+ });
72855
+ }
72856
+ throw e;
72857
+ }
72858
+ return {
72859
+ ok: true,
72860
+ comparison,
72861
+ base: { id: base.id, name: base.name, importedAt: base.importedAt },
72862
+ revised: { id: revised.id, name: revised.name, importedAt: revised.importedAt }
72863
+ };
72864
+ } catch (e) {
72865
+ const r = importRefusal(e);
72866
+ if (r) return reply.status(r.status).send(r.body);
72867
+ let goneNow = null;
72868
+ try {
72869
+ goneNow = !originalPath(g.project, base.file) ? base : !originalPath(g.project, revised.file) ? revised : null;
72870
+ } catch (probe) {
72871
+ app.log.error({ appId: g.appId, id: entry2.id, err: probe }, "could not re-check a reference version\u2019s original after a failed comparison");
72872
+ }
72873
+ if (goneNow) {
72874
+ return reply.status(409).send({
72875
+ ok: false,
72876
+ code: "reference-compare-file-missing",
72877
+ error: `The file behind version "${goneNow.name}" was removed while the two versions were being compared, so there is nothing to compare it with.`
72878
+ });
72879
+ }
72880
+ app.log.error({ appId: g.appId, id: entry2.id, base: base.id, revised: revised.id, err: e }, "reference version compare failed");
72881
+ return reply.status(500).send({ ok: false, code: "reference-compare-failed", error: `could not compare those two versions of "${entry2.name}"` });
72882
+ } finally {
72883
+ scope.finish();
72884
+ }
72885
+ }
72886
+ );
72597
72887
  app.post(
72598
72888
  "/api/steel/:appId/reference/:id/ghosts",
72599
72889
  async (req, reply) => {
@@ -72602,6 +72892,13 @@ function registerReferenceRoutes(app, deps) {
72602
72892
  if (!g.ok) return reply.status(g.refusal.status).send(g.refusal.body);
72603
72893
  const entry2 = referencesOf(g.doc).find((r) => r.id === req.params.id);
72604
72894
  if (!entry2) return reply.status(404).send({ ok: false, error: "no such reference model" });
72895
+ if (!versionIdsAreUnique(entry2)) {
72896
+ return reply.status(409).send({
72897
+ ok: false,
72898
+ code: "reference-versions-ambiguous",
72899
+ error: `"${entry2.name}" records two versions under the same id, so the objects that were removed cannot be drawn where they used to be`
72900
+ });
72901
+ }
72605
72902
  const versionId = req.body?.versionId;
72606
72903
  const version = typeof versionId === "string" && versionId ? (entry2.versions ?? []).find((v) => v.id === versionId) : void 0;
72607
72904
  if (!version) {
@@ -218,7 +218,62 @@ export function filterDiffers(selected) {
218
218
  return norm(selected.base) !== norm(selected.revised);
219
219
  }
220
220
 
221
+ /**
222
+ * The version chain as ROWS a history list can draw — newest first, numbered by position.
223
+ *
224
+ * NUMBERED BY POSITION IN THE CHAIN, NOT BY RENDER ORDER. The chain is oldest-first and everything else
225
+ * in this feature numbers it that way ("version 3" in the change panel's header is `versions.length`),
226
+ * so reversing for display must not renumber — a row that reads "version 1" at the bottom of one panel
227
+ * and "version 3" at the top of another is the same row described two ways.
228
+ *
229
+ * THREE DIFFERENT PASTS, THREE DIFFERENT WORDS, and collapsing any pair states something the chain does
230
+ * not say:
231
+ * • `adopted` — its date is when versioning was RECORDED, not when the file was loaded; nothing
232
+ * durable records the latter, which is the whole reason `sha256` had to join the
233
+ * schema. Saying "imported" would fabricate history in the one field a user reads to
234
+ * answer "which of these did I load first?".
235
+ * • restored — a rollback appends a COPY of an earlier row under a fresh id, so the same file
236
+ * appears twice. Rendered as an ordinary import it reads as "why did I load this
237
+ * twice?".
238
+ * • imported — an actual upload.
239
+ *
240
+ * A restored row is recognised by its FILE matching an earlier row's, which is exactly what `rollbackTo`
241
+ * produces and is the only handle available: nothing on the schema flags a restore, deliberately — the
242
+ * row IS a genuine load and carries no `adopted`.
243
+ */
244
+ export function versionRows(versions) {
245
+ // NUMBERED FROM THE RAW ARRAY, NOT THE FILTERED ONE. Dropping a null entry and then numbering by
246
+ // position would renumber every row after it, while the change panel's own "version N" counts
247
+ // `versions.length` unfiltered — so a malformed chain would make one row read as two different
248
+ // numbers in two panels, which is the exact thing this function's contract forbids.
249
+ const raw = Array.isArray(versions) ? versions : [];
250
+ const all = raw.map((v, rawIdx) => ({ v, rawIdx })).filter((x) => x.v);
251
+ const last = all.length - 1;
252
+ return all.map(({ v, rawIdx }, i) => {
253
+ const priorSame = all.findIndex((o) => o.v.file && o.v.file === v.file);
254
+ const restored = !v.adopted && priorSame >= 0 && priorSame < i;
255
+ return {
256
+ id: v.id || null,
257
+ // WHETHER ANYTHING CAN BE DONE TO THIS ROW. Both actions address a version by id, so a row without
258
+ // one can only produce a click that does nothing — and a control whose sole outcome is nothing is
259
+ // worse than no control, which is the rule the ⋯ menu already applies to itself.
260
+ actionable: !!v.id,
261
+ n: rawIdx + 1,
262
+ name: v.name || v.file || 'this version',
263
+ importedAt: v.importedAt || null,
264
+ current: i === last,
265
+ dateWord: v.adopted ? 'recorded' : restored ? 'restored' : 'imported',
266
+ // …AND THE NOTE'S NUMBER IS A RAW INDEX TOO. `priorSame` indexes the filtered list, so quoting it
267
+ // directly would name a different row than `n` counts once a null has been dropped.
268
+ note: v.adopted ? 'first seen before versioning'
269
+ : restored ? 'restored from version ' + (all[priorSame].rawIdx + 1)
270
+ : null,
271
+ };
272
+ }).reverse();
273
+ }
274
+
221
275
  export default {
222
276
  RC_CAP, STATUS, STAT_ORDER, REFUSAL_ACTIONS,
223
277
  summaryStats, movedPhrase, groupNeedsAttention, needsAttention, capWindow, refusalCopy, filterDiffers,
278
+ versionRows,
224
279
  };