Skip to content

Hardening from the codebase review - #1

Merged
optative-visuals merged 6 commits into
feat/locationsfrom
chore/review-hardening
Nov 10, 2026
Merged

optative-visuals merged 6 commits into
feat/locationsfrom
chore/review-hardening

Conversation

@optative-visuals

Copy link
Copy Markdown
Owner

What this changes and why

Hardening from a review of the codebase. It builds on feat/locations, so this PR targets that branch. One commit per change:

  • Time limits on network requests. An OpenStreetMap fetch gives up after 120 s and a place search after 15 s, each with its own "took too long" message; before, a stalled server could hang Refresh for about five minutes. A refused request (400, 403) no longer says the server is "busy".
  • Damaged project files. Opening a broken or hand-edited .afgeo says "This project file is damaged and can't be opened." or names the damaged layer, instead of a raw JavaScript error. The zip reader checks offsets and refuses an entry that unpacks to more than its declared size.
  • Errors reach main.log. console.error and console.warn from the app and its server are written to the log (the installed app has no console). The log rolls over at 2 MB. Settings and the recent list are written to a temp file and renamed, so a crash mid-save can't blank them.
  • Stale Affinity scripts. ensureScripts compares the installed scripts with the shipped ones and re-copies them when they differ, so a dev run on an unchanged version number no longer leaves Affinity on old scripts.
  • Companion. Map sides must be 10 to 5,000 mm and rotation within ±3,600°. A timed-out send no longer keeps the whole map payload in memory, and expired jobs are cleared even while Affinity is away. SendResult is defined once.
  • Workflows. CI cancels superseded runs and times out after 20 minutes. The release runs lint and typecheck before tests and times out after 45 minutes.

Behaviour changes

  • An unexpected main-process crash now logs, shows an error box and closes the app.
  • The 5,000 mm size limit is server-side only: the inspector fields have no limit of their own, so a larger value shows the server's message.
  • JobQueue.onLateCompletion now receives { op, mapName? } instead of the whole job.

Not tested

Nothing here was run in the app window or against Affinity; it is covered by unit tests only.

Checklist

  • npm test passes (917 tests)
  • npm run lint passes
  • npm run typecheck passes
  • I added or updated tests for any change in behaviour
  • No personal file paths or private details are included

🤖 Generated with Claude Code

optative-visuals and others added 6 commits November 10, 2026 07:52
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…omically

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… SendResult type

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… release

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@optative-visuals
optative-visuals merged commit 2efc973 into feat/locations Nov 10, 2026
1 check passed
@optative-visuals
optative-visuals deleted the chore/review-hardening branch November 11, 2026 07:18
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