Skip to content

FS-118: protect project revisions before overwrite#9

Merged
michaelfutol merged 2 commits into
mainfrom
release/fs-118-protected-revisions
Jul 14, 2026
Merged

FS-118: protect project revisions before overwrite#9
michaelfutol merged 2 commits into
mainfrom
release/fs-118-protected-revisions

Conversation

@michaelfutol

Copy link
Copy Markdown
Owner

Summary

FS-118 protects a user's saved structural intent before FutolStructure overwrites an existing .fstr file. The release is deliberately based on the verified FS-117 production baseline and leaves structural analysis, model geometry, solver exporters, and the AutoCAD R12 writer logic unchanged.

User impact and root cause

A normal save previously relied on the browser file and autosave paths without an immutable pre-overwrite history. If a floor, locked member, offset, cantilever, corner slab, or hidden/deleted state was lost before save, the newly written file could replace the last recoverable source. Browser autosave also had no last-known-healthy fallback when a current snapshot was corrupt or structurally implausible.

Implementation

  • Adds an IndexedDB revision store with cloned project payloads, project/source identity, schema and build provenance, structural summaries, health results, and destructive deltas.
  • Captures the existing file before saveProject(false) writes a child model revision.
  • Reviews destructive changes and blocks implausible autosaves from becoming the primary startup snapshot.
  • Restores the last known healthy autosave when the current snapshot is incompatible, corrupt, or structurally invalid.
  • Adds Recovery UI for revision history, restore, and .fstr download.
  • Retains the newest 50 revisions independently per project.
  • Adds a legacy v2.8 two-floor fixture and repeated migration/round-trip checks.
  • Identifies runtime artifacts as v3.16.118 / FS-118 while retaining FS-117 as the audited DXF-writer lineage.

Validation

  • node v3/tools/check-fs.js --no-browser
  • node v3/tools/check-fs.js
  • Full Olango GF/2F/RF project smoke with 20 current-floor columns, 23 beams, 12 regular slab records, and zero cantilever diagnostic failures.
  • Real mocked file-handle overwrite: pre-overwrite revision created, child model-revision-* written with parent qa-protected-baseline.
  • 55 ordered revision writes retain exactly the newest 50, from retention-5 through retention-54.
  • Legacy v2.8 hidden slab, deleted beam, locked beam, column lock, and 0.1 m beam offset survive two round trips.
  • Olango DXF: AC1009, 4,980 entities, zero parser audit errors/fixes, exact round-trip retention.
  • AutoCAD 2025 Core Engine: exit 0, model regenerated, no recovery message.

Scope exclusions

No historical helper scripts, diaries, broad UI changes, solver changes, structural formulas, project source files, or original dirty-worktree files are included. The only DXF change is truthful app-build versus writer-build provenance; R12 entities, tables, geometry, and layering remain unchanged.

Rollback

Revert the FS-118 merge commit only. The known-good FS-117 production baseline is fd0f69077be8328e267df83cb9b4eeeb1ada81c1.

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
futolstructure Ready Ready Preview, Comment Jul 14, 2026 6:05am

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da6a05d4ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread v3/release-manifest.json
"releaseName": "Protected Project Revisions",
"fstrSchemaVersion": "0.1.0",
"gitCommit": "58edb71ce88b0060a8a2d9901664e91ac61dfcc2",
"gitCommit": "aefbd94dfbf31121e5831ad21b8cf6e54ff9fccc",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Stamp FS-118 with this commit SHA

For packages built from the reviewed commit, this manifest points provenance at aefbd94dfbf31121e5831ad21b8cf6e54ff9fccc, but the commit under review is 7099c4293b588801cb13e30fc4b93c30981010b8. getReleaseManifest() feeds the recovery UI, reports, saved .fstr metadata, and DXF package audit, so this would make FS-118 artifacts cite the wrong source revision; the new validation only checks for any 40-hex string, so it will not catch the mismatch.

Useful? React with 👍 / 👎.

Comment on lines +77 to +83
const activeColumns = columns.filter(column => {
const perFloorState = column?.activePerFloor;
if (perFloorState && Object.prototype.hasOwnProperty.call(perFloorState, floor.id)) {
return perFloorState[floor.id] !== false;
}
return column?.active !== false;
}).length;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude floor-deleted columns from revision health

When a persisted project has entries in floor.deletedColumns, this summary still counts those columns as active on that floor. In the pre-overwrite path for an existing file that is not the currently loaded baseline, summarizePersistedProject() drives the stored health/delta, so a revision with slabs but fewer than two remaining supports can be labeled healthy and its active-column loss underreported in the recovery panel.

Useful? React with 👍 / 👎.

@michaelfutol
michaelfutol merged commit daef718 into main Jul 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant