Buildings and levels for the floor map, and make every identifier searchable
Some checks failed
CI / backend (push) Failing after 9s
CI / naming (push) Successful in 2s
CI / frontend (push) Successful in 10s
CI / migrations-mysql (push) Failing after 7s

The map was one picture of one floor. A second floor was added, the blueprint
changed size, and machines moved, so a position now records WHICH DRAWING its
coordinates belong to.

Buildings and levels (ADR-017). Each level owns its blueprint per theme and its
own native pixel size; assets.mapx/mapy are pixels of assets.levelid, not of the
site. A position whose level is unknown renders "level unknown" and is never
drawn on the default level, because a marker on the wrong floor plan looks
entirely correct while pointing at the wrong place.

Repositioning in bulk: filter by unplaced, needs-review or level, search, place,
confirm. Landmark recalibration solves the transform PER AXIS from landmark
pairs and never from image dimensions - the canvas grew taller without
rescaling, so a dimension-derived scale would stretch Y by 1.57 and be wrong
everywhere. It defaults to a dry run, reports what would land off the drawing,
snapshots before applying, and clears mapverifiedat because a transform is a
guess awaiting review. Snapshots restore, including the level and the review
state, and a restore snapshots first so an undo is undoable.

Search: gaugelabreference was matched only for measuring tools and
maintenancereference was matched nowhere at all, for any asset type, while
Settings happily offers both identifiers on machines and PCs. A tag an operator
is told to record has to be findable or it is a write-only field. USB devices
and printed items were unreachable from search entirely - neither is an asset,
so the generic asset search could not see them and no searcher existed; they
now match on serial, asset tag, label, bin code and gage-lab tag, honouring
isactive, with Settings toggles and result labels to match.

The retired-application rule was half a rule: GET /api/knowledgebase hid
articles whose topic application is retired while global search still returned
them and printed the retired application as the subject. A filter is only real
if every path that reaches the row applies it.

Contract to 0.20.0 (additive): Asset gained levelid and mapverifiedat, Location
gained levelid, and resolve_asset_position returns the levelid belonging to
whichever source supplied the coordinates. The five plugins that write a map
position are re-pinned. The install-list text format gained levelid as a NINTH
field, appended, because the shipped Pascal installer reads fields 0-7 by index.

That installer still compiles in one drawing's dimensions and bundles one
blueprint, so its map is accurate for the default level only; /api/maplevels is
deliberately unauthenticated so it can read both at runtime once rebuilt.
Recorded in PRINTER-INSTALLER.md section 6 along with the other known gaps.

Migration 7d33 converts an existing single-map site into one building and one
default level carrying the old map_* settings, then assigns every placed asset
and location to it. Nothing moves on screen. Old settings rows are kept so a
rollback still finds them. Verified end to end on MySQL 5.6 from a
production-shaped database.
This commit is contained in:
cproudlock
2026-08-17 12:55:51 -04:00
parent 7d9a54ca0f
commit 3324dbd91e
60 changed files with 5313 additions and 895 deletions

View File

@@ -10,6 +10,67 @@ ADR-007 and ADR-002.
## [Unreleased]
The floor map became a set of drawings instead of one picture. A site can hold
more than one building, a building more than one level, and every map position
now records which drawing its coordinates belong to. Driven by a real move: a
second floor was added, a new blueprint changed size, and machines relocated.
### Added
- Buildings and levels (ADR-017). Each level owns its own blueprint per theme
and its own native pixel size; `assets.mapx`/`mapy` are pixels of the level
named by the new `assets.levelid`, not of the site.
- A bulk repositioning tool on the map editor: filter by unplaced, by
needs-review, or by level, search, then place markers and confirm them. New
`POST /api/mappositions/positions` and `/verify`.
- Landmark recalibration (`POST /api/mappositions/transform`). Name two or more
points that appear on both the old and new drawing and every marker on the
level moves onto the new one. Defaults to a dry run that reports each old and
new position and anything that would land off the drawing. The transform is
solved PER AXIS from the landmarks, never derived from image dimensions: a
taller drawing that gained a level below did not rescale, and a
dimension-derived scale would stretch Y by 1.57 and be wrong everywhere.
- Position snapshots with restore, taken before any bulk change including a
restore, so an undo is itself undoable.
- A buildings and levels admin under Settings: name and order levels, see each
level's id and marker count, upload a blueprint per theme, choose the default.
- `assets.mapverifiedat`, the record of when a position was last confirmed
against the current drawing. A bulk transform clears it, because a transform
is a starting guess and nothing in the coordinates says which markers moved.
### Changed
- Plugin contract to 0.20.0 (additive; see CONTRACT-STABILITY.md). A plugin that
writes a map position must now write its level.
- A position whose level is unknown renders as "level unknown" and is NOT drawn
on the default level. Drawing it there would look entirely correct while
pointing at the wrong part of the building.
- `GET /api/printers/install-list?format=text` gained `levelid` as a NINTH
field, appended. Fields 0-7 are unchanged because the shipped Pascal installer
reads them by index.
- Knowledge base: an article whose topic is a retired (`isactive = 0`)
application no longer appears in listings, searches or the counts, and the
topic picker offers every active application rather than only installable
ones.
### Migration
- `7d33_buildings_and_levels` converts an existing single-map site: it creates
one building and one default level carrying the blueprint paths and dimensions
from the old `map_*` settings, then assigns every already-placed asset and
location to it. Nothing moves on screen. The old settings rows are left in
place so a rollback still finds them. Verified end to end on MySQL 5.6 from a
production-shaped database.
### Known gaps
- The Pascal printer-installer map still compiles in one drawing's dimensions and
bundles one blueprint, so it is accurate for the default level only. See
section 6 of PRINTER-INSTALLER.md.
- The setup wizard still asks for a single site-wide blueprint and writes
settings that no longer drive the map.
- Map PDF export covers the current level only.
## [0.10.0] - 2026-08-17
A security release. The Windows installer left the directories it creates