diff --git a/.claude/launch.json b/.claude/launch.json index ef306c52..cf43afbc 100644 --- a/.claude/launch.json +++ b/.claude/launch.json @@ -6,7 +6,7 @@ "runtimeExecutable": "cmd", "runtimeArgs": [ "/c", - "set CSC_PUBLIC_API_URL=http://127.0.0.1:8791&& scripts\\dev\\run_csc_python.cmd -u scripts/dev/serve_dump.py --dump latest --assets .dev/assets-261012 --port 8791 --mongo-port 27791" + "set CSC_PUBLIC_API_URL=http://127.0.0.1:8791&& scripts\\dev\\run_csc_python.cmd -u scripts/dev/serve_dump.py --dump latest --assets .dev/assets --port 8791 --mongo-port 27791" ], "port": 8791 }, diff --git a/.zenodo.json b/.zenodo.json index efc2ad7e..0efc10dc 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,8 +1,8 @@ { - "title": "Catalog of Second Chances (CSC) - Digital Database and Corresponding Interfaces for ReUse of Architectural Components (v0.6.4.4)", - "version": "0.6.4.4", + "title": "Catalog of Second Chances (CSC) - Digital Database and Corresponding Interfaces for ReUse of Architectural Components (v0.6.4.5)", + "version": "0.6.4.5", "upload_type": "software", - "description": "

The Catalog of Second Chances (CSC) is a prototypical digital component database. It catalogs digital representations of uniquely identifiable architectural components for reuse. Furthermore, it provides corresponding interfaces and tools to leverage them via a backend REST-API, a web-frontend as well as a interface for direct interaction within Rhino Grasshopper.

Changes in v0.6.4.4 (2026-11-03)

Grasshopper hardening, and the beta notice takes its version from the release. Run CSC_Update in Grasshopper after the server is deployed.

Fixed

Changed

Server notes

Full history: CHANGELOG.md

", + "description": "

The Catalog of Second Chances (CSC) is a prototypical digital component database. It catalogs digital representations of uniquely identifiable architectural components for reuse. Furthermore, it provides corresponding interfaces and tools to leverage them via a backend REST-API, a web-frontend as well as a interface for direct interaction within Rhino Grasshopper.

Changes in v0.6.4.5 (2026-11-08)

The web controls follow the permission rules, and a component can move to another dataset. No Grasshopper change: CSC_Update is not needed for this release.

Added

Changed

Fixed

Full history: CHANGELOG.md

", "creators": [ { "name": "Eschenbach, Max Benjamin", diff --git a/AGENTS.md b/AGENTS.md index c7211f44..3ae3aaf6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,6 +2,20 @@ Guidance for coding agents working in this repository. +## Standing rules + +- The maintainer makes every commit, push and production step. Do not stage, commit, push or run anything against + production; leave changes in the working tree and give the commands. Commit messages stay inline in the command. +- ASCII only in code and scripts, no emoji. In docs, write dashes as `--` and `---`. Icons come from `lucide-react`. +- No names of people or accounts in committed files; refer to roles. The legal pages and the author line of the + Grasshopper user objects are the exceptions. +- Packages must be about two weeks old: no dependency, action or lockfile entry younger than about 14 days. +- In user-facing text a catalogued building component is a "component" (on the Grasshopper page the other kind is a + "Grasshopper component"); "element" is only an item of a batch. A recorded state is a "snapshot"; "v1" is its number. +- Several docs and sources use CRLF. Keep the line ending of the file you edit. +- The root `README.md` states rules plainly, without decision references. Those belong in `docs/adr/`. +- The decision log `docs/adr/DESIGN_DECISIONS.md` is append-only: amend a row with an "Amended ..." sentence. + ## Agent skills ### Issue tracker diff --git a/CHANGELOG.md b/CHANGELOG.md index eafb4a63..14808b84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,61 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.4.5] - 2026-11-08 + +The web controls follow the permission rules, and a component can move to another dataset. No Grasshopper +change: `CSC_Update` is not needed for this release. + +### Added + +- **Move a component to another dataset:** `POST /identities/{id}/move` and a control in the actions menu of + the component, for a moderator of both datasets. One component at a time. A dataset emptied this way can be + deleted. Until the nightly run the map may colour a moved component by its old dataset; who sees it is decided + at read time (#50). +- **Delete a never-published component:** a control with a confirm dialog, for its creator or a moderator (#50). +- **API, open snapshots and corrections:** an identity carries `has_open_snapshot` and an evidence record + `has_open_correction`, for contributors and moderators of the dataset and admins. Only the fact, no details (#47). +- **API, lists of snapshots:** `GET /snapshots/pending` and `GET /snapshots?mine=1` carry `identity_withdrawn`, so + the moderation queue and My work hide Publish and Submit there (#49). + +### Changed + +- **Behaviour, a withdrawn component stays out of circulation:** reserve, re-enter, undo exit and undo deinstall + answer 409 on a withdrawn component. So does adding a photo to a withdrawn snapshot or to any snapshot of a + withdrawn component, and adding an attachment to a withdrawn record or to any record of a withdrawn + component, and correcting a snapshot of a withdrawn component, and submitting, publishing, promoting or + reinstating one, and reinstating an evidence record of it, and withdrawing a snapshot with `replacement_id`. + Recall, reject, back to draft and delete stay, so that an open snapshot can be cleared. A moderator reinstates the + component first (#49). +- **Behaviour, revoking an invitation:** only a moderator of the dataset, or an admin, revokes an invitation. + The creator loses the right with the role (#48). +- **Web, controls the backend allows:** a moderator adds an attachment to a published record, and edits the + name, notes and date of a withdrawn snapshot, the rest of the form stays disabled there; a contributor reaches + their own draft snapshot from the snapshot dialog; a new state, evidence and "out of circulation" stay available + when every snapshot is withdrawn; a site admin submits, recalls and returns to draft another person's record; an + author edits their evidence draft after losing the contributor role; the layout document of a superseded + record can be filled in (#48). +- **Web and backend, wording:** user text says "component" for a catalogued component again, also in error + messages, the Data Model page and the MCP tool descriptions. 0.6.4.2 had brought in "element", which left the web + mixing both words; "element" stays only for the items of a batch. A recorded state is a "snapshot", as in the + data model, where the web said "version" in most places; "v1" stays its number. +- **MCP, names:** the tools `list_versions` and `get_version` are now `list_snapshots` and `get_snapshot`; the + parameter `version_id` is `snapshot_id`, and the answers say `snapshots`, `current_snapshot` and `snapshot_count`. + A chat that calls an old name gets "tool not found" once and then sees the new list. +- **Web, page description:** the description search engines and link previews show reads "A digital database for + reclaimed architectural components." +- **Backend, index:** `component_snapshots` gains an index on `identity_id` and `status`, for the check of an + open snapshot. It is built when the server starts. + +### Fixed + +- **Web, controls that ended in a refusal:** controls the backend would refuse with a 403 or a 409 are hidden, + or disabled with the reason, before a form is filled in (#46, #47). +- **Web, claims:** a claim with a result saves. The form sent no `summary.kind`, so the server answered 422 although + the form said nothing was missing. +- **Tests:** `test_signin.py` passes on Python 3.9. +- **Backup:** `pull_production.ps1` passes SSH keepalive options, after a pull of the assets broke at 1.56 GB. + ## [0.6.4.4] - 2026-11-03 Grasshopper hardening, and the beta notice takes its version from the release. Run `CSC_Update` in diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..43c994c2 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/CONTEXT.md b/CONTEXT.md index 07d2cfc8..883b8f78 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -1,6 +1,6 @@ # Catalog of Second Chances (CSC) -A research catalog of reclaimed building components: what each physical element is, where it came +A research catalog of reclaimed building components: what each physical component is, where it came from, what state it is in, and what is known about it --- so it can be designed with and reused. ## Language @@ -8,13 +8,13 @@ from, what state it is in, and what is known about it --- so it can be designed ### Components and records **Component**: -A physical reclaimed building element the catalog tracks --- a beam, a panel, a lump of rubble. In user-facing text a -single one is an "element" (not to be confused with a Grasshopper component). -_Avoid_: item, part, piece +A physical reclaimed building component the catalog tracks --- a beam, a panel, a lump of rubble. In user-facing text a +single one is a "component"; on the Grasshopper page the other kind is a "Grasshopper component". +_Avoid_: item, part, piece, element (an element is only an item of a batch) **Component identity**: The catalog's permanent record of one physical component, from its arrival to long after its exit. -_Avoid_: entry, component (when the record is meant) +_Avoid_: entry; in user-facing text the record and its UUID are a "component" and a "component id", "identity" stays in code, the API and Grasshopper **Tag**: The physical QR label on a component; it carries only the identity's UUID, never a URL. @@ -22,7 +22,7 @@ _Avoid_: label, sticker **Snapshot**: One recorded state of a component --- its shape and state from a point in time until the next state. -_Avoid_: version (a snapshot *has* a version number), scan (one way to capture a snapshot's geometry) +_Avoid_: version (a snapshot *has* a version number; also in user-facing text), scan (one way to capture a snapshot's geometry) **Snapshot photo**: A general-impression picture of a component in one state, so people get an idea of it regardless of how its geometry is represented. Not evidence. diff --git a/README.md b/README.md index f1380f3f..46962907 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ framework ## Current Versions -- **CSC**: 0.6.4.4 --- backend, web frontend and Grasshopper interface are released together - under one version (tag `v0.6.4.4`); the single source is the `VERSION` file. +- **CSC**: 0.6.4.5 --- backend, web frontend and Grasshopper interface are released together + under one version (tag `v0.6.4.5`); the single source is the `VERSION` file. See `CHANGELOG.md` for release notes. @@ -112,7 +112,7 @@ session with the first. **A local copy of the newest dump** (for checking the web app against real data) starts from `.claude/launch.json`: `backend-local` (the newest `mongodb_collections_local/` folder, a throwaway `mongod` on 27791, the -backend on http://127.0.0.1:8791, assets copied to `.dev/assets-261012`) and +backend on http://127.0.0.1:8791, assets copied to `.dev/assets`) and `frontend-local` (http://localhost:3000). Both run through `scripts/dev/run_csc_python.cmd`, which finds the conda environment `csc` without a path of your account: `CSC_PYTHON` (a `python.exe` you name), the @@ -530,7 +530,7 @@ and a JWT does not work in place of it. ## Using CSC from Claude Claude can read the catalog as you: ask it to find components, show one with its -versions and measurements, compare, or look at what happened to an element. It +snapshots and measurements, compare, or look at what happened to a component. It only reads, and it sees what you see on the website; nothing it can reach is private to anybody else. Administrators can connect it for now (the roles are `CSC_PAT_ROLES`). @@ -548,16 +548,16 @@ sent back to) before you press Allow, and press Deny when it is not the tool you just connected. **What it can do.** Ten read-only tools: `search_components` (the filters of -Browse and `has_evidence`, which keeps only elements with a published, current +Browse and `has_evidence`, which keeps only components with a published, current record of one evidence method, for example `reinforcement_layout` for "with -reinforcement", a page at a time), `catalog_overview` (how many elements, counted +reinforcement", a page at a time), `catalog_overview` (how many components, counted by material, original function, dataset, shape class and circulation, the range of each sorted side in millimetres, and how many have a location; it takes the same filters), `get_component` (with the reinforcement layouts of the current -version as counts), `list_versions`, `get_version` (geometry as counts and a -link, never the meshes; the reinforcement layouts of the version as counts), +snapshot as counts), `list_snapshots`, `get_snapshot` (geometry as counts and a +link, never the meshes; the reinforcement layouts of the snapshot as counts), `get_evidence`, `list_datasets`, `get_dataset`, `get_timeline` and -`similar_components` (the elements nearest in shape over the whole descriptor, not +`similar_components` (the components nearest in shape over the whole descriptor, not on the two-dimensional similarity map, with their distance in standardised units; it takes the same filters, which apply before the ranking). Every answer carries the web link of the record, and a record that is not public is marked @@ -700,8 +700,8 @@ The geometry runner and the component map share one lock, `~/csc/shared/locks/he so the two heavy jobs never run together (server memory): the frequent geometry run skips its run while the lock is held, the nightly run and the map wait up to 15 minutes instead of losing their slot. A write that changes -what the geometry stages read (a new version, a file, the geometry, the colour, -an override, the function of the element) marks the snapshot (`derivation_due`); +what the geometry stages read (a new snapshot, a file, the geometry, the colour, +an override, the function of the component) marks the snapshot (`derivation_due`); the frequent run derives only marked snapshots, the nightly run checks all of them (`main_geometry.py --due` / without it). @@ -784,7 +784,7 @@ the frontend is checked with `npx tsc --noEmit` and `npm run lint` in | Dataset | Source | Tools and instructions | |---|---|---| -| ReCreate pilot elements: 1150 reclaimed precast concrete elements of three donor buildings | , CC BY 4.0 | [`scripts/import/recreate/`](scripts/import/recreate/README.md) | +| ReCreate pilot elements: 1150 reclaimed precast concrete components of three donor buildings | , CC BY 4.0 | [`scripts/import/recreate/`](scripts/import/recreate/README.md) | | EPFL stones for augmented stacking: 452 scanned quarry offcut stones | , MIT | [`scripts/import/epfl_stacking/`](scripts/import/epfl_stacking/README.md) | The data is fetched from Zenodo and never committed. Everything else (environments, the order of the steps, diff --git a/VERSION b/VERSION index 472f35f1..db8fc124 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.4.4 +0.6.4.5 diff --git a/docs/adr/DATA_MODEL_SPEC.md b/docs/adr/DATA_MODEL_SPEC.md index 21637460..cd69db1b 100644 --- a/docs/adr/DATA_MODEL_SPEC.md +++ b/docs/adr/DATA_MODEL_SPEC.md @@ -44,7 +44,7 @@ landscape section 10.6. ``` Dataset ----------------------------- "which project" --- membership, roles, visibility (section 3.6) | - +-1:N-> ComponentIdentity ----------- "which physical element" + +-1:N-> ComponentIdentity ----------- "which physical component" | original_function (IFC name), material (+ class, trade name) | origin / exit / past_cycles how it entered and left circulation (section 3.1.1, section 3.1.3) | parent_identities[] + inherited_fields split / merge lineage (section 3.1.2) @@ -121,9 +121,9 @@ IFC element-class **names only**. No IFC structure is imported. | `IfcRailing` | Railing / balustrade | decision 8.107 | | `IfcDuctSegment` | Duct | decision 8.107 | | `IfcBuildingElementProxy` | Unknown | function not known | -| `CscDebris` | Debris | CSC extension: no prior function as a discrete element (rubble, aggregate) | +| `CscDebris` | Debris | CSC extension: no prior function as a discrete component (rubble, aggregate) | -Semantics: **what the element was** in its previous life. The reuse function is a design decision +Semantics: **what the component was** in its previous life. The reuse function is a design decision made in design tools outside CSC (decision 7.11) and is never recorded here. > CPR: the *declared use* (Art 3(22), Annex V 1(c)) is fixed by the manufacturer at placing on @@ -217,7 +217,7 @@ context is that snapshot into `snapshot.properties`). **Findings vs. overall grade (decision 7.9).** Findings (`spalling`, `cracking`, `corrosion`) are severities, 0 none ... 3 severe; the inspection form offers only those whose material group matches -the element (section 2.10 `group`). `condition_grade` keeps the 0.5 direction (higher = better). The UI +the component (section 2.10 `group`). `condition_grade` keeps the 0.5 direction (higher = better). The UI **condition badge** = the snapshot's folded `condition_grade` if present, else `3 - max(finding severity)`; no inspection --> "not assessed". More material-specific findings (chipped edges, surface wear, rot, residue) are additive vocabulary rows --> deferred (6.8). @@ -243,8 +243,8 @@ precision is a legitimate, expected value for `origin.at`.) Applies to `manufact ### 2.8 `origin.kind` (identity) -How the element entered circulation (section 3.1.1). The distinction matters regulatorily: only a -deinstalled element can be a CPR *used product*; demolition output is waste until end-of-waste; +How the component entered circulation (section 3.1.1). The distinction matters regulatorily: only a +deinstalled component can be a CPR *used product*; demolition output is waste until end-of-waste; production residue is a by-product question, not a reuse one. | value | label | definition | regulatory reading | @@ -257,14 +257,14 @@ production residue is a by-product question, not a reuse one. ### 2.9 `exit.kind` (identity) -How the element left circulation (section 3.1.3). +How the component left circulation (section 3.1.3). -| value | label | physical element | terminal? | notes | +| value | label | physical component | terminal? | notes | |---|---|---|---|---| | `split` | Split | ceased to exist as this identity | yes | server-set when a child's first snapshot is published (8.8); children via lineage | | `merged` | Merged | ceased to exist as this identity | yes | server-set like `split` when the child has >1 parent (8.8) | | `installed` | Installed | exists, in a construction work | no --- re-entry allowed | reuse accomplished; `construction_work` optional (where it went). A later deinstallation starts a new CPR life (Art 3(53)) | -| `recycled` | Recycled | material recovered, not the element | yes | crushed to aggregate, melted, ... | +| `recycled` | Recycled | material recovered, not the component | yes | crushed to aggregate, melted, ... | | `disposed` | Disposed | landfilled / waste | yes | | | `returned` | Returned | exists, left CSC custody | no | back to owner / supplier | | `lost` | Lost | unknown | no | whereabouts not recorded | @@ -341,10 +341,10 @@ judgement, noted in the table --- all are overridable (`material_class_source: a | `bitumen_membrane` | Bituminous membrane | bituminous | 17 03 02 | --- | | `mineral_wool` | Mineral wool insulation | insulation | 17 06 04 | --- | | `polymer_foam` | Polymer foam insulation (EPS, XPS, PUR/PIR) | insulation | 17 06 04 | --- | -| `mixed` | Mixed / composite element | other | 17 09 04 | --- | +| `mixed` | Mixed / composite component | other | 17 09 04 | --- | | `unknown` | Unknown | other | 17 09 04 | --- | -Multi-material elements (Annex IV 1.2(e) "main materials", plural) --> `secondary_materials[]`, +Multi-material components (Annex IV 1.2(e) "main materials", plural) --> `secondary_materials[]`, **deferred** (additive, 6.8). Until then `material` is the main material. ### 2.11 Connections and circularity classes (decision 8.38) @@ -393,7 +393,7 @@ Conventions unchanged from 0.5: `_id` = UUID string; timestamps ISO-8601 UTC str "material_class": "17 01 01", "material_class_source": "derived" | "assigned", // section 2.10 --- EU List of Waste ch. 17 "trade_name": "..." | null, // section 2.10 --- brand / product name (e.g. "Corian") "manufacturer": "..." | null, // free text (DIN SPEC 91484 Table 2); inheritable (8.38) - "connection_features": "..." | null, // anchors, cast-in plates, holes on the element itself (8.38); not inherited + "connection_features": "..." | null, // anchors, cast-in plates, holes on the component itself (8.38); not inherited "material_separability": { "class": "", "assessed_by": [ /* actor */ ], "note": "..." | null } | null, // section 2.11; inheritable // CPR: "main materials used" --- Annex IV 1.2(e); input to product family (Annex VII) "dataset": "beyond_debris", // FK --> datasets._id (section 3.6); no longer a free string @@ -458,7 +458,7 @@ Added: `original_function`, `material_class(+_source)`, `trade_name`, `manufactu `past_cycles`, `inherited_fields`, `inherited_from`, `withdrawn`, `properties`, `properties_version`, `created_by_user_id`. -#### 3.1.1 `origin` --- how the element entered circulation +#### 3.1.1 `origin` --- how the component entered circulation One block per identity, describing its **latest** origin: the event that took it out of its previous context (a building, a demolition, a production line, a stock) and made it available @@ -468,16 +468,16 @@ mixed an organisation, an address, a place and a stray note in one string. | field | meaning | applies to `kind` | |---|---|---| | `kind` | section 2.8 --- decides which regulatory reading applies | all | -| `at` / `at_precision` | when the element left its previous context (deinstalled, recovered from demolition, cut off, taken from stock). Precision per section 2.7; `year` is legitimate (CE mark carries the year only, CPR Art 18(2)(a)) | all | +| `at` / `at_precision` | when the component left its previous context (deinstalled, recovered from demolition, cut off, taken from stock). Precision per section 2.7; `year` is legitimate (CE mark carries the year only, CPR Art 18(2)(a)) | all | | `place` | where that happened: `name`, postal `address`, optional `location` | all | | `construction_work` | the **works** it left --- never the company (that is `performed_by`). CPR Art 3 sense: "buildings and civil engineering works ... including ... roads, bridges, tunnels". `name` (e.g. "Lichtwiese Campus Infrastructure --- pedestrian bridge"), `use` (e.g. "pedestrian bridge"), `year_built`; `identifier` is free-form now, intended for a digital-building-logbook or cadastral id (EPBD, section 10.6) | `deinstallation`, `demolition` only (I16) | -| `position_in_work` | where in the works the element sat (floor, axis, element mark); a drawing goes in as an `archival_document` (8.38) | `deinstallation`, `demolition` | +| `position_in_work` | where in the works the component sat (floor, axis, element mark); a drawing goes in as an `archival_document` (8.38) | `deinstallation`, `demolition` | | `connection_types` | how it was fixed in the works (section 2.11) | `deinstallation`, `demolition` | | `detachability` | DGNB class of how it could be released from the works, with who assessed it (section 2.11) | `deinstallation`, `demolition` | | `method` | free text: how it was deinstalled / recovered --- the Art 21(3) "process of deinstalling" | all; expected for `deinstallation` | | `performed_by` | actors (section 3.3.1): deinstaller, demolition contractor, fabricator that produced the offcut, stockist | all | | `notes` | anything that fits nowhere else | all | -| `planned` | `true` while the element is **in place**: identified in its works, not yet deinstalled; `at` is then the planned date or null. Cleared by the deinstall act (section 3.1.6, decision 8.104) | `deinstallation`, `demolition` | +| `planned` | `true` while the component is **in place**: identified in its works, not yet deinstalled; `at` is then the planned date or null. Cleared by the deinstall act (section 3.1.6, decision 8.104) | `deinstallation`, `demolition` | `origin` is `null` only on identities created without any provenance; migration never produces `null` (it writes `kind: unknown`). CPR export: Annex V 1(h) is filled from `origin` **iff** @@ -486,7 +486,7 @@ mixed an organisation, an address, a place and a stray note in one string. #### 3.1.2 Lineage inheritance (split / merge children) -A cut does not change an element's past. The **inheritable fields** --- `origin`, +A cut does not change a component's past. The **inheritable fields** --- `origin`, `manufactured_at` + `manufactured_precision` (one unit), `material` + `material_class` + `material_class_source` (one unit, decision 8.32), `trade_name`, `manufacturer`, `material_separability` (8.38), `original_function` --- are @@ -509,15 +509,15 @@ materialized on the child by the **server**, never copied by clients. `dataset` - Same pattern as property inheritance (section 4.4, decision 2.4) and `shape_class_source`: flat, queryable fields that cannot go stale because the server owns the propagation. -#### 3.1.3 `exit` --- how the element left circulation +#### 3.1.3 `exit` --- how the component left circulation -The counterpart of `origin`. `exit == null` means the element is in the catalogue's circulation -(available, reservable). Replaces 0.5 `consumed_at`, which conflated an element that no longer +The counterpart of `origin`. `exit == null` means the component is in the catalogue's circulation +(available, reservable). Replaces 0.5 `consumed_at`, which conflated a component that no longer exists (split, recycled) with one that exists elsewhere (installed, returned). - **Split / merge are server-derived from published children (decision 8.8).** Creating a child (an identity with `parent_identities`) changes nothing on the parent: while the child's v0 is a - draft or pending, the parent stays in circulation and shows "a cut from this element is awaiting + draft or pending, the parent stays in circulation and shows "a cut from this component is awaiting review". **Publishing the child's first snapshot** sets each parent's `exit = {kind: split | merged, at: , recorded_by_user_id: null}` (`merged` when the child has >1 parent) and clears the parent's reservation. **Not for a batch**: a draw only lowers `remaining`; the batch's `split` follows at `remaining == 0` (section 3.1.6). The server @@ -525,7 +525,7 @@ exists (split, recycled) with one that exists elsewhere (installed, returned). such child **identity** (the cut was recorded by mistake) clears the server-set exit. Withdrawing a child's *snapshot* does not: a child counts once it has ever been published (a `published` or `withdrawn` snapshot, the 8.9 test), because the cut happened. A client-set `split` without catalogued children is - legal ("cut up, elements not recorded") and is never touched by this rule. + legal ("cut up, components not recorded") and is never touched by this rule. - **Which parents can be cut (decision 8.34)**: published, not withdrawn, and either in circulation or already split / merged. `installed` / `returned` / `lost` parents re-enter first; `recycled` / `disposed`, withdrawn and unpublished parents are refused (409). Checked at @@ -534,15 +534,15 @@ exists (split, recycled) with one that exists elsewhere (installed, returned). authored exit is ever overwritten. - **Everything else is authored**: `POST /identities/{id}/exit` (`moderator(D)`, section 7.0) with the block. `construction_work` only for `kind == installed` (I18). -- **Re-entry** (an `installed` or `returned` element comes back, e.g. from a temporary pavilion): +- **Re-entry** (an `installed` or `returned` component comes back, e.g. from a temporary pavilion): `POST /identities/{id}/reenter` with a new `origin`. The server appends `{origin, exit}` to `past_cycles`, clears `exit`, writes the new `origin`. Evidence dated inside an archived gap resolves to `after_exit` (section 4.1); the next snapshot defaults to the new `origin.at` (8.19). `split`, `merged`, `recycled`, - `disposed` are terminal --- re-entry is rejected (the physical element no longer exists as this + `disposed` are terminal --- re-entry is rejected (the physical component no longer exists as this identity). `past_cycles` is never client-writable. -- **Reservation** is only possible with `exit == null` (0.5 rule, unchanged); in-place elements can be reserved (8.104). +- **Reservation** is only possible with `exit == null` (0.5 rule, unchanged); in-place components can be reserved (8.104). - **Exit from in place** (8.104): `recycled`, `disposed`, `lost` are allowed while `origin.planned`; `installed`, - `returned` are refused (409), since the element never left its works. + `returned` are refused (409), since the component never left its works. - **Batches** (8.105): a drawn child does not split its batch; the batch gets the server-set `split` only when `remaining` reaches 0 (section 3.1.6). @@ -550,7 +550,7 @@ exists (split, recycled) with one that exists elsewhere (installed, returned). **In place.** `origin.planned == true`. Counts as in circulation (`exit == null`): listed by default with a badge, reservable. Circulation filter: `active` (no exit) with the sub-values `in_place` (`origin.planned`) and -`deinstalled` (not planned; web label "Not in place", since it also holds offcuts, surplus and unknown origins, 8.115), and `exited`. The v0 of an in-place element starts at its survey date, not at `origin.at`. +`deinstalled` (not planned; web label "Not in place", since it also holds offcuts, surplus and unknown origins, 8.115), and `exited`. The v0 of an in-place component starts at its survey date, not at `origin.at`. **Deinstall** --- `POST /identities/{id}/deinstall {at, at_precision, method?, performed_by?, notes?, kind?}`, `moderator(D)`: sets `planned: false`, writes the given fields into the existing origin (`kind` may switch @@ -572,7 +572,7 @@ whole-identity: to hold part of a batch, draw a sub-batch; while a batch is rese the batch's `quantity`; a correction may change it, but not below the drawn sum (I32). The `remaining` check is atomic, so concurrent draws cannot overdraw. **Deinstalling a batch** (or any parent) propagates like a parent PATCH of `origin` (section 3.1.2) to the descendants that still inherit `origin`, and each child's timeline -records it; an element deinstalled on its own owns its origin and is not touched. Undo propagates the same way +records it; a component deinstalled on its own owns its origin and is not touched. Undo propagates the same way (decision 8.110). **The moment of the cut** is the child's first snapshot's `effective_from` (valid time, section 4.1). @@ -616,14 +616,14 @@ The tombstone body (every JSON read of the record answers 200 with it; file rout "identity_id": "uuid", "current_snapshot_id": "uuid" | null, "duplicate_of": "uuid" | null } ``` -Version lists and the lineage graph show a withdrawn snapshot outside D as a bare row (version, +Snapshot lists and the lineage graph show a withdrawn snapshot outside D as a bare row (version, dates, `status: withdrawn`, no name); the passport leaves it out. -**Implementation notes (P3).** Withdrawing an element that other withdrawn elements name as their +**Implementation notes (P3).** Withdrawing a component that other withdrawn components name as their `duplicate_of` needs a `duplicate_of` of its own, and those followers are re-pointed to it (I19 stays flat); without one the request is refused (409). Purge (`DELETE /identities/{id}?purge=1`, -`DELETE /snapshots/{sid}?purge=1`; admin; body `{confirm_id, reason}`) refuses an element that other -elements name as parent or `duplicate_of`, and the current snapshot (promote or withdraw first); it +`DELETE /snapshots/{sid}?purge=1`; admin; body `{confirm_id, reason}`) refuses a component that other +components name as parent or `duplicate_of`, and the current snapshot (promote or withdraw first); it writes one `purged_records` stub per removed id (identity, its snapshots, its evidence). #### 3.1.5 Unpublished identity (decision 8.9) @@ -699,8 +699,8 @@ Migration: `created_by_user_id` = the `added_by_user_id` of the identity's v0 (s "added_by_user_id": "...", "added_by_username": "...", "photo_count": 0, "mesh_ply_resolutions": { "0": ["reduced", "detailed"] }, - "point_cloud_files": [0], // DERIVED, 0.6.2: the indices of `geometry.point_clouds` whose full cloud is stored as a file (`point_clouds//.ply`); set by the upload route, removed by the delete route; absent on versions uploaded before 0.6.2 (8.148) - "derivation_due": "...", // DERIVED, optional: a timestamp set by every write that changes a stage input (a new version or correction, a PLY upload or removal, a PATCH of `geometry`, `color`, `shape_class` or `complexity`, a change of the element's `original_function`); the frequent geometry cron (`main_geometry.py --due`) reads only marked snapshots (partial index) and unsets it after a run without errors if it still holds the value read; not in the etag, not in the change log (8.136) + "point_cloud_files": [0], // DERIVED, 0.6.2: the indices of `geometry.point_clouds` whose full cloud is stored as a file (`point_clouds//.ply`); set by the upload route, removed by the delete route; absent on snapshots uploaded before 0.6.2 (8.148) + "derivation_due": "...", // DERIVED, optional: a timestamp set by every write that changes a stage input (a new snapshot or correction, a PLY upload or removal, a PATCH of `geometry`, `color`, `shape_class` or `complexity`, a change of the component's `original_function`); the frequent geometry cron (`main_geometry.py --due`) reads only marked snapshots (partial index) and unsets it after a run without errors if it still holds the value read; not in the etag, not in the change log (8.136) "etag": "...", "created": "...", "lastmodified": "..." // CPR: etag = integrity hash --- Art 78(h) } ``` @@ -769,7 +769,7 @@ until it is resubmitted as a draft (decision 8.18; same for evidence). | class | fields | before publish | after publish | |---|---|---|---| -| **frozen** --- claims about the element's state | inline `geometry.*` (meshes, point_clouds, authored proxies); mesh + point-cloud PLY files; `capture` except `capture.notes` (incl. fixture files); `fragment`, `quantity` | author / `moderator(D)` | never in place --> correction (below) | +| **frozen** --- claims about the component's state | inline `geometry.*` (meshes, point_clouds, authored proxies); mesh + point-cloud PLY files; `capture` except `capture.notes` (incl. fixture files); `fragment`, `quantity` | author / `moderator(D)` | never in place --> correction (below) | | **overrides** | `shape_class` / `complexity` set by hand (`*_source: assigned`) | author / `moderator(D)` | `moderator(D)` in place (8.3); never overwritten by a recompute | | **derived** --- server only | `descriptors`, fitted proxies + `deviation_maps`, `shape_class` / `complexity` when `derived`, `properties`, `frame`, `bbx`, previews, `mesh_ply_resolutions`, `point_cloud_files` | server | server, any time (crons, recompute routes). **Never accepted from a client** --- `descriptors` leaves `UpdateComponentSnapshotModel` | | **mutable metadata** | `name`, `notes`, `location`, `color`, `photo_credit` (8.128) | author / `moderator(D)` | `moderator(D)` in place | @@ -779,14 +779,14 @@ until it is resubmitted as a draft (decision 8.18; same for evidence). Two distinct acts, both explicit: -- **State change** (cut, weathered, repaired): a **new version** with a later `effective_from`. +- **State change** (cut, weathered, repaired): a **new snapshot** with a later `effective_from`. - **Correction** (wrong scan, wrong flag): `POST /snapshots/{sid}/supersede` with the corrected snapshot --> new document, next `version` number, **inherits the old `effective_from`**, `supersedes: `; the server sets `superseded_by` on the old one when the new one is published. A superseded snapshot drops out of resolution (section 4.1), the fold and default lists, stays retrievable, and shows as "corrected" on the timeline. If the old one was `current_snapshot_id`, the new one replaces it on publish; otherwise it never becomes current - (`promote` is ignored). Any version can be corrected: the correction keeps the place of the + (`promote` is ignored). Any snapshot can be corrected: the correction keeps the place of the first record of its `supersedes` chain in the order (I3) and on the timeline (decision 8.123 b). No role edits a frozen field in place; an empty `capture` field is filled once (8.123 a). @@ -804,12 +804,12 @@ the capture but is **not the component** out of `geometry`: coordinates of an authored or hand-oriented model. Not to be confused with the snapshot's derived `frame`, the canonical orientation (section 4.3). - `markers` --- labelled reference points: `role: rig` (fixed on the capture rig, e.g. the four - blue markers of the DDU gripper) or `role: component` (stuck on the element, e.g. green markers). -- `fixtures` --- meshes captured together with the element that are not part of it (the gripper that + blue markers of the DDU gripper) or `role: component` (stuck on the component, e.g. green markers). +- `fixtures` --- meshes captured together with the component that are not part of it (the gripper that held a stone during scanning), one PLY each under `capture//fixtures/`. No derivation (section 4.3) ever reads markers or fixtures, and they never satisfy I1. The 0.5 -convention "`meshes[0]` is the element, anything else is whatever" (descriptors read only index 0) +convention "`meshes[0]` is the component, anything else is whatever" (descriptors read only index 0) ends: every entry of `geometry.meshes` / `point_clouds` is the component. ### 3.3 `component_evidence` @@ -929,11 +929,11 @@ the canonical `frame`. `kind: "none"` + `description` must always be sufficient. When the snapshot is later corrected in new coordinates, the record keeps its `snapshot_id` and point; the viewer draws it only on that snapshot. When a correction changes the geometry, the -correction dialog warns "N evidence records are positioned on the previous version" and lists +correction dialog warns "N evidence records are positioned on the previous snapshot" and lists them, each linked to its own correction in the evidence form, where the point is picked again (a reinforcement layout: re-imported bars); there is no bulk re-placing tool in 0.6 (decision 8.87). A correction that keeps the geometry keeps the coordinates and warns nothing. No transform -between versions is stored in 0.6 (decision 8.16). +between snapshots is stored in 0.6 (decision 8.16). #### 3.3.3 Moderation vs. verification @@ -996,7 +996,7 @@ Every list query defaults to `superseded_by: null`; `?include=superseded` lifts ### 3.4 `designs` --- removed (decision 7.11) -CSC records elements, not designs. Evaluating a design built from catalog components happens in GH +CSC records components, not designs. Evaluating a design built from catalog components happens in GH on fetched passports; published, editable designs belong in tools built for that (e.g. Speckle). The `designs` collection, its routes, the web `/designs` pages and the GH design components go. @@ -1025,7 +1025,7 @@ bytes. **Photo metadata (decision 7.13)** --- for snapshot photos and evidence images alike, the upload pipeline removes the EXIF GPS block, owner / artist and body serial number, and keeps orientation, -capture time (`DateTimeOriginal`) and camera make / model. Where an element is stays the snapshot's +capture time (`DateTimeOriginal`) and camera make / model. Where a component is stays the snapshot's chosen `location`, never the photo's GPS. New env vars: `SNAPSHOT_PROXIES_DIR` (the `proxies/` folder above) and `SNAPSHOT_CAPTURE_DIR` @@ -1062,7 +1062,7 @@ policy: the merge pattern is removed; `datasets` and `materials` are collections disabled) may create a dataset with `POST /datasets` (name; the `_id` slug is derived from the name, made unique with a numeric suffix, and immutable). The creator becomes `moderator` and `contributor` of it; the dataset starts `visibility: members` and `reviewed: false`. A dataset that is not reviewed -cannot be `catalog`, and no element of it can be made public (the metadata PATCH, the create with +cannot be `catalog`, and no component of it can be made public (the metadata PATCH, the create with `is_public`, `POST /datasets/{did}/public`; the dry run still answers) until an admin sets `reviewed: true` with `PATCH /datasets/{did}` (the only admin-only field; 409 otherwise). The reviewed flag is not a member right: admins pass the gate. Datasets created by an admin, and every dataset that @@ -1071,7 +1071,7 @@ documents without it). A non-admin may create `CSC_MAX_DATASETS_PER_USER` datase counted by `created_by_user_id`; admins are not limited; 403 beyond). The last `moderator` of a dataset cannot be removed or demoted with `PUT /datasets/{did}/members/{user_id}` (409; an admin may). A dataset is deleted with `DELETE /datasets/{did}` by `moderator(D)` or an admin, **only while it holds -no identity** (409 with the count otherwise, for admins too: move the elements first, section 7.0); +no identity** (409 with the count otherwise, for admins too: move the components first, section 7.0); open invitations to it are revoked. Creating a dataset mails the admins ("Dataset created"); a mail failure never blocks the create. @@ -1089,11 +1089,11 @@ An anonymous caller never receives a person: responses on the public tier carry As one predicate: `admin or member(D) or (logged_in and D.visibility == catalog) or is_public`. Unpublished records: section 7.0. -**The public flag in the web (decision 8.131).** `is_public` is set per element with the ordinary +**The public flag in the web (decision 8.131).** `is_public` is set per component with the ordinary metadata PATCH (`moderator(D)`, or the creator while unpublished, 8.9; the "Public" switch in "Edit details") and for a whole dataset with `POST /datasets/{did}/public` (`moderator(D)`): it sets the -flag on the dataset's elements that were ever published (3.1.5) and are not withdrawn, where it -differs, and logs each change like a metadata PATCH. No element follows another: children never +flag on the dataset's components that were ever published (3.1.5) and are not withdrawn, where it +differs, and logs each change like a metadata PATCH. No component follows another: children never inherit the flag (6.2). ### 3.7 `users` changes @@ -1204,7 +1204,7 @@ their own `status_history` (8.30); derived fields (`properties`, `frame`, proxie `orcid` inside `old` / `new` values. - **Purge** (section 3.1.4) deletes the record's entries with the record. - The migration writes no entries: history starts at cutover (`cause: migration` is for later - data-repair scripts). `reserved` is not logged --- a booking, not a fact about the element; + data-repair scripts). `reserved` is not logged --- a booking, not a fact about the component; `current_snapshot_id` is (promote / fallback, cause `patch`). - Indexes: `(record_id, at)`, `(identity_id, at)`. @@ -1222,18 +1222,18 @@ existing product's passport, Art 76(1), 75(2)(e) --- the snapshot chain *is* tha - Set when the snapshot is created: now, or the author's value for a state that began earlier (the snapshot form, section 7.6). A correction inherits its predecessor's (section 3.2.2). -- **Default for v0 (decision 8.10):** `origin.at` with its precision when known --- the element is +- **Default for v0 (decision 8.10):** `origin.at` with its precision when known --- the component is assumed unchanged since it left its previous context; else `capture.captured_at`; else `created`. A child's v0 (cut from a parent) starts at the cut: `created` or the author's date --- never the - parent's inherited `origin.at`. Later versions: now or the author's date; the first snapshot - after a **re-entry** defaults to the new `origin.at` (8.19). The v0 of an **in-place** element (`origin.planned`, section 3.1.6) starts at its survey date (the author's date, else `capture.captured_at`, else `created`), never at the planned `origin.at` (8.104). + parent's inherited `origin.at`. Later snapshots: now or the author's date; the first snapshot + after a **re-entry** defaults to the new `origin.at` (8.19). The v0 of an **in-place** component (`origin.planned`, section 3.1.6) starts at its survey date (the author's date, else `capture.captured_at`, else `created`), never at the planned `origin.at` (8.104). - **Evidence outside the snapshot history** (8.10): resolution `before_first` (e.g. an inspection - while the element was still installed) or `after_exit` (e.g. inspected in the building it went + while the component was still installed) or `after_exit` (e.g. inspected in the building it went into) feeds no snapshot's `properties` --- no snapshot records that state. The record belongs to the identity like all evidence (I5): identity-scoped quantities fold from it as from any evidence, and every record --- of either scope --- is listed on the identity page and the timeline under "before cataloguing" / "after leaving circulation". **Archived cycles count too (8.19):** - a date between a `past_cycles[k].exit.at` and the next cycle's `origin.at` (the time the element + a date between a `past_cycles[k].exit.at` and the next cycle's `origin.at` (the time the component was installed elsewhere, returned or lost before it re-entered) also resolves to `after_exit`. - After publish, `moderator(D)`-editable via `PATCH /snapshots/{sid}` (section 7.1) --- decision 6.6. - Always set: there are no virtual snapshots (decision 7.12). @@ -1273,9 +1273,9 @@ elif boxscore > T_IRREGULAR: irregular # hull << OBB: pocke else: block ``` -Elongation is tested before the hull score (decision 8.56): a clearly elongated or flat element +Elongation is tested before the hull score (decision 8.56): a clearly elongated or flat component is linear or planar even when its hull is uneven (zirkus timber, aggregations); only the -remaining compact elements can be irregular. An element that passes both tests takes the class of +remaining compact components can be irregular. A component that passes both tests takes the class of its stronger elongation (decision 8.58): a long thin strip (e1/e2 3.3, e2/e3 25) is planar, a batten or board (e1/e2 20, e2/e3 5) linear. @@ -1290,9 +1290,9 @@ override writes `"assigned"` and is not overwritten by recompute. Setting the ov ### 4.2b Complexity --- `complexity.py` (decision 6.15) Ordinal 0--3 (0 simple, 1 normal, 2 complex, 3 very complex). Inputs: primary-proxy residual -`p95_mm / e1` (how far the element departs from its proxy), `boxscore` (hull concavity), and +`p95_mm / e1` (how far the component departs from its proxy), `boxscore` (hull concavity), and `shape_class == composite` => >= 2. Thresholds tuned by the same script as section 4.2 against the -**71 `beyond_debris` (0.5: `sas_cita_scans`) ratings, which are authored per element** (user) --- the only genuine labels; +**71 `beyond_debris` (0.5: `sas_cita_scans`) ratings, which are authored per component** (user) --- the only genuine labels; confusion table part of the deliverable. **Frozen 2026-10-02 (decision 8.59):** residual `p95_mm / e1` thresholds `0.005 / 0.05 / 0.12`, `boxscore` thresholds `5 / 15 / 45` (on 261001: 44 of 71 authored ratings exact, 71 of 71 within one level). `complexity_source: derived | @@ -1338,13 +1338,13 @@ any change of an upstream result --- a recompute, a moderator override of `shape stale and they rerun; no stage order can loop. Authored proxies are never refitted but still feed stage 1--2 (frame from the authored primitive). -**The frame (stage 1, decision 7.10)** is the element's standard orientation and size, used by GH +**The frame (stage 1, decision 7.10)** is the component's standard orientation and size, used by GH (`ApplyFrame`, filters, arrangement), the web filters and columns, the component map, the descriptors and the shape class. It is **not a proxy**: 1. Minimum-volume oriented bounding box of all component geometry (meshes, clouds, authored primitives' surfaces; never `capture` markers / fixtures) --- `trimesh.bounds.oriented_bounds`. - Edge-aligned for box-like elements; vertex PCA is not used (it lands on diagonals when two + Edge-aligned for box-like components; vertex PCA is not used (it lands on diagonals when two extents are similar or vertex density is uneven). 2. Axes by extent: **longest --> x, middle --> y, shortest --> z** (lying on its largest face); **`original_function == IfcColumn` and longest >= 2 x middle extent: longest --> z, middle --> @@ -1361,7 +1361,7 @@ descriptors and the shape class. It is **not a proxy**: differ by a 180 degree flip). `frame.o` = box centre; `bbx` = extents along x / y / z. 4. **Never upside down against the input (decision 8.53).** Before step 3's `trace(R)`: when the canonical z of a candidate lies within 60 degrees of the stored z axis (|z . Z| >= 0.5), only - candidates with `z . Z > 0` are valid --- the element keeps the input's up direction. Step 3 + candidates with `z . Z > 0` are valid --- the component keeps the input's up direction. Step 3 then decides among the rest. The frame report (rehearsal, tuning tables) lists every snapshot whose canonical z points against stored z (`z . Z < 0`) and every axis-order change against 0.5, for review. @@ -1420,12 +1420,12 @@ on the mesh topology and never on the convex hull: 1. Sample: meshes and authored primitives area-uniformly; point clouds thinned to the same size; fixed seed; all component geometry, never `capture` markers / fixtures (I23). 2. 64 non-zero eigenpairs of `L phi = lambda M phi`; time grid **fixed in area-normalised units** - (one grid for the catalogue, not per shape), so values compare across elements. + (one grid for the catalogue, not per shape), so values compare across components. 3. Per-point HKS, mass-weighted mean + variance pooling, L2-normalised (as in `hks_features.py`). Intrinsic, so it needs no frame (8.1). Why points: in the 260916 probe every mesh failure came from a mesh in disconnected pieces (scan islands; unmerged seams) --- the sample never failed (169 / 169) -and ranks elements like the intact mesh (rho 0.98); the hull always works but describes the envelope +and ranks components like the intact mesh (rho 0.98); the hull always works but describes the envelope only (rho 0.34). Errors raise and are recorded by the runner; `HKS_VERSION` versions the result. ### 4.4 Property fold --- `properties.py` @@ -1600,22 +1600,23 @@ role)`; the frontend merely hides controls. `admin` passes every check. D = the | submit `draft --> pending`; recall `pending --> draft` (8.18); resubmit `rejected --> draft` | author | | edit an unpublished record (fields, files, photos, attachments) | draft: author or `moderator(D)`; pending: `moderator(D)`; rejected: nobody (8.18) | | upload / replace / delete geometry files and photos | as "edit an unpublished record", **only while the snapshot is not `published`** (freeze rules: decision 6.6) | -| evidence attachments | unpublished record: as "edit an unpublished record"; published: `contributor(D)` adds, `moderator(D)` removes with reason, tombstone entry kept (decision 7.3) | +| evidence attachments | unpublished record: as "edit an unpublished record"; published: `contributor(D)` or `moderator(D)` adds, `moderator(D)` removes with reason, tombstone entry kept (decision 7.3) | | publish / reject / withdraw / reinstate (snapshot, evidence) | `moderator(D)`; publishing a child's **first** snapshot also ends its parents (split / merge, 8.8), so it needs `moderator` of every parent's dataset as well --- otherwise it waits in that dataset's queue | | promote `current_snapshot_id`; `effective_from`, `shape_class` overrides; recompute a snapshot's derived fields | `moderator(D)` | | PATCH identity metadata (`origin`, `material`, `original_function`, `is_public`, ...) | `moderator(D)`; while the identity is unpublished also its creator (8.9) | | `exit`, `reenter`, `withdraw` identity | `moderator(D)` | | `deinstall`, `undo-deinstall` (8.104) | `moderator(D)` | | draw from a batch (8.105) | as "create identity"; while the batch is reserved only the reserving user or `moderator(D)` (8.110) | -| move identity D1 --> D2 | `moderator(D1) and moderator(D2)` | +| move identity D1 --> D2 (8.191) | `moderator(D1) and moderator(D2)`; refused while a snapshot or record of it is draft or pending; a public identity into an unreviewed dataset only as `admin` | +| reserve, `reenter`, undo `exit`, `deinstall`, `undo-deinstall`, add a photo or an attachment on a withdrawn identity, snapshot or record (8.190) | nobody: 409 "The component is withdrawn."; a moderator reinstates first | | set evidence `verification` | `self_attested` / back to `unverified`: the recorder, unless a reviewer set the state; `reviewed` / `accredited` / any downgrade: `reviewer(D)` or `admin`, never the recorder or a `performed_by` user (8.12, I27) | | supersede published evidence | `contributor(D)` (new record enters `pending`) | -| reserve | any authenticated user who can read the element, while it is not reserved | +| reserve | any authenticated user who can read the component, while it is not reserved | | release | the reserving user, or `moderator(D)` (as 0.5) | | manage D's members, D's `visibility` / `name` / `description` | `moderator(D)` | | invite a user (8.14); add a member by exact email (8.20) | `admin` (any dataset, or none); `moderator(D)` (into D only) | | search users (8.20) | `admin` | -| revoke an unused invitation | its creator, `moderator(D)` of its dataset, `admin` | +| revoke an unused invitation | `moderator(D)` of its dataset, `admin`; its creator loses the right with the role (8.193) | | create dataset (8.139) | any signed-in account with a verified e-mail address, up to `CSC_MAX_DATASETS_PER_USER` (admins: unlimited); the creator becomes `moderator` and `contributor` | | delete a dataset (8.139) | `moderator(D)` or `admin`, only while D holds no identity | | set `reviewed` on a dataset (8.139) | `admin` | @@ -1648,7 +1649,7 @@ POST /snapshots/{sid}/proxies/recompute moderator(D); runs every stag GET /geometry/stale | /geometry/work/{sid} admin: the geometry runner off the server (decisions 8.45, 8.51) POST /geometry/results/{sid} admin: a worker's derived fields + files; 409 when the inputs changed GET /geometry/failed admin: snapshots with a failed frame / class / proxy stage, stage and stored error text (decisions 8.60, 8.61); web /admin/geometry -GET /identities/{id}/snapshots version list; each row carries `geometry_failed` (a frame, class or proxy stage failed --- a flag, never the text; 8.60) +GET /identities/{id}/snapshots snapshot list; each row carries `geometry_failed` (a frame, class or proxy stage failed --- a flag, never the text; 8.60) GET /identities/{id}/changes member(D) / admin: change_log entries of the identity, its snapshots and evidence (section 3.8) GET /identities/{id}?as_of= the record as of a date (section 3.8); same for /snapshots/{sid}, /evidence/{eid} GET /identities/{id}/timeline merged: past_cycles, origin, deinstalled (8.104), snapshot states + corrections, evidence, exit @@ -1666,6 +1667,7 @@ DELETE /identities/{id}/exit moderator(D); undo a mistaken POST /identities/{id}/reenter moderator(D); body = new origin; archives {origin, exit} to past_cycles (section 3.1.3) POST /identities/{id}/withdraw moderator(D); body = {reason, duplicate_of?} (section 3.1.4) POST /identities/{id}/reinstate moderator(D); clears `withdrawn` +POST /identities/{id}/move moderator of source and destination; body = the destination dataset; change-logged (8.191) DELETE /identities/{id} author or moderator(D) while nothing was ever published (I19); ?purge=1 admin only (body {confirm_id, reason}) DELETE /snapshots/{sid}?purge=1 admin: any status (body {confirm_id, reason}); not the current snapshot ``` @@ -1725,7 +1727,7 @@ Decision 8.11: | request | header | |---|---| | any write (POST / PUT / PATCH / DELETE), and any request with a login token | required: known client, version >= minimum, else **426 Upgrade Required** with a body naming the fix ("update via CSC_Update" / "reload the page") | -| anonymous GET / HEAD | optional --- the `/id/{uuid}` resolver, public elements, curl / Python readers | +| anonymous GET / HEAD | optional --- the `/id/{uuid}` resolver, public components, curl / Python readers | | a known client below its minimum | **426**, always | Exempt: CORS preflight (`OPTIONS`), `/ghinterface/*` (the updater), `/docs`, `/redoc`, @@ -1742,12 +1744,12 @@ GET /id/{uuid} frontend route AND API route, permanent --- never renamed, n - `Accept: application/json` --> 302 to `/identities/{uuid}/compose` (the passport). - Withdrawn with `duplicate_of` --> **301** to `/id/{duplicate_of}`; withdrawn without --> the tombstone page / JSON (members of D: the full record, 8.17); `current_snapshot_id == null` --> - the component page with "no current state"; purged --> **410**; unknown --> 404 --- except for a + the component page with "no current snapshot"; purged --> **410**; unknown --> 404 --- except for a signed-in caller with `contributor` in some dataset: the page "this tag is not in the catalog - yet" with *New component* and *Cut from elements* (the snapshot form, section 7.6; decision 8.87). -- Visibility rules (section 3.6) apply after the redirect. An element the viewer cannot see does - **not** hide behind a 404 (decision 8.11) --- whoever scans a tag holds the element: anonymous --> - a page "this component is not public" with a sign-in link (callback to the element); logged in + yet" with *New component* and *Cut from components* (the snapshot form, section 7.6; decision 8.87). +- Visibility rules (section 3.6) apply after the redirect. A component the viewer cannot see does + **not** hide behind a 404 (decision 8.11) --- whoever scans a tag holds the component: anonymous --> + a page "this component is not public" with a sign-in link (callback to the component); logged in without access --> "you have no access to this component", without dataset details. - Scanners (`identify`, `locate-by-id`, `transmit-id`, GH) accept a raw UUID **or** any URL whose last path segment is a UUID --- so a future URL-bearing tag works with no code change. @@ -1762,9 +1764,9 @@ one `POST /evidence/bulk`: | shortcut | what it does | typical use | |---|---|---| -| fan-out | one submission --> several atomic records (rule 1.3) | 3 rebound test areas on one element; one visual inspection noting spalling, cracking, corrosion | -| repeat from my last record | instrument, performers, standard, lab details prefilled from the user's latest record of the same method in the same dataset; dates default to now; readings / results always start empty | the next element of a site survey; the next core from the same lab report | -| apply to several elements | one claim --> one record per selected element | an archival drawing or datasheet covering a whole batch of elements | +| fan-out | one submission --> several atomic records (rule 1.3) | 3 rebound test areas on one component; one visual inspection noting spalling, cracking, corrosion | +| repeat from my last record | instrument, performers, standard, lab details prefilled from the user's latest record of the same method in the same dataset; dates default to now; readings / results always start empty | the next component of a site survey; the next core from the same lab report | +| apply to several components | one claim --> one record per selected component | an archival drawing or datasheet covering a whole batch of elements | Field explanations are "?" popovers (tap on touch, hover/focus on desktop); their text is the payload field descriptions served by `/evidence/methods` and `/schema/evidence`, never a @@ -1797,8 +1799,8 @@ capture, location, dimension inputs) --- reached from four places: | entry point | reached from | creates | |---|---|---| | new component | scan an unused tag (`/id/{uuid}`, section 7.5); `/add-component` | identity + v0 | -| cut from ... | scan an unused tag, then the parent's tag(s); "Cut an element from it" on the parent's page | child identity; server inherits (section 3.1.2); publishing its v0 sets the parents' `exit` split / merged (section 3.1.3, 8.8) | -| record new state | component page | next version, `effective_from` = now unless set; only for a changed **shape** --- damage without shape change is evidence | +| cut from ... | scan an unused tag, then the parent's tag(s); "Cut a component from it" on the parent's page | child identity; server inherits (section 3.1.2); publishing its v0 sets the parents' `exit` split / merged (section 3.1.3, 8.8) | +| new snapshot | component page | next number, `effective_from` = now unless set; only for a changed **shape** --- damage without shape change is evidence | | correct | a published snapshot | superseding snapshot (section 3.2.2), prefilled, geometry kept unless dimensions are re-entered, same `effective_from` | All four: `draft` --> photos --> `submit`; for a moderator, submit also publishes and promotes @@ -1820,11 +1822,11 @@ DELETE /datasets/{did} moderator(D) | admin: only wh GET /users/me the caller: username, full_name, email, role, memberships, moderated_datasets, profile (organization, organization_ror, orcid, default_role) PATCH /users/me the caller: full_name, organization, organization_ror, orcid, default_role; 422 names a bad field (8.133) PUT /datasets/{did}/members/{user_id} moderator(D): body = {roles: [...]}; empty set = remove; the last moderator cannot be removed or demoted (409, except by an admin) -POST /datasets/{did}/public moderator(D): body = {is_public, dry_run?}; every published, not withdrawn element of D public / private; --> {changed, skipped} (8.131); all elements are validated first, one that fails stops the call with a 422 that names it (nothing written); refused 409 on a dataset that is not reviewed (8.139) +POST /datasets/{did}/public moderator(D): body = {is_public, dry_run?}; every published, not withdrawn component of D public / private; --> {changed, skipped} (8.131); all components are validated first, one that fails stops the call with a 422 that names it (nothing written); refused 409 on a dataset that is not reviewed (8.139) POST /datasets/{did}/members moderator(D): body = {email, roles}; exact match --> added + notified, no account --> invitation (8.20) GET /users/search?q= admin: prefix search over username, name, email (member editor lookup, 8.20) GET /users admin: + memberships per user; ?q= ?dataset= ?dataset_role= ?no_dataset=1 ?role= ?state=enabled|disabled|unverified ?invited=1 (8.21) -PATCH /identities/{id} moderator(D) for metadata; changing `dataset` needs moderator of both (section 7.0) +PATCH /identities/{id} moderator(D) for metadata; `dataset` changes only through POST /identities/{id}/move (8.191) GET /materials public: the controlled list (section 2.10) POST /materials admin; `default_class` required (I25) PATCH /materials/{mid} admin; label, group, default_class, uniclass, notes, retired (_id immutable); re-derives material_class @@ -1854,7 +1856,7 @@ GET /identities/{id}/export/pdf the human-readable passport s The photo credit of the current snapshot (`photo_credit`, 8.128) is exported: JSON-LD carries `photo_credit` as `csc:photoCredit` with its `text` (`csc:text`) and, where the credit has one, its `url`; the PDF passport prints it in the state block as "Photo credit" (a (c) in the text becomes the -copyright sign; the link only for http / https). An element without a credit exports neither. +copyright sign; the link only for http / https). A component without a credit exports neither. All three read what the component read returns for the caller (section 3.6): the public tier for a public viewer, people named in evidence only for members (8.13). The storage is unchanged --- @@ -1866,14 +1868,14 @@ ontologies sit at the boundary (`ONTOLOGIES.md`). `sosa:Observation` (a core: `sosa:Sample`), actors --> `prov:Agent`. The JSON-LD context and the CERO exporter both read these columns; a new ontology is a new column (and, where its shape differs, an exporter). -- **CERO.** One literal per CERO property on the element: the conservative bound of the folded +- **CERO.** One literal per CERO property on the component: the conservative bound of the folded range (as the CPR projection, section 10.3), the unit of the CERO property; provenance stays behind a link to the CSC record (`rdfs:seeAlso` to `/id/{uuid}`). Lossy by design. - **PDF** (at most two pages, English): header (catalog number, name, QR code of `/id/{uuid}`, dataset, issue date, snapshot version); identity (original function, material and waste class, trade name, manufacturer, manufactured); origin and DGNB items (kind, date, place, works with construction method and year built, position, connections, detachability, - material separability); current state (preview image, dimensions, shape class, mass, + material separability); current snapshot (preview image, dimensions, shape class, mass, condition grade); the folded properties (quantity, range, unit, n, source, verification); the evidence list (method, date, result, verification, attachment names); lineage and circulation (parents, children, exit, earlier cycles); footer (links to the JSON, JSON-LD @@ -1886,7 +1888,7 @@ ontologies sit at the boundary (`ONTOLOGIES.md`). GET /identities/{id}/history?depth=1|2&expand=groups|all the lanes and events of a component and its relatives ``` -The element is the middle lane (level 0), its parents lie above (negative levels), its children below +The component is the middle lane (level 0), its parents lie above (negative levels), its children below (positive); `depth` = generations in each direction (default 1, max 2; 422 beyond). Read access as the component read (401 / 403 / 404 as there). Only projections of the documents are read. @@ -1894,33 +1896,33 @@ the component read (401 / 403 / 404 as there). Only projections of the documents { "root": "uuid", "depth": 1, "expand": "groups", "lanes": [ // sorted by level, then catalog number { "id": "uuid", "level": -1, "role": "parent" | "piece" | "child", "visible": true, - "catalog_number": 12, "name": "...", // name of the current version (else the latest the caller sees) + "catalog_number": 12, "name": "...", // name of the current snapshot (else the latest the caller sees) "dataset": "slug", "withdrawn": false, "exited": false, "in_place": false, "events": [ ... ] }, // time order, see below { "id": "uuid", "level": -1, "role": "parent", "visible": false, "label": "not visible" } // a stub: nothing else; a relative the caller may not see, or a lane beyond the first twelve is not a stub but counted in `more` ], "links": [ { "kind": "cut" | "assemble", "from": "parent uuid", "to": "child uuid", - "at": "...", "precision": "day", "version_id": "uuid" } ], // at / precision / version_id: the child's first version, absent when the child is a stub + "at": "...", "precision": "day", "version_id": "uuid" } ], // at / precision / version_id: the child's first snapshot, absent when the child is a stub "more": 0 } // lanes left out beyond twelve (MAX_LANES) ``` -- **Lanes.** The element first, then by distance (parents before children, then catalog number); +- **Lanes.** The component first, then by distance (parents before children, then catalog number); at most 12 lanes, the rest only as `more`. A relative the caller may not see is a stub (`visible: - false`, no content), and the walk does not continue through it. A withdrawn element the caller sees + false`, no content), and the walk does not continue through it. A withdrawn component the caller sees only as a tombstone (8.17) is a stub with `withdrawn: true`, `withdrawn_at` and `catalog_number`. A link is listed only where both lanes are kept: `cut` = the child has one parent, `assemble` = it - has several (split / merge, 8.8); its place in time is the child's first version (a correction keeps - the place of the version it corrects, 8.123 b). + has several (split / merge, 8.8); its place in time is the child's first snapshot (a correction keeps + the place of the snapshot it corrects, 8.123 b). - **Events** (`kind`, `at`, `precision`; `at` is `null` for an undated event, and those come first): `origin` (also the origins of earlier cycles, with `cycle`; `detail` = origin kind, `planned`), - `version` (`id`, `version`, `status`, `name`, `corrected: true` on a version a correction replaced, + `version` (`id`, `version`, `status`, `name`, `corrected: true` on a snapshot a correction replaced, `corrects` = the id of what a correction replaces, `withdrawn`), `evidence_group` (default: records of one day and method, `count`, `ids`, `statuses`, `day`, `method`), `evidence` (with `expand=all`: one event per record with `id`, `method`, `status`, `quantity`, `corrected`), - `exit` (also of earlier cycles), `withdrawal`. Withdrawn evidence is not listed. A version or + `exit` (also of earlier cycles), `withdrawal`. Withdrawn evidence is not listed. A snapshot or record appears only if the caller sees it in full (drafts: their author and `moderator(D)`). -- **Tiers.** An anonymous caller gets the public tier: full lanes only for public elements, stubs for +- **Tiers.** An anonymous caller gets the public tier: full lanes only for public components, stubs for all others, no people anywhere (8.101); the response is sent with `Vary: Authorization`. ## 8. Migration from 0.5 @@ -1974,7 +1976,7 @@ until memberships are assigned), idempotent, 70 fixture files. | 7 | 12 | `migrate_material_vocab.py` | --- | seed `materials` (section 2.10); map `corian --> mineral_composite` + `trade_name: "Corian"`, `concrete --> concrete`, `brick --> fired_clay`, `aerated-concrete --> autoclaved_aerated_concrete`, `asphalt --> asphalt`, `steel --> steel`, `wood --> timber`; derive `material_class` (`derived`). Aborts on any unmapped value. Runs before 10b (inheritance compares `material`/`trade_name`). | | 8 | 3 | `migrate_type_to_original_function.py` | --- | `panel-->IfcPlate`, `beam-->IfcBeam`, `column-->IfcColumn`, `slab-->IfcSlab`, `brick-->IfcBuildingElementPart` (6.13; no 0.5 identity uses it), `pipe-->IfcPipeSegment`, `profile-->IfcMember`, `connector-->IfcDiscreteAccessory`, `rubble-->CscDebris`, `other-->IfcBuildingElementProxy`. Drops `type` (no alias, section 8.0). | | 9 | 10 | `migrate_salvage_to_origin.py` | --- | Hand-mapped, not string-copied --- the 0.5 data holds only 4 distinct `salvage_source` values (table below). `salvaged_at` --> `origin.at`, precision `day` (all stored values are midnight). Identities with no salvage data get `origin.kind` from their dataset (table below). Drops `salvage_source`, `salvaged_at`. | -| 10 | 10c | `migrate_consumed_to_exit.py` | --- | 42 consumed identities (260916): by rule: consumed with catalogued children --> `{kind: split, at: (I18), precision exact, recorded_by_user_id: null}` (in 260916 that equals `consumed_at` to the microsecond for all 37; a difference is reported); consumed without children in `ddu_build_with_debris` --> `{kind: installed, notes: "modified by students during the workshop; resulting pieces not catalogued"}`, in `ddu_aggregations` --> `{kind: lost, notes: same}`, `at` = `consumed_at`; anything else aborts. **260916: 37 split (36 panels + 1 aggregations element that was cut again), 5 installed, 0 lost** --- the draft's "1 lost" was that aggregations element before its own cut was catalogued. All others `exit: null`, `past_cycles: []`. Drops `consumed_at`. | +| 10 | 10c | `migrate_consumed_to_exit.py` | --- | 42 consumed identities (260916): by rule: consumed with catalogued children --> `{kind: split, at: (I18), precision exact, recorded_by_user_id: null}` (in 260916 that equals `consumed_at` to the microsecond for all 37; a difference is reported); consumed without children in `ddu_build_with_debris` --> `{kind: installed, notes: "modified by students during the workshop; resulting pieces not catalogued"}`, in `ddu_aggregations` --> `{kind: lost, notes: same}`, `at` = `consumed_at`; anything else aborts. **260916: 37 split (36 panels + 1 aggregations component that was cut again), 5 installed, 0 lost** --- the draft's "1 lost" was that aggregations component before its own cut was catalogued. All others `exit: null`, `past_cycles: []`. Drops `consumed_at`. | | 11 | 10b | `migrate_lineage_inheritance.py` | 3, 10, 12 | after 3 and 10. For every identity with `parent_identities`: set `inherited_from`; for each inheritable field equal to the parent's value --> list it in `inherited_fields`. **`manufactured_at` on the 45 children holds their creation timestamp (GH wrote it)** --> overwrite with the parent's (all `unknown`) and list it as inherited; the cut moment survives as the child's first-snapshot `effective_from` (step 1). Roots get `inherited_fields: []`, `inherited_from: null`. | | 12 | 6 | `migrate_attributes_cleanup.py` | 1c | `attributes.primitive` --> dropped (now derivable); `attributes.scan` --> `capture.notes`; `attributes.3d_scan_metadata` --> `capture{method: photogrammetry, captured_at: created_utc}` **on the identity's v0 snapshot** (7.7; device and software are not in the metadata); `attributes.scan` --> `capture.notes: "scan "`; local paths dropped. 260916: 141 captures (70 robot scans, 71 `beyond_debris`). | | 13 | 6c | `migrate_capture_context.py` | 6 | the 70 `ddu_build_with_debris` snapshots (7.7): `geometry.marker_points` --> `capture.markers` by **order**: the import wrote the four blue rig markers first (`blue_1..4`, `role: rig`; asserted within 50 mm of the marker plane), then the green ones on the stone (`green_1..`, `role: component`; asserted z > 100 mm) --- in 260916 all 70 scans follow it, while the "+/-120 mm cross" of the draft fails on 7 (rotated or shifted planes); the source OBJs are not available. `meshes[1]` (`end_effector`) --> `capture.fixtures[0]`, its `detailed.ply` (else `reduced.ply`; one scan has neither --- its inline mesh is exported) moved to `capture//fixtures/0.ply`, inline copy and `reduced.ply` dropped, `mesh_ply_resolutions["1"]` removed; `capture.coordinate_system = {name: "DDU robot gripper marker plane"}`. Drops `geometry.marker_points`. Asserts every moved mesh is the effector: every vertex within r 170 mm of the gripper axis, z -260 ... 310 mm (the robot pipeline cut it out with a cylinder r 160, h 300 --- `3d_scan_metadata.step4.cylinder_split`). 260916: 70 snapshots, 337 markers, 70 fixture files. | @@ -2002,7 +2004,7 @@ Step 10 mapping (dump 260916): | *(none)* `ddu_build_with_debris` | 70 | `kind: demolition`, rest null | | *(none)* `spa_example_data` | 9 | `kind: unknown` | | *(none)* `ddu_aggregations` without parent | 4 | as the Rosskopf row (`offcut`) | -| *(none)* child without salvage data | 1 | its parents' origin when they agree (the one element cut from an aggregations child); step 10b lists it as inherited | +| *(none)* child without salvage data | 1 | its parents' origin when they agree (the one component cut from an aggregations child); step 10b lists it as inherited | | all 16 `dbu_zirkus` | 16 | `kind: deinstallation`, `place: {name: "TU Darmstadt Lichtwiese Campus", address: "Guenther-Behnisch-Strasse, 64287 Darmstadt, Germany"}`, `construction_work: {name: "Lichtwiese Campus Infrastructure --- pedestrian bridge", use: "pedestrian bridge"}`, `at: 2024-07-24` (day) --- one deinstallation for all 16 (user, 2026-09-28) | Frontend: regenerate models; replace every `type` and `extrusions` consumer. Grasshopper: bump @@ -2022,7 +2024,7 @@ assigned in the first draft; the numbering is kept so older references stay vali 6. *(decided 6.13: merges --> union of ranges, weakest confidence x k)* 7. *(decided 6.10: controlled `materials` collection + LoW ch. 17 class + `trade_name`)* 8. *(decided 6.13: `email` only admin + moderator(D))* -9. *(decided 7.1: one web form from the component page --- fan-out, repeat-from-last, multi-element; no sheet, no CSV import, no GH evidence component in 0.6. Decided 7.2: no campaign concept, `campaign_id` dropped)* +9. *(decided 7.1: one web form from the component page --- fan-out, repeat-from-last, multi-component; no sheet, no CSV import, no GH evidence component in 0.6. Decided 7.2: no campaign concept, `campaign_id` dropped)* 10. *(decided 6.7: 0.6.0.0 on `v-0.6.0.0`; no aliases; client header; GH bridge in 0.6)* 11. *(decided 6.14: one runner, ordered stages, cheap stages synchronous)* 12. *(decided: `condition` dropped; see section 2.6 `condition_grade`, section 8 6b)* @@ -2050,7 +2052,7 @@ itself arrives by delegated act (Art 75(1)); mandatory use follows 18 months aft | Remanufactured product | Art 3(25): transformed in a way *essential* to performance | a CSC identity after a cutting / re-engineering snapshot chain, once a harmonised spec says the transformation was essential | | Placing on the market | Art 3(5): "the first making available on the Union market of a used product **after a deinstallation**" | a CSC component handed to a reuse project --- unless directly reused | | Direct reuse carve-out | Recital 34: "products directly reused in a construction work should not be considered as placed on the market again" | the research/prototype path stays outside the regulation | -| Who becomes the manufacturer | Art 26(2): whoever places a used or remanufactured product on the market takes on Art 22 obligations (DoPC, CE, DPP) | not CSC itself; **the operator who lists an element for reuse** --- CSC is their documentation tool | +| Who becomes the manufacturer | Art 26(2): whoever places a used or remanufactured product on the market takes on Art 22 obligations (DoPC, CE, DPP) | not CSC itself; **the operator who lists a component for reuse** --- CSC is their documentation tool | | Rights vs. deinstaller | Art 21(3): that manufacturer may demand "information about the previous use of the product and about the process of deinstalling it" | CSC must be able to record the deinstallation *process*, not just a date | | Life cycle of a used product | Art 3(53): starts "from the latest deinstallation from the construction work" | CSC's timeline origin for LCA is the deinstallation date | | 3D-dataset | Art 3(11): "a set of numerical data describing the shape of an object by its outer dimensions and its cavities" | a CSC snapshot geometry, in the regulation's own words | @@ -2059,7 +2061,7 @@ itself arrives by delegated act (Art 75(1)); mandatory use follows 18 months aft ### 10.2 The product-type mismatch The CPR and the DPP are built on *product types* (one passport per type, serial/batch optional, -Art 22(5), Annex V 1(a)). A reclaimed element is unique: each identity is a product type of one. +Art 22(5), Annex V 1(a)). A reclaimed component is unique: each identity is a product type of one. Consequences, and how CSC absorbs them: - **Unique identification code of the product type** (Art 22(5), 18(2)(d)) <-> `catalog_number` @@ -2088,7 +2090,7 @@ Consequences, and how CSC absorbs them: | CPR requirement | CSC field / mechanism | status | |---|---|---| | Annex V 1(a) unique ID code + serial | `catalog_number` + `_id` | exists | -| Annex V 1(b) product category / **Annex VII product family** | `identity.cpr_product_family` (int 1--36), derived from `original_function` x `material` (concrete --> 1 or 26; steel --> 20; timber --> 13; masonry --> 17; **rubble/aggregate --> 24**; prefabricated elements --> 34), overridable | **deferred** (additive, 6.8) | +| Annex V 1(b) product category / **Annex VII product family** | `identity.cpr_product_family` (int 1--36), derived from `original_function` x `material` (concrete --> 1 or 26; steel --> 20; timber --> 13; masonry --> 17; **rubble/aggregate --> 24**; prefabricated components --> 34), overridable | **deferred** (additive, 6.8) | | Annex V 1(d) nominal dimensions | `bbx` --- extents along the snapshot `frame` (section 4.3 stage 1); primary proxy `params` for the shape | **in 0.6** | | Annex V 1(f) estimated service life (durability) | quantity `service_life` (years, identity scope, tiers archival/heuristic) | **deferred** (additive, 6.8) | | **Annex V 1(h) "date and place of the latest deinstallation"** | `identity.origin` (section 3.1.1) when `origin.kind == "deinstallation"`; empty otherwise. Covers Art 21(3) (`method`) and Art 18(2)(a) (`at` at `year` precision). Named `origin`, not `deinstallation`, because most of the 0.5 catalogue was never installed (offcuts, demolition rubble) --- calling it deinstallation would be false | **decided (6.1)** | @@ -2111,7 +2113,7 @@ Consequences, and how CSC absorbs them: | Art 77(1)(e) no end-user personal data without GDPR consent | actor projection: organization-only for anonymous readers (section 3.3.1); `email` never in lists; attachment files never served anonymously (8.13) | | Art 78(h) data authentication, reliability, integrity | `etag` hashes; supersession instead of edits (section 3.3.4); server-recomputed derived values; signed evidence records **deferred** (additive, 6.8) | | Art 75(2)(i) system available **25 years** after last placing; operator keeps passport >= **10 years** | **retention rule:** `published` snapshots and evidence are never hard-deleted --- `DELETE` becomes a tombstone (`status: withdrawn`, reason, by, at) that keeps the document and its files. Draft/pending/rejected may be hard-deleted. An ever-published identity is never deleted: it `exit`s (physical, section 3.1.3) or is withdrawn (record, section 3.1.4); only the admin purge (410 stub) removes one | -| Art 75(2)(e) arrangements for **updating** the passport of an existing product | snapshot versions + evidence supersession + fold recompute --- the update model is the whole point of section 3--4 | +| Art 75(2)(e) arrangements for **updating** the passport of an existing product | snapshots + evidence supersession + fold recompute --- the update model is the whole point of section 3--4 | | Art 75(2)(j) "availability of information for the reuse and remanufacturing of products" | CSC's purpose; the timeline (section 7.1) is the human-readable form | | Art 15(2) environmental performance calculated with Commission software | out of scope for CSC; the `env_*` quantities are inputs/outputs of that step, tier `calculated` | | Art 14 exemption: custom-made / non-series products installed by the manufacturer in a single identified work | most research reuse projects fall here --> no DoPC, no DPP obligation --- but the record should still be exportable | @@ -2143,14 +2145,14 @@ of how directly it binds: | instrument | status (Sep 2026) | what it fixes | CSC consequence | |---|---|---|---| -| **ESPR --- Reg. (EU) 2024/1781**, Arts 9--15 + Annex III | in force; DPP registry to be set up by the Commission by **19 Jul 2026** (Art 13); product-group delegated acts pending | the DPP *framework*: data requirements, unique product / operator / facility identifiers (Art 12), registry (Art 13), web portal (Art 14). CPR Art 79 applies these to construction products | `identifiers[]` (section 10.2) must hold an ESPR-registry-issued identifier once it exists; the QR on the element is the ESPR data carrier | +| **ESPR --- Reg. (EU) 2024/1781**, Arts 9--15 + Annex III | in force; DPP registry to be set up by the Commission by **19 Jul 2026** (Art 13); product-group delegated acts pending | the DPP *framework*: data requirements, unique product / operator / facility identifiers (Art 12), registry (Art 13), web portal (Art 14). CPR Art 79 applies these to construction products | `identifiers[]` (section 10.2) must hold an ESPR-registry-issued identifier once it exists; the QR on the component is the ESPR data carrier | | **EN 182xx family --- CEN/CLC JTC 24** ("Digital product passport: framework and system", standardisation request M/604) | first six published **27 May 2026**, cited in the OJ **15 Jul 2026** (Implementing Decision (EU) 2026/1736); two still to be cited | EN 18216 data exchange protocols ; **EN 18219 unique identifiers** ; **EN 18220 data carriers** (optical 2D, RFID, NFC) ; **EN 18221 data storage, archiving, persistence** ; **EN 18222 APIs for passport lifecycle management and searchability** ; EN 18223 system interoperability ; EN 18239 access rights, security, confidentiality ; EN 18246 data authentication, reliability, integrity | these are the *technical* targets for section 10.4: identifier syntax (18219), QR payload (18220), archiving (18221: every change archived, point-in-time retrieval, a backup service provider; the 25 years come from CPR Art 75(2)(i)), the API surface an export must speak (18222), tombstones + hashes (18246). **Obtain 18219/18220/18221/18222 before implementing `identifiers[]` and the export.** | | **CIRPASS-2** (Digital Europe, May 2024 -- Apr 2027) | running; 13 lighthouse pilots, one of them **construction, led by Cobuilder** | the reference pilot for a construction DPP; will produce the de-facto data model the delegated act inherits | watch item; the pilot's construction data model (Cobuilder's "Define"/bSDD-based dictionary) is the likeliest shape of Recital 92's "common data dictionary" | | **EN 15804+A2** (EPD core rules) | established | the 13 core + 6 additional environmental indicators | **CPR Annex II (a)--(m) = the 13 core, (n)--(s) = the 6 additional --- a 1:1 match.** The `env_*` quantities (section 10.3) should carry EN 15804 indicator codes (GWP-total, GWP-fossil, GWP-biogenic, GWP-luluc, ODP, AP, EP-freshwater, EP-marine, EP-terrestrial, POCP, ADP-minerals&metals, ADP-fossil, WDP; PM, IRP, ETP-fw, HTP-c, HTP-nc, SQP) as their `unit`-adjacent identifier. Used products: modules from the latest deinstallation only (Art 3(53), Recital 36). Data source candidates: Oekobaudat (`docs/adr/FUTURE.md`), ISO 22057 EPD data templates | -| **EPBD --- Dir. (EU) 2024/1275** | renovation-passport schemes by **29 May 2026** (Annex VIII); digital building logbooks where available; whole-life-carbon disclosure per EN 15978 / Level(s) 1.2 | the *building-side* twin of the product passport: what the element is deinstalled *from* and installed *into* | `origin.construction_work.identifier` / `exit.construction_work.identifier` (section 3.1.1) should be able to carry a building identifier that a digital building logbook would recognise; a design's WLC (computed outside CSC, 7.11) needs each component's `env_*` | +| **EPBD --- Dir. (EU) 2024/1275** | renovation-passport schemes by **29 May 2026** (Annex VIII); digital building logbooks where available; whole-life-carbon disclosure per EN 15978 / Level(s) 1.2 | the *building-side* twin of the product passport: what the component is deinstalled *from* and installed *into* | `origin.construction_work.identifier` / `exit.construction_work.identifier` (section 3.1.1) should be able to carry a building identifier that a digital building logbook would recognise; a design's WLC (computed outside CSC, 7.11) needs each component's `env_*` | | **Level(s)** (EU building sustainability framework) | established, voluntary | indicator 1.2 life-cycle GWP, 2.1 bill of quantities/materials, 2.4 design for deconstruction & reuse | CSC components are exactly Level(s) 2.4's input; a GH definition over fetched catalog data could produce a 2.1 bill of materials (designs are not stored in CSC, 7.11) | | **Battery Reg. (EU) 2023/1542** | battery passport mandatory **Feb 2027** | the first live DPP --- the working reference for registry, access tiers, QR resolution | implementation patterns only; no data overlap | -| **Waste Framework Dir. 2008/98/EC** | established | end-of-waste: an element is a *product* only if it "is not waste or has ceased to be waste" (Art 3(20)/(25)) | `origin` should be able to record the end-of-waste basis (never waste / ceased to be waste + reference) --- **deferred** (additive optional field on `origin`, 6.8) | +| **Waste Framework Dir. 2008/98/EC** | established | end-of-waste: a component is a *product* only if it "is not waste or has ceased to be waste" (Art 3(20)/(25)) | `origin` should be able to record the end-of-waste basis (never waste / ceased to be waste + reference) --- **deferred** (additive optional field on `origin`, 6.8) | | **DIN SPEC 91484:2023** | published; German, voluntary | pre-demolition audit data set for reusable products | national precursor of Annex V 1(h) + Annex IV; cross-check pending (section Sources) | Not yet law, watch: the Commission's announced **Circular Economy Act** (expected 2026) and any @@ -2206,7 +2208,7 @@ the schema stores enough to re-check it. Checked against the full texts on 2026- **Drilled core in compression (EN 12504-1:2019, EN 12390-3:2019, machine EN 12390-4, assessment EN 13791).** Three acts at different times: -1. **Sampling** --- the core is drilled out of the element: diameter (typically 50 / 100 / 150 mm), +1. **Sampling** --- the core is drilled out of the component: diameter (typically 50 / 100 / 150 mm), position, orientation to the casting direction, wet / dry drilling, date. 2. **Specimen preparation** --- measured diameter, lengths as drilled and prepared, end preparation (ground / capped / sawn), length-to-diameter ratio (2:1 class 1.95--2.05, 1:1 @@ -2367,7 +2369,7 @@ impractical, then 1:1 and three cores per location). Context resolves at `sample "url": "https://..." | null, "retrieved_at": "2026-10-05" | null }, // 8.106: http(s) only; the date the link was read "claim": { "text": "B225", "interpretation": "..." } | null } // summary: {concrete_class, range: ["B225"], claimed} or {compressive_strength, range:[18,28], MPa, claimed} -// or none (8.106): a **document** --- documents the element, never enters the fold; the only method whose summary is optional +// or none (8.106): a **document** --- documents the component, never enters the fold; the only method whose summary is optional // visual_inspection { "observations": [ { "quantity": "spalling", "value": 1, "note": "..." } ] } // value = severity 0--3 for findings, grade 0--3 (3 good) for condition_grade (section 2.6) @@ -2419,14 +2421,14 @@ One record per source: a drawing, a scan survey, one exposure. Viewers draw the snapshot named by `position.snapshot_id`; a new snapshot (new coordinates) needs a new layout record. GH: the `ReinforcementLayout` builder (curves + spec + diameter, `DocumentUrl` / `DocumentRetrievedAt` for the drawing) posted by the generic `AddEvidence` component --- the one evidence path in the 0.6 bridge. Its optional -`ComponentPassport` input maps curves drawn on a moved element back to the stored coordinates: with the passport's +`ComponentPassport` input maps curves drawn on a moved component back to the stored coordinates: with the passport's client-side `csc_placement` Q the points go placed --> stored through the inverse of `placement_transform(Q)` (8.98) and `SnapshotID` comes from the passport (a different explicit `SnapshotID` is an error). Document units are taken as millimetres, 1:1, like the `Fetch...Geometry` components and `ApplyFrame` do: nothing is scaled, a document in another unit only gets a warning (all components become unit-aware in a later task). `FetchReinforcementLayout` reads the records back (`GET /identities/{id}/evidence?method=reinforcement_layout`, `status` as the API offers): one polyline per bar, one tree branch per record, newest first, the passport's placement applied to the layouts of -its own snapshot (stored --> placed, as for the mesh), layouts of another version in their stored coordinates +its own snapshot (stored --> placed, as for the mesh), layouts of another snapshot in their stored coordinates with a warning. --- diff --git a/docs/adr/DESIGN_DECISIONS.md b/docs/adr/DESIGN_DECISIONS.md index d466b7d6..52eed9b4 100644 --- a/docs/adr/DESIGN_DECISIONS.md +++ b/docs/adr/DESIGN_DECISIONS.md @@ -148,7 +148,7 @@ into one **metadata object**. | 8.11 | **The client header is required for writes and every logged-in request; anonymous GETs may omit it; a scanned non-public piece shows a "not public" page** (review item 5, user 2026-09-29). Writes and requests with a login token: header required, known client, version >= minimum, else 426. Anonymous GET / HEAD: header optional (the `/id/{uuid}` resolver for any scanner, curl / Python readers of public pieces --- CPR Art 76(2)(e) free access). A known client below its minimum: 426 always. User: an anonymous scan of a non-public piece shows a page saying the component is not public, with a sign-in link. | Every GH UserObject logs in (`CSC_Session` sends the token), so old ones --- also those before 0.5.1.0 without any header --- can neither write nor misread 0.6 data. Enforcement is on iff `CSC_MIN_CLIENT_VERSIONS` is set (production sets it in the cutover deploy; dev and tests stay log-only). Exempt: CORS preflight (`OPTIONS`), all of `/ghinterface/` (the updater also calls version / download / name lists), `/docs`, `/redoc`, `/openapi.json`, `/health`, `/version`. `/id/{uuid}` no longer hides existence behind a 404-equivalent: whoever scans a tag holds the piece. Anonymous --> "not public" + sign-in (callback to the piece); logged in without access --> "no access" page, no dataset details. Spec section 7.4, section 7.5. | | 8.12 | **Verification has owners: `self_attested` is the recorder's own claim, `reviewed` and `accredited` need a second person** (review item 6, user 2026-09-30). (1) `self_attested`: set by the recorder (evidence form checkbox "I performed this and stand by the result"), only when `performed_by` contains an actor with `user_id == recorded_by_user_id`; an outside lab's result stays `unverified` until reviewed. The recorder toggles `unverified` <--> `self_attested` and never overrides a reviewer's state. (2) `reviewed` / `accredited`: `reviewer(D)` or admin who is neither the recorder nor a `performed_by` user --- **no admin exception**; server sets `verification.by` (the reviewer as a user actor) and `at`. (3) The accreditation block stays typed in; `accredited` is a reviewer's act with I22 as precondition and a **required `verification.note`** saying what was checked (the reviewer view links the body's public register, e.g. DAkkS). No curated organisation registry in 0.6. (4) Changing a result field (`summary`, `payload`, `derived`, `performed_by`, `standard`, `method*`, `observed_at*`, `sampled_at*`, `position.snapshot_id` / `point`) while draft / pending resets `reviewed` / `accredited` to `unverified`. | Closes: a reviewer could mark their own record `reviewed` (factor 1.00); anyone could type an ISO 17025 block and satisfy I22; nobody could set `self_attested`. New **I27** (document check). A one-person dataset cannot reach `reviewed` without a second person. Spec section 3.3.3, section 5, section 7.0, section 7.2. | | 8.13 | **Attachment files are downloaded only by signed-in users** (review item 7, user 2026-09-30: "to reduce moderation overhead"). Anonymous readers of an `is_public` piece see the attachment list (`media_type`, `size`, `sha256`, `uploaded_at`) and "sign in to download"; signed-in users who can see the record download as before. Snapshot photos stay public (general impression, EXIF-stripped, 7.13). The upload control carries a "?" notice: professional roles are fine; private persons, faces, number plates are not --- redact before upload. `POST /actors/redact` also returns a worklist of attachments on records naming the person (`performed_by`, `recorded_by`, `uploaded_by`); a moderator adds a redacted copy and removes the original with reason `gdpr`, which also blanks the tombstone's `name` (`sha256` kept). No content scanning. | Actor redaction and the organisation-only projection could not reach inside files (lab reports name technicians, photos show people); a per-attachment public flag was rejected (a review step per file). Spec section 3.1.4, section 3.3, section 7.2, section 7.3. | -| 8.14 | **Registration without an open-domain address is by email-bound invitation only** (user 2026-09-30: 0.6 needs non-TU registration; "only email bound invitations, no open codes"). `admin` invites anyone; `moderator(D)` invites into its own dataset. An invitation names one email address, holds a single-use code (16-char base32, 80 bit; only `code_sha256` stored), expires after 14 days by default, is sent by mail as `/auth/register?code=...` and can be revoked while unused. Registration with a code must use the invited address; the address then counts as verified (the code proves receipt). Optional dataset + roles are granted on redemption (a moderator only in its own dataset). Batches = a list of addresses, one invitation each. Self-registration stays open for `CSC_OPEN_REGISTRATION_DOMAINS` (env, default `tu-darmstadt.de`, subdomains included). Amended by 8.172: no open domain set means invite only, and the web names the open domains instead of TU Darmstadt. | New collection `invitations` (spec section 3.7), routes in section 7.7, permission rows in section 7.0, `/admin` + dataset member editor gain "invite" (plan P3). Rejected: open codes handed over in person (a leaked code admits anyone). | +| 8.14 | **Registration without an open-domain address is by email-bound invitation only** (user 2026-09-30: 0.6 needs non-TU registration; "only email bound invitations, no open codes"). `admin` invites anyone; `moderator(D)` invites into its own dataset. An invitation names one email address, holds a single-use code (16-char base32, 80 bit; only `code_sha256` stored), expires after 14 days by default, is sent by mail as `/auth/register?code=...` and can be revoked while unused. Registration with a code must use the invited address; the address then counts as verified (the code proves receipt). Optional dataset + roles are granted on redemption (a moderator only in its own dataset). Batches = a list of addresses, one invitation each. Self-registration stays open for `CSC_OPEN_REGISTRATION_DOMAINS` (env, default `tu-darmstadt.de`, subdomains included). Amended by 8.172: no open domain set means invite only, and the web names the open domains instead of TU Darmstadt. Amended by 8.193: only a moderator of the dataset or an admin revokes an invitation; its creator loses the right with the role. | New collection `invitations` (spec section 3.7), routes in section 7.7, permission rows in section 7.0, `/admin` + dataset member editor gain "invite" (plan P3). Rejected: open codes handed over in person (a leaked code admits anyone). | | 8.15 | **The frame is the valid frame closest to the stored coordinates** (review item 8, user 2026-09-30). Candidates: the OBB axes assigned to x / y / z in extent order (7.10, columns standing), extents within `max(2 %, 3 mm)` of each other count as tied and may swap, either sign per axis, right-handed only; the candidate with the smallest rotation from the stored axes (max `trace(R)`) wins, exact ties by a fixed candidate order. Round sections: trimesh's angle about the long axis is accepted (deterministic on the same input; `bbx` unaffected). | One rule gives both the sign rule and the tie-break; re-runs are stable; a beam uploaded along world X keeps +X and DDU stones stay near their gripper-plane pose. Signs are not intrinsic: rescans in other poses may differ by a 180 degree flip (`bbx`, filters, shape class unaffected; snapshot comparison needs registration, not in 0.6). Rejected: third-moment (skew) signs --- flip on near-symmetric pieces. Spec section 4.3. | | 8.16 | **Minor review items b--d** (user 2026-09-30). (b) At most one open correction per record: at most one `draft` / `pending` record with `supersedes == X` (I14 extended; a second --> 409 naming the open one). (c) Evidence on a withdrawn identity --> 409 (with `duplicate_of`, the 409 names the canonical identity); on a terminal exit (`split`, `merged`, `recycled`, `disposed`) only with `observed_at <= exit.at`; on a non-terminal exit (`installed`, `returned`, `lost`) allowed (resolves `after_exit`, 8.10). (d) Positioned evidence keeps its `position.snapshot_id` and stored-coordinate point when that snapshot is corrected in new coordinates; the viewer draws it only on that snapshot; the correction dialog warns "N evidence records are positioned on the previous version" and offers to supersede each (re-placed point / re-imported bars). No stored transform between versions in 0.6. | New I28 (evidence vs. withdrawn identity / terminal exit; corpus check). Spec section 3.3.2, section 5, section 7.2. | | 8.17 | **"Withdrawn" means one thing at every level: the full record for the dataset, a tombstone for everyone else** (minor review item a, user's proposal refined, 2026-09-30). Identity, snapshot and evidence alike: members of D and admin see content, files and the reason; everyone else who can see the component (anonymous on `is_public`, logged-in non-members of a `catalog` dataset) gets **200 with a tombstone** --- id, kind, `version`, `status: withdrawn`, withdrawal date, link to the identity's current snapshot (or `duplicate_of`). The reason is never public; files of withdrawn records are members only; the public timeline shows "v2 --- withdrawn (date)". 410 stays for purged records. Withdrawing the current snapshot falls back automatically to the latest remaining published, non-superseded snapshot (naming a replacement is optional); none left --> `current_snapshot_id = null`, identity out of default lists, `/id` shows "no current state". Reinstate restores. | Before, withdrawn records followed the component's visibility, so a public piece kept showing exactly what a moderator had withdrawn (wrong piece, bad scan, person in a photo). I3b: "if not null, references a published snapshot". `can_see_record` returns a projection `full | tombstone | none`. Content that must vanish for members too: photo / attachment removal (tombstone entry) or purge. Spec section 3.1.4, section 5, section 7.0, section 7.1, section 7.5. | @@ -229,10 +229,10 @@ into one **metadata object**. | 8.92 | **The Grasshopper client stays CPython script UserObjects in 0.6** (user 2026-10-03, after a rundown with measurements). After P8 the heavy maths runs in the geometry runner (P5); what stays on the client is HTTP + JSON (network- and server-bound in any language) and mesh in / out, where only building a Rhino mesh from Python is bound by the CPython-to-.NET bridge (a median reduced mesh loads in under 1 s). P8 adds keep-alive, bulk mesh export with numpy for uploads, numpy parsing for downloads, a measurement of the mesh build, and two environments (the bridge needs `requests` only); the header stays `gh-userobjects/0.6.0.0`. After the cutover, gated by that measurement: a pip-installable client package with tests outside Rhino; a small .NET PLY / mesh helper via Yak only if the build is too slow; a compiled `.gha` only if tests inside Rhino, Rhino 7 or one-click installs outweigh editable scripts. | Rejected for 0.6: C# script components (port of 44 components, students lose readable scripts); a compiled `.gha` in P8 (P8 would become XL, header, `CSC_Update` and `/ghinterface` change). | | 8.93 | **P8 is tested locally** (user 2026-10-03; closes O11). The Grasshopper bridge runs end to end against `invoke dev-migrated --test-accounts` on the workstation, reached from Rhino on the same machine; the `Session` component takes the server address and `CSC_Update` can read from a local folder. The real deployment path (TLS, network, distribution from the server) is not part of P8. | Rejected: a staging instance on Uberspace for P8; a staging dress rehearsal tied to P8. | | 8.94 | **P8 touches only what must change; the frame runs offline in the client** (user 2026-10-03). (a) A Grasshopper component changes only when it breaks against the 0.6 API or data model, or when a settled decision asks for it (8.92, 7.8, `ApplyFrame`); P8 starts with a read-only audit of every component, approved by the user before any edit. (b) Development components (save / export, release files, dependencies) are reviewed only and changed only when they would otherwise break, after asking. (c) The frame rules (7.10, 8.52, 8.53) are replicated in the client so design targets and uncatalogued geometry get the same canonical frame offline; a parity test on shared test geometries keeps client and server in step. (d) Sync between Grasshopper and the Rhino document goes through the D2P bridge (`d2p-core-py`). | Rejected: revising every component; a stateless server route for the frame (needs the network). | -| 8.95 | **P8 audit answered** (user 2026-10-03; audit `.dev/p8-audit.md`, checked by the review session). Must change: Session, the four Create / Add components, ApplyPCAFrame (-> ApplyFrame), CreateReinforcement (-> ReinforcementLayout), DisassembleComponent, FetchFilteredComponents, FilterComponents, BakeComponents, SyncWithRhinoDoc, PassportToD2P, and the development component Update; dropped: CreateDesign, AddDesign, FetchDesign (7.11); new: Actor, Origin, IdentityMetadata, SnapshotMetadata, Capture, AddEvidence, a local frame component, ReadFromD2P; everything else stays as is (8.94 a). Answers: (1) the Create components keep `Mesh.Reduce` for the Preview (inline) and Reduced levels --- the server has no decimator and 8.23 never reduces Original; 7.6's "no mesh reduction" meant only that PCA / orientation leaves the client. (2) Centring at the centroid becomes an input, default off (stored coordinates as uploaded; robot scans keep the gripper plane). (3) The bridge environment `DDU_CSC` holds `requests` and `numpy` (the PLY parse / write of 8.92 needs numpy; amends 8.92); matchmaking runs in `DDU_CSC_MATCH` (numpy, scipy, scikit-learn, trimesh); numpy is pinned identically in both, since one Rhino session runs one interpreter. (4) Rhino-document sync: D2P (PassportToD2P updated, new ReadFromD2P) plus a minimal built-in Bake / Sync, both on one user-text convention: `csc_identity_id`, `csc_snapshot_id`, `csc_placement` (`{o,x,y,z}`), optional `csc_component`; d2p-core-py needs no licence or plugin. (5) The client-side placement key `iframe` in passport JSON becomes `csc_placement`. (6) ComputePCAOrientation stays as is. (7) Renamed inputs / outputs break by name, no aliases. (8) Authored geometry comes from `Geometry`: an extrusion becomes a `prism`, a box-shaped brep a `box`; no extra input. (9) Fetch components build authored-only pieces from proxy `params` + `placement` (the web-authored and migrated ones would otherwise be invisible). (10) FetchDetailedGeometry becomes FetchOriginalGeometry. (11) Update may change: a local-folder source (8.93) and the renamed / dropped names; `/auth/token` is exempt from the client-version check so a 0.5 Session can still log in and run CSC_Update after cutover, and the client shows the server's 426 hint instead of a generic error. (12) The backend serves the 0.6 bodies at `/schema/create-identity` (`IdentityCreateBody`) and `/schema/create-snapshot` (`SnapshotDraftBody`); the 0.5 `CreateComponentRequest` / `CreateSnapshotRequest` are deleted. (13) A correction from Grasshopper is a supersede input on CreateComponentSnapshot / AddComponentSnapshot with the new scan; `supersede` keeping a scan's files for a web correction is not part of 0.6 (settles the P8 bullet of 8.91 a). (14) A fifth builder `Capture` (method, device, coordinate_system, markers with label and role, fixtures) for the robot-scan import. The release and example definitions are rewired to 0.6. | Rejected: a server-side mesh decimator in 0.6 (new dependency, Uberspace load); aliases for renamed outputs; D2P only. | +| 8.95 | **P8 audit answered** (user 2026-10-03; audit `.dev/p8-audit.md`, checked by the review session). Must change: Session, the four Create / Add components, ApplyPCAFrame (-> ApplyFrame), CreateReinforcement (-> ReinforcementLayout), DisassembleComponent, FetchFilteredComponents, FilterComponents, BakeComponents, SyncWithRhinoDoc, PassportToD2P, and the development component Update; dropped: CreateDesign, AddDesign, FetchDesign (7.11); new: Actor, Origin, IdentityMetadata, SnapshotMetadata, Capture, AddEvidence, a local frame component, ReadFromD2P; everything else stays as is (8.94 a). Answers: (1) the Create components keep `Mesh.Reduce` for the Preview (inline) and Reduced levels --- the server has no decimator and 8.23 never reduces Original; 7.6's "no mesh reduction" meant only that PCA / orientation leaves the client. (2) Centring at the centroid becomes an input, default off (stored coordinates as uploaded; robot scans keep the gripper plane). (3) The bridge environment `DDU_CSC` holds `requests` and `numpy` (the PLY parse / write of 8.92 needs numpy; amends 8.92); matchmaking runs in `DDU_CSC_MATCH` (numpy, scipy, scikit-learn, trimesh); numpy is pinned identically in both, since one Rhino session runs one interpreter. (4) Rhino-document sync: D2P (PassportToD2P updated, new ReadFromD2P) plus a minimal built-in Bake / Sync, both on one user-text convention: `csc_identity_id`, `csc_snapshot_id`, `csc_placement` (`{o,x,y,z}`), optional `csc_component`; d2p-core-py needs no licence or plugin. (5) The client-side placement key `iframe` in passport JSON becomes `csc_placement`. (6) ComputePCAOrientation stays as is. (7) Renamed inputs / outputs break by name, no aliases. (8) Authored geometry comes from `Geometry`: an extrusion becomes a `prism`, a box-shaped brep a `box`; no extra input. (9) Fetch components build authored-only pieces from proxy `params` + `placement` (the web-authored and migrated ones would otherwise be invisible). (10) FetchDetailedGeometry becomes FetchOriginalGeometry. (11) Update may change: a local-folder source (8.93) and the renamed / dropped names; `/auth/token` is exempt from the client-version check so a 0.5 Session can still log in and run CSC_Update after cutover, and the client shows the server's 426 hint instead of a generic error. (12) The backend serves the 0.6 bodies at `/schema/create-identity` (`IdentityCreateBody`) and `/schema/create-snapshot` (`SnapshotDraftBody`); the 0.5 `CreateComponentRequest` / `CreateSnapshotRequest` are deleted. (13) A correction from Grasshopper is a supersede input on CreateComponentSnapshot / AddComponentSnapshot with the new scan; `supersede` keeping a scan's files for a web correction is not part of 0.6 (settles the P8 bullet of 8.91 a). (14) A fifth builder `Capture` (method, device, coordinate_system, markers with label and role, fixtures) for the robot-scan import. The release and example definitions are rewired to 0.6. Amended 2026-11-05: the audit now lies in `.dev/notes-archive/p8-audit.md`. | Rejected: a server-side mesh decimator in 0.6 (new dependency, Uberspace load); aliases for renamed outputs; D2P only. | | 8.96 | **P8 part A as built (confirmed by the user, with 8.97; the build notes of the audit answers 8.95).** (a) *Backend*: `/auth/token` joins the exempt paths of the client-header check (it gives no access by itself; every other `/auth` write stays checked), `/schema/create-identity` serves `IdentityCreateBody` with its `snapshot` as a `$ref` to `SnapshotDraftBody`, `/schema/create-snapshot` serves `SnapshotDraftBody`, and the 0.5 `CreateComponentRequest` / `CreateSnapshotRequest` are deleted; the frontend models are unchanged (`generate:models` reads neither schema). (b) *Shared code*: the pure parts of the client live in `grasshopper_lib/` (`csc_ply` numpy PLY, `csc_build` payload builders, `csc_read` passport / frame / proxy / filter helpers, `csc_frame` the offline frame, `csc_rhino` the RhinoCommon helpers, `csc_upload` the Add steps) and are copied into each component between BEGIN / END EMBEDDED markers by `invoke gh-embed`; a test fails on a stale copy, on a first `version:` line that is not the component's own (the updater reads the first one) and on a library name a component redefines; `grasshopper_lib/envs.json` is the one pinned list and writes the `# venv:` / `# r:` headers of the components it names. (c) *Environments*: `DDU_CSC` = requests 2.32.5 + numpy 2.0.2, `DDU_CSC_MATCH` = numpy 2.0.2, scipy 1.13.1, scikit-learn 1.6.1, trimesh 4.12.2 and networkx 3.2.1 (trimesh needs networkx for a degenerate hull; the parity test on Python 3.9 found it); `ApplyFrame` and the new `ComputeFrame` are in the MATCH environment because the local frame needs trimesh and scipy and they never call the server; the six matchmaking components change their `# venv:` / `# r:` header and `Version:` line only. (d) *Frame parity*: 18 procedural point sets (lying / rotated / standing / tied / upside-down boxes, sheets, a scan-like surface, an L slab, rubble, two round sections) are written by the server's `compute_frame` into `tests/fixtures/frame_parity`, a test regenerates them and fails when the server moved (also `FRAME_VERSION`), and the client reproduces axes, signs, extents and origin within 1e-4 on the server stack and on Python 3.9 with the Rhino pins (round sections: long axis and extents only). (e) *Mesh build, measured headless (Rhino 8.34, Python 3.9.11), first numbers, the in-Rhino run decides*: the p90 reduced mesh (2.6 MB, 62 136 vertices) took 3.3 - 4.3 s with one call per element, 0.14 s with the arrays blitted into pinned Point3f / MeshFace arrays (vertex colours one call each: 2.5 s), 0.2 - 0.34 s through Rhino's own PLY importer on a headless document; the median original mesh (11.8 MB, 281 072 vertices) 15 - 19 s, 0.4 - 0.63 s. `MESH_BUILD_MODE` is `import` with a fallback to `blit`; all four modes (`loop`, `bulk`, `blit`, `import`) give the same vertices, faces, colours and normals (tests). On these numbers the scripts stay scripts and no .NET helper is needed (the gate of 8.92). (f) *Requests*: CreateComponentIdentity makes an `IdentityCreateBody`; CreateComponentSnapshot a request `{identity_id, supersedes?, snapshot}` (a `SnapshotDraftBody` has no identity and no id); the staged files wait in `%APPDATA%\DDU_CSC\pending_assets\` (no id exists before the server assigns it, and a changed request cannot find stale files); Add posts the draft, uploads the files, then submits (`Submit` default true, `Publish` for a moderator) and does not submit after a failed upload; a correction is `Supersedes` on either component. (g) *`csc_placement`* keeps the 0.5 meaning of `iframe`: the frame the stored geometry is placed in; TransformComponent writes it, Fetch and Disassemble apply it, `ApplyFrame` sets it to the transform that makes the piece canonical (the world plane moved by stored -> canonical); part B takes the same convention into Bake, Sync and D2P. (h) *Session*: one keep-alive `requests.Session`, a `Server` input (a new address drops the login and the cache), the on-disk cache emptied once when the client release changes, a 426 raised as `CSCClientOutdated` with the server's sentence plus the fix (CSC_Update) in every component, no design cache. (i) *Authored shapes*: Disassemble and the Fetch components draw a piece's authored proxies only when it has no mesh and no cloud; an extrusion becomes a prism (further profiles are holes), a box-shaped brep a box, any other brep is refused; `Centre` is off by default. (j) *Update*: `LocalFolder` reads sources and UserObjects from a checkout; an in-place update replaces a component's code only, so a component whose inputs or outputs changed (Session, the Create / Add / Filter / Fetch-filtered / Disassemble components) needs its new UserObject. (k) *Not part A*: Bake, Sync, PassportToD2P, ReadFromD2P, the release and example definitions, regenerating the `.ghuser` / `.xml` files (they need Rhino; the six stale ones of the dropped and renamed components are removed), and the web page `/gh-interface`, which still lists the 0.5 components. | Rejected: trimesh 5 on the client (Python 3.10); the `pending_identity_assets/` key (the id is not known for a snapshot, stale files survive a change); a Python module imported by the scripts (a script component is one file); keeping the per-element mesh build as the default. | | 8.97 | **P8 part A confirmed; the maintainer's author line stays** (user 2026-10-03, after the review of part A). (a) 8.96 is confirmed. (b) ViewCaptureToFile gets a header-only edit: its unused `# r:` lines go, because they would install the matchmaking packages into the bridge environment and break the split of 8.95 (3) --- a case of 8.94 a. (c) `server_url()` treats an IPv6 loopback address as local (http). (d) The `Author:` line in the Grasshopper sources names the maintainer as author of the client; it is the maintainer's own authorship, not a record about a person, and stays (8.27 covers people in catalog records, accounts and data, not the author credit of the code). | Rejected: removing the author line from 48 sources. | -| 8.98 | **P8 part B as built: the Rhino document (confirmed by the user, with 8.99; the build notes of 8.95 4 and 8.95 5).** (a) *Two planes, one key name.* The passport key `csc_placement` stays the placement `Q` of the STORED geometry (8.96 g: `TransformComponent` writes it, `ApplyFrame` sets it, Fetch / Disassemble / Bake / D2P draw `placement_transform(Q)`). The user-text key `csc_placement` of the document is the plane `P` of the CANONICAL piece (box centre and axes once the frame is applied; `WorldXY` = the piece stands in its frame at the origin), as the audit and the part B brief say. They are linked by the snapshot's frame `F` (stored -> canonical): `P = Q . frame`, `Q = P . F` (`csc_convention.piece_plane` / `placement_from_piece_plane`, tested for any frame, rotation and move). A piece without a `csc_placement` is baked canonical at the origin; to place it (or keep stored coordinates) run `ApplyFrame` / `TransformComponent` first. A snapshot without a frame is refused (Bake, PassportToD2P, read-back): `P` could not be derived or undone; there is no bounding-box fallback any more (audit 2.1). (b) *A piece in the document* is a group with one text label and objects carrying the keys. `BakeComponents`: geometry (meshes from the PLY level `Level` = `original` default, `reduced` or `preview`, point clouds, authored shapes of a piece without mesh and cloud), ONE text tag at `P` with all four keys (`csc_component`, the passport, when `WithPassport` is true, the default), the two ids and the primitive index on every geometry object, group and layer `CSC_COMPONENTS::`, one undo step. D2P writes the label of a component with fresh attributes when it commits (`ComponentBase.create`; seen in the source and in the headless test), so user text on the label is lost: `PassportToD2P` puts the two ids on every member object and the full set on the first one, and the readers merge the keys of a group (text label first, objects of different identities in one group are no piece). The tag / label plane NOW is the truth (`Q' = P' . F`); moving the whole group moves it. (c) *What is read from a document is untrusted* (`csc_convention`): ids must be UUID v4 (they end up in a URL), `csc_placement` at most 4 KB and a finite, unit, perpendicular, right-handed plane, `csc_component` at most 64 MB and it must hold the tag's own identity and snapshot or it is ignored, a bad value is reported and left out; the only request a read-back makes is `GET /identities/{id}/compose?snapshots=` through the Session's cached read when the tag has no passport; nothing is written to the server (tests with a recording fake Session). (d) *The four components.* `BakeComponents` (new inputs `Level`, `WithPassport`), `SyncWithRhinoDoc` (same input and output, reads by tags), `PassportToD2P` (D2P type id from the IFC class: BM, CL, SB, PL, WL, MB, PP, FT, AC, EP, OT for a proxy or unknown, RB for `CscDebris`; extrusions become authored `Proxy` members, markers come from `capture.markers`, `iframe`, `type` and `assembly` are gone, the component plane is `P`, the output name `D2PComponent` is kept) and the new `ReadFromD2P` (`Read` -> `ComponentData`, `D2PComponent`: the plane of the D2P component the label belongs to, found through `instance_from_object` when the label has a name; a tag of `BakeComponents` is read as a plain tag, so each path reads the other's pieces). (e) *Libraries*: `csc_convention` (pure, depends on `csc_build` and `csc_read`) and `csc_doc` (RhinoCommon: bake, tag scan, read-back) join the embedded set; `d2p-core-py` 0.1.2 is an extra of the two D2P components in `DDU_CSC` (`envs.json`). (f) *Tests*: 62 pure tests of the convention and a headless Rhino 8 suite (23 tests: bake, rotate and move everything in the document, read back; both paths; crossed; mesh, authored box, scan, markers; hostile user text) run on .NET 7 like Rhino 8's own Python (`rhino_runtime.py`; the existing headless tests pass there too); the stored mesh moved by the placement read back lies on the moved baked mesh within 1e-3. The runs found that Rhino 8's python.net does not convert a Python list to `IEnumerable` or `IEnumerable`: typed .NET lists are used (this also repairs the marker members of `PassportToD2P`, which passed a plain list to `SetObjects`). (g) `ViewCaptureToFile` gets a new `Version:` line so `CSC_Update` delivers its lean header (8.97 b). (h) The release / example / development definitions are not edited (binary `.gh`); `.dev/p8/rewire-list.md` lists, from the definitions themselves (read with GH_IO, read only), every component that changes and what to reconnect, with the canvas position; the output names of the new tables follow the `/gh-interface` page and the script variables (`GeometryData`, `GeometrySource`, `FilteredComponentData`, `AddedSnapshotData`), the shipped `.ghuser` and the 0.5 definitions carry older ones (`Geometry`, `GeometryType`, `ComponentData`, `AddedComponentData`). | Rejected: `Q` as the user text (the tag would sit at the stored origin, far from a scan with a gripper plane); `csc_*` user text on the D2P label (lost at commit); a `Canonical` switch on Bake / D2P (one rule: place it first); a bounding-box fallback; reading a piece whose tag has no frame; a D2P-only read (the built-in pieces would not be read by `ReadFromD2P`). | +| 8.98 | **P8 part B as built: the Rhino document (confirmed by the user, with 8.99; the build notes of 8.95 4 and 8.95 5).** (a) *Two planes, one key name.* The passport key `csc_placement` stays the placement `Q` of the STORED geometry (8.96 g: `TransformComponent` writes it, `ApplyFrame` sets it, Fetch / Disassemble / Bake / D2P draw `placement_transform(Q)`). The user-text key `csc_placement` of the document is the plane `P` of the CANONICAL piece (box centre and axes once the frame is applied; `WorldXY` = the piece stands in its frame at the origin), as the audit and the part B brief say. They are linked by the snapshot's frame `F` (stored -> canonical): `P = Q . frame`, `Q = P . F` (`csc_convention.piece_plane` / `placement_from_piece_plane`, tested for any frame, rotation and move). A piece without a `csc_placement` is baked canonical at the origin; to place it (or keep stored coordinates) run `ApplyFrame` / `TransformComponent` first. A snapshot without a frame is refused (Bake, PassportToD2P, read-back): `P` could not be derived or undone; there is no bounding-box fallback any more (audit 2.1). (b) *A piece in the document* is a group with one text label and objects carrying the keys. `BakeComponents`: geometry (meshes from the PLY level `Level` = `original` default, `reduced` or `preview`, point clouds, authored shapes of a piece without mesh and cloud), ONE text tag at `P` with all four keys (`csc_component`, the passport, when `WithPassport` is true, the default), the two ids and the primitive index on every geometry object, group and layer `CSC_COMPONENTS::`, one undo step. D2P writes the label of a component with fresh attributes when it commits (`ComponentBase.create`; seen in the source and in the headless test), so user text on the label is lost: `PassportToD2P` puts the two ids on every member object and the full set on the first one, and the readers merge the keys of a group (text label first, objects of different identities in one group are no piece). The tag / label plane NOW is the truth (`Q' = P' . F`); moving the whole group moves it. (c) *What is read from a document is untrusted* (`csc_convention`): ids must be UUID v4 (they end up in a URL), `csc_placement` at most 4 KB and a finite, unit, perpendicular, right-handed plane, `csc_component` at most 64 MB and it must hold the tag's own identity and snapshot or it is ignored, a bad value is reported and left out; the only request a read-back makes is `GET /identities/{id}/compose?snapshots=` through the Session's cached read when the tag has no passport; nothing is written to the server (tests with a recording fake Session). (d) *The four components.* `BakeComponents` (new inputs `Level`, `WithPassport`), `SyncWithRhinoDoc` (same input and output, reads by tags), `PassportToD2P` (D2P type id from the IFC class: BM, CL, SB, PL, WL, MB, PP, FT, AC, EP, OT for a proxy or unknown, RB for `CscDebris`; extrusions become authored `Proxy` members, markers come from `capture.markers`, `iframe`, `type` and `assembly` are gone, the component plane is `P`, the output name `D2PComponent` is kept) and the new `ReadFromD2P` (`Read` -> `ComponentData`, `D2PComponent`: the plane of the D2P component the label belongs to, found through `instance_from_object` when the label has a name; a tag of `BakeComponents` is read as a plain tag, so each path reads the other's pieces). (e) *Libraries*: `csc_convention` (pure, depends on `csc_build` and `csc_read`) and `csc_doc` (RhinoCommon: bake, tag scan, read-back) join the embedded set; `d2p-core-py` 0.1.2 is an extra of the two D2P components in `DDU_CSC` (`envs.json`). (f) *Tests*: 62 pure tests of the convention and a headless Rhino 8 suite (23 tests: bake, rotate and move everything in the document, read back; both paths; crossed; mesh, authored box, scan, markers; hostile user text) run on .NET 7 like Rhino 8's own Python (`rhino_runtime.py`; the existing headless tests pass there too); the stored mesh moved by the placement read back lies on the moved baked mesh within 1e-3. The runs found that Rhino 8's python.net does not convert a Python list to `IEnumerable` or `IEnumerable`: typed .NET lists are used (this also repairs the marker members of `PassportToD2P`, which passed a plain list to `SetObjects`). (g) `ViewCaptureToFile` gets a new `Version:` line so `CSC_Update` delivers its lean header (8.97 b). (h) The release / example / development definitions are not edited (binary `.gh`); `.dev/p8/rewire-list.md` lists, from the definitions themselves (read with GH_IO, read only), every component that changes and what to reconnect, with the canvas position; the output names of the new tables follow the `/gh-interface` page and the script variables (`GeometryData`, `GeometrySource`, `FilteredComponentData`, `AddedSnapshotData`), the shipped `.ghuser` and the 0.5 definitions carry older ones (`Geometry`, `GeometryType`, `ComponentData`, `AddedComponentData`). Amended 2026-11-05: the rewire list now lies in `.dev/notes-archive/p8/`. | Rejected: `Q` as the user text (the tag would sit at the stored origin, far from a scan with a gripper plane); `csc_*` user text on the D2P label (lost at commit); a `Canonical` switch on Bake / D2P (one rule: place it first); a bounding-box fallback; reading a piece whose tag has no frame; a D2P-only read (the built-in pieces would not be read by `ReadFromD2P`). | | 8.99 | **P8 part B confirmed** (user 2026-10-04, after its review). (a) 8.98 is confirmed. (b) The tag of a baked piece sits at the canonical piece's plane in the document (`csc_placement` = P, the plane the user sees and moves), not at the stored origin, which for a robot scan is the gripper plane far from the piece. (c) Output and input names follow the sources (`GeometryData`, `GeometrySource`, `FilteredComponentData`, `AddedSnapshotData`, ...), as on the `/gh-interface` page; the shipped `.ghuser` files and the 0.5 definitions follow after the one export and rewire (no aliases, 8.95 7). (d) Every Grasshopper source carries the maintainer's `Author:` line (8.97 d; the user aligned the 14 part A files). | --- | | 8.100 | **Grasshopper vocabulary follows the glossary; "component passport" is the term** (user 2026-10-04, after a check of all component inputs / outputs against `CONTEXT.md` and the spec). (a) The passport JSON `{identity, snapshots[]}` is a **component passport** (new glossary entry; the backend model is already `ComponentPassport`): it is about one component, never a building (DGNB Building Resource Passport, EPBD logbooks and renovation passports are the building level). Ports: `ComponentData` -> `ComponentPassport` (10 components), `FilteredComponentData` -> `FilteredComponentPassports`, `XComponentData` -> `XComponentPassport`, Bake `WithPassport` -> `WithComponentPassport`; descriptions say "component passport". (b) The create bodies are requests, not passports: CreateComponentIdentity -> AddComponentIdentity `IdentityRequest`, CreateComponentSnapshot -> AddComponentSnapshot `SnapshotRequest`; AddComponentIdentity's output `Created`. (c) Glossary terms on the ports: `ComponentID` -> `IdentityID`; DisassembleComponent `ID` -> `IdentityID`, `Condition` -> `ConditionGrade`, `ParentComponent` -> `ParentIdentities`, `PrimitiveGeometry` -> `Proxies`; ReinforcementLayout output `Record` and AddEvidence input `EvidenceData` -> `Evidence`; Bake `Level` -> `DetailLevel`. Component names stay (they speak about the physical components). (d) Of the 8.38 fields, Grasshopper gets `PositionInWork` (Origin), `ManufacturedPrecision` (IdentityMetadata) and `EffectiveFromPrecision` (SnapshotMetadata) as inputs; connection types, detachability and material separability stay web-only. (e) `RunScript` takes no default values (Grasshopper does not support them); a test guards it. (f) After the review of the pass: ReadFromD2P's output and the `Passport` outputs of FetchAllSnapshots and FetchSnapshot are `ComponentPassport` as well; AddComponentSnapshot's output `AddedSnapshotData` is `Created`, the twin of AddComponentIdentity's. (g) The library labels `EffectivePrecision` and `EvidenceData` in `csc_build` follow the port names at the next library change, and the two label mappings then go. | Rejected: plain `Passport` (ambiguous next to building passports); renaming the components themselves. | | 8.101 | **Anonymous callers never receive a person** (user 2026-10-05, finding C7 / M3 of the UI / UX review). A response to an anonymous caller (the public tier of 3.6) carries no username, name, e-mail or user id of a person: not the snapshot's author, not the recorder, reviewer or moderator of evidence, not the reserving user, not the actors of change history or status history, in any route an anonymous caller can reach (identity, snapshots, component passport, evidence, lineage, lists, map, analytics, files' metadata). The backend drops the fields (absent, not empty strings); the frontend shows the dataset name where a signed-in user sees "Added by". Signed-in callers keep today's fields; where the recorder is shown to them is part of the UI revision (M2: history and record cards only, never a catalog fact). After the review (user 2026-10-05): every identity-shaped response carries the response-only boolean `is_reserved` (single identity, component passport, list and child rows, the PATCH response, reserve / unreserve), so a visitor sees that a piece is booked without seeing by whom; the stored document keeps `reserved`. ETags of responses that differ by viewer are viewer-specific (a 304 never hands one tier's body to another), and public-tier responses send `Vary: Authorization` next to `Cache-Control: public`. | Rejected: hiding the name only in the frontend (the API is public and the JSON still carries it). | @@ -252,7 +252,7 @@ into one **metadata object**. | 8.115 | **P9 review: undo, quantity, filter label, timeline event** (user 2026-10-06, review of the P9 build). (a) `undo-deinstall` only undoes the act: refused (409) when `origin.at` is null ("set the date by PATCH first") or when the identity's latest origin change in the change log is not the deinstall act; an imported or hand-set deinstalled origin cannot be turned "in place" by it. (b) **Every** identity's later states keep v0's `quantity`, not only batches; a correction is the only way to change it (I32), so a drawn single piece cannot turn into a batch by a state change. (c) The web label of the circulation value `deinstalled` is **Not in place** (it also lists offcuts, surplus and unknown origins, which were never installed); the API value stays. (d) The timeline gets one event `deinstalled` at `origin.at` from the change-log entry of the act (3.1.6). (e) Small fixes: a non-integer draw quantity answers 422, not 500; a draw from a batch without an authored proxy and without size or geometry gets the message "the batch has no authored proxy to copy; give a size or geometry"; the per-batch publish locks are released after use. (f) For P12 step 3b: the rehearsal copied 312 MB of attachments (one file per record; the hard links of 8.108 are not built) --- decided together with the rights question (8.110 d). | Rejected: undo on any deinstalled origin (turns imported pieces back in place without a trace); the quantity frozen for batches only (a later state could create a batch). | | 8.116 | **P10 before the build: route, P9 items, conservative bound, CERO scope** (user 2026-10-06, coordinator check of P10 against the spec and P9). (a) JSON-LD on `GET /identities/{id}/compose?format=jsonld` (the passport), as spec 7.8. (b) From P9: CPR Annex V 1(h) only when deinstalled and not planned; batch `quantity` and `remaining` in JSON-LD and PDF; a document's `url` / `retrieved_at` as links in JSON-LD and CERO; the PDF says "In place, deinstallation planned " for a planned origin. (c) A mapping column `conservative: low | high | None` per quantity: low for the compressive strengths, density, elastic modulus, cover depth; high for chloride content, carbonation depth, crack width, mass; None = a value only when the range is a single value. Categorical values only when the fold is unambiguous; ordinal hazards (severity) take the worst level. (d) CERO (v0.1, concrete elements) only for `concrete` and `autoclaved_aerated_concrete`; other materials 409 "CERO covers concrete elements only", no CERO link in the web. (e) `steel_grade` gets an IFC / bSDD mapping only where IFC 4.3 has one (`Pset_MaterialSteel.StructuralGrade` to verify), else none. (f) Exports read through the passport's path: people stripped for anonymous callers (8.101), viewer-specific ETags and `Vary`, 401 / 403 as `compose`, attachment names in the PDF for members only (8.13). (g) PDF: QR code from `reportlab.graphics.barcode.qr`; a bundled OFL font (Noto Sans, licence in `licenses/`) for characters outside Latin-1; preview image = the snapshot preview, else the first photo, else none. (h) `@id` = `{FRONTEND_URL}/id/{uuid}`, no new setting. (i) `pyld` and `rdflib` in `requirements-dev.txt` only, for validation tests; route tests in `tests/api`. (j) Done-when adds an imported in-place batch (no 1(h), batch line), a recycling-hall piece (1(h) filled, no CERO) and a public viewer's export without people. | Rejected: CERO values for steel / timber pieces (outside CERO's scope); one global bound direction; a new base-URL setting. | | 8.117 | **P10 review: export hardening and IRIs** (user 2026-10-06, review of the P10 build). (a) The `ifc:` prefix is the bSDD class identifier for IFC 4.3 (`https://identifier.buildingsmart.org/uri/buildingsmart/ifc/4.3/class/`), buildingSMART's resolvable identifier; IFC-OWL may follow as a further mapping (FUTURE). (b) `@vocab` `{FRONTEND_URL}/vocab/v1#` stays a namespace; a resolvable vocabulary page is FUTURE. (c) Context and PDF footer links come from the request URL; P12 step 4b checks them on production. (d) Fixes: the export test writes non-ASCII as `\u` escapes and the PDF test carries a character outside Latin-1; `/export/pdf` and `/export/cero` get the rate limiter and the PDF a small in-process LRU cache keyed by its ETag; the PDF ETag includes the preview file's mtime / size and the path of the stand-in photo; the file name falls back to the id without a catalogue number; in JSON-LD a quantity whose bSDD code is taken uses its CERO term before the CSC term. (e) **Client address for rate limits**: the web proxy forwards the client address as `X-Forwarded-For`; the backend trusts that header only from loopback or the known proxy and then takes the entry the trusted proxy appended (the rightmost untrusted hop), never the leftmost a caller can set --- this also closes the spoofable login limits. Signed-in callers are limited per token, anonymous callers per IP. A 429 shows a readable message in the web ("Too many downloads, try again in a minute"). | Rejected: one shared bucket for every web user (a seminar group hits 429 within a minute); the leftmost `X-Forwarded-For` entry; unlimited anonymous PDF renders; an unverified IFC-OWL namespace now. | -| 8.118 | **P11 UI revision: style and structure** (user 2026-10-06, grilling of the UI / UX review in `.dev/ui-review/`; the wireframes are accepted in principle). **Style stays**: the existing shadcn components and the CI colours (the blue and the magenta) are kept; margins and paddings may shrink to gain screen space, and secondary shades (e.g. in dark mode) may be adapted for a better UX. (Q1) Component page actions: **Reserve / Release** stays a visible button and **Add evidence** stays visible in the Properties card; everything else --- Download passport (PDF), CERO, geometry, Locate, Cut a piece / Draw pieces, Record new state, Edit details, and the moderation group --- goes into one Actions menu (bottom sheet on a phone, dropdown on desktop), grouped Record / Moderate. (Q2) Phone order: header strip, banner when it applies, then the **viewer** with a toolbar (detail level, orientation, an Overlay menu) in place of the settings panel, then the facts card. (Q3) Snapshot versions are **read-only rows** in the History card (version, status, "since ", corrected / withdrawn); Correct a version, Make current and Withdraw sit in the Moderate group of the Actions menu, which asks for the version. (Q4) **My work** replaces Dashboard and Reserved: waiting for you (moderators / reviewers, with counts), my reservations (Release), my drafts, pending and rejected records --- snapshots and evidence together, with status and rejection reason --- and recent components; the backend gets `GET /snapshots?mine=1&status=...` (the caller's own snapshots only; evidence has `recorded_by=me`). (Q6) Browse on a phone is a **card list** (thumbnail, name + number, "function / material / X x Y x Z mm", a status chip, "N pieces" for a batch); desktop keeps a table of 8 columns (thumbnail, name + number, function, material, dataset, size, shape class, status) with a column picker for the rest. (Q7) **One Scan page** with the modes Identify / Locate / Transmit; on a phone the camera starts on open, the paste field sits under it, the explanation behind a "?"; one sidebar entry and one top-bar icon. (Q8) **Anonymous visitors browse**: Browse, the map and the component page in the public tier (public pieces only, no people, 8.101); their sidebar shows Browse, Grasshopper, API docs and Sign in; the home page's first button is "Browse the catalog". (Q9) No sidebar entry "Out of circulation": Browse has one circulation switch --- In circulation (default; sub-filter In place / Not in place) / Out of circulation / All --- kept in the URL (`?circulation=...`) so teaching links keep working. (Q10) The switch says **In circulation / Out of circulation / All** (glossary); "Active Catalog" goes everywhere. (Q12) **Scope**: all MUST (M1, M2, M4, M5, M6; M3 done by 8.101) and all SHOULD (S1 Scan page, S2 Moderation page with tabs and counts, S3 sidebar with 12 entries, S4 merged cards, S5 form steps and method order, S6 Settings / Materials, S7 terminology and day-precision dates) of the review, plus C-1 (home page), 8.101 M2, 8.102 (History card) and the leftovers of P9 / P10 (the cut dataset default without a parent in the link, the in-place map popup on real data, undo deinstallation in the browser). The other COULD items are grilled separately. Built in three stages, each reviewed and shown to the user: (1) component page with the History card; (2) Browse, My work, sidebar, Scan, Moderation; (3) forms, Settings / Materials, terminology, home page. Q5 is settled by 8.101, Q11 by 8.102. (C-2) **Map in P11** (stage 2): the plot at full width without the outer card, one toolbar (layout, descriptor, colour by dataset / shape class / material / circulation incl. in place) with a legend, the status as "N components" with the cache date behind a "?". (C-3) **Analytics in P11** (stage 2): the shared filter bar (applied on change), one line "N components in M datasets, K pieces" instead of the tiles, the Overview tab opens with the function and material charts, Top Descriptor Keys moves to the Descriptors tab, a new Circulation chart (in place / not in place / out of circulation). (C-4) **Footer in P11** (stage 3): the full footer only on the public pages (home, sign in / register, Credits, Imprint, Browse and the component page for anonymous visitors); in the signed-in app one thin line (Imprint, Credits, Cookie settings), none inside forms; the Imprint stays reachable from every page (account menu in the app). (C-5) **Grasshopper page in P11** (stage 3): a short page --- download card with the version from the backend; installation (the library via CSC_Update, the restart note, the junction for development); a **component reference generated** from the release tag's sources (name, subcategory, description, inputs and outputs with their descriptions from the `RunScript` signature and `OUTPUTS`, 8.112), through the `/ghinterface` routes or a JSON built at release time. All 0.5 text goes. With C-2 to C-5 every COULD of the review is in P11. **Stage 1 as built (user 2026-10-06):** History sits at the bottom of the right column on desktop (the graph needs the width); the Evidence layer is off in Graph view (no evidence nodes until the swimlane graph); an Actions entry "Versions awaiting action" keeps submit / recall / publish / reject / reinstate / delete of unfinished versions reachable; JSON-LD stays in the PDF footer and the API, CERO is an Actions entry; the camera / gallery buttons show only while the piece has an unpublished version (6.6); "Record changed" rows leave the History list and stay in the collapsed change history; the "Public demo view" banner is replaced by "Not public: only members of and the moderators see this piece."; `can_undo_deinstall` is a response-only flag, computed only for moderators of the dataset and admins. **Stage 2, API (user 2026-10-06)**: for Q8, `GET /identities`, `/identities/count`, `/identities/map`, `/identities/stats` and `/identities/meta/datasets` answer anonymous callers with the public tier only (`is_public` pieces, no people, no unpublished states; the map cache filtered by the same visible set), rate-limited per client address; the web proxy lets `/components`, `/components/map`, `/analytics` and component pages through anonymously; `GET /identities?q=` is a free-text filter (name, catalog number, id prefix); `GET /snapshots?mine=1&status=...` lists the caller's own snapshots. **Stage 2 as built (user 2026-10-07)**: the anonymous sidebar shows Browse, Map, Analytics, Grasshopper, API docs and Sign in; map points carry dataset / material / shape_class and the stats response `byCirculation` and `pieces` (additive; the map cache is rebuilt in P12); the sidebar has 14 entries for an admin (every entry a page); Moderation stays at `/admin/validation` with tabs, the old pages redirect; count / stats / map / meta answer with the viewer's cache headers (`Vary: Authorization`, 8.101); Browse shows a placeholder instead of requesting a missing preview. **Stage 3, API (user 2026-10-07)**: `GET /ghinterface/reference` parses the release tag's component sources with `ast` only (never executes them) into one JSON (name, nickname, subcategory, description, inputs with descriptions, outputs from `OUTPUTS`), cached per release tag; it and `GET /ghinterface/version` answer anonymous callers, rate-limited per client address; the other `/ghinterface` routes stay signed-in. `GET /datasets` rows gain `member_count` (moderators of the dataset and admins only, else absent) and `component_count` (published pieces the caller may see). Settings "Account" reads `GET /users/me`; admins read "Administrator: all datasets, all roles". **Stage 3 review (user 2026-10-07)**: an anonymous caller of `/ghinterface/reference` gets the release the backend runs, `?channel=` only for signed-in callers (the server's GitHub token must not be spent by anonymous ref cycling; CSC_Update shares it); the download of the UserObjects stays signed-in; the unreferenced 0.5 screenshots in `public/gh-interface/` are deleted; Appendix A is walked line by line by the implementer on the acceptance instance with every role (checklist with screenshots), the review checks the signed-out lines and the checklist. **Grasshopper page, revised (user 2026-10-07, at the stage 3 acceptance; replaces the short page of C-5)**: per component a card as on the 0.5 page --- screenshot (the old files in `public/gh-interface/` come back; a placeholder where none matches; new screenshots are added later), the generated description, inputs and outputs, and "Copy Grasshopper component to clipboard" (the component's XML, pasted into a definition); the installation section leads with the copy-and-run path: copy the CSC_Update component, paste it into a definition and run it, which installs the UserObjects and `csc_gh`; the download stays as the second path. `GET /ghinterface/xml/{name}` answers anonymous callers too (read-only, the backend's release tag only, no `channel`, rate-limited per client address), so the copy buttons and the copy-and-run installation work signed out; the zip download stays signed-in. The layout need not be one card per component (a grouped, expandable form is fine) as long as screenshot, description, inputs and outputs read clearly. | Rejected: a new visual style; all actions in the menu (Reserve one tap further); the PDF as a second visible button. Amended 2026-10-28 (user, 0.6.4.2): Q1, "Add evidence" is a button of the evidence records card, not of the Properties card: the action makes a record, and properties are derived, never typed in, so a button on the Properties card suggests editing them. The Properties card keeps only a quiet link "add evidence" in its empty state (no properties yet), with the same rule for who sees it; its "?" says that properties are worked out from the evidence. | +| 8.118 | **P11 UI revision: style and structure** (user 2026-10-06, grilling of the UI / UX review in `.dev/ui-review/`; the wireframes are accepted in principle). **Style stays**: the existing shadcn components and the CI colours (the blue and the magenta) are kept; margins and paddings may shrink to gain screen space, and secondary shades (e.g. in dark mode) may be adapted for a better UX. (Q1) Component page actions: **Reserve / Release** stays a visible button and **Add evidence** stays visible in the Properties card; everything else --- Download passport (PDF), CERO, geometry, Locate, Cut a piece / Draw pieces, Record new state, Edit details, and the moderation group --- goes into one Actions menu (bottom sheet on a phone, dropdown on desktop), grouped Record / Moderate. (Q2) Phone order: header strip, banner when it applies, then the **viewer** with a toolbar (detail level, orientation, an Overlay menu) in place of the settings panel, then the facts card. (Q3) Snapshot versions are **read-only rows** in the History card (version, status, "since ", corrected / withdrawn); Correct a version, Make current and Withdraw sit in the Moderate group of the Actions menu, which asks for the version. (Q4) **My work** replaces Dashboard and Reserved: waiting for you (moderators / reviewers, with counts), my reservations (Release), my drafts, pending and rejected records --- snapshots and evidence together, with status and rejection reason --- and recent components; the backend gets `GET /snapshots?mine=1&status=...` (the caller's own snapshots only; evidence has `recorded_by=me`). (Q6) Browse on a phone is a **card list** (thumbnail, name + number, "function / material / X x Y x Z mm", a status chip, "N pieces" for a batch); desktop keeps a table of 8 columns (thumbnail, name + number, function, material, dataset, size, shape class, status) with a column picker for the rest. (Q7) **One Scan page** with the modes Identify / Locate / Transmit; on a phone the camera starts on open, the paste field sits under it, the explanation behind a "?"; one sidebar entry and one top-bar icon. (Q8) **Anonymous visitors browse**: Browse, the map and the component page in the public tier (public pieces only, no people, 8.101); their sidebar shows Browse, Grasshopper, API docs and Sign in; the home page's first button is "Browse the catalog". (Q9) No sidebar entry "Out of circulation": Browse has one circulation switch --- In circulation (default; sub-filter In place / Not in place) / Out of circulation / All --- kept in the URL (`?circulation=...`) so teaching links keep working. (Q10) The switch says **In circulation / Out of circulation / All** (glossary); "Active Catalog" goes everywhere. (Q12) **Scope**: all MUST (M1, M2, M4, M5, M6; M3 done by 8.101) and all SHOULD (S1 Scan page, S2 Moderation page with tabs and counts, S3 sidebar with 12 entries, S4 merged cards, S5 form steps and method order, S6 Settings / Materials, S7 terminology and day-precision dates) of the review, plus C-1 (home page), 8.101 M2, 8.102 (History card) and the leftovers of P9 / P10 (the cut dataset default without a parent in the link, the in-place map popup on real data, undo deinstallation in the browser). The other COULD items are grilled separately. Built in three stages, each reviewed and shown to the user: (1) component page with the History card; (2) Browse, My work, sidebar, Scan, Moderation; (3) forms, Settings / Materials, terminology, home page. Q5 is settled by 8.101, Q11 by 8.102. (C-2) **Map in P11** (stage 2): the plot at full width without the outer card, one toolbar (layout, descriptor, colour by dataset / shape class / material / circulation incl. in place) with a legend, the status as "N components" with the cache date behind a "?". (C-3) **Analytics in P11** (stage 2): the shared filter bar (applied on change), one line "N components in M datasets, K pieces" instead of the tiles, the Overview tab opens with the function and material charts, Top Descriptor Keys moves to the Descriptors tab, a new Circulation chart (in place / not in place / out of circulation). (C-4) **Footer in P11** (stage 3): the full footer only on the public pages (home, sign in / register, Credits, Imprint, Browse and the component page for anonymous visitors); in the signed-in app one thin line (Imprint, Credits, Cookie settings), none inside forms; the Imprint stays reachable from every page (account menu in the app). (C-5) **Grasshopper page in P11** (stage 3): a short page --- download card with the version from the backend; installation (the library via CSC_Update, the restart note, the junction for development); a **component reference generated** from the release tag's sources (name, subcategory, description, inputs and outputs with their descriptions from the `RunScript` signature and `OUTPUTS`, 8.112), through the `/ghinterface` routes or a JSON built at release time. All 0.5 text goes. With C-2 to C-5 every COULD of the review is in P11. **Stage 1 as built (user 2026-10-06):** History sits at the bottom of the right column on desktop (the graph needs the width); the Evidence layer is off in Graph view (no evidence nodes until the swimlane graph); an Actions entry "Versions awaiting action" keeps submit / recall / publish / reject / reinstate / delete of unfinished versions reachable; JSON-LD stays in the PDF footer and the API, CERO is an Actions entry; the camera / gallery buttons show only while the piece has an unpublished version (6.6); "Record changed" rows leave the History list and stay in the collapsed change history; the "Public demo view" banner is replaced by "Not public: only members of and the moderators see this piece."; `can_undo_deinstall` is a response-only flag, computed only for moderators of the dataset and admins. **Stage 2, API (user 2026-10-06)**: for Q8, `GET /identities`, `/identities/count`, `/identities/map`, `/identities/stats` and `/identities/meta/datasets` answer anonymous callers with the public tier only (`is_public` pieces, no people, no unpublished states; the map cache filtered by the same visible set), rate-limited per client address; the web proxy lets `/components`, `/components/map`, `/analytics` and component pages through anonymously; `GET /identities?q=` is a free-text filter (name, catalog number, id prefix); `GET /snapshots?mine=1&status=...` lists the caller's own snapshots. **Stage 2 as built (user 2026-10-07)**: the anonymous sidebar shows Browse, Map, Analytics, Grasshopper, API docs and Sign in; map points carry dataset / material / shape_class and the stats response `byCirculation` and `pieces` (additive; the map cache is rebuilt in P12); the sidebar has 14 entries for an admin (every entry a page); Moderation stays at `/admin/validation` with tabs, the old pages redirect; count / stats / map / meta answer with the viewer's cache headers (`Vary: Authorization`, 8.101); Browse shows a placeholder instead of requesting a missing preview. **Stage 3, API (user 2026-10-07)**: `GET /ghinterface/reference` parses the release tag's component sources with `ast` only (never executes them) into one JSON (name, nickname, subcategory, description, inputs with descriptions, outputs from `OUTPUTS`), cached per release tag; it and `GET /ghinterface/version` answer anonymous callers, rate-limited per client address; the other `/ghinterface` routes stay signed-in. `GET /datasets` rows gain `member_count` (moderators of the dataset and admins only, else absent) and `component_count` (published pieces the caller may see). Settings "Account" reads `GET /users/me`; admins read "Administrator: all datasets, all roles". **Stage 3 review (user 2026-10-07)**: an anonymous caller of `/ghinterface/reference` gets the release the backend runs, `?channel=` only for signed-in callers (the server's GitHub token must not be spent by anonymous ref cycling; CSC_Update shares it); the download of the UserObjects stays signed-in; the unreferenced 0.5 screenshots in `public/gh-interface/` are deleted; Appendix A is walked line by line by the implementer on the acceptance instance with every role (checklist with screenshots), the review checks the signed-out lines and the checklist. **Grasshopper page, revised (user 2026-10-07, at the stage 3 acceptance; replaces the short page of C-5)**: per component a card as on the 0.5 page --- screenshot (the old files in `public/gh-interface/` come back; a placeholder where none matches; new screenshots are added later), the generated description, inputs and outputs, and "Copy Grasshopper component to clipboard" (the component's XML, pasted into a definition); the installation section leads with the copy-and-run path: copy the CSC_Update component, paste it into a definition and run it, which installs the UserObjects and `csc_gh`; the download stays as the second path. `GET /ghinterface/xml/{name}` answers anonymous callers too (read-only, the backend's release tag only, no `channel`, rate-limited per client address), so the copy buttons and the copy-and-run installation work signed out; the zip download stays signed-in. The layout need not be one card per component (a grouped, expandable form is fine) as long as screenshot, description, inputs and outputs read clearly. Amended 2026-11-05: the review now lies in `.dev/notes-archive/ui-review/`. | Rejected: a new visual style; all actions in the menu (Reserve one tap further); the PDF as a second visible button. Amended 2026-10-28 (user, 0.6.4.2): Q1, "Add evidence" is a button of the evidence records card, not of the Properties card: the action makes a record, and properties are derived, never typed in, so a button on the Properties card suggests editing them. The Properties card keeps only a quiet link "add evidence" in its empty state (no properties yet), with the same rule for who sees it; its "?" says that properties are worked out from the evidence. | | 8.119 | **Deviation maps: points assigned by surface normal, sample sized to the map** (user 2026-10-07, after the P11 acceptance showed #709's distance overlay narrowing along the beam). Diagnosis: `_box_unwrap` assigned each sample to the nearest box plane; #709's underside lies 50--350 mm inside the obb, so beyond the gap where a side plane is nearer its points jumped to the sides (of 919 downward-facing samples 406 on `-z`, 343 on `+y`); and 50 000 samples over about 11.9 m^2 at 11 mm cells filled only 24--47 % of the cells. (a) Each sample goes to the face whose outward normal best matches its surface normal; the nearest plane only when the best `|n . face|` is below 0.5 (edges); the same for prism faces and caps; the hull keeps its angular map. The distance channel then shows a recessed surface's depth as a gradient. (b) The surface sample is sized to the maps: about 3 points per cell of the sampled area, at least 50 000, at most 300 000. Map files keep their size. All fitted proxies are re-derived (P12 step 3 runs the geometry runner anyway). Test: #709's downward-facing samples land on `-z` for at least 90 %. | Rejected: ray projection per face (exact under occlusion, costly without Embree; later if (a) is not enough); keeping the nearest-plane rule; display-only filling of the gaps. | | 8.120 | **Nobody publishes directly; self-moderation from the queue** (user 2026-10-07). Submitting a snapshot or an evidence record never publishes it, for any role incl. moderators and admins: the submit route loses `?publish=1` (and `&promote=1`), the web forms, the evidence lifecycle actions and the Grasshopper upload (`csc_gh.upload`) only submit, and every new record waits in the moderation queue as `pending`. Publishing is always the separate `POST /snapshots/{sid}/publish` / `POST /evidence/{eid}/publish` by `moderator(D)`; a moderator may publish their own submission from the queue (a deliberate second step; the queue card marks it "Own record"). The external catalogue import (8.108) submits and then publishes through those routes as a scripted moderation step. | Rejected: auto-publish for moderators / admins (records skip the queue); a strict four-eyes rule (blocks datasets with one moderator; a per-dataset setting may follow, FUTURE). | | 8.121 | **P12 preparation review: sweep only on request, map distance to the face plane, outline cap** (user 2026-10-07, after the review of the P12 preparation and the incident in which a local geometry run deleted one derived preview in the local asset original). (a) `main_geometry.py` sweeps orphaned previews only with an explicit `--sweep` flag, default off; only the production cron (`uberspaceconfig/crontab`) sets it; the guard "no snapshot in the database" stays. On the server the asset folder is the one the production database describes, so the sweep there is right (P12 checklist). Local `dev.env` points every `SNAPSHOT_*_DIR` at `.dev/assets/` (a copy of the assets, gitignored), never at an original. (b) The deviation maps' distance channel measures the signed distance to the plane (or surface) of the face the point is assigned to (8.119 a), so a recess shows its full depth on the face it is drawn on; the residual figures (`rms`, `p95`, `max`, `inlier_ratio`) stay the distance to the nearest proxy surface. (c) The planar prism's outline input is capped at 50 000 points (strided before `_thin`); the outline does not need the map density; measure the largest flat piece (the aerated concrete wall) once. (d) **A planar accept check with a box fallback** (user 2026-10-07, from the measurement of (c)): a plain rectangular scanned slab fitted a ragged prism with p95 about 1.5 m, because `_accept` only guarded linear prisms. A planar prism is accepted only when its p95 is at most one thickness (`PRISM_PLANAR_TOLERANCE` 1.0; the 11 planar prisms of dump 261001 sit at 0.07--0.39, notched slabs at 0.003--0.006, the broken plain wall at 7.6) and its rms is not worse than the frame's box on the same sample (the rms, not the p95: a notch covers too little surface for the p95 to tell box and prism apart); otherwise the box is the primary proxy. On 261001 none of the 11 planar pieces switches. | Rejected: a sweep on every full pass whatever the stages; the map distance to the nearest surface (understates recesses on the face they belong to). | @@ -317,12 +317,20 @@ into one **metadata object**. | 8.180 | **Scope of 0.6.4.3: Grasshopper only** (user 2026-10-28; after 0.6.4.2, before 0.6.5). A release that touches only the Grasshopper side: `invoke bump-version 0.6.4.3 --gh` first, then the export in Rhino 8. In: issue #40 (the scan of 8.179 (2): a missing or empty input is a warning, an output without a result is an empty Grasshopper tree, in every component, through helpers in the shared library), with #32 and #33 as its first cases; #36 (`ReadFromD2P` resolves the D2P component from a tagged member object); the descriptions of `ApplyFrame` (0.6.5 (e)). Amended 2026-10-29 (user): this release becomes 0.6.4.4; 0.6.4.3 is the photo controls only (8.184). Amended 2026-11-02 (user): #52 joins, #36 is an output fault, the dev requirements are pinned exactly (8.185). | | 8.181 | **A data model reference page for users** (user 2026-10-28; added to 0.6.4.2). The web app gains a public page that explains the data model in a digestible reference form, built from the material that exists (`docs/adr/DATA_MODEL_SPEC.md`, `CONTEXT.md`, `vocab.py`). (a) Audience: catalog users --- members who add pieces and evidence, readers, Grasshopper and MCP users --- not developers. Content: the four entities (dataset, component identity, snapshot, evidence) and how they relate; the four rules of the model in plain words; per entity the fields a user sees or fills in, with meaning, type or unit, an example and whether the server derives it; the vocabularies, each value with its label and one line of meaning; an example record per evidence method. Left out: the API surface, permission internals, invariants, migration and the CPR mapping; they stay in the spec. (b) Sources (hybrid): the text, the examples and the field tables are written by hand in a typed content module of the web app, since the field descriptions of the models are technical; each vocabulary value gains a one-line description in `vocab.py`, served by `GET /vocab` and generated into `generated/Vocab.ts` (`*_DESCRIPTIONS`), so the page shows label and meaning from the backend and other readers (forms, MCP) can use them. Two tests keep it in step: a backend test fails on a vocabulary value without a description, a frontend test fails on a field named on the page that the generated models do not have. (c) Place: `/reference`, titled "Data Model", public without sign-in, in the style of the privacy page (#39); linked in the sidebar next to the Grasshopper item (`/gh-interface`, group `tools` in `lib/navigation.ts`), visible to anyone, not in the footer; a table of contents at the top and an anchor per entity and per vocabulary (`/reference#evidence`, `/reference#evidence-methods`), so that forms, the MCP connector and the Grasshopper descriptions can link a section later. (d) Examples: made up, not taken from the catalog. One made-up piece is followed through the whole model (for example a concrete beam: its dataset, its identity, two versions, evidence records of several methods), so each section shows the same piece. Each record is a table of field, value and a short comment, with its raw JSON folded below. No names of people or organisations (roles instead), ids marked as examples; the values follow the examples of the spec (Appendix A). Real records were rejected: they change or are withdrawn, carry names, and no single piece has every kind of evidence. (e) Authorship: the implementer drafts the text, the field tables, the vocabulary descriptions (one line, about 120 characters at most) and the example piece from the spec and `CONTEXT.md`, and marks the sentences where it read the spec loosely; the reviewer checks every statement against the spec and the decisions; the maintainer approves the wording on the dev stack. Built as T9 of 0.6.4.2, after T7 and before the warning cleanup T8 (about 2--3 days). Amended 2026-10-28 (user, after the first look at the page): (c) the page is not one long column but seven tabs along the top (Overview with the diagram and the four rules; Dataset; Identity with origin and exit; Versions; Evidence with result, place, check, lifecycle and actors; Lists of values; Example), which replace the table of contents; inside a tab the vocabularies and the evidence records of the example are folded sections, closed by default. The tab is in the address (`/reference#evidence`); a link to a section further down opens its tab and its folded section and scrolls to it, so the anchors keep working. On a phone the tab bar scrolls sideways in itself, the page does not. The background mesh stays. Amended again the same day (user): the Data Model page has no background mesh. | | 8.182 | **Session expiry on a public piece; the return address after sign-in** (user 2026-10-28; 0.6.4.2, from the review of #35). (a) When the session ends on a component page whose view is public (8.179, #35), the page is signed out without a redirect and rendered again as anonymous: it stays readable, but what only a signed-in user sees (person names and e-mails of actors, people in the History graph, `added_by_username`) goes, and the navigation shows the user as signed out. A view that is not public leads to the sign-in page as before. (b) The return address after sign-in (`callbackUrl`) only accepts an address on this site: exactly one leading `/` and the same origin, checked by one shared function on the server and in the browser; anything else falls back to the default page. Closes an open redirect (`//evil.com`, `/\evil.com`) that was there before 0.6.4.2. | -| 8.183 | **"Element", not "piece"** (user 2026-10-28; 0.6.4.2 and 0.6.4.3). "Piece" is not the maintainer's word; in user-facing text a single physical building component is an "element" (chosen so it is not confused with a Grasshopper component). "Component" keeps its meaning (the glossary entry); the single items of a batch are its elements. Origin: the agent sessions since 2026-10-09 (about 720 uses in the web app, 300 in the backend, 135 in the Grasshopper sources). (a) 0.6.4.2: every text a user sees in the web app, the Data Model page included; the backend's error messages, the mail templates, the MCP tool descriptions and the OpenAPI descriptions; the README; the unreleased 0.6.4.2 CHANGELOG entry; `CONTEXT.md` ("piece" under _Avoid_ for Component) and `DATA_MODEL_SPEC.md`, so that briefs and agents stop copying the word. (b) 0.6.4.3: the Grasshopper descriptions, with the re-export. (c) Unchanged: code comments, earlier CHANGELOG entries and this log (append-only). Each hit is read before it changes: "piece" in another sense ("a piece of information") stays. "Element" in the IFC sense (`IfcBuildingElement`) agrees in meaning. Amended 2026-10-29 (user): (b) moves to 0.6.4.4 with the Grasshopper release (8.184). | +| 8.183 | **"Element", not "piece"** (user 2026-10-28; 0.6.4.2 and 0.6.4.3). "Piece" is not the maintainer's word; in user-facing text a single physical building component is an "element" (chosen so it is not confused with a Grasshopper component). "Component" keeps its meaning (the glossary entry); the single items of a batch are its elements. Origin: the agent sessions since 2026-10-09 (about 720 uses in the web app, 300 in the backend, 135 in the Grasshopper sources). (a) 0.6.4.2: every text a user sees in the web app, the Data Model page included; the backend's error messages, the mail templates, the MCP tool descriptions and the OpenAPI descriptions; the README; the unreleased 0.6.4.2 CHANGELOG entry; `CONTEXT.md` ("piece" under _Avoid_ for Component) and `DATA_MODEL_SPEC.md`, so that briefs and agents stop copying the word. (b) 0.6.4.3: the Grasshopper descriptions, with the re-export. (c) Unchanged: code comments, earlier CHANGELOG entries and this log (append-only). Each hit is read before it changes: "piece" in another sense ("a piece of information") stays. "Element" in the IFC sense (`IfcBuildingElement`) agrees in meaning. Amended 2026-10-29 (user): (b) moves to 0.6.4.4 with the Grasshopper release (8.184). Amended 2026-11-08 (user), 0.6.4.5: reversed for a single catalogued component. In user-facing text it is a "component" again, as in the navigation, the routes and the page titles; "element" stays only for the items of a batch, which are drawn from it. On the Grasshopper page the other kind is a "Grasshopper component". Done in 0.6.4.5 for every text a user sees in the web app, the Data Model page included, the backend's messages, the mail templates, the MCP tool descriptions and the OpenAPI descriptions, the README, the 0.6.4.5 CHANGELOG entry, `CONTEXT.md`, `DATA_MODEL_SPEC.md` and `AGENTS.md`. The Grasshopper descriptions follow with the next Grasshopper release, since 0.6.4.5 has none (8.189). Earlier CHANGELOG entries and this log stay. Each hit is read before it changes: "element" in the IFC sense, and in another sense ("an element passport"), stays. Reason: the first wording made the web mix both words, as 0.6.4.2 replaced "piece" while the navigation and older text kept "component", and new text written by the rule in `AGENTS.md` added more "element". | | 8.184 | **Scope of 0.6.4.3: the photo controls follow the permission rule; the Grasshopper release becomes 0.6.4.4** (user 2026-10-29; after 0.6.4.2, before 0.6.5). 0.6.4.3 is a web release, bumped without `--gh`, with one item: issue #45. The photo controls of an existing version on the component page follow the backend rule and nothing else changes: before publish, whoever may edit the version's files adds and removes photos (8.18, 8.142 a); after publish, a contributor or moderator of the dataset adds photos (3.2.2) and only a moderator removes one; a site admin passes every check. Today the web app shows them to a site admin only, and only before publish. The backend rule stays as it is. Everything else that is open moves to 0.6.4.4: the Grasshopper release of 8.180 with 8.183 (b), and the open items listed with it in the plan. | | 8.185 | **Scope of 0.6.4.4: the beta notice joins; the cause of #36; exact pins for the dev tools** (user 2026-11-02; amends the scope of 8.180). (a) Issue #52 joins 0.6.4.4, so the release is no longer Grasshopper only (still `invoke bump-version 0.6.4.4 --gh` first): the beta banner and the beta login notice take the version from `package.json` as `lib/cscClient.ts` does; the frontend `.env` keeps `BETA_PHASE` and the wording, with a `{version}` placeholder that `lib/beta.ts` fills in; a text without the placeholder stays as it is. The release needs a server note: the version number leaves `BETA_BANNER_TEXT` and `BETA_LOGIN_MESSAGE` of the server's frontend `.env`. (b) #36, observed by the maintainer in Rhino: `ReadFromD2P` finds the D2P component; the fault is the `Component` output, which does not carry a D2P component instance that Grasshopper and D2P accept. Probable cause (read in the code, to be confirmed): `RunScript` adds the Python object that `instance_from_object` returns, while `PassportToD2P` adds `d2p_component.NetObj`, the .NET `IComponentBase`. The resolution from a tagged member object (8.180) is kept only if the live check shows it is needed. (c) The development requirements (`requirements-dev.txt`: `pytest`, `pytest-xdist`, `coverage`, `flake8`, `invoke`, `requests`, `pyld`, `rdflib`) are pinned exactly (`==`), at versions about two weeks old; they are raised by hand, since Dependabot watches only GitHub Actions. Amended 2026-11-02 (review): the probable cause of (b) does not hold. `instance_from_object` returns the .NET object itself (`_NetInstantiation.InstanceFromObject`, declared as the interface `IComponentBase`), not a Python wrapper with `.NetObj`; D2P resolves it through the groups of any member object, so the member-object resolution of 8.180 is not needed. The cause stays open; the leading hypothesis is the interface proxy of pythonnet 3 (the concrete object is `__implementation__`). The live check in Rhino decides. Amended 2026-11-03 (maintainer, live check in Rhino 8): with a component that `PassportToD2P` made and D2P committed, `ReadFromD2P` puts out the D2P component. An element baked by `BakeComponents` is no D2P component and gives null, as the output description says; the earlier null came from such a bake. | | 8.186 | **A failed item keeps its slot** (user 2026-11-02; 0.6.4.4, from the review of #40 at stop point 1; refines 8.180). Grasshopper runs an item-access component once per item. (a) An input with no data at all (nothing connected, or `VolatileDataCount` 0) is a warning and gives empty trees on every output, as #40 says. (b) When one item of a list is missing, empty or fails, that iteration gives a null in its slot (with the warning or error of the item), so the outputs stay one to one with the input list, as native Grasshopper components do; an empty tree there would shift every later result. (c) Components with list or tree access, and the early stop (`empty_outputs()`), give empty trees. (d) Live check in Rhino 8 by the maintainer: `ApplyFrame` with `Input = [passport, '', passport]` gives three slots on `Output` and `Frame`, the middle one null; and with nothing connected, empty outputs. | | 8.187 | **`ReinforcementLayout`: the steel grade is optional** (user 2026-11-02; 0.6.4.4, from the review of #40 at stop point 1). The `Spec` input may stay empty: no warning, and the bars are stored without a grade, as the backend allows (`LayoutBar.spec` is optional). A covermeter scan rarely knows the grade. A `Spec` that is given follows the existing count rule. | | 8.188 | **After a source swap: save, close and reopen the definition** (user 2026-11-03; 0.6.4.4, from the first local update of 0.6.4.4; amends the wording of 8.155 b). A component whose source `CSC_Update` replaced with `SetSource` has no compiled code in Rhino 8 (8.35): it shows "Object reference not set to an instance of an object", and its script editor opens the source as plain text with Run, Save and Apply disabled (`ScriptEditor.BeginEdit` falls back to "as text" when `Script.GetCode` has no cached code). The Apply that 8.155 names is therefore not reachable. Saving the definition, closing it and opening it again builds the code from the stored source; then the editor opens normally (checked by the maintainer in Rhino 8). (a) The remark under a replaced component and the end-of-run line of `CSC_Update` say so: save, close and reopen the definition, then open the script editor and click Apply. (b) Unchanged: `CSC_Update` still only calls `SetSource` (no self-healing, 8.155 b). | +| 8.189 | **Scope of 0.6.4.5: the permission mismatches and the leftovers** (user 2026-11-04; after 0.6.4.4, before 0.6.5). In: the permission mismatches of the audit of 2026-10-29, issues #46 to #50, and the leftovers of the earlier reviews. Out: `CSC_Update` stays as it is, without self-healing after a source swap (8.155 b, 8.188); so also no warning in its local mode about older user objects. A web and backend release: `bump-version` without `--gh`, no Rhino export. The two Grasshopper leftovers of the review of 0.6.4.4 (`Actor` can still shift slots when a needed input depends on another item's value; the unreachable return of `ApplyFrame`) move to 0.6.5. The open rules are grilled before the brief and logged here or in their own rows. Amended 2026-11-05 (user): one bug from outside the audit comes in, found in the review of this release: the web form sends no `summary.kind`, so a claim with a result answers 422. | +| 8.190 | **A withdrawn element stays out of circulation: the backend refuses** (user 2026-11-04; 0.6.4.5, #49). Reserve, re-enter, undo exit and undo deinstall answer 409 "The component is withdrawn." on a withdrawn element, as deinstall already does. Adding a photo to a withdrawn version, or to any version of a withdrawn element, and adding an attachment to a withdrawn record are refused too. To act on it, a moderator reinstates first. The web keeps hiding these controls. Amended 2026-11-05 (user): adding an attachment to any record of a withdrawn element is refused too, as for photos; the first wording named only a withdrawn record. Amended 2026-11-05 (user): correcting a version of a withdrawn element is refused too (`POST /snapshots/{sid}/supersede`, 409), and the web hides the control: a correction adds a version, so the element could otherwise gain a published version. Amended 2026-11-05 (user): submitting, publishing and promoting a version of a withdrawn element are refused too (409), and the web hides those controls: a draft or pending version opened before the withdrawal could otherwise be published after it. Recall, reject, back to draft and delete stay, so that an open version can be cleared. Withdrawing stays allowed while a version is open, since it can be urgent. Amended 2026-11-05 (user): on a withdrawn element, reinstating a version and reinstating an evidence record are refused too (409), and withdrawing a version with `replacement_id` is refused, since it moves the current version; the web hides the two reinstate controls. A moderator reinstates the element first, then the version or record. Withdrawing a version without `replacement_id` stays allowed, as it only takes away. | A withdrawn element is a tombstone (6.4); withdrawing already clears the reservation. | +| 8.191 | **Moving an element to another dataset** (user 2026-11-04; 0.6.4.5, #50). `POST /identities/{id}/move` with the destination dataset, and a control in the actions menu of the element; one element at a time, no "move all". The rule is `move_identity`: a moderator of the source and of the destination dataset. `dataset` is stored only on the identity and catalog numbers are global, so the move changes that field and writes a change log entry. A withdrawn element can move, so that a dataset can be emptied and deleted. Refused (409) while a version or record of the element is draft or pending, since the rights of its author hang on the dataset. A public element cannot move into an unreviewed dataset unless the caller is an admin (8.139 c). An element in several datasets, or a separate collection system, is not part of this: issue #54, for later. Amended 2026-11-05 (user): three cases are accepted as they are. The refusal looks only at the element's own records, so a child's pending first version does not block its parent's move; publishing that child then needs a moderator of the parent's new dataset (8.8) or an admin. A rejected version or record does not block a move; a moderator of the destination can still delete it. A reservation survives a move; a moderator of the destination can release it. | Deleting a dataset refuses while it holds any element, and no route could empty it. | +| 8.192 | **#50: a delete control for a never-published element; the other actions without a web control stay API-only** (user 2026-11-04; 0.6.4.5). The web gains a control to delete an element nothing of which was ever published, with a confirm dialog, for its creator or a moderator (`delete_identity`). No web control in this release, each logged for later: editing the notes of published evidence (#55), the moderators' recompute and overrides (#56), uploading and deleting meshes and point clouds (#57), the "as of a date" views of the history (#58). `purge` and `redact_actor` stay admin-only over the API. | A missing control fails for nobody, so these are no mismatches; the delete control is one, since the web offers no way to remove such an element. | +| 8.193 | **#48: what the web hides although the backend allows it** (user 2026-11-04; 0.6.4.5). (a) The web shows the control, the backend rule stays: a moderator without the contributor role adds an attachment to a published record; a contributor reaches the edit form of their own draft version through a link in the version dialog; a new state or evidence can be added when every version is withdrawn, and an element published once with no current version can be taken out of circulation, both through one shared "ever published" helper that replaces `current_snapshot_id` as the test; a site admin submits, recalls or returns to draft another person's record (6.5); an author edits their evidence draft after losing the contributor role, the form no longer blocks. (b) The same for two rules the user kept: a moderator edits the name, notes and date of a withdrawn version or of any version of a withdrawn element, and fills the layout document of a superseded record. Neither needs a reinstatement or a correction first. (c) The backend tightens one rule: only a moderator of the dataset, or an admin, revokes an invitation; the creator loses the right with the role. The old rule was deliberate and tested; the user confirmed the change knowing that, so `test_a_demoted_moderator_cannot_resend_but_can_still_revoke` changes with it. (d) Stays as it is: on an unreviewed dataset the visibility and public switches stay disabled for a site admin too, who ticks "Reviewed" first; the API override of `refuse_unreviewed` stays (8.139 c). Amended 2026-11-05 (user), on (b): the web enables only name, notes and date there and disables the rest of the form (location, colour, photo credit, capture fields, Public switch). The backend rule stays, so the API still accepts those fields. Amended 2026-11-05 (user), wording: the Public switch is hidden there, not disabled. | Correcting a text or adding a drawing reference changes no state and adds no version, so it differs from the actions 8.190 refuses, and a tombstone may still need a typo fixed. Rights that came with a role end with the role. The review of a dataset stays a visible step. | +| 8.194 | **The leftovers of 0.6.4.5** (user 2026-11-04; amends nothing, settles 8.189). In: the check of `tests/grasshopper/test_signin.py` that needs `sys.stdlib_module_names` runs only on Python 3.10 or newer, so the file passes in a 3.9 environment; "version" replaces "snapshot" in the user text of `SnapshotPhotoCapture`. Later: "Show in viewer" for other positioned records (8.178), and an actor role for "retrieved the source" or "modeller", which is grilled with other data-model work. No change: the photo hint line stays hidden in the compact card; `GetDescriptor` and `AddEvidence` keep reporting the first failure of a list in their own way. No repository change for the crontab: `crontab.example` is the tracked one and `uberspaceconfig/crontab/crontab` a gitignored local copy; the maintainer compares the crontab on the server with the example. | The hint would not fit the low row, and the Add button is disabled at the limit. The 14 days of the privacy page hold for the request log without cron, since `DailyFileHandler` deletes its older files; the crontab line covers the cron and deploy logs. Amended 2026-11-08 (user), 0.6.4.5: the wording half is reversed. In user-facing text a recorded state is a "snapshot", as in the data model, `CONTEXT.md` and `DATA_MODEL_SPEC.md`; its number stays "v1", "v2", and "version" stays for the version of the software, a release, a geometry stage or a file format. Done in 0.6.4.5 with the scope of the amendment of 8.183: every text a user sees in the web app, the Data Model page included, the backend's messages, the mail templates, the MCP tool descriptions and the OpenAPI descriptions, the README, the 0.6.4.5 CHANGELOG entry and `AGENTS.md`; the Grasshopper descriptions follow with the next Grasshopper release. Earlier CHANGELOG entries and this log stay. Each hit is read before it changes. Reason: the data model says "snapshot" while the web said "version" in most places and "snapshot" in others ("Snapshot v1" in My work, "Snapshots (2)" on the moderation page). | +| 8.195 | **#47: the web learns of an open version or correction through two booleans** (user 2026-11-05; 0.6.4.5). The identity payload gains `has_open_version` and an evidence record `has_open_correction`, computed by the server in the pattern of `can_undo_deinstall`, for signed-in members of the dataset and admins. Only the fact: no version number, status or author. "Record new state", "Correct" on a version, "Back to draft" and "Correct" on an evidence record are then hidden or disabled with the reason before a form is filled in. Amended 2026-11-05 (user): the audience is the contributors and moderators of the dataset and the admins, not every member. A reviewer without another role adds no version or record, so never gets that 409, and the flag would tell them of a draft they cannot see; the last sentence of the reason holds only for this narrower audience. | A draft or pending version is visible only to its author and the moderators, so a contributor cannot tell from the rows that another person's version is open and would fill in a whole form for a 409. That 409 already tells the same people more, the version number and its status. | +| 8.196 | **Terms in user text follow the data model** (user 2026-11-08; 0.6.4.5; with 8.183 and 8.194, both amended 2026-11-08). A terminology sweep found the code, the API routes, the database and the Grasshopper components consistent with `CONTEXT.md` (identity, snapshot, evidence record), and the web and the MCP tools mixed. (a) In user-facing text the catalogue record of a component and its UUID are a "component" and a "component id", also on the tag and id pages ("Identity id", "identity UUID", "physical identity id" go); "identity" stays the name in the code, the API, the Grasshopper components and on the Data Model page where it explains the model. (b) The two API fields new in 0.6.4.5 are renamed before release: `has_open_version` to `has_open_snapshot` (8.195) and `element_withdrawn` to `identity_withdrawn`. (c) The recorded object is a "snapshot" in user-facing text, never a "version" or a "state" ("Record new state" becomes "New snapshot", "This state" "This snapshot"); "state" stays for the physical condition a snapshot records, and "state change" for the act, as in the glossary. Each hit is read before it changes. (d) The MCP tools `list_versions` and `get_version` become `list_snapshots` and `get_snapshot`, with their titles, parameter texts and the hints that name them; clients load the tool list on connect, and an old chat that calls the old name gets "tool not found" once. Amended 2026-11-08 (user, found in the review of the round): the MCP parameter and answer keys follow as well, beyond the rule that no other identifier is renamed: `version_id` becomes `snapshot_id` (also in a layout row), `versions` `snapshots`, `current_version` `current_snapshot`, `version_count` `snapshot_count`; the field `version`, the number, stays. Old chats break once anyway with the tool names. | `CONTEXT.md`: the _Avoid_ line of Component identity no longer forbids "component" in user text. No released API changes: both fields are new in this release. | **Facts confirmed (user, 2026-09-28):** the 35 ZirKuS reinforcement bars were modelled after the original drawing --> `basis: drawing` (step 6d). The 2024-07-24 deinstallation applies to all 16 diff --git a/docs/adr/HANDOFF.md b/docs/adr/HANDOFF.md index 505eb99c..e7d98721 100644 --- a/docs/adr/HANDOFF.md +++ b/docs/adr/HANDOFF.md @@ -89,7 +89,7 @@ on dump 261001 (`invoke rehearse`, now with steps 5, 7, 8): 701 / 701 snapshots errors, 0 invariant errors; the frame changed axis order against the 0.5 `pca_frame` on 23 snapshots (5 `beyond_debris`, 8 `dbu_zirkus`, 8 `ddu_build_with_debris`, 1 each `schoenes_neues_feld` and `spa_example_data`). Build decisions 8.46--8.51 are marked "to confirm". **Open before P5 is -accepted:** the user signs off the tuning tables (`.dev/tuning_261001.txt`: shape class and +accepted:** the user signs off the tuning tables (`.dev/notes-archive/tuning_261001.txt`: shape class and complexity against the 71 authored `beyond_debris` ratings) and the frame report; the thresholds in `shape_class.py` and `complexity.py` are still the initial guesses and are frozen after that sign-off (a change is a `*_VERSION` bump). Left for P7: the add-component wizard still calls @@ -106,7 +106,7 @@ implementation session and the review session; a "go" from the user sends a task (`PassportToD2P` updated, new `ReadFromD2P`) and the built-in Bake / Sync on one user-text convention (`csc_identity_id`, `csc_snapshot_id`, `csc_placement`), the `Version` bump of ViewCaptureToFile, a rewire list for the release / example definitions and the in-Rhino checklist; (3) the user's -Rhino runs (`.dev/p8/in-rhino-checklist.md`, `measure_mesh_build.py`) and one export of every new or +Rhino runs (`.dev/notes-archive/p8/in-rhino-checklist.md`, `measure_mesh_build.py`) and one export of every new or changed `.ghuser` with ExportScriptsAndSource after part B. O12 (cutover runbook) closed by 8.122 (one offline day, plan P12 "Cutover day"); O4 (email setup) closed by 8.124. Phase order from 8.103: P9 in-place state, batches and the external catalogue import (grilled 2026-10-05: 8.104--8.109, ready to build), P10 exports, P11 UI revision, P12 cutover. The production Atlas password, the JWT secret and the NextAuth secret were rotated on 2026-10-08 (printed into session tool output earlier). New on 2026-10-08, not part of the diff --git a/docs/adr/IMPLEMENTATION_PLAN_0.6.md b/docs/adr/IMPLEMENTATION_PLAN_0.6.md index 4b69018e..e9ef9c70 100644 --- a/docs/adr/IMPLEMENTATION_PLAN_0.6.md +++ b/docs/adr/IMPLEMENTATION_PLAN_0.6.md @@ -363,7 +363,7 @@ test geometries. Rhino-document sync (bake, read back) goes through the D2P brid one for the matchmaking tools (numpy, scipy, scikit-learn, ...), versions pinned in one place. - Correcting a scanned version (8.91 a, 8.95 13): a supersede input on the snapshot components carries the new scan; `supersede` does not keep a scan's files for web corrections in 0.6. -- Step 1 (audit, done 2026-10-03, `.dev/p8-audit.md`) and its answers: decision 8.95 --- the +- Step 1 (audit, done 2026-10-03, `.dev/notes-archive/p8-audit.md`) and its answers: decision 8.95 --- the component list, `Mesh.Reduce` kept for Preview / Reduced, centring as an input, environments `DDU_CSC` (requests, numpy) and `DDU_CSC_MATCH`, D2P plus a minimal built-in Bake / Sync on one user-text convention, `csc_placement`, authored-proxy fall-back in Fetch, FetchOriginalGeometry, @@ -394,9 +394,9 @@ document is a group with one text label; the label plane now is the truth, so mo piece in Grasshopper (`Q = P . F`); D2P commits its label without user text, so PassportToD2P puts the keys on the members. Tests: pure (`test_convention.py`) and a headless Rhino 8 round trip on .NET 7 of both paths and across (`test_rhino_doc.py`). `ViewCaptureToFile` has a new `Version:` line for its lean header. Not in the repository (binary -`.gh`, Rhino): the rewiring of the release / example / development definitions (`.dev/p8/rewire-list.md` lists each +`.gh`, Rhino): the rewiring of the release / example / development definitions (`.dev/notes-archive/p8/rewire-list.md` lists each change and canvas position), the in-Rhino checks of part B and the one export of every new and changed `.ghuser` / -`.xml` (`.dev/p8/in-rhino-checklist.md`, sections 7 to 9), and the web page `/gh-interface`. +`.xml` (`.dev/notes-archive/p8/in-rhino-checklist.md`, sections 7 to 9), and the web page `/gh-interface`. ### P8 part C --- shared library, declared outputs, fixes --- size M --- **next, before P9** @@ -430,7 +430,7 @@ terms in place, planned origin, batch, draw, remaining, document. Source data: t Document card (the host as an external link); `steel_grade` and the new functions through `GET /vocab`. No redesign (P11). - **GH** (8.109, rule 8.94). `Origin`: `Planned` input; `DisassembleComponent`: `Planned`, `Remaining` outputs; `FilterComponents`: `in_place`; `AddEvidence` tooltips. The user exports the changed `.ghuser` files - (`.dev/p9/` checklist). + (`.dev/notes-archive/p9/` checklist). - **Import** (8.108). Untracked in `.dev/import_external/`: scraper, parser (cached pages --> entries), IFC element reader (ifcopenshell, local tools environment only), planner (entries --> plan JSON + report: counts per dataset, skips with reasons, mismatches), runner (through the HTTP API; `--dry-run`; resumable by `attributes.import`). @@ -477,7 +477,7 @@ member-only data. ### P11 --- UI revision --- size L --- **scope grilled 2026-10-06 (8.118), not started** -Called "P7b" in decision 8.102 and in the UI / UX review (`.dev/ui-review/`, wireframes accepted in principle). +Called "P7b" in decision 8.102 and in the UI / UX review (`.dev/notes-archive/ui-review/`, wireframes accepted in principle). Decisions 8.101 (M2), 8.102 (History card), 8.118 (style rule, Q1--Q12, scope). Style: the existing shadcn components and the blue / magenta CI colours stay; spacing and secondary shades may change. - **Stage 1, component page**: header strip with chips, banner, viewer with toolbar, facts card "The component" / @@ -988,6 +988,8 @@ fold (once it is clear which quantities are searched); Atlas Search for typo-tol **0.6.4.4 --- Grasshopper hardening (user 2026-10-28, after 0.6.4.2; 8.180; moved from 0.6.4.3 by 8.184; scope amended by 8.185):** the Grasshopper side and one web item, (g) (`bump-version --gh` first, then the export in Rhino 8). (a) #40, with #32 and #33 as its first cases: the scan of 2026-10-28 found eleven components that report a missing input with `_addError` through `BuildError` (`Actor`, `ApplyFrame`, `Capture`, `ComputeFrame`, `CreateComponentIdentity`, `CreateComponentSnapshot`, `FetchReinforcementLayout`, `IdentityMetadata`, `Origin`, `ReinforcementLayout`, `SnapshotMetadata`; `AddEvidence` already warns), fourteen outputs started as `''` or `None`, and an `empty_outputs()` that returns `None` in 47 components. The fix belongs in the shared library (a missing-input error reported as a warning, an empty tree helper) and then in every component; the implementer lists each component and what changed. A failed item of an item-access component keeps its slot with a null; an input with no data and the early stop give empty trees (8.186). The `Spec` input of `ReinforcementLayout` is optional (8.187). (b) #36: `ReadFromD2P` finds the D2P component, but its `Component` output does not carry a D2P component instance (the maintainer, live in Rhino; 8.185 b). Cause open (8.185 b, amended): `instance_from_object` already returns the .NET object, declared as `IComponentBase`; the leading hypothesis is the pythonnet 3 interface proxy. Unwrap to the concrete object, fix the output, report a failed resolution as a warning naming the element, check `SyncWithRhinoDoc` for the same fault; live check in Rhino by the maintainer. (c) The descriptions of `ApplyFrame`, moved from 0.6.5 (e); with them the `Frame` and `BoundingBox` descriptions of `DisassembleComponent` say "where the element sits" instead of "stored coordinates", since both apply `csc_placement` (found in the review, kept by the user 2026-11-02). (d) The 8 `PytestUnhandledThreadExceptionWarning` of the Grasshopper tests: cause found, fixed or explained. (e) "Element" instead of "piece" in the Grasshopper descriptions (8.183 b). (f) `requirements-dev.txt` takes `pytest>=8` without an upper bound, so CI gets each new pytest the day it is out (pytest 9.2.0 broke a test on the tag of 0.6.4.2, fixed in #44): every dev requirement pinned exactly (`==`) at a version about two weeks old (8.185 c). (g) #52: the beta banner and the login notice take the version from `package.json`, the `.env` keeps the wording with a `{version}` placeholder (8.185 a); server note at the release. (h) CHANGELOG only: the component map's UMAP starts from `init='pca'` (commit `d2b39012`, made outside a release); all map positions shift once. +**0.6.4.5 --- permission mismatches and leftovers (user 2026-11-04, after 0.6.4.4; 8.189):** (a) #46 controls the backend refuses (403), (b) #47 controls the state refuses (409), (c) #48 controls the web hides although the backend allows them: six plus the two rules kept for a withdrawn version and a superseded layout get a control, revoking an invitation becomes moderator-only, the switches of an unreviewed dataset stay disabled (8.193), (d) #49 the backend refuses the circulation actions and added files on a withdrawn element, photos and attachments alike (8.190, amended), (e) #50 a route and a web control to move one element to another dataset (8.191), and a web control to delete a never-published one; the other actions without a web control stay API-only, #55 to #58 (8.192), (f) the leftovers (8.194): the 3.10-only check of `test_signin.py` is limited to 3.10 or newer, and "version" replaces "snapshot" in the user text of `SnapshotPhotoCapture`, (g) the backup script passes SSH keepalive options (user 2026-11-04; the pull of the assets broke at 1.56 GB on 2026-10-29), (h) the web form sends `summary.kind`, so a claim with a result saves (8.189, amended), (i) user-facing text says "component" for a catalogued component again, "element" only for the items of a batch (8.183, amended 2026-11-08; web, backend messages, MCP and OpenAPI descriptions, README, `CONTEXT.md`, `DATA_MODEL_SPEC.md`; the Grasshopper descriptions with the next Grasshopper release); (j) user-facing text says "snapshot" for a recorded state, as the data model does, "v1" stays its number (8.194, amended 2026-11-08; the scope of (i)); (k) the record and its UUID are a "component" and a "component id" in user text, the recorded object a "snapshot" and never a "state", the new API fields become `has_open_snapshot` and `identity_withdrawn`, the MCP tools `list_snapshots` and `get_snapshot` (8.196). Web and backend only: `bump-version` without `--gh`, no Rhino export; `CSC_Update` is not touched (8.189). Each case is read again before it is fixed. The rules are grilled before the brief. For (b), two server-computed booleans tell the web of an open version or correction, for contributors, moderators and admins (8.195, amended; user 2026-11-05, found while writing the brief). Found in the end review, for later: the cut form reads its parent with `?expand=shallow`, which answers 404 for an element with no current version, so the web keeps Cut tied to a current version although the backend asks only "published once". The header strip of a withdrawn element still says "Published" and "In circulation", under it the withdrawal banner; the sidebar "Recent" list keeps a deleted element, whose link answers 404; "Versions awaiting action" on a withdrawn element does not say that the element is reinstated first; My work says "Snapshot v1", the moderation page "Snapshots (2)", the menu "Reinstate component", against the rule "element" and "version"; the evidence queue still offers Publish on a withdrawn element, which ends in the 409 with its reason, while the version queue hides it. Found in the review of (k), for later: a withdrawn snapshot reads "withdrawn, withdrawn" in the history list; the transmit page shows "Record it" next to the snapshot-id conflict message; `/id/` offers to record a new component with that UUID. + **0.6.5 --- reinforcement from Grasshopper (about 6--8 days; moved from 0.6.4 by the user 2026-10-21):** (a) units in GH: every component scales by the document unit (a prerequisite for placing scans); (b) RL8, a GH builder for the `rebar_spec` claim and its display, grilled together with (c); (c) Ferroscan to reinforcement layout, @@ -996,7 +998,9 @@ as attachments, (d) several scans of one face; (c) "the image in 3D" later. (e) is (user 2026-10-27): its `Frame` output is the frame used, in the stored coordinates (where the piece sat before the move), not the frame of the moved piece. The descriptions of the component and of the output say so plainly and point to `DisassembleComponent`, whose `Frame` applies `csc_placement` and so -gives the frame where the moved piece sits; moved to 0.6.4.3 (8.180), then to 0.6.4.4 (8.184). +gives the frame where the moved piece sits; moved to 0.6.4.3 (8.180), then to 0.6.4.4 (8.184). (f) From the review +of 0.6.4.4 (8.189): `Actor` can still shift slots when a needed input depends on another item's value; the +unreachable return of `ApplyFrame`. **0.6.6 --- interoperability (about 5--7 days):** the IFC export (`compose?format=ifc`; first the `ifcopenshell` wheel check for the server, then IFC4 vs IFC4x3 and single piece vs selection); the timeline as PROV-O / @@ -1029,13 +1033,13 @@ passport) in `CONTEXT.md` first; whether the backend errors become codes, the ma and the privacy page a German text (the maintainer's own); a rule for the implementer that every new string is written in both languages. Grasshopper and MCP texts stay English. -**Later, not yet scheduled --- permission mismatches between the web app and the backend (user 2026-10-29):** an audit of every action in `permissions.py` against the web app, after #45, found more cases, logged as issues and kept in the backlog for now: #46 controls the backend refuses (403); #47 controls the record's state refuses (409), often only after a whole form is filled in; #48 controls the web hides although the backend allows them (several from reading "published" as `current_snapshot_id` instead of `identity_ever_published`); #49 the backend allows reserve, re-enter and the undo actions on a withdrawn element, which the web hides (a rule to decide); #50 no route to move an element to another dataset (`move_identity` is a rule only, so a dataset that ever held an element cannot be deleted) and no web control to delete a never-published element. Each case is read again before it is fixed. Found in the review of 0.6.4.3 (#45): "snapshot" in user-facing text of `SnapshotPhotoCapture` (the web says "version"); the photo hint line never shows in the compact card. +**Later, not yet scheduled --- permission mismatches between the web app and the backend (user 2026-10-29):** an audit of every action in `permissions.py` against the web app, after #45, found more cases, logged as issues and kept in the backlog for now: #46 controls the backend refuses (403); #47 controls the record's state refuses (409), often only after a whole form is filled in; #48 controls the web hides although the backend allows them (several from reading "published" as `current_snapshot_id` instead of `identity_ever_published`); #49 the backend allows reserve, re-enter and the undo actions on a withdrawn element, which the web hides (a rule to decide); #50 no route to move an element to another dataset (`move_identity` is a rule only, so a dataset that ever held an element cannot be deleted) and no web control to delete a never-published element. Each case is read again before it is fixed. Found in the review of 0.6.4.3 (#45): "snapshot" in user-facing text of `SnapshotPhotoCapture` (the web says "version"); the photo hint line never shows in the compact card. Moved to 0.6.4.5 (8.189). **Outside a release (the maintainer):** the Atlas traffic measurement of 0.6.1.0 (c); the backend CI job back to `ubuntu-latest` once MongoDB 8.0 starts on the runner's kernel (SERVER-121912); the two open dev findings of `npm audit` (`body-parser`, `deepmerge`, both through `shadcn`) once fixed versions exist and are about two weeks old (0.6.4.2 (g)). -**Later or ideas:** the GH sign-in on macOS (Keychain); Ferroscan "the image in 3D"; MCP opened to members +**Later or ideas:** "Show in viewer" for other positioned records (8.178, 8.194); an actor role for "retrieved the source" or "modeller" (a data-model grill, 8.194); the GH sign-in on macOS (Keychain); Ferroscan "the image in 3D"; MCP opened to members (after 0.6.3.1); the CSC logo and brand, then the logo in mails, Open Graph and the favicon; the partners on the credits page (their consent); usage statistics without cookies; timber evidence methods; the analytics page; transactions for record plus change log; xeokit (for later, see `FUTURE.md`); a similarity-search diff --git a/scripts/backup/pull_production.ps1 b/scripts/backup/pull_production.ps1 index 97975c67..07e2736b 100644 --- a/scripts/backup/pull_production.ps1 +++ b/scripts/backup/pull_production.ps1 @@ -21,7 +21,8 @@ $day = Get-Date -Format yyMMdd $repo = Resolve-Path (Join-Path $PSScriptRoot '..\..') function Pull([string]$remote, [string]$file) { - cmd /c "ssh $Server $remote > `"$file`"" + # keepalives: the long asset pull broke with a connection reset without them + cmd /c "ssh -o ServerAliveInterval=15 -o ServerAliveCountMax=8 $Server $remote > `"$file`"" if ($LASTEXITCODE -ne 0) { throw "ssh failed ($LASTEXITCODE): $remote" } $size = (Get-Item $file).Length if ($size -eq 0) { throw "empty download: $file" } diff --git a/scripts/import/epfl_stacking/README.md b/scripts/import/epfl_stacking/README.md index 604bdbf0..d76630c5 100644 --- a/scripts/import/epfl_stacking/README.md +++ b/scripts/import/epfl_stacking/README.md @@ -120,7 +120,7 @@ output goes outside the repository or into `.dev/`; a path anywhere else in the 1. Start the instance: launch configs `backend-local` (backend on 8791 with the newest dump of `mongodb_collections_local`, throwaway mongod on 27791, a copy of the production assets in - `.dev/assets-261012`) and `frontend-local` (3000) in `.claude/launch.json`. + `.dev/assets`) and `frontend-local` (3000) in `.claude/launch.json`. Never point `--assets` at the original backup of the assets, and never run a runner with `--sweep` on it. 2. Fetch, prepare, plan; `run.py --dry-run`; `run.py --server http://127.0.0.1:8791 --username dev-admin` (the password is in `.dev/dev-local-credentials-8791.txt`); run it again (it creates nothing). diff --git a/scripts/import/recreate/README.md b/scripts/import/recreate/README.md index a4ac0381..779508d6 100644 --- a/scripts/import/recreate/README.md +++ b/scripts/import/recreate/README.md @@ -124,7 +124,7 @@ Paths below are the defaults (`--data` = `.dev/open_datasets/recreate/zenodo-168 1. Start the instance: launch configs `backend-local` (backend on 8791 with the newest dump of `mongodb_collections_local`, throwaway mongod on 27791, a copy of the production assets in - `.dev/assets-261012`) and `frontend-local` (3000) in `.claude/launch.json`. + `.dev/assets`) and `frontend-local` (3000) in `.claude/launch.json`. Never point `--assets` at the original backup of the assets, and never run a runner with `--sweep` on it. 2. Fetch, parse, compute geometry, plan, check (the order above). 3. `run.py --dry-run`, then `run.py --server http://127.0.0.1:8791 --username dev-admin` (the password of diff --git a/scripts/import/recreate/recreate_common.py b/scripts/import/recreate/recreate_common.py index 44fa60b6..f377226b 100644 --- a/scripts/import/recreate/recreate_common.py +++ b/scripts/import/recreate/recreate_common.py @@ -28,7 +28,7 @@ # the places of the local rehearsal (arguments of every script) DEFAULT_DATA = DOT_DEV / 'open_datasets' / 'recreate' / 'zenodo-16809738' DEFAULT_OUT = DOT_DEV / 'import_open' / 'recreate' / 'out' -DEFAULT_ASSETS = DOT_DEV / 'assets-261012' +DEFAULT_ASSETS = DOT_DEV / 'assets' DEFAULT_MONGO_URI = 'mongodb://127.0.0.1:27791' DEFAULT_SERVER = 'http://127.0.0.1:8791' diff --git a/src/backend/apps/catalog/api/access.py b/src/backend/apps/catalog/api/access.py index 2c8c00a9..18febf96 100644 --- a/src/backend/apps/catalog/api/access.py +++ b/src/backend/apps/catalog/api/access.py @@ -34,6 +34,7 @@ record_projection, withdrawn_projection, ) +from apps.catalog.vocab import OPEN_STATUSES NOT_PUBLIC = 'This component is not public. Sign in to view it.' NO_ACCESS = 'You have no access to this component.' @@ -116,7 +117,7 @@ async def identity_ever_published(request: Request, UNREVIEWED = ('This dataset has not been reviewed by an admin yet: it stays ' - 'visible to its members only, and its elements cannot be made ' + 'visible to its members only, and its components cannot be made ' 'public until it is reviewed.') @@ -128,6 +129,32 @@ def refuse_unreviewed(dataset: Dataset, viewer: Viewer) -> None: raise HTTPException(status_code=409, detail=UNREVIEWED) +def may_know_open(viewer: Viewer, dataset: Dataset) -> bool: + """Who is told that a version or a correction is open (8.195): a + contributor or a moderator of the dataset, and the admins (``dataset_roles`` + gives an admin every role). A member who only reviews, and everyone else, + gets a constant False for ``has_open_snapshot`` and ``has_open_correction`` + and costs no query. The one place the audience is decided.""" + return bool(dataset_roles(viewer, dataset) & {'contributor', 'moderator'}) + + +async def has_open_snapshot(request: Request, viewer: Viewer, + identity: Dict[str, Any]) -> bool: + """``has_open_snapshot`` (8.195): a draft or pending version of the element + exists (I3b, the one open version). Only the fact, for whoever + ``may_know_open``; a draft is otherwise invisible to a contributor who is + not its author.""" + if not viewer.logged_in: + return False + dataset = await dataset_of(request, identity.get('dataset')) + if not may_know_open(viewer, dataset): + return False + found = await request.app.mongodb_component_snapshots.find_one( + {'identity_id': identity['_id'], + 'status': {'$in': list(OPEN_STATUSES)}}, {'_id': 1}) + return found is not None + + def deny_read(viewer: Viewer) -> HTTPException: if not viewer.logged_in: return HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, @@ -185,7 +212,7 @@ async def raise_if_purged(request: Request, record_id: str, async def find_identity(request: Request, identity_id: str, projection: Optional[Dict[str, int]] = None, - what: str = 'Identity') -> Dict[str, Any]: + what: str = 'Component') -> Dict[str, Any]: """The identity document; 404 / 410 when it is not there. No access check: ``load_identity`` is the entry for a route.""" check_id(identity_id, what) @@ -369,11 +396,13 @@ async def require(request: Request, user: Optional[User], action: str, *, snapshot: Optional[Dict[str, Any]] = None, evidence: Optional[Dict[str, Any]] = None, dataset: Optional[Dataset] = None, - invitation: Optional[Dict[str, Any]] = None) -> Viewer: + invitation: Optional[Dict[str, Any]] = None, + destination: Optional[Dataset] = None) -> Viewer: """ Section 7.0 for one action: builds the ``Target`` from the documents and raises 401 / 403 unless ``can`` allows it. Read access to the - component is part of every action on it. + component is part of every action on it. ``destination`` is the dataset + a move goes to. """ viewer = viewer_of(user) if snapshot is not None and identity is None: @@ -411,7 +440,7 @@ async def require(request: Request, user: Optional[User], action: str, *, dataset=dataset, kind=kind, status=status_, author_id=author, identity_published=published, reserved_by=(identity or {}).get('reserved') or None, - readable=readable, performer_ids=performers, + readable=readable, performer_ids=performers, destination=destination, correction=bool(kind == 'evidence' and evidence.get('supersedes'))) if not can(viewer, action, target): raise deny_write(viewer, action) @@ -538,7 +567,7 @@ async def load_evidence(request: Request, user: Optional[User], raise deny_read(viewer) -NO_CURRENT_STATE = 'The component has no current state.' +NO_CURRENT_STATE = 'The component has no current snapshot.' async def load_current_snapshot(request: Request, @@ -586,7 +615,7 @@ async def load_invitation(request: Request, user: Optional[User], """One invitation for a route (decision 8.158): 404 "Invitation not found". ``invite``: the caller's current invite permission on the invitation's dataset (an admin for one without a dataset); - ``revoke_invitation``: its creator, moderator(D) or an admin.""" + ``revoke_invitation``: moderator(D) or an admin (8.193 c).""" viewer = viewer_of(user) check_id(invitation_id, 'Invitation') doc = await request.app.mongodb_invitations.find_one( diff --git a/src/backend/apps/catalog/api/actors.py b/src/backend/apps/catalog/api/actors.py index cfc5d6ff..51f516f1 100644 --- a/src/backend/apps/catalog/api/actors.py +++ b/src/backend/apps/catalog/api/actors.py @@ -216,7 +216,7 @@ async def redact_actor( break else: raise HTTPException(status_code=409, detail=( - f'Identity {doc["_id"]} kept changing; run the redaction ' + f'Component {doc["_id"]} kept changing; run the redaction ' f'again.')) async for entry in log.find({}): diff --git a/src/backend/apps/catalog/api/catalog_common.py b/src/backend/apps/catalog/api/catalog_common.py index 83b0e192..d716b795 100644 --- a/src/backend/apps/catalog/api/catalog_common.py +++ b/src/backend/apps/catalog/api/catalog_common.py @@ -138,13 +138,13 @@ async def validate_parent_identities( if self_id and pid == self_id: raise HTTPException( status_code=400, - detail='identity cannot list itself in parent_identities', + detail='a component cannot list itself in parent_identities', ) found = await col.find_one({'_id': pid}, {'_id': 1}) if found is None: raise HTTPException( status_code=404, - detail=f'Parent identity {pid} not found', + detail=f'Parent component {pid} not found', ) @@ -205,7 +205,7 @@ async def validate_snapshot_and_promote( raise HTTPException( status_code=500, detail=( - f'Identity {identity_id} not found for snapshot {snapshot_id}' + f'Component {identity_id} not found for snapshot {snapshot_id}' ), ) diff --git a/src/backend/apps/catalog/api/catalog_list.py b/src/backend/apps/catalog/api/catalog_list.py index 5caa4021..c363b761 100644 --- a/src/backend/apps/catalog/api/catalog_list.py +++ b/src/backend/apps/catalog/api/catalog_list.py @@ -169,7 +169,7 @@ async def _visible_map_payload(request: Request, user: Optional[User], @router.get( '/identities/count', - summary='Count identities (current snapshot filters)', + summary='Count components (current snapshot filters)', response_model=ComponentCount, ) @local_limiter.limit(LIST_RATE, key_func=signed_in_or_ip) @@ -232,7 +232,7 @@ async def _candidate_ids(request: Request, args: Dict[str, Any], @router.get( '/identities/{identity_id}/similar', - summary='The elements nearest to one in descriptor space (kNN)', + summary='The components nearest to one in descriptor space (kNN)', ) @local_limiter.limit(LIST_RATE, key_func=signed_in_or_ip) async def get_similar_identities( @@ -247,13 +247,13 @@ async def get_similar_identities( count: int = Query(10, ge=1, le=sim.MAX_NEIGHBOURS, description='how many neighbours, 1 to 50'), ): - """The ``count`` elements nearest to this one in the full descriptor space + """The ``count`` components nearest to this one in the full descriptor space of ``basis`` (decision 8.174): Euclidean distance after each dimension is - standardised over the catalog (smaller is more similar). The elements ranked + standardised over the catalog (smaller is more similar). The components ranked are those this caller may see that pass the filters of the list (also a dimension and a near search): the filters come first, then the ranking, so "similar and can hold X and within 50 km" returns the k nearest that pass. - The element itself is never one of them. An element the caller cannot see is + The component itself is never one of them. A component the caller cannot see is 404; one without the descriptor of the basis is 422; before the matrix of the basis has been computed (``main_component_map.py``) the answer is 409.""" @@ -364,15 +364,15 @@ async def get_identities_locations( current_user: Annotated[Optional[User], Depends(get_optional_current_user)], filters: Annotated[CatalogFilters, Depends(catalog_filters)], layer: NearLayer = Query( - 'current', description='which place of an element is a point: ' + 'current', description='which place of a component is a point: ' 'current (the location of the current ' - 'version) or origin (the origin building)'), + 'snapshot) or origin (the origin building)'), ): - """Every element this caller may see that matches the filters and has a + """Every component this caller may see that matches the filters and has a point on the layer (decisions 8.170, 8.171), with what the map colours - and labels it by; the elements without a point are only counted + and labels it by; the components without a point are only counted (``left_out``). The filters, the visibility and a near or fit search are - those of the list. An element never appears for someone who may not see it, + those of the list. A component never appears for someone who may not see it, and neither does it count.""" if current_user is None: filters = public_filters(filters) @@ -601,7 +601,7 @@ def _with_location(facet) -> Dict[str, int]: '/identities/stats', summary=( 'Aggregated catalog statistics ' - '(identities joined to current snapshots)' + '(components joined to current snapshots)' ), ) @local_limiter.limit(LIST_RATE, key_func=signed_in_or_ip) @@ -611,7 +611,7 @@ async def get_identities_stats( filters: Annotated[CatalogFilters, Depends(catalog_filters)], limit_dim: int = Query(10, description='Top-N limit for long tail dims'), ): - """Facet counts over the filtered catalog (identity + current snapshot).""" + """Facet counts over the filtered catalog (component + current snapshot).""" if current_user is None: filters = public_filters(filters) try: @@ -681,7 +681,7 @@ def topn(items): @router.get( '/identities', - summary='List identities (join current snapshot)', + summary='List components (join current snapshot)', ) @local_limiter.limit(LIST_RATE, key_func=signed_in_or_ip) async def list_identities_route( @@ -692,7 +692,7 @@ async def list_identities_route( size: int = Query(0, description='Page size (0=get all)'), sortkey: Optional[str] = Query( None, description='Sort key; volume = the product of the three bbx ' - 'sides (an element without bbx last); match = the ' + 'sides (a component without bbx last); match = the ' 'closeness to the dimension search (needs ' 'fit_mode); distance = the distance to the near ' 'point (needs near_lat and near_lon). Default: ' diff --git a/src/backend/apps/catalog/api/change_log.py b/src/backend/apps/catalog/api/change_log.py index 22fc5fb2..bcd6bc74 100644 --- a/src/backend/apps/catalog/api/change_log.py +++ b/src/backend/apps/catalog/api/change_log.py @@ -99,7 +99,7 @@ async def list_changes( identity_id: str, limit: int = Query(200, ge=1, le=1000), ): - """Entries of the identity, its snapshots and evidence, newest first. + """Entries of the component, its snapshots and evidence, newest first. Old values may name people, so the log is for members only (8.36).""" await load_identity(request, current_user, identity_id, 'view_history') entries = await request.app.mongodb_change_log.find( diff --git a/src/backend/apps/catalog/api/datasets.py b/src/backend/apps/catalog/api/datasets.py index 4515f51f..a69c16cd 100644 --- a/src/backend/apps/catalog/api/datasets.py +++ b/src/backend/apps/catalog/api/datasets.py @@ -121,7 +121,7 @@ class DatasetView(BaseModel): 'moderator(D) and admin only, else absent') component_count: Optional[int] = Field( default=None, - description='list rows only: published elements the caller may see') + description='list rows only: published components the caller may see') model_config = {'populate_by_name': True} @@ -144,7 +144,7 @@ class DatasetPatch(BaseModel): visibility: Optional[Visibility] = None reviewed: Optional[bool] = Field( None, description='admin only: the dataset may be catalog and its ' - 'elements public (8.139)') + 'components public (8.139)') class MemberRoles(BaseModel): @@ -569,7 +569,7 @@ async def put_dataset_member( class PublicBody(BaseModel): model_config = ConfigDict(extra='forbid') - is_public: bool = Field(description='the flag to set on the elements') + is_public: bool = Field(description='the flag to set on the components') dry_run: bool = Field(False, description='only count what would change') @@ -584,7 +584,7 @@ class PublicResult(BaseModel): @router.post('/datasets/{did}/public', response_model=PublicResult, - summary='Make every published element of a dataset public or ' + summary='Make every published component of a dataset public or ' 'private (moderator(D))') async def set_dataset_public( request: Request, @@ -592,10 +592,10 @@ async def set_dataset_public( did: str, body: PublicBody, ): - """Sets ``is_public`` on the elements of the dataset that were ever + """Sets ``is_public`` on the components of the dataset that were ever published (3.1.5) and are not withdrawn, where the flag differs, and logs each change like a metadata PATCH (``cause: patch``). Unpublished and - withdrawn elements are left alone, and so are children: no element follows + withdrawn components are left alone, and so are children: no component follows another (6.2). ``dry_run`` only counts.""" dataset = (await load_dataset(request, current_user, did, 'set_dataset_public')).record @@ -627,7 +627,7 @@ async def set_dataset_public( invalid[identity['_id']] = str(exc.detail) if invalid: raise HTTPException(status_code=422, detail={ - 'message': f'{len(invalid)} of {len(pieces)} elements do not pass ' + 'message': f'{len(invalid)} of {len(pieces)} components do not pass ' f'validation; nothing was changed. Correct them first.', 'pieces': invalid}) changed = skipped = 0 @@ -655,8 +655,8 @@ async def delete_dataset( current_user: Annotated[User, Depends(get_current_active_user)], did: str, ): - """Only while the dataset holds no element at all (no identity, whatever - its state; for an admin too: move the elements first, ``move_identity``). + """Only while the dataset holds no component at all (no component, whatever + its state; for an admin too: move the components first, ``move_identity``). The open invitations into it are revoked with it (8.139 f).""" await load_dataset(request, current_user, did, 'delete_dataset') pieces = await request.app.mongodb_component_identities.count_documents( @@ -664,7 +664,7 @@ async def delete_dataset( if pieces: raise HTTPException( status_code=409, - detail='The dataset still holds elements: move them to another ' + detail='The dataset still holds components: move them to another ' 'dataset first.') now = now_iso() revoked = await request.app.mongodb_invitations.update_many( diff --git a/src/backend/apps/catalog/api/evidence.py b/src/backend/apps/catalog/api/evidence.py index e3b84028..dba6dee6 100644 --- a/src/backend/apps/catalog/api/evidence.py +++ b/src/backend/apps/catalog/api/evidence.py @@ -73,6 +73,7 @@ require_contributor, gate_identity, new_evidence_doc, + open_corrections, prepare, viewer_context, ) @@ -347,7 +348,7 @@ async def list_identity_evidence( 'whole day)'), status: str = Query('published', description='a status, or all'), include: Optional[str] = Query( - None, description='comma list: context (the state of the element each ' + None, description='comma list: context (the snapshot of the component each ' 'record belongs to), superseded (corrected ones)'), ): """Published, non-superseded records by default; what the caller may @@ -370,6 +371,8 @@ async def list_identity_evidence( raise HTTPException(status_code=500, detail='Internal server error') viewer = viewer_of(current_user) project = await _projector(request, viewer, identity) + # which records have a correction open: one query for the list (8.195) + open_ids = await open_corrections(request, viewer, identity) snapshots = None if 'context' in flags: snapshots = await request.app.mongodb_component_snapshots.find( @@ -383,7 +386,8 @@ async def list_identity_evidence( if seen == 'full': items.append(await evidence_body( request, viewer, doc, identity, listing=True, - with_context='context' in flags, snapshots=snapshots)) + with_context='context' in flags, snapshots=snapshots, + open_correction=doc['_id'] in (open_ids or ()))) elif seen == 'tombstone': items.append(evidence_tombstone(doc, identity)) return JSONResponse(status_code=200, content=items) @@ -584,20 +588,26 @@ async def get_evidence( return JSONResponse(status_code=200, content=project_evidence( rolled, tier, email_ok=email_ok)) with_context = 'context' in {p.strip() for p in (include or '').split(',')} + open_ids = await open_corrections(request, viewer, identity) + open_correction = record['_id'] in (open_ids or ()) if with_context: # the context follows the snapshots, not the record: never a 304 body = await evidence_body(request, viewer, record, identity, - with_context=True) + with_context=True, + open_correction=open_correction) return JSONResponse(status_code=200, content=body, headers={ 'Cache-Control': 'no-store', 'Vary': 'Authorization'}) tier, email_ok = await viewer_context(request, viewer, identity) etag = hashlib.sha256('::'.join([ - record.get('etag') or '', tier, str(email_ok)]).encode( + record.get('etag') or '', tier, str(email_ok), + # a correction someone opens does not touch the record (8.195) + 'open' if open_correction else '']).encode( 'utf-8')).hexdigest() if request.headers.get('if-none-match') == etag: return not_modified_response(etag, **viewer_headers( cache_control='private, max-age=0')) - body = await evidence_body(request, viewer, record, identity) + body = await evidence_body(request, viewer, record, identity, + open_correction=open_correction) return JSONResponse(status_code=200, content=body, headers=viewer_headers( etag=etag, cache_control='private, max-age=0')) @@ -625,14 +635,14 @@ async def get_identity_properties( @router.get('/snapshots/{snapshot_id}/properties', - summary='Properties of one state of a component') + summary='Properties of one snapshot of a component') async def get_snapshot_properties( request: Request, current_user: Annotated[Optional[User], Depends(get_optional_current_user)], snapshot_id: str, ): """The snapshot block (the materialized as-of fold): the snapshot-scoped - quantities whose records resolve to this state.""" + quantities whose records resolve to this snapshot.""" snapshot = (await load_snapshot(request, current_user, snapshot_id, allow_tombstone=True)).record return JSONResponse(status_code=200, content={ @@ -648,9 +658,9 @@ async def get_timeline( current_user: Annotated[Optional[User], Depends(get_optional_current_user)], identity_id: str, ): - """Archived cycles, the origin, every state and correction, every + """Archived cycles, the origin, every snapshot and correction, every evidence record (where it falls: before cataloguing, in the history, - after the element left circulation), changes of the metadata and the exit. + after the component left circulation), changes of the metadata and the exit. What the caller may not see is left out; a withdrawn record outside the dataset is a bare row; outside the dataset a metadata change shows only its date (8.36).""" diff --git a/src/backend/apps/catalog/api/evidence_attachments.py b/src/backend/apps/catalog/api/evidence_attachments.py index eff67c81..c0cd4eb1 100644 --- a/src/backend/apps/catalog/api/evidence_attachments.py +++ b/src/backend/apps/catalog/api/evidence_attachments.py @@ -150,11 +150,16 @@ async def attach_file( detail=f'record_ids: 1 to {MAX_RECORDS} records') records = [] for rid in ids: - record = (await load_evidence(request, current_user, rid, - 'add_attachment')).record + loaded = await load_evidence(request, current_user, rid, + 'add_attachment') + record = loaded.record if record.get('status') == 'withdrawn': raise HTTPException(status_code=409, detail=f'{rid} is withdrawn.') + if (loaded.identity or {}).get('withdrawn'): + # any record of a withdrawn element, an admin too (8.190) + raise HTTPException(status_code=409, + detail='The component is withdrawn.') if len(record.get('attachments') or []) \ >= evidence_files.MAX_ATTACHMENTS: raise HTTPException( @@ -221,7 +226,7 @@ async def list_attachments( evidence_id: str, ): """The list as the viewer may see it. Anonymous readers of a public - element get media type, size, checksum and date --- no names, no + component get media type, size, checksum and date --- no names, no uploaders --- and "sign in to download" (8.13).""" loaded = await load_evidence(request, current_user, evidence_id, allow_tombstone=True) diff --git a/src/backend/apps/catalog/api/evidence_lifecycle.py b/src/backend/apps/catalog/api/evidence_lifecycle.py index 89def52a..a70947ad 100644 --- a/src/backend/apps/catalog/api/evidence_lifecycle.py +++ b/src/backend/apps/catalog/api/evidence_lifecycle.py @@ -340,6 +340,7 @@ async def reinstate_evidence( loaded = await load_evidence(request, current_user, evidence_id, 'reinstate') record, identity = loaded.record, loaded.identity + gate_identity(identity) # a withdrawn element takes no step forward (8.190) _step(record, 'reinstate', 'published') predecessor = record.get('supersedes') old = None diff --git a/src/backend/apps/catalog/api/evidence_service.py b/src/backend/apps/catalog/api/evidence_service.py index de5d43b1..d1100b56 100644 --- a/src/backend/apps/catalog/api/evidence_service.py +++ b/src/backend/apps/catalog/api/evidence_service.py @@ -50,6 +50,7 @@ ) from apps.catalog.properties import contexts_for from apps.catalog.vocab import ( + OPEN_STATUSES, TERMINAL_EXIT_KINDS, EvidenceMethod, PositionKind, @@ -58,7 +59,8 @@ UncertaintyType, ) from apps.catalog.timeutil import parse_ts -from .access import component_visible, dataset_of, require, viewer_of +from .access import ( + component_visible, dataset_of, may_know_open, require, viewer_of) from .catalog_common import now_iso MAX_BULK = 200 @@ -67,7 +69,7 @@ # WHAT A CLIENT SENDS --------------------------------------------------------- class PositionInput(BaseModel): - """Where on the element (3.3.2). ``kind: none`` with a description is + """Where on the component (3.3.2). ``kind: none`` with a description is always enough; a point is picked on the 3D viewer and needs the snapshot whose stored coordinates it uses.""" model_config = ConfigDict(extra='forbid') @@ -82,7 +84,7 @@ class PositionInput(BaseModel): None, description='Picked point in stored coordinates; for a rebound ' 'grid the server sets the grid centre') description: Optional[str] = Field( - None, description='Where on the element, in words, e.g. "north face, ' + None, description='Where on the component, in words, e.g. "north face, ' 'mid-span"') @@ -209,6 +211,10 @@ class EvidenceView(Evidence): the state of the piece it belongs to (4.1).""" warnings: List[str] = Field(default_factory=list) context: Optional[ContextView] = None + # response-only (8.195): a draft or pending correction of this record is + # open. Only the fact, for a contributor or moderator of the dataset and + # admins; a constant False for everyone else. Not in the exports. + has_open_correction: bool = False # ERRORS ---------------------------------------------------------------------- @@ -254,16 +260,21 @@ async def evidence_body(request: Request, viewer: Viewer, record: Dict[str, Any], identity: Dict[str, Any], *, listing: bool = False, with_context: bool = False, snapshots: Optional[List[Dict[str, Any]]] = None, - context: Optional[Tuple[str, bool]] = None + context: Optional[Tuple[str, bool]] = None, + open_correction: Optional[bool] = None ) -> Dict[str, Any]: """The record as ``viewer`` sees it, validated against the model. - ``context`` is ``viewer_context`` when a list has it already.""" + ``context`` is ``viewer_context`` when a list has it already. + ``open_correction`` is ``has_open_correction`` (8.195); the field is in + the body only when a route asks for it, so the exports do not carry it.""" tier, email_ok = context or await viewer_context(request, viewer, identity) stored = Evidence.model_validate(record).model_dump(by_alias=True, mode='json') body = project_evidence(stored, tier, email_ok=email_ok, listing=listing) body['warnings'] = record_warnings(record) + if open_correction is not None: + body['has_open_correction'] = open_correction body['context'] = None if with_context: if snapshots is None: @@ -277,6 +288,23 @@ async def evidence_body(request: Request, viewer: Viewer, return body +async def open_corrections(request: Request, viewer: Viewer, + identity: Dict[str, Any]) -> Optional[set]: + """The ids of the records of one element that have a draft or pending + correction, for ``has_open_correction`` (8.195): one ``distinct`` per + request, never a query per record. None when the viewer is not told + (``may_know_open``): the flag is then a constant False.""" + if not viewer.logged_in: + return None + if not may_know_open(viewer, await dataset_of(request, + identity.get('dataset'))): + return None + return set(await request.app.mongodb_component_evidence.distinct( + 'supersedes', {'identity_id': identity['_id'], + 'supersedes': {'$ne': None}, + 'status': {'$in': list(OPEN_STATUSES)}})) + + async def projector(request: Request, viewer: Viewer, identity: Dict[str, Any]): """A function ``record -> 'full' | 'tombstone' | None`` for the records @@ -334,7 +362,7 @@ def gate_identity(identity: Dict[str, Any], and parse_ts(observed_at) > parse_ts(exit_['at']): raise HTTPException( status_code=409, - detail=f'The component no longer exists as this element ' + detail=f'The component no longer exists as this component ' f'({exit_["kind"]}, {exit_["at"]}): only observations ' f'from before that date are recorded (I28).') diff --git a/src/backend/apps/catalog/api/history.py b/src/backend/apps/catalog/api/history.py index abccd168..d1375652 100644 --- a/src/backend/apps/catalog/api/history.py +++ b/src/backend/apps/catalog/api/history.py @@ -126,11 +126,11 @@ async def get_identity_history( 'groups', description='groups: evidence per day and method; all: ' 'every record its own event'), ): - """The element is the middle lane (level 0), parents have negative levels + """The component is the middle lane (level 0), parents have negative levels and children positive ones. Every lane has ``id``, ``role``, ``level`` and ``visible``; a visible one also its header and ``events``. ``links`` join a parent and a child lane (``cut``: one parent; ``assemble``: - several) at the child's first version. ``more`` counts the lanes left + several) at the child's first snapshot. ``more`` counts the lanes left out beyond twelve.""" viewer = viewer_of(current_user) root = (await load_identity( diff --git a/src/backend/apps/catalog/api/identities.py b/src/backend/apps/catalog/api/identities.py index 9bdd2830..ce1f8c58 100644 --- a/src/backend/apps/catalog/api/identities.py +++ b/src/backend/apps/catalog/api/identities.py @@ -52,6 +52,7 @@ and_match, dataset_of, deny_read, + has_open_snapshot, load_current_snapshot, load_identity, require, @@ -166,7 +167,7 @@ async def _resolve_passport_snapshot_docs( if not docs: raise HTTPException( status_code=404, - detail=f'No snapshots found for identity {identity_id}', + detail=f'No snapshots found for component {identity_id}', ) elif mode == 'ids': docs = [] @@ -182,7 +183,7 @@ async def _resolve_passport_snapshot_docs( raise HTTPException( status_code=404, detail=( - f'Snapshot {snapshot_id} does not belong to identity ' + f'Snapshot {snapshot_id} does not belong to component ' f'{identity_id}' ), ) @@ -216,10 +217,13 @@ def passport_json( user: Optional[User] = None, remaining: Optional[int] = None, can_undo_deinstall: bool = False, + has_open: Optional[bool] = None, ) -> Dict[str, Any]: """The passport body as ``user`` may see it (people stripped for an anonymous caller, 8.101): what compose answers, and the base of every - export (JSON-LD, CERO, PDF; 8.116 f).""" + export (JSON-LD, CERO, PDF; 8.116 f). ``has_open`` is the flag + ``has_open_snapshot`` of compose (8.195); without it the field is not in + the body, which keeps it out of the exports.""" try: body = passport_body(identity_doc, snapshot_docs) except Exception as exc: @@ -227,6 +231,8 @@ def passport_json( if remaining is not None: # a batch (8.105) body['identity']['remaining'] = remaining body['identity']['can_undo_deinstall'] = can_undo_deinstall + if has_open is not None: + body['identity']['has_open_snapshot'] = has_open if evidence is not None: # ?include=evidence (7.2) body['evidence'] = evidence return for_viewer(body, user) @@ -243,11 +249,13 @@ def _passport_response( user: Optional[User] = None, remaining: Optional[int] = None, can_undo_deinstall: bool = False, + has_open: Optional[bool] = None, ) -> JSONResponse: response_body = passport_json(identity_doc, snapshot_docs, evidence=evidence, user=user, remaining=remaining, - can_undo_deinstall=can_undo_deinstall) + can_undo_deinstall=can_undo_deinstall, + has_open=has_open) resolved_etag = etag or viewer_etag( _compute_passport_etag(identity_doc, snapshot_docs, remaining), user) return JSONResponse( @@ -260,7 +268,7 @@ def _passport_response( @router.get( '/identities/{identity_id}/children', - summary='List identities that list this identity as a parent', + summary='List components that list this component as a parent', ) async def list_identity_children( request: Request, @@ -409,7 +417,7 @@ async def _collect_lineage_identity_docs( @router.get( '/identities/{identity_id}/provenance', - summary='Lineage graph of related identities and snapshots', + summary='Lineage graph of related components and snapshots', ) async def get_identity_provenance( request: Request, @@ -423,8 +431,8 @@ async def get_identity_provenance( ), ): """ - Walk ``parent_identities`` up and down from this identity, then attach - each identity's snapshot versions. Anonymous callers who can read a + Walk ``parent_identities`` up and down from this component, then attach + each component's snapshots. Anonymous callers who can read a public root only see public relatives. """ identity_doc = (await load_identity( @@ -488,7 +496,7 @@ async def get_identity_provenance( @router.get( '/identities/{identity_id}/snapshots', - summary='List snapshot versions for an identity (summary rows)', + summary='List the snapshots of a component (summary rows)', response_model=List[SnapshotSummaryItem], response_model_by_alias=True, ) @@ -497,7 +505,7 @@ async def list_identity_snapshots( current_user: Annotated[Optional[User], Depends(get_optional_current_user)], identity_id: str, ): - """Return all snapshots for one identity, ordered by version ascending.""" + """Return all snapshots of one component, ordered by their number.""" identity_doc = (await load_identity( request, current_user, identity_id, projection={'_id': 1, 'current_snapshot_id': 1, 'is_public': 1})).record @@ -570,7 +578,7 @@ async def _identity_as_of(request: Request, user: Optional[User], @router.get( '/identities/{identity_id}', - summary='Get one identity (shallow, passport, or identity-only)', + summary='Get one component (shallow, passport, or without snapshots)', ) async def get_identity( request: Request, @@ -584,7 +592,7 @@ async def get_identity( ), ), as_of: Optional[str] = Query( - None, description='the identity as it was at this ISO date ' + None, description='the component as it was at this ISO date ' '(members of D and admin; section 3.8)'), ): identity_doc = (await load_identity(request, current_user, @@ -612,6 +620,8 @@ async def get_identity( body['remaining'] = pieces_left body['can_undo_deinstall'] = await _can_undo_deinstall( request, identity_doc, current_user) + body['has_open_snapshot'] = await has_open_snapshot( + request, viewer_of(current_user), identity_doc) return JSONResponse( status_code=200, content=for_viewer(body, current_user), @@ -620,9 +630,11 @@ async def get_identity( current_snapshot_id = identity_doc.get('current_snapshot_id') if not current_snapshot_id: # no published snapshot (8.17) - return _passport_response(identity_doc, [], - anonymous_public=anonymous_public, - user=current_user) + return _passport_response( + identity_doc, [], anonymous_public=anonymous_public, + user=current_user, + has_open=await has_open_snapshot( + request, viewer_of(current_user), identity_doc)) pieces_left = await remaining_of(request, identity_doc) snapshot_doc = await load_current_snapshot(request, identity_doc) await refresh_snapshot_photo_count( @@ -634,6 +646,8 @@ async def get_identity( anonymous_public=anonymous_public, user=current_user, remaining=pieces_left, + has_open=await has_open_snapshot( + request, viewer_of(current_user), identity_doc), ) @@ -668,6 +682,7 @@ class PassportRead: etag: str anonymous_public: bool can_undo_deinstall: bool = False + has_open_snapshot: bool = False async def read_passport( @@ -712,6 +727,12 @@ async def read_passport( if can_undo: # a later record can close the undo without changing the identity etag = hashlib.sha256(f'{etag}::undo'.encode('utf-8')).hexdigest() + open_snapshot = await has_open_snapshot(request, viewer_of(current_user), + identity_doc) + if open_snapshot: + # a draft someone else opens changes neither the identity nor the + # versions shown, so a 304 would hand back a stale False (8.195) + etag = hashlib.sha256(f'{etag}::open'.encode('utf-8')).hexdigest() evidence = None if 'evidence' in {part.strip() for part in (include or '').split(',')}: from .evidence_service import published_bodies, viewer_context @@ -729,7 +750,8 @@ async def read_passport( evidence=evidence, remaining=pieces_left, etag=viewer_etag(etag, current_user), anonymous_public=anonymous_public, - can_undo_deinstall=can_undo) + can_undo_deinstall=can_undo, + has_open_snapshot=open_snapshot) JSONLD_MEDIA_TYPE = 'application/ld+json' @@ -749,7 +771,7 @@ async def get_identity_passport( default=None, description=( 'Which snapshots to include: omitted or "current" = live ' - 'current_snapshot_id; "all" = every version; or one or more ' + 'current_snapshot_id; "all" = every snapshot; or one or more ' 'snapshot UUIDs (comma-separated).' ), ), @@ -773,8 +795,8 @@ async def get_identity_passport( Return ``{identity, snapshots[]}``. - Default / ``?snapshots=current``: live ``current_snapshot_id``. - - ``?snapshots=all``: every version (ascending by version). - - ``?snapshots=`` or comma-separated UUIDs: specific versions. + - ``?snapshots=all``: every snapshot (ascending by version). + - ``?snapshots=`` or comma-separated UUIDs: specific snapshots. - ``?format=jsonld``: the same body as JSON-LD (spec 7.8). """ read = await read_passport(request, current_user, identity_id, @@ -813,4 +835,5 @@ async def get_identity_passport( user=current_user, remaining=read.remaining, can_undo_deinstall=read.can_undo_deinstall, + has_open=read.has_open_snapshot, ) diff --git a/src/backend/apps/catalog/api/identity_edit.py b/src/backend/apps/catalog/api/identity_edit.py index 0c2355e5..65675156 100644 --- a/src/backend/apps/catalog/api/identity_edit.py +++ b/src/backend/apps/catalog/api/identity_edit.py @@ -60,6 +60,7 @@ from apps.catalog.vocab import ( INHERIT_UNITS, IN_PLACE_EXIT_KINDS, + OPEN_STATUSES, TERMINAL_EXIT_KINDS, ExitKind, OriginalFunction, @@ -73,6 +74,7 @@ identity_ever_published, load_datasets, load_identity, + require, viewer_of, ) from .auth import get_current_active_user @@ -140,6 +142,11 @@ class ReenterBody(_Strict): origin: Origin +class MoveBody(_Strict): + """The dataset a component moves to (8.191).""" + dataset: str + + class DeinstallBody(_Strict): """The act of deinstalling an in-place piece (8.104).""" at: Timestamp @@ -347,7 +354,7 @@ async def create_identity( each parent must be cuttable (8.8, 8.34). Every inheritance unit the body does not state is copied from the parents (3.1.2); a merge whose parents disagree on ``material`` or ``original_function`` needs them - stated. The identity stays unpublished until its v0 is published. + stated. The component stays unpublished until its v0 is published. """ from .snapshot_lifecycle import ( # the snapshot module imports this one SnapshotDraftBody, @@ -355,11 +362,11 @@ async def create_identity( ) viewer = viewer_of(current_user) identity_id = body.id or str(uuid.uuid4()) - validate_uuid(identity_id, label='identity id') + validate_uuid(identity_id, label='component id') identities = request.app.mongodb_component_identities if await identities.find_one({'_id': identity_id}, {'_id': 1}): raise HTTPException(status_code=409, - detail=f'Identity {identity_id} already exists') + detail=f'Component {identity_id} already exists') datasets = await load_datasets(request) if body.dataset not in datasets: raise HTTPException(status_code=422, @@ -367,14 +374,14 @@ async def create_identity( parents: List[Dict[str, Any]] = [] for pid in body.parent_identities or []: - validate_uuid(pid, label='parent identity id') + validate_uuid(pid, label='parent component id') if pid == identity_id: raise HTTPException(status_code=422, detail='A component is not its own parent.') parent = await identities.find_one({'_id': pid}) if parent is None: raise HTTPException(status_code=404, - detail=f'Parent identity {pid} not found') + detail=f'Parent component {pid} not found') parents.append(parent) readable = True for parent in parents: @@ -590,6 +597,14 @@ async def patch_identity( return JSONResponse(status_code=200, content=identity_body(written)) +def refuse_withdrawn(identity: Dict[str, Any]) -> None: + """A withdrawn element stays out of circulation (8.190): a moderator + reinstates it first.""" + if identity.get('withdrawn'): + raise HTTPException(status_code=409, + detail='The component is withdrawn.') + + # CIRCULATION ----------------------------------------------------------------- @router.post('/identities/{identity_id}/exit', summary='Take a component out of circulation (moderator(D))') @@ -600,13 +615,11 @@ async def exit_identity( body: ExitBody, ): """Installed, recycled, disposed, returned, lost --- or a hand-set - ``split`` without catalogued elements. ``merged`` is only ever set by the + ``split`` without catalogued components. ``merged`` is only ever set by the server (8.8). ``construction_work`` only for ``installed`` (I18).""" identity = (await load_identity(request, current_user, identity_id, 'exit')).record - if identity.get('withdrawn'): - raise HTTPException(status_code=409, detail='The component is ' - 'withdrawn.') + refuse_withdrawn(identity) if not await identity_ever_published(request, identity): raise HTTPException(status_code=409, detail='Not published yet: it never entered ' @@ -618,12 +631,12 @@ async def exit_identity( if body.kind == 'merged': raise HTTPException(status_code=422, detail='merged is set by the server when a ' - 'merged element is published (8.8).') + 'merged component is published (8.8).') if (identity.get('origin') or {}).get('planned') \ and body.kind not in IN_PLACE_EXIT_KINDS: raise HTTPException( status_code=409, - detail=f'An element still in place leaves as ' + detail=f'A component still in place leaves as ' f'{", ".join(IN_PLACE_EXIT_KINDS)} only; it never left ' f'its works, so it was not {body.kind}. Record its ' f'deinstallation first (8.104).') @@ -646,6 +659,7 @@ async def undo_exit( withdraw the child instead (8.8).""" identity = (await load_identity(request, current_user, identity_id, 'exit')).record + refuse_withdrawn(identity) exit_ = identity.get('exit') if not exit_: raise HTTPException(status_code=409, detail='The component is in ' @@ -653,7 +667,7 @@ async def undo_exit( if exit_.get('recorded_by_user_id') is None: raise HTTPException( status_code=409, - detail='This split / merge follows from published elements cut ' + detail='This split / merge follows from published components cut ' 'from it; withdraw those to undo it (8.8).') after = _validated({**identity, 'exit': None}) written = await _write(request, identity, after, @@ -671,20 +685,21 @@ async def reenter_identity( body: ReenterBody, ): """ - An installed, returned or lost element comes back with a new origin; the + An installed, returned or lost component comes back with a new origin; the old ``{origin, exit}`` goes to ``past_cycles`` (3.1.3). Terminal exits cannot re-enter (I18). The next snapshot defaults to the new ``origin.at`` (8.19). A re-entered child owns its new origin. """ identity = (await load_identity(request, current_user, identity_id, 'reenter')).record + refuse_withdrawn(identity) exit_ = identity.get('exit') if not exit_: raise HTTPException(status_code=409, detail='The component is in ' 'circulation.') if exit_.get('kind') in TERMINAL_EXIT_KINDS: raise HTTPException(status_code=409, - detail=f'A {exit_["kind"]} element no longer exists ' + detail=f'A {exit_["kind"]} component no longer exists ' f'as this component; it cannot re-enter ' f'(I18).') cycles = [*(identity.get('past_cycles') or []), @@ -703,6 +718,66 @@ async def reenter_identity( return JSONResponse(status_code=200, content=identity_body(written)) +# MOVE (decision 8.191) ------------------------------------------------------- +@router.post('/identities/{identity_id}/move', + summary='Move a component to another dataset (moderator of ' + 'both datasets)') +async def move_identity( + request: Request, + current_user: Annotated[User, Depends(get_current_active_user)], + identity_id: str, + body: MoveBody, +): + """ + Changes ``dataset`` on the component (the only place it is stored; catalog + numbers are global) and writes a change-log entry. ``move_identity``: + moderator of the source and of the destination dataset, an admin always. + A withdrawn component moves too, so that a dataset can be emptied and + deleted. 409 while a snapshot or an evidence record of the component is + draft or pending: the rights of its author hang on the dataset. A public + component does not move into a dataset an admin has not reviewed, unless an + admin moves it (8.139 c). Accepted as they are (8.191, amended): the + refusal looks at the component's own records only, so a child's pending + first snapshot does not block its parent; a rejected snapshot or record does + not block; a reservation survives the move. + """ + identity = (await load_identity(request, current_user, identity_id, + None)).record + datasets = await load_datasets(request) + source = await dataset_of(request, identity.get('dataset')) + destination = datasets.get(body.dataset) + # an unknown destination is checked against the source, so that a caller + # who may not move from it gets the 403 before any word about the target + viewer = await require(request, current_user, 'move_identity', + identity=identity, + destination=destination or source) + if destination is None: + raise HTTPException(status_code=422, + detail=f'dataset: unknown dataset {body.dataset!r}') + if destination.id == identity.get('dataset'): + raise HTTPException(status_code=409, + detail='The component is in this dataset ' + 'already.') + for name, collection in ( + ('version', request.app.mongodb_component_snapshots), + ('evidence record', request.app.mongodb_component_evidence)): + if await collection.count_documents( + {'identity_id': identity_id, 'status': {'$in': list( + OPEN_STATUSES)}}, limit=1): + raise HTTPException( + status_code=409, + detail=f'A {name} of the component is still draft or ' + f'pending; publish, reject or delete it first, ' + f'since the rights of its author hang on the dataset ' + f'(8.191).') + if identity.get('is_public') is True: + refuse_unreviewed(destination, viewer) # 8.139 c + after = _validated({**identity, 'dataset': destination.id}) + written = await _write(request, identity, after, + user_id=current_user.id, cause='patch') + return JSONResponse(status_code=200, content=identity_body(written)) + + # DEINSTALL (decisions 8.104, 8.110) ------------------------------------------ def _own_origin(identity: Dict[str, Any], origin: Dict[str, Any] ) -> Dict[str, Any]: @@ -739,7 +814,7 @@ async def _dated_after(request: Request, identity_id: str, at: str {'identity_id': identity_id, 'status': live}, {'effective_from': 1}).to_list(length=None) if any(_moment(s['effective_from']) > moment for s in snapshots): - return 'a state starts after the deinstallation' + return 'a snapshot starts after the deinstallation' records = await request.app.mongodb_component_evidence.find( {'identity_id': identity_id, 'status': live}, {'observed_at': 1, 'sampled_at': 1}).to_list(length=None) @@ -758,15 +833,17 @@ async def undo_deinstall_refusal(request: Request, identity: Dict[str, Any] act, 8.115 a) and no state or evidence is dated after it (8.104). The undo route answers 409 with this text; the passport carries ``can_undo_deinstall`` for the menu.""" + if identity.get('withdrawn'): + return 'The component is withdrawn.' origin = identity.get('origin') or {} if origin.get('planned') or origin.get('kind') not in ( 'deinstallation', 'demolition'): - return 'The element is not a deinstalled one.' + return 'The component is not a deinstalled one.' exit_ = identity.get('exit') if (exit_ and exit_.get('recorded_by_user_id') is not None and exit_.get('kind') not in IN_PLACE_EXIT_KINDS): - return (f'The element left as {exit_["kind"]}, which only a ' - f'deinstalled element can do (8.104).') + return (f'The component left as {exit_["kind"]}, which only a ' + f'deinstalled component can do (8.104).') if not origin.get('at'): return ('The deinstallation has no date; set the date by PATCH ' 'of the origin first (8.115).') @@ -783,7 +860,7 @@ async def undo_deinstall_refusal(request: Request, identity: Dict[str, Any] @router.post('/identities/{identity_id}/deinstall', - summary='Record the deinstallation of an in-place element ' + summary='Record the deinstallation of an in-place component ' '(moderator(D))') async def deinstall_identity( request: Request, @@ -794,7 +871,7 @@ async def deinstall_identity( """ ``planned`` becomes false and the given fields go into the existing origin; ``kind`` may switch to ``demolition``. A reservation survives; - no snapshot is created. The origin is now the element's own, and every + no snapshot is created. The origin is now the component's own, and every descendant that still inherits it follows, like a parent's PATCH of ``origin`` (3.1.2, 8.110). """ @@ -803,15 +880,13 @@ async def deinstall_identity( origin = identity.get('origin') or {} if not origin.get('planned'): raise HTTPException(status_code=409, - detail='The element is not in place; there is ' + detail='The component is not in place; there is ' 'nothing to deinstall.') - if identity.get('withdrawn'): - raise HTTPException(status_code=409, - detail='The component is withdrawn.') + refuse_withdrawn(identity) if (identity.get('exit') or {}).get('recorded_by_user_id') is not None: # a split the server keeps from cut pieces does not stop it raise HTTPException(status_code=409, - detail='The element left circulation while in ' + detail='The component left circulation while in ' 'place; undo that exit first.') given = body.model_dump(mode='json', exclude_none=True) new_origin = {**origin, 'planned': False, **given} @@ -831,7 +906,7 @@ async def undo_deinstall( current_user: Annotated[User, Depends(get_current_active_user)], identity_id: str, ): - """``planned`` is true again, but only while no state starts and no + """``planned`` is true again, but only while no snapshot starts and no evidence is valid after the deinstallation's ``at``; later than that a moderator corrects the origin by PATCH (8.104). Propagates like the deinstall.""" diff --git a/src/backend/apps/catalog/api/identity_filters.py b/src/backend/apps/catalog/api/identity_filters.py index c6cec7b8..f4e5dfb1 100644 --- a/src/backend/apps/catalog/api/identity_filters.py +++ b/src/backend/apps/catalog/api/identity_filters.py @@ -228,14 +228,14 @@ def catalog_filters( q: str = Query('', max_length=FILTER_MAX_LENGTH, description='name, catalogue number or id'), evidence_method: Optional[EvidenceMethod] = Query( - None, description='only elements with at least one published, current ' + None, description='only components with at least one published, current ' 'evidence record of this method (8.177), for example ' 'reinforcement_layout; combines with every other ' 'filter'), fit_mode: Optional[FitMode] = Query( None, description='dimension search (8.169): about = every side ' 'within fit_tol of fit_size; can_hold = every side ' - 'of the element at least fit_size'), + 'of the component at least fit_size'), fit_size: Optional[str] = Query( None, max_length=FILTER_MAX_LENGTH, description='three sizes in mm in any order, for example ' @@ -251,12 +251,12 @@ def catalog_filters( None, description='near search: longitude, -180 to 180; needs ' 'near_lat'), near_layer: Optional[NearLayer] = Query( - None, description='which point of an element is measured: current (the ' - 'location of the current version, default) or ' + None, description='which point of a component is measured: current (the ' + 'location of the current snapshot, default) or ' 'origin (the origin building)'), radius_km: Optional[float] = Query( - None, description='near search: only elements within this many km; ' - 'without it every element with a point on the layer, ' + None, description='near search: only components within this many km; ' + 'without it every component with a point on the layer, ' 'nearest first'), ) -> CatalogFilters: """FastAPI dependency: the catalog filters from the query string.""" diff --git a/src/backend/apps/catalog/api/identity_lifecycle.py b/src/backend/apps/catalog/api/identity_lifecycle.py index c2de46f0..de323059 100644 --- a/src/backend/apps/catalog/api/identity_lifecycle.py +++ b/src/backend/apps/catalog/api/identity_lifecycle.py @@ -45,7 +45,7 @@ class WithdrawIdentityBody(BaseModel): reason: str = Field(min_length=1) duplicate_of: Optional[str] = Field( - None, description='the canonical element this one duplicates') + None, description='the canonical component this one duplicates') class PurgeBody(BaseModel): @@ -95,8 +95,8 @@ async def withdraw_identity( """ Hidden everywhere by default; members of D see it in full, everyone else who could see it a tombstone (8.17). With ``duplicate_of`` the - resolver and the component page lead to the canonical element; elements - that named this one as their canonical element follow along (I19). + resolver and the component page lead to the canonical component; components + that named this one as their canonical component follow along (I19). """ identity = (await load_identity(request, current_user, identity_id, 'withdraw_identity')).record @@ -118,15 +118,15 @@ async def withdraw_identity( if target.get('withdrawn'): raise HTTPException( status_code=422, - detail='duplicate_of is withdrawn itself; name the element it ' + detail='duplicate_of is withdrawn itself; name the component it ' 'leads to (I19).') followers = await request.app.mongodb_component_identities.count_documents( {'withdrawn.duplicate_of': identity_id}) if followers and duplicate_of is None: raise HTTPException( status_code=409, - detail=f'{followers} withdrawn element(s) name this one as their ' - f'canonical element; give duplicate_of so they follow ' + detail=f'{followers} withdrawn component(s) name this one as their ' + f'canonical component; give duplicate_of so they follow ' f'(I19).') now = now_iso() withdrawn = {'at': now, 'by_user_id': current_user.id, @@ -222,7 +222,7 @@ async def delete_identity( if referenced: raise HTTPException( status_code=409, - detail=f'Other elements name this one (catalog numbers ' + detail=f'Other components name this one (catalog numbers ' f'{referenced}); resolve those links first.') snapshots = await db.mongodb_component_snapshots.find( {'identity_id': identity_id}, {'_id': 1}).to_list(length=None) @@ -304,8 +304,8 @@ async def resolve_id( """ ``Accept: text/html`` --> 302 to the component page; otherwise 302 to the passport. A withdrawn duplicate --> 301 to ``/id/{duplicate_of}``; - other withdrawn elements and elements without a current state still - redirect (the page shows the tombstone / "no current state"); purged + other withdrawn components and components without a current snapshot still + redirect (the page shows the tombstone / "no current snapshot"); purged --> 410; unknown or never published (unless the caller may see it) --> 404. Visibility applies after the redirect (8.11). """ diff --git a/src/backend/apps/catalog/api/identity_query.py b/src/backend/apps/catalog/api/identity_query.py index 1db423b9..3db98276 100644 --- a/src/backend/apps/catalog/api/identity_query.py +++ b/src/backend/apps/catalog/api/identity_query.py @@ -439,7 +439,7 @@ async def shallow_row_for_identity( if not docs: raise HTTPException( status_code=404, - detail=f'Identity {identity_id} not found', + detail=f'Component {identity_id} not found', ) return catalog_row(docs[0]) diff --git a/src/backend/apps/catalog/api/identity_workflows.py b/src/backend/apps/catalog/api/identity_workflows.py index b7bce46f..2afa9587 100644 --- a/src/backend/apps/catalog/api/identity_workflows.py +++ b/src/backend/apps/catalog/api/identity_workflows.py @@ -50,7 +50,7 @@ async def _resolve_user_id( @router.get( '/identities/reserved/{user_identifier}', - summary='List identities reserved by a user (shallow rows)', + summary='List components reserved by a user (shallow rows)', ) async def list_reserved_identities( request: Request, @@ -154,7 +154,7 @@ async def get_vocabularies(): @router.get( '/identities/meta/datasets', - summary='Datasets that hold identities (dropdowns)', + summary='Datasets that hold components (dropdowns)', ) @local_limiter.limit('120/minute', key_func=signed_in_or_ip) async def list_identity_datasets( @@ -180,7 +180,7 @@ async def list_identity_datasets( @router.post( '/identities/{identity_id}/reserve', - summary='Reserve identity for the current user', + summary='Reserve a component for the current user', ) async def reserve_identity( request: Request, @@ -194,7 +194,7 @@ async def reserve_identity( if identity.get('exit'): raise HTTPException( status_code=409, - detail='An element out of circulation cannot be reserved (I18)', + detail='A component out of circulation cannot be reserved (I18)', ) reserved = identity.get('reserved') or '' @@ -215,6 +215,12 @@ async def reserve_identity( ) # any signed-in user who can read the piece (7.0) await require(request, current_user, 'reserve', identity=identity) + if identity.get('withdrawn'): + # after the permission, so that a caller who cannot read the element + # learns nothing of its state; the reservation was cleared when it + # was withdrawn (8.190) + raise HTTPException(status_code=409, + detail='The component is withdrawn.') identities = await get_identities_col(request) try: @@ -246,7 +252,7 @@ async def reserve_identity( @router.delete( '/identities/{identity_id}/reserve', - summary='Release reservation on an identity', + summary='Release reservation on a component', ) async def release_identity_reservation( request: Request, diff --git a/src/backend/apps/catalog/api/idtransmission.py b/src/backend/apps/catalog/api/idtransmission.py index 4ee1c0b4..1deb1b03 100644 --- a/src/backend/apps/catalog/api/idtransmission.py +++ b/src/backend/apps/catalog/api/idtransmission.py @@ -45,7 +45,7 @@ class TransmitPayload(BaseModel): identity_id: str = Field( min_length=1, max_length=MAX_IDENTITY_ID_LEN, - description='Identity UUID scanned from the QR code.', + description='Component id scanned from the QR code.', ) force_overwrite: bool = Field( default=False, @@ -123,7 +123,7 @@ def _snapshot_conflict_response(identity_id: str) -> JSONResponse: 'status': 'snapshot_id_exists', 'message': ( 'This UUID is already a snapshot id. Transmit the physical ' - 'identity id from the tag, not a snapshot id.' + 'component id from the tag, not a snapshot id.' ), 'identity_id': identity_id, }, @@ -132,14 +132,14 @@ def _snapshot_conflict_response(identity_id: str) -> JSONResponse: @router.get( '/component_id_transmission/availability/{identity_id}', - summary='Check whether a UUID is already an identity or snapshot id', + summary='Check whether a UUID is already a component id or snapshot id', ) async def check_identity_availability( identity_id: str, current_user: Annotated[User, Depends(get_current_active_user)], request: Request, ): - identity_id = validate_uuid(identity_id.strip(), label='identity id') + identity_id = validate_uuid(identity_id.strip(), label='component id') conflict = await _catalog_id_conflict(request, identity_id) return JSONResponse( status_code=status.HTTP_200_OK, @@ -153,7 +153,7 @@ async def check_identity_availability( @router.get( '/component_id_transmission', - summary='Get the current pending transmitted identity id for the user', + summary='Get the current pending transmitted component id for the user', ) async def get_pending_transmission( current_user: Annotated[User, Depends(get_current_active_user)], @@ -178,7 +178,7 @@ async def get_pending_transmission( @router.post( '/component_id_transmission', - summary='Transmit a scanned identity id (one pending per user)', + summary='Transmit a scanned component id (one pending per user)', ) async def transmit_identity_id( payload: TransmitPayload, @@ -191,7 +191,7 @@ async def transmit_identity_id( status_code=status.HTTP_400_BAD_REQUEST, detail='identity_id must not be empty', ) - validate_uuid(identity_id, label='identity id') + validate_uuid(identity_id, label='component id') coll = await get_transmit_col(request) now = _now_iso() @@ -218,7 +218,7 @@ async def transmit_identity_id( content={ 'status': 'conflict', 'message': ( - 'A different identity id is still pending. ' + 'A different component id is still pending. ' 'Confirm overwrite to replace it.' ), 'existing': _serialize_item(existing), @@ -258,7 +258,7 @@ async def transmit_identity_id( @router.delete( '/component_id_transmission', - summary='Clear the current pending transmitted identity id', + summary='Clear the current pending transmitted component id', ) async def clear_pending_transmission( current_user: Annotated[User, Depends(get_current_active_user)], @@ -286,7 +286,7 @@ async def clear_pending_transmission( @router.post( '/component_id_transmission/consume', - summary='Consume pending transmission after identity was created', + summary='Consume pending transmission after the component was created', ) async def consume_pending_transmission( payload: ConsumePayload, @@ -299,7 +299,7 @@ async def consume_pending_transmission( if payload.identity_id: query['identity_id'] = validate_uuid( payload.identity_id.strip(), - label='identity id', + label='component id', ) result = await coll.delete_one(query) diff --git a/src/backend/apps/catalog/api/invitations.py b/src/backend/apps/catalog/api/invitations.py index d315ed07..5ce2bc91 100644 --- a/src/backend/apps/catalog/api/invitations.py +++ b/src/backend/apps/catalog/api/invitations.py @@ -10,8 +10,8 @@ * ``POST /invitations/{iid}/resend`` --- a new code (the old one is void), mailed again; who may revoke may resend * ``GET /invitations`` --- admin: all; moderator: their datasets' -* ``DELETE /invitations/{iid}`` --- revoke while unused: its creator, - ``moderator(D)``, admin +* ``DELETE /invitations/{iid}`` --- revoke while unused: ``moderator(D)``, + admin (the creator loses the right with the role, 8.193 c) * ``POST /datasets/{did}/members`` --- ``moderator(D)``: in a reviewed dataset an existing account (exact email) is added and notified, any other address invited; in a dataset an admin has not reviewed yet every address is diff --git a/src/backend/apps/catalog/api/materials.py b/src/backend/apps/catalog/api/materials.py index deb2e578..c87d88e3 100644 --- a/src/backend/apps/catalog/api/materials.py +++ b/src/backend/apps/catalog/api/materials.py @@ -161,7 +161,7 @@ async def delete_material( current_user: Annotated[User, Depends(get_current_active_user)], mid: str, ): - """Only while no identity references it, withdrawn ones included.""" + """Only while no component references it, withdrawn ones included.""" await load_material(request, current_user, mid, 'manage_materials') used = await request.app.mongodb_component_identities.count_documents( {'material': mid}) @@ -186,7 +186,7 @@ async def merge_material( mid: str, body: MergeBody, ): - """Every identity moves to the target; derived classes follow the + """Every component moves to the target; derived classes follow the target's default, assigned ones stay; ``mid`` remains as an alias ``{_id, merged_into}`` so old references resolve (8.35).""" source = (await load_material(request, current_user, mid, diff --git a/src/backend/apps/catalog/api/schema_routes.py b/src/backend/apps/catalog/api/schema_routes.py index c61c5cd8..ce05c342 100644 --- a/src/backend/apps/catalog/api/schema_routes.py +++ b/src/backend/apps/catalog/api/schema_routes.py @@ -162,7 +162,7 @@ def _create_schema_response(request: Request, schema: dict): ) async def get_create_snapshot_json_schema(request: Request): """ - The 0.6 body of a new state or a correction, as the Grasshopper + The 0.6 body of a new snapshot or a correction, as the Grasshopper bridge and other clients send it. Derived fields are not part of it. """ from .snapshot_lifecycle import SnapshotDraftBody diff --git a/src/backend/apps/catalog/api/snapshot_lifecycle.py b/src/backend/apps/catalog/api/snapshot_lifecycle.py index e6f5085f..361a714d 100644 --- a/src/backend/apps/catalog/api/snapshot_lifecycle.py +++ b/src/backend/apps/catalog/api/snapshot_lifecycle.py @@ -98,13 +98,13 @@ # BODIES ---------------------------------------------------------------------- class SnapshotDraftBody(BaseModel): - """A new state or a correction, as the client sends it. Derived fields + """A new snapshot or a correction, as the client sends it. Derived fields (frame, bbx, descriptors, fitted proxies, ...) are never accepted.""" model_config = ConfigDict(extra='forbid') name: Optional[str] = None effective_from: Optional[Timestamp] = Field( - None, description='a new state: default now; a correction inherits') + None, description='a new snapshot: default now; a correction inherits') effective_from_precision: Optional[Precision] = None geometry: Geometry capture: Optional[Capture] = None @@ -118,7 +118,7 @@ class SnapshotDraftBody(BaseModel): location: Optional[GeoLocation] = None notes: Optional[str] = None photo_credit: Optional[PhotoCredit] = Field( - None, description='who the photos of this version come from ' + None, description='who the photos of this snapshot come from ' '(mutable metadata, 8.128 a)') @model_validator(mode='after') @@ -347,6 +347,7 @@ async def _publish(request: Request, user: User, snapshot: dict, parent_datasets=tuple(parents)) if not can(viewer, 'publish', target): raise deny_write(viewer, 'publish') + _refuse_withdrawn(identity) # after the right (8.190) # the parents may have changed since the cut was recorded (8.34) await check_cut_allowed(request, parent_docs) _ensure_monotonic(snapshot, await _snapshots_of(request, identity['_id'])) @@ -429,17 +430,26 @@ async def _publish_locked(request: Request, user: User, snapshot: dict, return published +def _refuse_withdrawn(identity: dict) -> None: + """A withdrawn element stays out of circulation (8.190): a version of it + is not submitted, published or made current, whoever asks, an admin + included. Recall, reject, back to draft and delete stay.""" + if identity.get('withdrawn'): + raise HTTPException(status_code=409, + detail='The component is withdrawn.') + + # CREATE ---------------------------------------------------------------------- @router.post('/identities/{identity_id}/snapshots', status_code=201, - summary='Record a new state of a component (always a draft)') + summary='Record a new snapshot of a component (always a draft)') async def create_snapshot( request: Request, current_user: Annotated[User, Depends(get_current_active_user)], identity_id: str, body: SnapshotDraftBody, ): - """contributor(D). ``effective_from`` defaults to now. Only for an element - in circulation: an exited element re-enters first (section 3.1.3).""" + """contributor(D). ``effective_from`` defaults to now. Only for a component + in circulation: an exited component re-enters first (section 3.1.3).""" identity = (await load_identity(request, current_user, identity_id, 'create_snapshot')).record if identity.get('withdrawn'): @@ -449,7 +459,7 @@ async def create_snapshot( raise HTTPException( status_code=409, detail='The component is out of circulation; it re-enters ' - 'before it gets a new state (section 3.1.3).') + 'before it gets a new snapshot (section 3.1.3).') _check_client_geometry(body) size = await current_quantity(request, identity) if size is not None: @@ -459,7 +469,7 @@ async def create_snapshot( raise HTTPException( status_code=422, detail=f'quantity: this component records {size} and keeps ' - f'it in later states; correct the state to change it ' + f'it in later snapshots; correct the snapshot to change it ' f'(I32).') body = body.model_copy(update={'quantity': size}) snapshots = await _snapshots_of(request, identity_id) @@ -495,6 +505,11 @@ async def supersede_snapshot( loaded = await load_snapshot(request, current_user, snapshot_id, 'supersede_snapshot') old, identity = loaded.record, loaded.identity + if identity.get('withdrawn'): + # a withdrawn element stays out of circulation (8.190): a correction + # would publish a new state of it; reinstate it first + raise HTTPException(status_code=409, + detail='The component is withdrawn.') if old.get('status') != 'published' or old.get('superseded_by'): raise HTTPException( status_code=409, @@ -514,9 +529,9 @@ async def supersede_snapshot( s['_id'] != old['_id'] for s in _live(snapshots)): raise HTTPException( status_code=409, - detail='The component has other states that record ' + detail='The component has other snapshots that record ' f'{old_quantity}; correct the quantity while it has ' - 'one state only (I32).') + 'one snapshot only (I32).') _ensure_nothing_in_flight(snapshots) version = max(s['version'] for s in snapshots) + 1 doc = _new_snapshot( @@ -544,6 +559,7 @@ async def submit_snapshot( request, current_user, snapshot_id, lambda s: _transition_or_409(s, 'pending')) snapshot = loaded.record + _refuse_withdrawn(loaded.identity) # the frame and the class are current when it goes to review (6.14) snapshot = await derive_sync(request, snapshot_id) or snapshot return _ok(await _change_status(request, current_user, snapshot, @@ -622,6 +638,7 @@ async def promote_snapshot( loaded = await load_snapshot(request, current_user, snapshot_id, 'promote') snapshot, identity = loaded.record, loaded.identity + _refuse_withdrawn(identity) if snapshot.get('status') != 'published' or snapshot.get('superseded_by'): raise HTTPException( status_code=409, @@ -645,6 +662,10 @@ async def withdraw_snapshot( request, current_user, snapshot_id, lambda s: _transition_or_409(s, 'withdrawn')) snapshot, identity = loaded.record, loaded.identity + if body.replacement_id: + # a replacement makes another version current: not on a withdrawn + # element (8.190); a plain withdrawal stays allowed + _refuse_withdrawn(identity) snapshots = await _snapshots_of(request, identity['_id']) remaining = [s for s in _live(snapshots) if s['_id'] != snapshot['_id']] replacement = None @@ -678,6 +699,7 @@ async def reinstate_snapshot( request, current_user, snapshot_id, lambda s: _transition_or_409(s, 'published')) snapshot, identity = loaded.record, loaded.identity + _refuse_withdrawn(identity) # reinstate the element first (8.190) published = await _change_status(request, current_user, snapshot, 'published') if not identity.get('current_snapshot_id') \ diff --git a/src/backend/apps/catalog/api/snapshot_media.py b/src/backend/apps/catalog/api/snapshot_media.py index 9d2b3e23..d91de59b 100644 --- a/src/backend/apps/catalog/api/snapshot_media.py +++ b/src/backend/apps/catalog/api/snapshot_media.py @@ -258,9 +258,17 @@ async def put_snapshot_photo( """ Accept up to upload limit; store JPEG scaled/compressed to max output. """ - await load_snapshot( + loaded = await load_snapshot( request, current_user, snapshot_id, 'add_photo', files=True, frozen=False) + # a withdrawn version, or any version of a withdrawn element, takes no + # new photo, for an admin as well: the state refuses (8.190) + if (loaded.identity or {}).get('withdrawn'): + raise HTTPException(status_code=409, + detail='The component is withdrawn.') + if loaded.record.get('status') == 'withdrawn': + raise HTTPException(status_code=409, + detail='This snapshot is withdrawn.') content_type = (photo.content_type or '').split(';', 1)[0].strip().lower() if content_type not in _ALLOWED_PHOTO_TYPES: diff --git a/src/backend/apps/catalog/api/snapshots.py b/src/backend/apps/catalog/api/snapshots.py index bc1ed793..3d833c82 100644 --- a/src/backend/apps/catalog/api/snapshots.py +++ b/src/backend/apps/catalog/api/snapshots.py @@ -69,9 +69,9 @@ async def list_my_snapshots( limit: int = Query(100, ge=1, le=500), ): """ - The versions the caller added (``added_by_user_id``), for "My work" + The snapshots the caller added (``added_by_user_id``), for "My work" (8.118 Q4): drafts, pending and rejected ones by default, each with its - element and, when rejected, the reason. Nobody lists another person's + component and, when rejected, the reason. Nobody lists another person's snapshots here. """ if not mine: @@ -100,7 +100,8 @@ async def list_my_snapshots( i['_id']: i async for i in identities.find( {'_id': {'$in': ids}}, {'_id': 1, 'current_snapshot_id': 1, 'catalog_number': 1, - 'original_function': 1, 'material': 1, 'dataset': 1})} + 'original_function': 1, 'material': 1, 'dataset': 1, + 'withdrawn': 1})} except ConnectionFailure: raise # the 503 handler of main_fastapi.py except PyMongoError: @@ -125,6 +126,7 @@ async def list_my_snapshots( 'original_function': piece.get('original_function'), 'material': piece.get('material'), 'dataset': piece.get('dataset'), + 'identity_withdrawn': bool(piece.get('withdrawn')), 'rejection_reason': reason, }).model_dump(by_alias=True)) except Exception as exc: @@ -185,6 +187,7 @@ async def list_pending_snapshots( 'original_function': 1, 'material': 1, 'dataset': 1, + 'withdrawn': 1, }, ) if identity_doc is None or identity_doc.get('dataset') not in moderated: @@ -207,6 +210,7 @@ async def list_pending_snapshots( 'original_function': identity_doc.get('original_function'), 'material': identity_doc.get('material'), 'dataset': identity_doc.get('dataset'), + 'identity_withdrawn': bool(identity_doc.get('withdrawn')), 'live_version': live_version, } try: diff --git a/src/backend/apps/catalog/documents.py b/src/backend/apps/catalog/documents.py index 9013f467..00510fca 100644 --- a/src/backend/apps/catalog/documents.py +++ b/src/backend/apps/catalog/documents.py @@ -208,7 +208,7 @@ class GeoLocation(_Block): class PhotoCredit(_Block): - """Who the photos of one version come from (decision 8.128 a): a short + """Who the photos of one snapshot come from (decision 8.128 a): a short text for all its photos and, optionally, the page they come from. Good practice, not a licence.""" text: str = Field(min_length=1, max_length=300) @@ -240,7 +240,7 @@ class Place(_Block): class ConstructionWork(_Block): - """The works an element left or went into --- never the company.""" + """The works a component left or went into --- never the company.""" name: str identifier: Optional[str] = None year_built: Optional[int] = None @@ -257,10 +257,10 @@ class CircularityClass(_Block): class Origin(_Block): - """How the element entered circulation (section 3.1.1).""" + """How the component entered circulation (section 3.1.1).""" kind: OriginKind planned: bool = Field( - False, description='true while the element is in place: identified in ' + False, description='true while the component is in place: identified in ' 'its works, not yet deinstalled (decision 8.104)') at: Optional[Timestamp] = None at_precision: Precision = 'unknown' @@ -290,7 +290,7 @@ def _construction_work_kind(self) -> 'Origin': class Exit(_Block): - """How the element left circulation (section 3.1.3).""" + """How the component left circulation (section 3.1.3).""" kind: ExitKind at: Timestamp at_precision: Precision = 'exact' @@ -396,19 +396,19 @@ def _consistency(self) -> 'ComponentIdentity': 'inherited_from must be one of parent_identities (I17)') if self.reserved and self.exit is not None: raise ValueError( - 'an element out of circulation cannot be reserved (I18)') + 'a component out of circulation cannot be reserved (I18)') if (self.origin is not None and self.origin.planned and self.exit is not None and self.exit.recorded_by_user_id is not None and self.exit.kind not in IN_PLACE_EXIT_KINDS): raise ValueError( 'an exit set by hand from in place is recycled, disposed or ' - 'lost: the element never left its works (I31)') + 'lost: the component never left its works (I31)') if self.withdrawn and self.withdrawn.duplicate_of == self.id: raise ValueError( - 'an identity cannot be a duplicate of itself (I19)') + 'a component cannot be a duplicate of itself (I19)') if self.parent_identities and self.id in self.parent_identities: - raise ValueError('an identity cannot be its own parent') + raise ValueError('a component cannot be its own parent') return self @@ -679,7 +679,7 @@ class Derivation(_Block): class ComponentSnapshot(_Document): - """``component_snapshots``: one recorded state of a component.""" + """``component_snapshots``: one snapshot of a component.""" id: str = Field(alias='_id') identity_id: str version: int = Field(ge=0) @@ -750,7 +750,7 @@ class Standard(_Block): class Position(_Block): - """Where on the element (3.3.2); kind none + description always works.""" + """Where on the component (3.3.2); kind none + description always works.""" kind: PositionKind = 'none' snapshot_id: Optional[str] = None point: Optional[Vec3] = None @@ -1108,7 +1108,7 @@ class AccessToken(_Document): class ChangeLogEntry(_Document): - """``change_log``: one write to an identity, snapshot or evidence + """``change_log``: one write to a component, snapshot or evidence record (section 3.8, decision 8.36, I30); append-only.""" id: str = Field(alias='_id') record_kind: str = Field(pattern='^(identity|snapshot|evidence)$') diff --git a/src/backend/apps/catalog/evidence/payloads.py b/src/backend/apps/catalog/evidence/payloads.py index ff26533c..8dea93ca 100644 --- a/src/backend/apps/catalog/evidence/payloads.py +++ b/src/backend/apps/catalog/evidence/payloads.py @@ -145,7 +145,7 @@ class Grid(Payload): class ReboundTestArea(Payload): label: Optional[str] = Field( - None, description='Name of the test area on the element, e.g. TA-1.') + None, description='Name of the test area on the component, e.g. TA-1.') surface_preparation: Literal['ground', 'as_found'] = Field( description='Whether the surface was ground before testing.') surface_condition: Literal['dry', 'damp', 'wet'] = Field( @@ -226,7 +226,7 @@ class ReboundHammerPayload(Payload): class CoreSampling(Payload): cored_at: Timestamp = Field( description='When the core was drilled; becomes the record\'s ' - 'sampled_at and decides which state of the element the ' + 'sampled_at and decides which snapshot of the component the ' 'result belongs to.') paired_rebound_id: Optional[str] = Field( None, description='The rebound hammer record taken at this drill ' @@ -402,7 +402,7 @@ class ArchivalDocumentPayload(Payload): claim: Optional[ArchivalClaim] = Field( None, description='What the document says. Without a claim and a ' 'summary the record is a document: it documents ' - 'the element and never enters the fold.') + 'the component and never enters the fold.') class VisualObservation(Payload): diff --git a/src/backend/apps/catalog/evidence/registry.py b/src/backend/apps/catalog/evidence/registry.py index 0602a714..46a91048 100644 --- a/src/backend/apps/catalog/evidence/registry.py +++ b/src/backend/apps/catalog/evidence/registry.py @@ -220,7 +220,7 @@ def prepare_record(data: Dict[str, Any], *, position = dict(WHOLE_COMPONENT) if position is None: problems.append(Problem( - 'position', 'say where on the element: kind none with a ' + 'position', 'say where on the component: kind none with a ' 'description is always enough')) else: position = dict(position) diff --git a/src/backend/apps/catalog/evidence/specs.py b/src/backend/apps/catalog/evidence/specs.py index 620a08d4..958d09c3 100644 --- a/src/backend/apps/catalog/evidence/specs.py +++ b/src/backend/apps/catalog/evidence/specs.py @@ -50,9 +50,9 @@ def _claimable(tier: str) -> Tuple[str, ...]: name='core_compression', label='Drilled core in compression (EN 12504-1, EN 12390-3)', description=( - 'A core drilled from the element, prepared and crushed. The record ' - 'carries both dates: sampled_at (the element was drilled) decides the ' - 'state of the element it belongs to, observed_at is the test. The ' + 'A core drilled from the component, prepared and crushed. The record ' + 'carries both dates: sampled_at (the component was drilled) decides the ' + 'snapshot of the component it belongs to, observed_at is the test. The ' 'server recomputes F / A and the length-to-diameter class and ' 'derives the in-situ strength (EN 13791).'), payload_model=CoreCompressionPayload, @@ -69,7 +69,7 @@ def _claimable(tier: str) -> Tuple[str, ...]: 'A claim from a drawing, specification, report, photo, marking, ' 'type plate or declaration of performance. The claim is the ' 'summary: a value or a range, or a class. Without a summary it is a ' - 'document: it documents the element (a plan, an element passport, a ' + 'document: it documents the component (a plan, an element passport, a ' 'report), never enters the fold, and may carry the link it was read ' 'from.'), payload_model=ArchivalDocumentPayload, @@ -99,7 +99,7 @@ def _claimable(tier: str) -> Tuple[str, ...]: label='Rule of thumb by era, region or typology', description=( 'An estimate from the construction year, regional practice or the ' - 'typology of the element. The estimate is the summary.'), + 'typology of the component. The estimate is the summary.'), payload_model=EraHeuristicPayload, source_tier=METHOD_TIER['era_heuristic'], destructive=False, default_standard=None, summary_quantities=_claimable('heuristic'), @@ -122,7 +122,7 @@ def _claimable(tier: str) -> Tuple[str, ...]: name='reinforcement_layout', label='Reinforcement layout', description=( - 'The bars of the element from one source: a drawing (archival), a ' + 'The bars of the component from one source: a drawing (archival), a ' 'cover-meter or radar scan (non-destructive) or exposed bars ' '(visual). The bar centrelines are in the stored coordinates of ' 'the snapshot named by position.snapshot_id, which is required. ' diff --git a/src/backend/apps/catalog/exports/cero.py b/src/backend/apps/catalog/exports/cero.py index 7425383c..00a696e9 100644 --- a/src/backend/apps/catalog/exports/cero.py +++ b/src/backend/apps/catalog/exports/cero.py @@ -35,7 +35,7 @@ CERO = 'https://w3id.org/cero#' CERO_MATERIALS = ('concrete', 'autoclaved_aerated_concrete') -NOT_CONCRETE = 'CERO covers concrete elements only' +NOT_CONCRETE = 'CERO covers concrete components only' # CERO declares these two as strings, all other exported scalars as decimals _STRING_RANGE = ('chlorideContent',) diff --git a/src/backend/apps/catalog/exports/pdf.py b/src/backend/apps/catalog/exports/pdf.py index 239fe7a7..ade8aa14 100644 --- a/src/backend/apps/catalog/exports/pdf.py +++ b/src/backend/apps/catalog/exports/pdf.py @@ -377,7 +377,7 @@ def _story(data: PassportPdfData, rows_cap: int, props_cap: int, Paragraph( f'Dataset: {escape(data.dataset_name)}
' f'Issued {escape(data.generated_at[:10])}' - + (f' · state v{snapshot["version"]}' + + (f' · snapshot v{snapshot["version"]}' if snapshot.get('version') is not None else '') + f'
{_link(iri)}', st['sub']), ] @@ -399,7 +399,7 @@ def _story(data: PassportPdfData, rows_cap: int, props_cap: int, + (f' {date}' if date else ' (date not set)'), st['note'])] # IDENTITY -------------------------------------------------------------- - story.append(_p('Identity', st['section'])) + story.append(_p('Component', st['section'])) function = identity.get('original_function') ifc = '' if function == 'CscDebris' else f' ({function})' table = _kv([ @@ -430,7 +430,7 @@ def _story(data: PassportPdfData, rows_cap: int, props_cap: int, f'{", " + escape(place) if place else ""}', st['body'])] # CURRENT STATE --------------------------------------------------------- - story.append(_p('Current state', st['section'])) + story.append(_p('Current snapshot', st['section'])) props = {**(snapshot.get('properties') or {}), **(identity.get('properties') or {})} bbx = snapshot.get('bbx') or [] diff --git a/src/backend/apps/catalog/lineage.py b/src/backend/apps/catalog/lineage.py index 7d9a8e73..122727c2 100644 --- a/src/backend/apps/catalog/lineage.py +++ b/src/backend/apps/catalog/lineage.py @@ -282,7 +282,7 @@ def cut_refusal(parent: Dict[str, Any], *, ever_published: bool if exit_.get('kind') in ('installed', 'returned', 'lost'): return (f'{label} is out of circulation ({exit_["kind"]}); ' f'it re-enters first.') - return f'{label} no longer exists as this element ({exit_["kind"]}).' + return f'{label} no longer exists as this component ({exit_["kind"]}).' return None diff --git a/src/backend/apps/catalog/mcp_server.py b/src/backend/apps/catalog/mcp_server.py index e86133ad..d24e6da3 100644 --- a/src/backend/apps/catalog/mcp_server.py +++ b/src/backend/apps/catalog/mcp_server.py @@ -67,9 +67,9 @@ 'The Catalog of Second Chances (CSC) is a catalog of reused and ' 'salvaged building components (German: wiederverwendete Bauteile, ' 'Wiederverwendung, Bauteilboerse): concrete walls and beams ' - '(Betonwaende, Traeger), stone, timber and other elements, each ' - 'with its shape, origin, versions and measurements ("evidence"). Use ' - 'these tools before a web search when the user looks for such elements, ' + '(Betonwaende, Traeger), stone, timber and other components, each ' + 'with its shape, origin, snapshots and measurements ("evidence"). Use ' + 'these tools before a web search when the user looks for such components, ' 'for example "Betontraeger mit Bewehrung" or reused beams with ' 'reinforcement (Bewehrung): search_components with the filters below, ' 'and has_evidence=reinforcement_layout for "with reinforcement". ' @@ -85,7 +85,7 @@ + EVIDENCE_METHOD_TEXT + '. A list gives short rows: method, source ' 'tier, when observed, who performed it, summary, status, verification; ' 'a reinforcement_layout row also gives a summary of its bars (count, ' - 'basis, specs, diameters, cover, the version it refers to). Filter with ' + 'basis, specs, diameters, cover, the snapshot it refers to). Filter with ' 'method. Pass evidence_id for one record in full, with its payload (the ' 'bars of a layout).') @@ -204,7 +204,7 @@ def layout_bars(record: dict) -> list: return [b for b in bars if isinstance(b, dict)] -def layouts_of_version(rows: list, snapshot_id: Optional[str]) -> dict: +def layouts_of_snapshot(rows: list, snapshot_id: Optional[str]) -> dict: """The reinforcement of one version, from the published ``reinforcement_layout`` evidence that names it in ``position.snapshot_id`` (decision 7.8: the bars are evidence, not geometry): how many records and @@ -236,7 +236,7 @@ def layout_summary(record: dict) -> dict: 'diameters_mm': sorted({b['diameter_mm'] for b in bars if isinstance(b.get('diameter_mm'), (int, float))}), - 'version_id': (record.get('position') or {}).get('snapshot_id')} + 'snapshot_id': (record.get('position') or {}).get('snapshot_id')} if covers: summary['cover_mm'] = {'min': min(covers), 'max': max(covers)} return summary @@ -296,8 +296,8 @@ def size() -> int: 'active (default: in circulation), in_place, deinstalled, ' 'exited, all.'))] StatusArg = Annotated[str, Field(description=( - 'Version status: published (default), or any to include ' - 'pending and other states you may see.'))] + 'Snapshot status: published (default), or any to include ' + 'pending and other statuses you may see.'))] WithdrawnArg = Annotated[bool, Field(description=( 'Also withdrawn components, if you may see them.'))] HasEvidenceArg = Annotated[str, Field(description=( @@ -307,11 +307,11 @@ def size() -> int: 'filter. Leave empty for all.'))] FitModeArg = Annotated[str, Field(description=( 'Search by size, with size_mm: about = every side within the ' - 'tolerance of the asked side (which elements are about this ' - 'size); can_hold = every side of the element at least the asked ' - 'side (which elements can this part be cut from). The sides are ' + 'tolerance of the asked side (which components are about this ' + 'size); can_hold = every side of the component at least the asked ' + 'side (which components can this part be cut from). The sides are ' 'compared largest to smallest, so the orientation does not ' - 'matter. An element without a known size never matches.'))] + 'matter. A component without a known size never matches.'))] SizeArg = Annotated[Optional[list[float]], Field(description=( 'The asked size: three numbers in mm in any order, for example ' '[1200, 600, 200]. Needs fit_mode.'))] @@ -320,18 +320,18 @@ def size() -> int: 'millimetres, for example "10%" (the default) or "50mm".'))] NearLatArg = Annotated[Optional[float], Field(description=( 'Search by place: the latitude of the point, -90 to 90, with ' - 'near_lon. Only elements with a known place on the chosen layer ' + 'near_lon. Only components with a known place on the chosen layer ' 'are listed, nearest first, each with its distance_km.'))] NearLonArg = Annotated[Optional[float], Field(description=( 'The longitude of the point, -180 to 180. Needs near_lat.' ))] NearLayerArg = Annotated[str, Field(description=( - 'Which place of an element is measured: current (where the element ' + 'Which place of a component is measured: current (where the component ' 'is now; the default) or origin (the building it comes from, ' - 'known for fewer elements).'))] + 'known for fewer components).'))] RadiusArg = Annotated[Optional[float], Field(description=( - 'Only elements within this many km of the point. Without it every ' - 'element with a place on the layer is listed, nearest first.' + 'Only components within this many km of the point. Without it every ' + 'component with a place on the layer is listed, nearest first.' ))] @@ -445,8 +445,8 @@ async def search_components( radius_km: RadiusArg = None, sort: Annotated[str, Field(description=( 'catalog_number (default without a size or place search), date ' - '(the version applies from), created, volume (length x width x ' - 'height; elements without a size last), match (closeness to the ' + '(the snapshot applies from), created, volume (length x width x ' + 'height; components without a size last), match (closeness to the ' 'size search: smallest deviation, or least waste, first; the ' 'default with fit_mode and no place search), distance (from the ' 'near point, nearest first; the default with near_lat and ' @@ -460,7 +460,7 @@ async def search_components( component (name, function, material, dataset, size, status, visibility) with its web link, and the total. With fit_mode and size_mm each row also carries its deviation (about, in per cent) or - waste (can_hold, in m3 and in per cent of the element); with near_lat + waste (can_hold, in m3 and in per cent of the component); with near_lat and near_lon each row carries its distance_km. has_evidence keeps only components with a published, current evidence record of one method, for example reinforcement_layout for "with reinforcement". Use @@ -506,7 +506,7 @@ async def get_component( ) -> dict: """One component: what it is, where it comes from, how it left circulation, its derived properties with confidence, its current - version in short (with the count of its reinforcement layouts and + snapshot in short (with the count of its reinforcement layouts and bars), and links. Geometry is a summary only.""" passport = await get(f'/identities/{component_id}/compose') versions = await get(f'/identities/{component_id}/snapshots') @@ -543,7 +543,7 @@ async def get_component( ('range', 'unit', 'confidence', 'source', 'n')} for k, v in (identity.get('properties') or {}).items() if isinstance(v, dict)}, - 'current_version': { + 'current_snapshot': { 'id': current.get('_id'), 'version': current.get('version'), 'status': current.get('status'), 'shape_class': current.get('shape_class'), @@ -554,26 +554,26 @@ async def get_component( 'effective_from': current.get('effective_from'), 'location': current.get('location'), 'geometry': geometry_summary(current.get('geometry')), - 'reinforcement_layouts': layouts_of_version( + 'reinforcement_layouts': layouts_of_snapshot( layouts, current.get('_id'))}, - 'version_count': len(versions), + 'snapshot_count': len(versions), 'web_link': link_component(identity.get('_id') or component_id), - 'next': ('list_versions, get_evidence and get_timeline take ' + 'next': ('list_snapshots, get_evidence and get_timeline take ' 'this id.')})) # 3 ------------------------------------------------------------------------- - @mcp.tool(title='List the versions of a component', annotations=READ_ONLY) - async def list_versions( + @mcp.tool(title='List the snapshots of a component', annotations=READ_ONLY) + async def list_snapshots( component_id: Annotated[str, Field(description='The component id.')], ) -> dict: - """The versions (states) of a component, oldest first: version number, + """The snapshots of a component, oldest first: version number, status, name, from when it applies, which one is current, with the id - to pass to get_version and a web link for each.""" + to pass to get_snapshot and a web link for each.""" rows = await get(f'/identities/{component_id}/snapshots') return limited(clean({ 'component_id': component_id, 'web_link': link_component(component_id), - 'versions': [{ + 'snapshots': [{ 'id': r.get('_id'), 'version': r.get('version'), 'status': r.get('status'), 'is_current': r.get('is_current'), 'name': r.get('name'), @@ -585,16 +585,16 @@ async def list_versions( for r in rows]})) # 4 ------------------------------------------------------------------------- - @mcp.tool(title='Get one version of a component', annotations=READ_ONLY) - async def get_version( - version_id: Annotated[str, Field(description=( - 'The version id (a UUID) from list_versions.'))], + @mcp.tool(title='Get one snapshot of a component', annotations=READ_ONLY) + async def get_snapshot( + snapshot_id: Annotated[str, Field(description=( + 'The snapshot id (a UUID) from list_snapshots.'))], ) -> dict: - """One version of a component: size, shape class, descriptors, + """One snapshot of a component: size, shape class, descriptors, derived properties, status and notes. The geometry is only a summary (counts); the web link opens the viewer. The reinforcement layouts - of the version are counted from the evidence.""" - s = await get(f'/snapshots/{version_id}') + of the snapshot are counted from the evidence.""" + s = await get(f'/snapshots/{snapshot_id}') identity_id = s.get('identity_id') layouts = await get(f'/identities/{identity_id}/evidence', {'method': 'reinforcement_layout'} @@ -616,7 +616,7 @@ async def get_version( 'supersedes': s.get('supersedes'), 'superseded_by': s.get('superseded_by'), 'geometry': geometry_summary(s.get('geometry')), - 'reinforcement_layouts': layouts_of_version( + 'reinforcement_layouts': layouts_of_snapshot( layouts, s.get('_id')), 'web_link': link_component(identity_id, s.get('_id')) if identity_id else None})) @@ -710,7 +710,7 @@ async def get_dataset( async def get_timeline( component_id: Annotated[str, Field(description='The component id.')], ) -> dict: - """What happened to a component, in order: origin, versions, + """What happened to a component, in order: origin, snapshots, corrections, evidence, changes, how it left circulation. Each event has a kind, a time (with its precision) and a short detail.""" body = await get(f'/identities/{component_id}/timeline') @@ -807,11 +807,11 @@ async def catalog_overview( ) -> dict: """What the catalog holds, in numbers, for the components that match the filters of search_components (none: the whole catalog you may - see). It counts components (one per element or batch, with its current - version), not rows of a list: the total, how many physical elements they + see). It counts components (one per single component or batch, with its current + snapshot), not rows of a list: the total, how many physical elements they stand for, and the counts by material (with its label), original function, dataset, shape class and circulation. The ranges give the - smallest and the largest value of each side of the elements that have a + smallest and the largest value of each side of the components that have a size, sides sorted largest, middle, smallest; lengths are in millimetres. It also says how many components have a current and how many an origin location, and how many of the counted components are @@ -841,7 +841,7 @@ def counted(rows, label_of=None): not_public = int(stats.get('notPublic') or 0) total = int(stats.get('total') or 0) return limited(clean({ - 'counted': 'components with a current version that match the ' + 'counted': 'components with a current snapshot that match the ' 'filters and that you may see', 'total': total, 'pieces': stats.get('pieces'), 'by_material': counted(stats.get('byMaterial'), labels.get), diff --git a/src/backend/apps/catalog/models.py b/src/backend/apps/catalog/models.py index 7902c81a..9ba7a0a9 100644 --- a/src/backend/apps/catalog/models.py +++ b/src/backend/apps/catalog/models.py @@ -376,7 +376,7 @@ class ComponentIdentity(BaseModel): id: str = Field( default_factory=lambda: str(uuid.uuid4()), alias="_id", - description="Globally unique identity identifier (GUID)" + description="Globally unique component id (GUID)" ) catalog_number: int = Field( description=( @@ -432,19 +432,19 @@ class ComponentIdentity(BaseModel): ) attributes: Optional[Dict] = Field( default_factory=dict, - description="Additional static metadata about the physical element" + description="Additional static metadata about the physical component" ) parent_identities: Optional[List[str]] = Field( None, description=( - "UUIDs of immediate parent identities. Single-element for 1:1 " + "UUIDs of immediate parent components. Single-element for 1:1 " "splits; multi-element for N:1 merges. `None` if no known parent." ) ) consumed_at: Optional[str] = Field( None, description=( - "ISO-8601 timestamp when the physical element ceased to exist as " + "ISO-8601 timestamp when the physical component ceased to exist as " "a discrete object (split, demolished, returned). `None` = active." ) ) @@ -458,14 +458,14 @@ class ComponentIdentity(BaseModel): current_snapshot_id: str = Field( description=( "UUID of the snapshot in `component_snapshots` that represents " - "the current state of this identity." + "the current snapshot of this component." ) ) created: str = Field( - description="ISO timestamp when this identity was first recorded" + description="ISO timestamp when this component was first recorded" ) lastmodified: str = Field( - description="ISO timestamp when this identity was last modified" + description="ISO timestamp when this component was last modified" ) @field_validator('componenttype') @@ -521,7 +521,7 @@ def _validate_parent_identities( class ComponentSnapshot(BaseModel): - """State of one identity at one point in time. Version 0 created at M3.""" + """A snapshot: the state of one component at one point in time. Snapshot v0 created at M3.""" id: str = Field( default_factory=lambda: str(uuid.uuid4()), alias="_id", @@ -532,8 +532,8 @@ class ComponentSnapshot(BaseModel): ) version: int = Field( description=( - "Per-identity monotonic version, zero-based. First snapshot for " - "an identity is `0`. Unique on (identity_id, version). " + "Per-component monotonic snapshot number, zero-based. First snapshot for " + "a component is `0`. Unique on (identity_id, version). " "Server-assigned: never accept this field from client payloads; " "the backend computes it (`0` on initial create, " "`max(existing)+1` on snapshot evolution)." @@ -543,14 +543,14 @@ class ComponentSnapshot(BaseModel): default=False, description=( "True when this snapshot represents a hypothetical / proposal " - "(not yet realized on the physical element). Migrated snapshots " + "(not yet realized on the physical component). Migrated snapshots " "from legacy are `False`." ) ) name: Optional[str] = Field( 'Unnamed Component', description=( - "Human readable name for this state (can change across " + "Human readable name for this snapshot (can change across " "snapshots, e.g. on remanufacturing)." ) ) @@ -584,7 +584,7 @@ class ComponentSnapshot(BaseModel): condition: Optional[int] = Field( None, description=( - "Condition grade for this state. 0 = destroyed/retired, " + "Condition grade for this snapshot. 0 = destroyed/retired, " "1 = poor, 2 = average, 3 = good. `None` = unknown." ) ) @@ -595,22 +595,22 @@ class ComponentSnapshot(BaseModel): location: Optional[ComponentLocation] = Field( {'lat': 0.0, 'lon': 0.0}, description=( - "Geographic location of the element at the time of this snapshot. " + "Geographic location of the component at the time of this snapshot. " "PATCH-able on the current snapshot without creating a new one." ) ) processes: Optional[Dict] = Field( default_factory=dict, - description="Manufacturing or processing information for this state" + description="Manufacturing or processing information for this snapshot" ) iframe: ComponentFrame = Field( description=( - "Insertion frame / transformation matrix for this state" + "Insertion frame / transformation matrix for this snapshot" ) ) pca_frame: ComponentFrame = Field( description=( - "PCA frame / principal-component transformation for this state" + "PCA frame / principal-component transformation for this snapshot" ) ) validated: bool = Field( @@ -633,7 +633,7 @@ class ComponentSnapshot(BaseModel): None, description=( "User id of whoever created this snapshot (set on v0 create; " - "records who added the identity to the catalog)" + "records who added the component to the catalog)" ), ) added_by_username: Optional[str] = Field( @@ -646,7 +646,7 @@ class ComponentSnapshot(BaseModel): notes: Optional[str] = Field( None, max_length=5000, - description="Free-text notes for this snapshot state", + description="Free-text notes for this snapshot", ) quantity: int = Field( default=1, @@ -673,7 +673,7 @@ class ComponentSnapshot(BaseModel): description=( "Indices of ``geometry.point_clouds`` whose full cloud is stored " "as a file (``point_clouds//.ply``); set by the " - "upload route. Absent on versions uploaded before the marker " + "upload route. Absent on snapshots uploaded before the marker " "existed. Example: [0]." ), ) diff --git a/src/backend/apps/catalog/permissions.py b/src/backend/apps/catalog/permissions.py index cd9644a6..630b4bc0 100644 --- a/src/backend/apps/catalog/permissions.py +++ b/src/backend/apps/catalog/permissions.py @@ -304,8 +304,9 @@ def _review_verification(viewer: Viewer, roles: Roles, def _revoke_invitation(viewer: Viewer, roles: Roles, target: Target) -> bool: - """Its creator or moderator(D) (8.14).""" - return _author_or_moderator(viewer, roles, target) + """moderator(D) only; the creator loses the right with the role + (8.14, amended by 8.193 c).""" + return 'moderator' in roles RULES: Dict[str, Rule] = { diff --git a/src/backend/apps/catalog/proxies/fit.py b/src/backend/apps/catalog/proxies/fit.py index 113e2a84..d9531daa 100644 --- a/src/backend/apps/catalog/proxies/fit.py +++ b/src/backend/apps/catalog/proxies/fit.py @@ -138,7 +138,7 @@ def fit_primary(source: Source, frame: Dict[str, list], chosen = (spec, fitted, stats, local, signed) break if chosen is None: - raise ValueError(f'no proxy fits a {shape_class} element') + raise ValueError(f'no proxy fits a {shape_class} component') spec, fitted, stats, local, signed = chosen rotation = np.array([fitted.placement['x'], fitted.placement['y'], fitted.placement['z']]) diff --git a/src/backend/apps/catalog/read_models.py b/src/backend/apps/catalog/read_models.py index 868f67de..2f667050 100644 --- a/src/backend/apps/catalog/read_models.py +++ b/src/backend/apps/catalog/read_models.py @@ -29,23 +29,27 @@ # PASSPORT -------------------------------------------------------------------- class ComponentIdentity(documents.ComponentIdentity): - """The identity as the read routes serve it: the stored document plus the + """The component as the read routes serve it: the stored document plus the status of the reservation. ``reserved`` holds the id of the reserving user, which an anonymous caller never gets (8.101); ``is_reserved`` stays for everyone. ``remaining`` is derived for a batch (8.105): its recorded quantity minus the pieces drawn, None for anything else. ``can_undo_deinstall`` says whether the undo of the deinstall act is open - (the passport and the single identity read; False elsewhere). Same + (the passport and the single component read; False elsewhere). Same name as the stored model, so the generated frontend type keeps it.""" is_reserved: bool = False remaining: Optional[int] = None # response-only (8.115 a, P11): true while a deinstall act can still be # taken back; the Actions menu shows "Undo deinstallation" only then can_undo_deinstall: bool = False + # response-only (8.195): a draft or pending version of the element exists. + # Only the fact, for a contributor or moderator of the dataset and admins; + # a constant False for everyone else. Not in the exports. + has_open_snapshot: bool = False class ComponentPassport(BaseModel): - """``GET /identities/{id}/compose``: one identity and its snapshots.""" + """``GET /identities/{id}/compose``: one component and its snapshots.""" identity: ComponentIdentity snapshots: List[ComponentSnapshot] # only with ?include=evidence (spec 7.2): the published evidence, as the @@ -54,9 +58,12 @@ class ComponentPassport(BaseModel): def identity_body(doc: Dict[str, Any]) -> Dict[str, Any]: + """The identity as the read routes serve it. ``has_open_snapshot`` is left + out: only a route that computed it puts it in (8.195), so a write response + or a batch row never claims a False it did not look up.""" return ComponentIdentity.model_validate( {**doc, 'is_reserved': bool(doc.get('reserved'))}).model_dump( - by_alias=True, mode='json') + by_alias=True, mode='json', exclude={'has_open_snapshot'}) def snapshot_body(doc: Dict[str, Any]) -> Dict[str, Any]: @@ -93,15 +100,15 @@ class FitCanHold(BaseModel): """The match of a dimension search *can hold this size* (8.169).""" mode: Literal['can_hold'] waste_mm3: float = Field( - description='box volume of the element minus the asked volume, in mm3') + description='box volume of the component minus the asked volume, in mm3') waste_percent: float = Field( - description='that waste as a share of the box volume of the element, ' + description='that waste as a share of the box volume of the component, ' 'in per cent') class CatalogRow(BaseModel): """ - One catalog list row: identity core + current-snapshot metadata. Not a + One catalog list row: component core + current-snapshot metadata. Not a stored document; the list, map and children routes serve it. """ model_config = ConfigDict(populate_by_name=True) @@ -121,17 +128,17 @@ class CatalogRow(BaseModel): is_public: bool = False has_preview: Optional[bool] = Field( default=None, - description='whether the current state has a rendered preview ' + description='whether the current snapshot has a rendered preview ' '(list rows only; absent elsewhere)') current_snapshot_id: Optional[str] = None fit: Optional[Union[FitAbout, FitCanHold]] = Field( default=None, - description='how close the element is to the asked size, while the ' + description='how close the component is to the asked size, while the ' 'list has a dimension search (fit_mode); absent otherwise') distance_m: Optional[float] = Field( default=None, description='distance in metres from the near point of the list ' - '(near_lat, near_lon) to the element, on the layer asked ' + '(near_lat, near_lon) to the component, on the layer asked ' '(near_layer); absent without a near search') # current snapshot identity_id: str @@ -154,7 +161,7 @@ class CatalogRow(BaseModel): class LocationPoint(BaseModel): - """One element on the location map (``GET /identities/locations``): where + """One component on the location map (``GET /identities/locations``): where it is and what the map colours and labels it by.""" id: str catalog_number: Optional[int] = None @@ -175,11 +182,11 @@ class LocationMap(BaseModel): """The points of the location map (decisions 8.170, 8.171).""" layer: Literal['current', 'origin'] total: int = Field( - description='the elements this caller may see that match the filters') + description='the components this caller may see that match the filters') displayed: int = Field( description='of those, the ones with a point on the layer') left_out: int = Field( - description='the elements without a point on the layer') + description='the components without a point on the layer') points: List[LocationPoint] @@ -194,15 +201,15 @@ class SimilarPiece(BaseModel): class SimilarPieces(BaseModel): - """``GET /identities/{id}/similar``: the nearest elements by descriptor.""" + """``GET /identities/{id}/similar``: the nearest components by descriptor.""" query_id: str basis: Literal['radial_signature', 'scalars', 'hks'] basis_label: str computed_at: Optional[str] = Field( default=None, description='when the matrix of the catalog was built') considered: int = Field( - description='how many visible elements that pass the filters were ' - 'ranked (the query element not among them)') + description='how many visible components that pass the filters were ' + 'ranked (the query component not among them)') results: List[SimilarPiece] @@ -294,17 +301,19 @@ class PendingSnapshotItem(BaseModel): original_function: Optional[str] = None material: Optional[str] = None dataset: Optional[str] = None + identity_withdrawn: bool = Field( + default=False, description='the component is withdrawn (8.190): no publish') live_version: Optional[int] = Field( default=None, - description='Version of the identity\'s current snapshot, if any') + description='Number of the current snapshot of the component, if any') supersedes: Optional[str] = Field( default=None, description='set when this corrects a published one') added_by_username: Optional[str] = None class MySnapshotItem(BaseModel): - """Row for ``GET /snapshots?mine=1``: one of the caller's own versions, - with the element it belongs to and, for a rejected one, the reason.""" + """Row for ``GET /snapshots?mine=1``: one of the caller's own snapshots, + with the component it belongs to and, for a rejected one, the reason.""" model_config = ConfigDict(populate_by_name=True) id: str = Field(alias='_id') @@ -319,6 +328,8 @@ class MySnapshotItem(BaseModel): original_function: Optional[str] = None material: Optional[str] = None dataset: Optional[str] = None + identity_withdrawn: bool = Field( + default=False, description='the component is withdrawn (8.190): no submit') supersedes: Optional[str] = Field( default=None, description='set when this corrects a published one') rejection_reason: Optional[str] = Field( diff --git a/src/backend/apps/catalog/vocab.py b/src/backend/apps/catalog/vocab.py index 086037e6..d8c4ed5d 100644 --- a/src/backend/apps/catalog/vocab.py +++ b/src/backend/apps/catalog/vocab.py @@ -189,7 +189,7 @@ 'withdraw': 'Withdrawn', 'reinstate': 'Reinstated', 'migration': 'Migration', - 'derived_exit': 'Cut into elements', + 'derived_exit': 'Cut into components', 'deinstall': 'Deinstalled', 'undo_deinstall': 'Deinstallation undone', 'verify': 'Verification changed', @@ -564,7 +564,7 @@ class MaterialSeed: '17 06 04'), MaterialSeed('polymer_foam', 'Polymer foam insulation (EPS, XPS, PUR/PIR)', 'insulation', '17 06 04'), - MaterialSeed('mixed', 'Mixed / composite element', 'other', '17 09 04'), + MaterialSeed('mixed', 'Mixed / composite component', 'other', '17 09 04'), MaterialSeed('unknown', 'Unknown', 'other', '17 09 04'), ) MATERIAL_SEED_BY_ID: Dict[str, MaterialSeed] = { @@ -675,7 +675,7 @@ class MaterialSeed: 'IfcRailing': 'A railing or balustrade.', 'IfcDuctSegment': 'A length of ventilation duct.', 'IfcBuildingElementProxy': 'The former function is not known.', - 'CscDebris': 'No former function as a single element: rubble, aggregate, fragments.', + 'CscDebris': 'No former function as a single component: rubble, aggregate, fragments.', }, 'shape_class': { 'linear': 'One extent is much larger than the other two, like a beam or a column.', @@ -686,18 +686,18 @@ class MaterialSeed: }, 'origin_kind': { 'deinstallation': 'Taken out of a construction work in which it was installed.', - 'demolition': 'Recovered from demolition output, not taken out as a single element.', + 'demolition': 'Recovered from demolition output, not taken out as a single component.', 'offcut': 'Residue of a fabrication process; it was never installed.', 'surplus': 'An unused whole product: overstock, a return or a site leftover.', - 'unknown': 'Where the element came from is not recorded.', + 'unknown': 'Where the component came from is not recorded.', }, 'exit_kind': { - 'split': 'Cut into smaller elements; they are catalogued as children of this element.', - 'merged': 'Joined with other elements into a new element, which is catalogued as its child.', - 'installed': 'Built into a construction work. The element still exists and may come back.', - 'recycled': 'The material was recovered, for example crushed or melted; the element is gone.', + 'split': 'Cut into smaller components; they are catalogued as children of this component.', + 'merged': 'Joined with other components into a new component, which is catalogued as its child.', + 'installed': 'Built into a construction work. The component still exists and may come back.', + 'recycled': 'The material was recovered, for example crushed or melted; the component is gone.', 'disposed': 'Disposed of as waste.', - 'returned': 'Given back to its owner or supplier. The element exists but left the custody of the catalog.', + 'returned': 'Given back to its owner or supplier. The component exists but left the custody of the catalog.', 'lost': 'Its whereabouts are not recorded.', }, 'status': { @@ -753,24 +753,24 @@ class MaterialSeed: 'polymer': 'Plastics and plastic composites, such as acrylic, PVC and solid surface.', 'bituminous': 'Asphalt and bituminous membranes.', 'insulation': 'Mineral wool and polymer foam insulation.', - 'other': 'Mixed or composite elements, and materials not known.', + 'other': 'Mixed or composite components, and materials not known.', }, 'evidence_method': { 'rebound_hammer': 'A rebound hammer test of concrete: at least nine readings, no strength by itself.', 'core_compression': 'A drilled core crushed in a press; a destructive test with a measured strength.', - 'archival_document': 'A drawing, report, type plate or marking that documents the element; it may carry a claim.', + 'archival_document': 'A drawing, report, type plate or marking that documents the component; it may carry a claim.', 'visual_inspection': 'An observation of the condition: cracks, spalling, corrosion or an overall grade.', 'era_heuristic': 'An estimate from the year of construction, the regional practice or the type.', 'manufacturer_datasheet': 'A claim from the manufacturer of the product.', - 'reinforcement_layout': 'The reinforcement bars of the element as centre lines in its coordinates.', + 'reinforcement_layout': 'The reinforcement bars of the component as centre lines in its coordinates.', }, 'source_tier': { 'destructive': 'A test that destroys a sample. For most quantities the most trusted source.', - 'ndt': 'A test that leaves the element intact, with an instrument.', + 'ndt': 'A test that leaves the component intact, with an instrument.', 'archival': 'A claim from a document, a drawing or a datasheet.', 'visual': 'An observation by a person.', 'heuristic': 'An estimate from rules of thumb. The least trusted source.', - 'inherited': 'Taken over from a parent element, with a lower confidence.', + 'inherited': 'Taken over from a parent component, with a lower confidence.', }, 'verification_state': { 'unverified': 'No one has confirmed it yet. It counts with a low weight.', @@ -792,7 +792,7 @@ class MaterialSeed: 'exposure_class': 'Exposure class of the concrete after EN 206, such as XC3.', 'chloride_content': 'Chloride content, as a percentage of the mass of cement.', 'elastic_modulus': 'Stiffness of the material (GPa).', - 'mass': 'Weight of the element in this state (kg).', + 'mass': 'Weight of the component in this snapshot (kg).', 'carbonation_depth': 'Depth to which the concrete is carbonated (mm).', 'spalling': 'Severity of spalled concrete, from 0 (none) to 3 (severe).', 'cracking': 'Severity of cracking, from 0 (none) to 3 (severe).', diff --git a/src/backend/csc_version.py b/src/backend/csc_version.py index 16ea2ebb..dc603e07 100644 --- a/src/backend/csc_version.py +++ b/src/backend/csc_version.py @@ -6,7 +6,7 @@ against VERSION, package.json and the release tag by scripts/ci/check_version.py. """ -CSC_VERSION = '0.6.4.4' +CSC_VERSION = '0.6.4.5' def release_tag(version: str = CSC_VERSION) -> str: diff --git a/src/backend/main_fastapi.py b/src/backend/main_fastapi.py index bf9501ce..8c5d48e1 100644 --- a/src/backend/main_fastapi.py +++ b/src/backend/main_fastapi.py @@ -176,6 +176,10 @@ async def lifespan(app: FastAPI): await app.mongodb_component_snapshots.create_index( 'derivation_due', name='derivation_due_marked', partialFilterExpression=DUE_INDEX['partialFilterExpression']) + # has_open_snapshot (8.195): one find_one on the element and the open + # statuses + await app.mongodb_component_snapshots.create_index( + [('identity_id', 1), ('status', 1)]) await app.mongodb_component_evidence.create_index('identity_id') await app.mongodb_component_evidence.create_index( [('status', 1), ('method', 1)]) diff --git a/src/backend/templates/mail/dataset_created.html.j2 b/src/backend/templates/mail/dataset_created.html.j2 index e65e9ceb..ab333720 100644 --- a/src/backend/templates/mail/dataset_created.html.j2 +++ b/src/backend/templates/mail/dataset_created.html.j2 @@ -2,5 +2,5 @@ {% from "_macros.html.j2" import p %} {% block body %} {% call p() %}{{ by_name }} created the dataset "{{ dataset_name }}" ({{ slug }}).{% endcall %} -{% call p() %}It is visible to its members only, and its elements cannot be made public until you have reviewed it.{% endcall %} +{% call p() %}It is visible to its members only, and its components cannot be made public until you have reviewed it.{% endcall %} {% endblock %} diff --git a/src/backend/templates/mail/dataset_created.txt.j2 b/src/backend/templates/mail/dataset_created.txt.j2 index 08d9b8b3..d2b672f3 100644 --- a/src/backend/templates/mail/dataset_created.txt.j2 +++ b/src/backend/templates/mail/dataset_created.txt.j2 @@ -2,5 +2,5 @@ {% block body -%} {{ by_name }} created the dataset "{{ dataset_name }}" ({{ slug }}). -It is visible to its members only, and its elements cannot be made public until you have reviewed it. +It is visible to its members only, and its components cannot be made public until you have reviewed it. {%- endblock %} diff --git a/src/frontend/app/admin/datasets/[did]/page.tsx b/src/frontend/app/admin/datasets/[did]/page.tsx index 46c98a49..2ee05318 100644 --- a/src/frontend/app/admin/datasets/[did]/page.tsx +++ b/src/frontend/app/admin/datasets/[did]/page.tsx @@ -37,7 +37,7 @@ import { } from '@/components/ui/table' import { Textarea } from '@/components/ui/textarea' import InviteDialog from '@/components/admin/InviteDialog' -import { addMemberHint, memberLabel, memberLine } from '@/lib/members' +import { addMemberHint, deleteDatasetReason, lastModeratorReason, memberLabel, memberLine } from '@/lib/members' import InvitationsTable from '@/components/admin/InvitationsTable' import RoleCheckboxes, { type DatasetRole } from '@/components/admin/RoleCheckboxes' import type { @@ -202,7 +202,7 @@ function DatasetSettings({ dataset, isAdmin, onSaved }: {

{waiting ? REVIEW_EXPLANATION - : 'An administrator has looked at this dataset: it may be visible to all signed-in users and its elements may be made public.'} + : 'An administrator has looked at this dataset: it may be visible to all signed-in users and its components may be made public.'}

setVisibility(v as DatasetView['visibility'])}> - Members only (and elements marked public) + Members only (and components marked public) All signed-in users @@ -270,7 +270,7 @@ function PublicPiecesCard({ dataset }: { dataset: DatasetView }) { const result = await backendJson<{ changed: number; skipped?: number }>(path, { method: 'POST', body: { is_public: isPublic }, }) - toast.success(`${result.changed} element${result.changed === 1 ? '' : 's'} now ${isPublic ? 'public' : 'private'}` + toast.success(`${result.changed} component${result.changed === 1 ? '' : 's'} now ${isPublic ? 'public' : 'private'}` + (result.skipped ? `; ${result.skipped} changed meanwhile and were left as they were` : '')) await count() } catch (err) { @@ -284,10 +284,10 @@ function PublicPiecesCard({ dataset }: { dataset: DatasetView }) { return ( - Public elements + Public components - Sets the public flag of every published element of this dataset at once. Unpublished and withdrawn - elements, and other datasets, stay as they are. Every element keeps its own flag: children do not follow + Sets the public flag of every published component of this dataset at once. Unpublished and withdrawn + components, and other datasets, stay as they are. Every component keeps its own flag: children do not follow their parents. @@ -312,8 +312,8 @@ function PublicPiecesCard({ dataset }: { dataset: DatasetView }) { { if (!busy) setConfirm(open) }} - title={`Make ${counts.toPublic ?? 'all'} published elements public?`} - subject={`${counts.toPublic ?? 'All'} published element${counts.toPublic === 1 ? '' : 's'} of ${dataset.name} become public.`} + title={`Make ${counts.toPublic ?? 'all'} published components public?`} + subject={`${counts.toPublic ?? 'All'} published component${counts.toPublic === 1 ? '' : 's'} of ${dataset.name} become public.`} confirmLabel="Make public" onConfirm={() => void apply(true)} /> @@ -332,11 +332,22 @@ function DeleteDatasetCard({ dataset }: { dataset: DatasetView }) { const { refresh } = useMe() const { confirm, dialog } = useConfirm() const [busy, setBusy] = useState(false) + // the list counts the published elements the caller sees (the dataset itself carries no count) + const [count, setCount] = useState(null) + useEffect(() => { + let cancelled = false + backendJson('/datasets') + .then((rows) => { if (!cancelled) setCount(rows.find((row) => row._id === dataset._id)?.component_count ?? null) }) + .catch(() => { if (!cancelled) setCount(null) }) + return () => { cancelled = true } + }, [dataset._id]) + const blocked = deleteDatasetReason(count) const remove = async () => { const ok = await confirm({ title: `Delete ${dataset.name}?`, - description: 'The dataset and its open invitations are deleted. Its members keep their accounts. This cannot be undone.', + description: 'The dataset and its open invitations are deleted. Its members keep their accounts. It must hold no component at all: ' + + 'a draft, a withdrawn or a private one counts too, and the server refuses the delete then. This cannot be undone.', confirmLabel: 'Delete the dataset', destructive: true, }) @@ -360,14 +371,16 @@ function DeleteDatasetCard({ dataset }: { dataset: DatasetView }) { Delete this dataset - Only possible while the dataset holds no element: move its elements to another dataset first. Open + Only possible while the dataset holds no component: move its components to another dataset first. Open invitations are revoked with it. - - void remove()}> + + void remove()}> Delete the dataset + {blocked &&

{blocked}

}
) @@ -383,6 +396,8 @@ function MembersCard({ onChanged: () => void }) { const members = dataset.members ?? [] + // the reason a locked box or button carries only as a tooltip, in text as well (8.139 g) + const lockNote = members.map((member) => lastModeratorReason(members, member, isAdmin)).find(Boolean) const { confirm, dialog } = useConfirm() const setRoles = async (member: DatasetMemberView, roles: DatasetRole[]) => { if (roles.length === 0 && !(await confirm({ @@ -441,11 +456,17 @@ function MembersCard({ idPrefix={`m-${member.user_id}`} compact value={member.roles as DatasetRole[]} + locked={(() => { + const reason = lastModeratorReason(members, member, isAdmin) + return reason ? { moderator: reason } : undefined + })()} onChange={(roles) => void setRoles(member, roles)} /> void setRoles(member, [])}> @@ -455,6 +476,7 @@ function MembersCard({ )} + {lockNote &&

{lockNote}

} ) diff --git a/src/frontend/app/admin/validation/page.tsx b/src/frontend/app/admin/validation/page.tsx index 116d41eb..1492f599 100644 --- a/src/frontend/app/admin/validation/page.tsx +++ b/src/frontend/app/admin/validation/page.tsx @@ -15,7 +15,7 @@ type Tab = 'snapshots' | 'evidence' | 'verification' const TAB_HELP: Record = { snapshots: - 'Versions of components waiting in the datasets you moderate, oldest first. Publishing makes a version the current state of its component; a rejection goes back to its author with your reason.', + 'Snapshots of components waiting in the datasets you moderate, oldest first. Publishing makes a snapshot the current snapshot of its component; a rejection goes back to its author with your reason.', evidence: 'Records waiting in the datasets you moderate, oldest first. Publishing freezes a record and updates the properties of its component; a rejection goes back to its author with your reason.', verification: diff --git a/src/frontend/app/analytics/page.tsx b/src/frontend/app/analytics/page.tsx index 1b09865b..8d345a0f 100644 --- a/src/frontend/app/analytics/page.tsx +++ b/src/frontend/app/analytics/page.tsx @@ -215,7 +215,7 @@ function Analytics() { - + ({ ...d, label: String(d.label) }))} @@ -227,7 +227,7 @@ function Analytics() { {data && activeTab === 'types' && ( - + )} diff --git a/src/frontend/app/components/[component_id]/page.tsx b/src/frontend/app/components/[component_id]/page.tsx index 5e344f70..02d7ee17 100644 --- a/src/frontend/app/components/[component_id]/page.tsx +++ b/src/frontend/app/components/[component_id]/page.tsx @@ -4,10 +4,10 @@ import type { CatalogComponent } from '@/generated/CatalogModels' import { primarySnapshot, type CatalogShallowRow } from '@/generated/catalogExtras' import type { SnapshotSummaryItem } from '@/generated/SnapshotModels' import { isPublished } from '@/components/components/componentDetailShared' -import Link from 'next/link' import ComponentAccessNotice from '@/components/components/ComponentAccessNotice' import ComponentSnapshotVersionList from '@/components/components/ComponentSnapshotVersionList' import { isTombstone } from '@/lib/backend' +import { newestVersionRow } from '@/lib/newestVersion' import { serverBackend } from '@/lib/serverBackend' import { redirect, notFound } from 'next/navigation' @@ -80,42 +80,46 @@ export default async function ComponentDetailPage({ /> ) } - const catalog = body as CatalogComponent + let catalog = body as CatalogComponent + const versionsKnown = snapshotsRes.ok + const snapshots: SnapshotSummaryItem[] = versionsKnown ? ((await snapshotsRes.json()) as SnapshotSummaryItem[]) : [] + // no current version: every version withdrawn, or none published yet. The page is then built on the + // newest version, with a banner, so that the controls of the element are there (8.193, reviewer F1); + // a caller who may not read that version (an outsider with bare rows) keeps the notice if (!catalog.snapshots?.length) { - // the author and the moderators of a piece nobody has published yet see - // its versions (draft, pending, rejected) and their buttons (spec 3.1.5, 7.0) - const inFlight: SnapshotSummaryItem[] = snapshotsRes.ok ? ((await snapshotsRes.json()) as SnapshotSummaryItem[]) : [] - return ( - <> - - {inFlight.length > 0 && ( -
- - - Edit details of the latest version - -
- )} - - ) + const newest = newestVersionRow(snapshots) + const again = newest + ? await serverBackend( + `/identities/${encodeURIComponent(component_id)}/compose?${new URLSearchParams({ snapshots: newest._id })}`) + : null + const shown = again?.ok ? ((await again.json()) as unknown) : null + if (shown && !isTombstone(shown) && (shown as CatalogComponent).snapshots?.length) { + catalog = shown as CatalogComponent + } else { + return ( + <> + + {snapshots.length > 0 && ( +
+ +
+ )} + + ) + } } const snapshot = primarySnapshot(catalog) - let snapshots: SnapshotSummaryItem[] = [] - if (snapshotsRes.ok) { - snapshots = (await snapshotsRes.json()) as SnapshotSummaryItem[] - } let childIdentities: CatalogShallowRow[] = [] if (childrenRes.ok) { const body = (await childrenRes.json()) as CatalogShallowRow[] @@ -126,12 +130,14 @@ export default async function ComponentDetailPage({ const liveSnapshotId = String(catalog.identity.current_snapshot_id ?? '') const activeSnapshotId = String(snapshot._id ?? liveSnapshotId) - const isViewingLive = activeSnapshotId === liveSnapshotId - const liveVersion = - snapshots.find((row) => row._id === liveSnapshotId)?.version ?? - (typeof snapshot.version === 'number' && isViewingLive - ? snapshot.version - : snapshots.find((row) => row.is_current)?.version ?? 0) + // no current version, however the version was opened (default or ?snapshots=): nothing to go back to + const isViewingLive = !!liveSnapshotId && activeSnapshotId === liveSnapshotId + const liveVersion = !liveSnapshotId + ? null + : snapshots.find((row) => row._id === liveSnapshotId)?.version ?? + (typeof snapshot.version === 'number' && isViewingLive + ? snapshot.version + : snapshots.find((row) => row.is_current)?.version ?? 0) const viewingVersion = typeof snapshot.version === 'number' ? snapshot.version @@ -141,6 +147,7 @@ export default async function ComponentDetailPage({ Grasshopper

Components for Rhino 8 and Grasshopper that read from and write to the catalog: fetch components, record - states and evidence, compute frames and descriptors. + snapshots and evidence, compute frames and descriptors.

diff --git a/src/frontend/app/layout.tsx b/src/frontend/app/layout.tsx index 9b06823b..ceeb823b 100644 --- a/src/frontend/app/layout.tsx +++ b/src/frontend/app/layout.tsx @@ -19,7 +19,7 @@ const inter = Inter({ subsets: ['latin'] }) export const metadata: Metadata = { title: 'CSC - Catalog of Second Chances', - description: 'A components and materials database.', + description: 'A digital database for reclaimed architectural components.', } // Beta/gh-interface flags come from the server's .env at request time. Without diff --git a/src/frontend/app/my-work/page.tsx b/src/frontend/app/my-work/page.tsx index 0e820d07..a200088d 100644 --- a/src/frontend/app/my-work/page.tsx +++ b/src/frontend/app/my-work/page.tsx @@ -29,6 +29,7 @@ import { submitRecords, submittableKeys, waitingLines, + WITHDRAWN_DRAFT_NOTE, type MyRecord, type Piece, type SubmitResult, @@ -323,6 +324,9 @@ function MyRecords({ enabled }: { enabled: boolean }) { {[row.piece, row.dataset].filter(Boolean).join(' / ')} + {row.status === 'draft' && row.identityWithdrawn && ( +

{WITHDRAWN_DRAFT_NOTE}

+ )} {row.status === 'rejected' && row.reason && (

Reason: {row.reason}

)} diff --git a/src/frontend/app/page.tsx b/src/frontend/app/page.tsx index 9cd596c4..b70d1c20 100644 --- a/src/frontend/app/page.tsx +++ b/src/frontend/app/page.tsx @@ -61,8 +61,8 @@ export default function Home() {

On the web

-

Browse and filter components, open an element with its geometry and records, and on site record - elements and evidence from a phone.

+

Browse and filter components, open a component with its geometry and records, and on site record + components and evidence from a phone.

In Grasshopper

diff --git a/src/frontend/app/reference/page.tsx b/src/frontend/app/reference/page.tsx index f7ea1ad2..e9e775b6 100644 --- a/src/frontend/app/reference/page.tsx +++ b/src/frontend/app/reference/page.tsx @@ -197,7 +197,7 @@ export default function ReferencePage() { ), example: ( - +

{EXAMPLE_ID_NOTE}

void disabled?: boolean compact?: boolean + /** Roles that cannot be taken away now, with the reason (the last moderator, 8.139 g). */ + locked?: Partial> }) { const toggle = (role: DatasetRole, checked: boolean) => { const next = new Set(value) @@ -39,7 +42,8 @@ export default function RoleCheckboxes({ id={`${idPrefix}-${role.value}`} checked={value.includes(role.value)} onCheckedChange={(checked) => toggle(role.value, checked === true)} - disabled={disabled} + disabled={disabled || (!!locked?.[role.value] && value.includes(role.value))} + title={value.includes(role.value) ? locked?.[role.value] : undefined} />
- - Back to live (v{liveVersion}) - + {liveVersion !== null && ( + + Back to live (v{liveVersion}) + + )} ) } diff --git a/src/frontend/components/components/ComponentLocateById.tsx b/src/frontend/components/components/ComponentLocateById.tsx index 46a2cbb9..2c622a60 100644 --- a/src/frontend/components/components/ComponentLocateById.tsx +++ b/src/frontend/components/components/ComponentLocateById.tsx @@ -76,7 +76,7 @@ const ComponentLocateById: React.FC = ({ presetReferenceID }) => { ? 'border-destructive' : 'border-border' const message = !referenceID - ? 'Scan or paste the id of the element you look for.' + ? 'Scan or paste the id of the component you look for.' : 'Tap to start the camera and scan tags until one matches.' return ( @@ -102,12 +102,12 @@ const ComponentLocateById: React.FC = ({ presetReferenceID }) => { {matched && (

- This is the element you look for. + This is the component you look for.

)} {status === 'bad' && (

- This is not the element you look for. + This is not the component you look for.

)} diff --git a/src/frontend/components/components/ComponentProvenanceCard.tsx b/src/frontend/components/components/ComponentProvenanceCard.tsx index b49cc497..7941be07 100644 --- a/src/frontend/components/components/ComponentProvenanceCard.tsx +++ b/src/frontend/components/components/ComponentProvenanceCard.tsx @@ -14,6 +14,7 @@ import { import type { CatalogShallowRow } from '@/generated/catalogExtras' import InheritedMark from '@/components/lineage/InheritedMark' import ProvenanceEditDialog from '@/components/lineage/ProvenanceEditDialog' +import { everPublished } from '@/lib/everPublished' import { useMe } from '@/lib/me' import ComponentLineageIdentityBadges from './ComponentLineageIdentityBadges' import { @@ -59,20 +60,24 @@ const formatDate = formatDateAtPrecision type ComponentProvenanceCardProps = { catalog: CatalogComponent childIdentities?: CatalogShallowRow[] + /** the version rows: published once is not the same as a current version (8.193) */ + snapshots?: readonly { status?: string | null }[] } export default function ComponentProvenanceCard({ catalog, childIdentities = [], + snapshots, }: ComponentProvenanceCardProps) { const { identity } = catalog const parentIds = parentIdentityIds(identity) const origin = identity.origin const { me, moderates } = useMe() const [editOpen, setEditOpen] = useState(false) - // moderator(D); the creator while it is unpublished (8.9) --- the backend decides + // moderator(D); the creator while nothing was ever published (8.9, 8.193) --- the backend decides const canEdit = !!me && (moderates(identity.dataset) - || (!identity.current_snapshot_id && me._id === identity.created_by_user_id)) + || (!everPublished({ currentSnapshotId: identity.current_snapshot_id, versions: snapshots }) + && me._id === identity.created_by_user_id)) const [parentStatuses, setParentStatuses] = useState>({}) const childBadges = childIdentities.flatMap((row) => { diff --git a/src/frontend/components/components/ComponentSnapshotVersionList.tsx b/src/frontend/components/components/ComponentSnapshotVersionList.tsx index 8ce13005..0a350fc1 100644 --- a/src/frontend/components/components/ComponentSnapshotVersionList.tsx +++ b/src/frontend/components/components/ComponentSnapshotVersionList.tsx @@ -15,6 +15,10 @@ type ComponentSnapshotVersionListProps = { liveSnapshotId: string /** The identity's dataset: decides who sees moderation buttons. */ dataset?: string | null + /** `has_open_snapshot` of the element (8.195) */ + hasOpenSnapshot?: boolean + /** the element is withdrawn (8.190) */ + identityWithdrawn?: boolean } function versionHref(identityId: string, row: SnapshotSummaryItem): string { @@ -38,6 +42,8 @@ export default function ComponentSnapshotVersionList({ activeSnapshotId, liveSnapshotId, dataset, + hasOpenSnapshot, + identityWithdrawn, }: ComponentSnapshotVersionListProps) { const hasPendingUpdate = snapshots.some( (row) => row.status === 'pending' && !row.is_current, @@ -52,7 +58,7 @@ export default function ComponentSnapshotVersionList({

- Snapshot versions + Snapshots

@@ -61,7 +67,7 @@ export default function ComponentSnapshotVersionList({ role="status" className="mb-3 rounded-md border border-amber-300 bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:border-amber-700 dark:bg-amber-950/40 dark:text-amber-100" > - A newer snapshot is awaiting moderation. The current version shown + A newer snapshot is awaiting moderation. The current snapshot shown above remains unchanged until it is published. )} @@ -115,7 +121,7 @@ export default function ComponentSnapshotVersionList({ Geometry not processed @@ -124,13 +130,14 @@ export default function ComponentSnapshotVersionList({
since {formatDay(row.effective_from)}
- +
diff --git a/src/frontend/components/components/ComponentViewer.tsx b/src/frontend/components/components/ComponentViewer.tsx index efa8add1..caf1d6c0 100644 --- a/src/frontend/components/components/ComponentViewer.tsx +++ b/src/frontend/components/components/ComponentViewer.tsx @@ -538,7 +538,7 @@ async function loadExternalMeshes( mode: MeshFileLevel, snapshotRouting: SnapshotMeshRouting | null, ): Promise { - debugLog(`Loading ${mode} meshes for identity ${identityId}`) + debugLog(`Loading ${mode} meshes for component ${identityId}`) const hint = meshHintForCache(snapshotRouting) const cacheKey = `${identityId}:mesh:${mode}:${hint}` @@ -604,7 +604,7 @@ async function loadExternalPointClouds( snapshotRouting: SnapshotMeshRouting | null, pointCloudCount: number, ): Promise { - debugLog(`Loading original point clouds for identity ${identityId}`) + debugLog(`Loading original point clouds for component ${identityId}`) const hint = meshHintForCache(snapshotRouting) const cacheKey = `${identityId}:pc:${hint}:count${pointCloudCount}` @@ -1163,7 +1163,7 @@ function LayoutEntry({ label, status, onClear }: { label: string; status?: strin const LAYOUT_NOTES: Record = { hidden: 'This layout is not visible to you.', failed: 'This layout could not be loaded.', - other_version: 'This layout belongs to another version of the element and is not drawn here.', + other_version: 'This layout belongs to another snapshot of the component and is not drawn here.', no_bars: 'This layout has no bars to draw.', } diff --git a/src/frontend/components/components/detail/AddEvidenceButton.tsx b/src/frontend/components/components/detail/AddEvidenceButton.tsx index 1a55ae30..720c7fee 100644 --- a/src/frontend/components/components/detail/AddEvidenceButton.tsx +++ b/src/frontend/components/components/detail/AddEvidenceButton.tsx @@ -18,15 +18,18 @@ export default function AddEvidenceButton({ dataset, withdrawn, currentSnapshotId, + versions, }: { identityId: string dataset?: string | null withdrawn?: unknown currentSnapshotId?: string | null + /** the rows of the version list: published once is not the same as a current version (8.193) */ + versions?: readonly { status?: string | null }[] | null }) { const { me, isAdmin, rolesIn } = useMe() const href = addEvidenceHref(identityId, - canAddEvidence({ signedIn: !!me, isAdmin, roles: dataset ? rolesIn(dataset) : [], withdrawn, currentSnapshotId })) + canAddEvidence({ signedIn: !!me, isAdmin, roles: dataset ? rolesIn(dataset) : [], withdrawn, currentSnapshotId, versions })) if (!href) return null return ( {showCorrected && [...corrected].sort(newestFirst).map((record) => ( + shownIds={shownIds} identityWithdrawn={!!identity.withdrawn} /> ))} )} diff --git a/src/frontend/components/components/detail/ComponentSimilarCard.tsx b/src/frontend/components/components/detail/ComponentSimilarCard.tsx index 2db4b526..a89d72a6 100644 --- a/src/frontend/components/components/detail/ComponentSimilarCard.tsx +++ b/src/frontend/components/components/detail/ComponentSimilarCard.tsx @@ -34,9 +34,9 @@ import { } from '@/lib/similarPieces' import ComponentPreviewImage from '../ComponentPreviewImage' -const HELP = 'The elements whose shape is closest to this one, compared over the whole radial signature of ' - + 'each element (not the two-dimensional similarity map). Similar in outline and size: the signature ' - + 'measures distances from the centre of the element. Only elements in circulation that you may see are compared.' +const HELP = 'The components whose shape is closest to this one, compared over the whole radial signature of ' + + 'each component (not the two-dimensional similarity map). Similar in outline and size: the signature ' + + 'measures distances from the centre of the component. Only components in circulation that you may see are compared.' function Neighbour({ item }: { item: SimilarPiece }) { const row = item.piece @@ -110,12 +110,12 @@ export default function ComponentSimilarCard({ identityId }: { identityId: strin const label = toggleLabel(card.pieces.length, expanded) return ( -

- Similar elements - + Similar components +

    {shownPieces(card.pieces, expanded).map((item) => )} diff --git a/src/frontend/components/components/detail/HistoryList.tsx b/src/frontend/components/components/detail/HistoryList.tsx index c2f26f03..22bff86f 100644 --- a/src/frontend/components/components/detail/HistoryList.tsx +++ b/src/frontend/components/components/detail/HistoryList.tsx @@ -45,9 +45,9 @@ export type TimelineEvent = HistoryEvent & { } const SECTIONS: Record = { - before_cataloguing: 'Before the element was catalogued', + before_cataloguing: 'Before the component was catalogued', history: 'In the catalog', - after_leaving_circulation: 'After the element left circulation', + after_leaving_circulation: 'After the component left circulation', } function Related({ event }: { event: LineageEvent }) { @@ -99,7 +99,7 @@ function Row({ event }: { event: TimelineEvent | LineageEvent }) { icon = text = ( <> - State v{e.version}{e.name ? ` ${e.name}` : ''} + Snapshot v{e.version}{e.name ? ` ${e.name}` : ''} {e.status && e.status !== 'published' ? `, ${e.status}` : ''} {e.corrected ? ', corrected' : ''} {e.corrects ? ', a correction' : ''} @@ -118,7 +118,7 @@ function Row({ event }: { event: TimelineEvent | LineageEvent }) { {e.corrects ? ', a correction' : ''} {e.verification && e.verification !== 'unverified' ? `, ${vocabLabel(VERIFICATION_STATE_LABELS, e.verification).toLowerCase()}` : ''} - {e.resolution === 'approximate' ? ' (state approximate)' : ''} + {e.resolution === 'approximate' ? ' (snapshot approximate)' : ''} ) : <>Evidence record, withdrawn break @@ -155,7 +155,7 @@ export default function HistoryList({ events, lineage, layers }: {

    {SECTIONS[section.id]}

    - {section.id !== 'history' && outside the folded states} + {section.id !== 'history' && outside the folded snapshots}
      {section.rows.map((event, i) => ( diff --git a/src/frontend/components/components/history/SwimlaneGraph.tsx b/src/frontend/components/components/history/SwimlaneGraph.tsx index 10c413ef..30df3091 100644 --- a/src/frontend/components/components/history/SwimlaneGraph.tsx +++ b/src/frontend/components/components/history/SwimlaneGraph.tsx @@ -189,7 +189,7 @@ export default function SwimlaneGraph({ } if (target.openCorrected) setShowCorrected(true) if (!(await scrollToRecord(target.recordId))) { - toast.message('That record is not on this version of the page.') + toast.message('That record is not on this snapshot of the page.') } } @@ -291,13 +291,13 @@ export default function SwimlaneGraph({

      - Time is in sections and not to scale. Click a version to show it, a number to open its records. + Time is in sections and not to scale. Click a snapshot to show it, a number to open its records.

      -
        +
          {layout.lanes.map(({ lane }) => (
        • {lane.visible && lane.role !== 'piece' ? ( @@ -310,7 +310,7 @@ export default function SwimlaneGraph({ )} - {lane.role === 'parent' ? 'parent' : lane.role === 'child' ? 'child' : 'this element'} + {lane.role === 'parent' ? 'parent' : lane.role === 'child' ? 'child' : 'this component'} {lane.visible && lane.dataset ? ` - ${lane.dataset}` : ''}
        • @@ -341,7 +341,7 @@ export default function SwimlaneGraph({ {history.more > 0 && (

          +{history.more} more{' '} - {history.more === 1 ? 'element is' : 'elements are'} not drawn (twelve lanes at most). The JSON export lists what the lanes hold. + {history.more === 1 ? 'component is' : 'components are'} not drawn (twelve lanes at most). The JSON export lists what the lanes hold.

          )} {busy && busy.includes('|') &&

          Loading the records...

          } diff --git a/src/frontend/components/components/history/SwimlaneSvg.tsx b/src/frontend/components/components/history/SwimlaneSvg.tsx index de546ba9..10a4252b 100644 --- a/src/frontend/components/components/history/SwimlaneSvg.tsx +++ b/src/frontend/components/components/history/SwimlaneSvg.tsx @@ -123,8 +123,8 @@ function LegendRow({ colours, x, y }: { colours: Colours; x: number; y: number } ) return ( <> - {item(0, 'Start of the element', )} - {item(150, 'Version', )} + {item(0, 'Start of the component', )} + {item(150, 'Snapshot', )} {item(240, 'Replaced by a correction', )} {item(420, 'Evidence record', )} {item(560, 'Left circulation', )} @@ -177,7 +177,7 @@ export default function SwimlaneSvg({ height={height} viewBox={`0 0 ${width} ${height}`} role={interactive ? 'group' : 'img'} - aria-label={title ?? 'History of the element and its relatives'} + aria-label={title ?? 'History of the component and its relatives'} fontFamily={FONT} > {palette === 'print' && } @@ -308,7 +308,7 @@ export default function SwimlaneSvg({ {layout.more > 0 && ( - {`+${layout.more} more ${layout.more === 1 ? 'element' : 'elements'} not shown`} + {`+${layout.more} more ${layout.more === 1 ? 'component' : 'components'} not shown`} )} @@ -333,7 +333,7 @@ export default function SwimlaneSvg({ Legend - Dashed lines join an element and the elements it was cut into or assembled from, at the child's first version. + Dashed lines join a component and the components it was cut into or assembled from, at the child's first snapshot. The time axis is in sections by year and not to scale. diff --git a/src/frontend/components/components/map/LocationMapPageClient.tsx b/src/frontend/components/components/map/LocationMapPageClient.tsx index 9ae7a3f8..e0d8c243 100644 --- a/src/frontend/components/components/map/LocationMapPageClient.tsx +++ b/src/frontend/components/components/map/LocationMapPageClient.tsx @@ -55,9 +55,9 @@ import { cn } from '@/lib/utils' import LocationMapCanvas from './LocationMapCanvas' const MAP_HELP = - 'Every element you may see, as a point on the map. Current is where an element is now; Origin is the building it ' - + 'comes from, known for fewer elements. Elements at one place are grouped: click a group to zoom in. Click a ' - + 'element to preview it, or an empty spot to search near it. The filters are those of Browse.' + 'Every component you may see, as a point on the map. Current is where a component is now; Origin is the building it ' + + 'comes from, known for fewer components. Components at one place are grouped: click a group to zoom in. Click a ' + + 'component to preview it, or an empty spot to search near it. The filters are those of Browse.' /** The map and its preview: a click on a piece opens the shared preview panel. */ function MapWithPreview(props: Omit, 'onPick'>) { diff --git a/src/frontend/components/components/overview/ComponentOverviewColumns.tsx b/src/frontend/components/components/overview/ComponentOverviewColumns.tsx index 9afd9773..4a47d59b 100644 --- a/src/frontend/components/components/overview/ComponentOverviewColumns.tsx +++ b/src/frontend/components/components/overview/ComponentOverviewColumns.tsx @@ -80,7 +80,7 @@ function RowMenu({ row }: { row: CatalogShallowRow }) { void copy(row._id, 'Component id copied')}> Copy component id - void copy(snapshotId, 'Version id copied')}> + void copy(snapshotId, 'Snapshot id copied')}> Copy snapshot id void copy(generateGrasshopperPanelXML('ComponentID', row._id), 'Copied as a Grasshopper panel')}> @@ -234,7 +234,7 @@ const OPTIONAL: Record = { _id: { id: '_id', accessorKey: '_id', - header: () => , + header: () => , cell: ({ row }) => , }, catalog_number: { diff --git a/src/frontend/components/datasets/YourDatasets.tsx b/src/frontend/components/datasets/YourDatasets.tsx index f41b53fe..aa91fa25 100644 --- a/src/frontend/components/datasets/YourDatasets.tsx +++ b/src/frontend/components/datasets/YourDatasets.tsx @@ -62,7 +62,7 @@ export default function YourDatasets() {

          Loading...

          ) : rows.length === 0 ? (

          - You are not a member of a dataset yet. Start one for your own elements, or ask a moderator to add you + You are not a member of a dataset yet. Start one for your own components, or ask a moderator to add you to theirs.

          ) : ( diff --git a/src/frontend/components/evidence/EvidenceAttachments.tsx b/src/frontend/components/evidence/EvidenceAttachments.tsx index da31b1f7..1f1d5c3c 100644 --- a/src/frontend/components/evidence/EvidenceAttachments.tsx +++ b/src/frontend/components/evidence/EvidenceAttachments.tsx @@ -2,8 +2,9 @@ /** * The files of one evidence record (spec 3.3.4, decisions 7.3, 8.13): - * list, download (signed-in users only), add, remove. Before publish the - * author removes; after publish only moderator(D) removes, with a reason + * list, download (signed-in users only), add, remove. Who may add and remove + * is `attachmentButtons` (`lib/lifecycleRights.ts`): before publish the author + * removes; after publish only moderator(D) removes, with a reason * (`gdpr` also blanks the file name), and the entry stays as a tombstone. * Names are rendered as text, never as markup; downloads go through the * backend route only. @@ -20,6 +21,7 @@ import type { EvidenceView } from '@/generated' import { BackendError } from '@/lib/backend' import { attachmentUrl, removeAttachment, uploadAttachment, type AttachmentEntry } from '@/lib/evidence/api' import { ATTACHMENT_ACCEPT, MAX_ATTACHMENT_TEXT, fileProblem, prepareUpload } from '@/lib/evidence/photos' +import { attachmentButtons } from '@/lib/lifecycleRights' import { useMe } from '@/lib/me' import { formatDay } from '@/lib/utils' @@ -31,16 +33,19 @@ function sizeText(bytes: number): string { export default function EvidenceAttachments({ record, dataset, + identityWithdrawn = false, onChanged, uploadHelp, }: { record: EvidenceView dataset: string | null | undefined + /** the element is withdrawn: no new file on any of its records (8.190) */ + identityWithdrawn?: boolean onChanged: () => void uploadHelp?: string }) { const { data: session } = useSession() - const { me, moderates, rolesIn } = useMe() + const { me, isAdmin, moderates, rolesIn } = useMe() const input = useRef(null) const [busy, setBusy] = useState(false) const [removing, setRemoving] = useState(null) @@ -49,17 +54,11 @@ export default function EvidenceAttachments({ const entries = (record.attachments ?? []) as AttachmentEntry[] const isAuthor = !!me && record.recorded_by_user_id === me._id const isModerator = moderates(dataset) - const published = record.status === 'published' || record.status === 'withdrawn' - // as the routes decide (7.0): a draft: author or moderator; pending: - // moderator; after publish contributor(D) adds, moderator(D) removes - // the author of a pending correction also adds and removes files (RL4, 8.142 a) - const ownCorrection = isAuthor && Boolean(record.supersedes) && record.status === 'pending' - const canAdd = record.status !== 'withdrawn' && record.status !== 'rejected' && ( - record.status === 'draft' ? isAuthor || isModerator - : record.status === 'pending' ? isModerator || ownCorrection - : rolesIn(dataset).includes('contributor') - ) - const canRemove = published ? isModerator : record.status === 'pending' ? isModerator || ownCorrection : isAuthor || isModerator + // as the routes decide (7.0, 8.190, 8.193): `attachmentButtons` + const { add: canAdd, remove: canRemove } = attachmentButtons({ + isAuthor, isAdmin, isModerator, isContributor: rolesIn(dataset).includes('contributor'), + status: record.status, correction: Boolean(record.supersedes), identityWithdrawn, + }) const add = async (files: FileList | null) => { if (!files || files.length === 0) return @@ -158,7 +157,7 @@ export default function EvidenceAttachments({ open={removing !== null} onOpenChange={(open) => { if (!open) setRemoving(null) }} title={`Remove ${removing?.name || 'the file'}`} - description={published + description={record.status === 'published' || record.status === 'withdrawn' ? 'The file is deleted and its entry stays as a tombstone with your reason. Use the reason gdpr when it shows a person: the file name is blanked too.' : 'The file is deleted; the entry stays marked as removed.'} confirmLabel="Remove" diff --git a/src/frontend/components/evidence/EvidenceCard.tsx b/src/frontend/components/evidence/EvidenceCard.tsx index a9921109..4a93d67a 100644 --- a/src/frontend/components/evidence/EvidenceCard.tsx +++ b/src/frontend/components/evidence/EvidenceCard.tsx @@ -40,6 +40,7 @@ export default function EvidenceCard({ uploadHelp, menu = false, shownIds, + identityWithdrawn = false, }: { record: EvidenceView dataset: string | null | undefined @@ -50,6 +51,8 @@ export default function EvidenceCard({ menu?: boolean /** The ids of the cards the page lists (the paired record is linked only when it is one of them). */ shownIds?: readonly string[] + /** the element is withdrawn: no correction, no new file (8.190, I28) */ + identityWithdrawn?: boolean }) { const [open, setOpen] = useState(defaultOpen) const anchor = recordAnchor(String(record._id)) @@ -82,7 +85,8 @@ export default function EvidenceCard({
          {menu && (
          - +
          )}
      )} diff --git a/src/frontend/components/evidence/LayoutDetails.tsx b/src/frontend/components/evidence/LayoutDetails.tsx index 76791bd1..8a7bbff0 100644 --- a/src/frontend/components/evidence/LayoutDetails.tsx +++ b/src/frontend/components/evidence/LayoutDetails.tsx @@ -60,7 +60,8 @@ export default function LayoutDetails({ const note = typeof payload.accuracy_note === 'string' ? payload.accuracy_note.trim() : '' const bars = Array.isArray(payload.bars) ? payload.bars.length : 0 const open = emptyDocumentFields(payload) - const mayFill = record.status === 'published' && !record.superseded_by && moderates(dataset) && open.length > 0 + // a superseded record can be filled as well: the backend does not check it (#48 case 10) + const mayFill = record.status === 'published' && moderates(dataset) && open.length > 0 const [dialog, setDialog] = useState(false) const rows: [string, React.ReactNode][] = [] diff --git a/src/frontend/components/evidence/PositionPickerDialog.tsx b/src/frontend/components/evidence/PositionPickerDialog.tsx index b7668047..cab74c9b 100644 --- a/src/frontend/components/evidence/PositionPickerDialog.tsx +++ b/src/frontend/components/evidence/PositionPickerDialog.tsx @@ -224,11 +224,11 @@ function PickerBody({ const patchNote = proxyModel ? 'Edge distance measured to the proxy face.' : hit?.patch === 'face' - ? 'This version has no proxy: edge distance is measured to the outer boundary of the flat face you picked on.' + ? 'This snapshot has no proxy: edge distance is measured to the outer boundary of the flat face you picked on.' : hit?.patch === 'estimated-plane' - ? 'A point cloud has no faces and this version has no proxy: edge distance cannot be checked.' + ? 'A point cloud has no faces and this snapshot has no proxy: edge distance cannot be checked.' : hit?.kind === 'mesh' - ? 'The surface here is not a flat face and this version has no proxy: edge distance is not checked.' + ? 'The surface here is not a flat face and this snapshot has no proxy: edge distance is not checked.' : null return ( @@ -242,7 +242,7 @@ function PickerBody({ {mode === 'grid' ? 'Tap or click a face: that point becomes the centre of the grid. Turn the grid with the buttons, then set rows, columns and spacing.' : 'Tap or click the model. A drag still turns the view.'} - {' '}Stored coordinates of {version !== null ? `version ${version}` : 'this version'} (mm). + {' '}Stored coordinates of {version !== null ? `snapshot v${version}` : 'this snapshot'} (mm). diff --git a/src/frontend/components/evidence/PropertiesCard.tsx b/src/frontend/components/evidence/PropertiesCard.tsx index 97c437d4..e928dc46 100644 --- a/src/frontend/components/evidence/PropertiesCard.tsx +++ b/src/frontend/components/evidence/PropertiesCard.tsx @@ -141,7 +141,7 @@ export default function PropertiesCard({ const versionEntries = Object.entries((versionProperties ?? {}) as Record) const blocks: { title: string; entries: [string, FoldedProperty][]; outrankedFor: boolean }[] = [ { title: 'Condition', entries: versionEntries.filter(([quantity]) => quantity === 'condition_grade'), outrankedFor: false }, - { title: 'The element', entries: Object.entries((properties ?? {}) as Record), outrankedFor: true }, + { title: 'The component', entries: Object.entries((properties ?? {}) as Record), outrankedFor: true }, { title: versionLabel, entries: versionEntries.filter(([quantity]) => quantity !== 'condition_grade'), outrankedFor: false }, ].filter((block) => block.entries.length > 0) const derived = blocks.some((block) => block.title === 'Condition') ? null : conditionDerived @@ -171,7 +171,7 @@ export default function PropertiesCard({ )} {empty.kind === 'plain' && (

      - No published evidence yet: nothing is known about this element beyond what its record says. + No published evidence yet: nothing is known about this component beyond what its record says.

      )} {empty.kind === 'link' && ( @@ -184,7 +184,7 @@ export default function PropertiesCard({

      {block.title}

      - {!block.outrankedFor && block.title !== 'Condition' && this version} + {!block.outrankedFor && block.title !== 'Condition' && this snapshot}
        {block.entries.map(([quantity, property]) => ( diff --git a/src/frontend/components/evidence/form/ClaimEditor.tsx b/src/frontend/components/evidence/form/ClaimEditor.tsx index e7685191..37e9f4bb 100644 --- a/src/frontend/components/evidence/form/ClaimEditor.tsx +++ b/src/frontend/components/evidence/form/ClaimEditor.tsx @@ -50,7 +50,7 @@ export function SummaryEditor({ id={`${id}-quantity`} label="Property" help={method.summary_optional - ? 'Leave empty to record the document only: it documents the element and states no value.' + ? 'Leave empty to record the document only: it documents the component and states no value.' : helpFor('quantity')} required={!method.summary_optional} errors={errors} @@ -176,13 +176,13 @@ export function PiecesField({ return } if (pieces.includes(id)) { - setError('That element is already in the list.') + setError('That component is already in the list.') return } try { await backendJson(`/identities/${encodeURIComponent(id)}`) } catch (err) { - setError(err instanceof BackendError ? err.message : 'Could not find that element.') + setError(err instanceof BackendError ? err.message : 'Could not find that component.') return } setError(null) @@ -193,10 +193,10 @@ export function PiecesField({ return (
        - Elements this applies to + Components this applies to

        - One record is made for every element, each with the same claim. Add the others by id, link or scanned tag. + One record is made for every component, each with the same claim. Add the others by id, link or scanned tag.

          {pieces.map((id) => { @@ -205,11 +205,11 @@ export function PiecesField({
        • {row ? `#${row.catalog_number ?? '?'} ${row.name ?? ''}` : id} - {id === thisPiece && (this element)} + {id === thisPiece && (this component)} {id !== thisPiece && ( )} diff --git a/src/frontend/components/evidence/form/EvidenceForm.tsx b/src/frontend/components/evidence/form/EvidenceForm.tsx index f356b748..c6b0fcb8 100644 --- a/src/frontend/components/evidence/form/EvidenceForm.tsx +++ b/src/frontend/components/evidence/form/EvidenceForm.tsx @@ -105,6 +105,7 @@ import { prepareUpload } from '@/lib/evidence/photos' import { getAt, isBlank, parseNumber, setAt, type FormObject } from '@/lib/evidence/schema' import { useRegistry } from '@/lib/evidence/useRegistry' import { useMe } from '@/lib/me' +import { passportOfNewestVersion } from '@/lib/newestVersion' type Picker = | { mode: 'point'; recordKey: string } @@ -169,7 +170,12 @@ export default function EvidenceForm({ loadEvidenceOf(identityId, 'method=core_compression&status=all').catch(() => []), sourceId ? backendJson(`/evidence/${encodeURIComponent(sourceId)}`) : Promise.resolve(null), ]) - .then(([passport, materials, reb, core, record]) => { + .then(async ([first, materials, reb, core, record]) => { + // every version withdrawn: compose has no state, so the form starts from the newest + // version, which the page names as withdrawn (8.193) + const passport = first.snapshots?.length + ? first + : await passportOfNewestVersion(identityId, first, { publishedOnly: true }) if (cancelled) return setCatalog(passport) const material = materials.find((m) => m._id === passport.identity.material) @@ -205,11 +211,14 @@ export default function EvidenceForm({ const snapshot = catalog?.snapshots?.length ? primarySnapshot(catalog) : null const snapshotId = snapshot ? String(snapshot._id ?? '') : '' const dataset = catalog?.identity.dataset ?? null - const canContribute = rolesIn(dataset).includes('contributor') - || (editing && Boolean(dataset) && moderates(dataset)) // an edit is for the author of a draft or a moderator; the record decides const mayEdit = !editing || !corrected || canEditEvidence( corrected.status, corrected.recorded_by_user_id === me?._id, moderates(dataset)) + // the author of a draft keeps the right to edit it after losing the contributor role + // (`_unpublished_editor` asks for the author, not for a role; #48 case 9) + const canContribute = rolesIn(dataset).includes('contributor') + || (editing && Boolean(dataset) && moderates(dataset)) + || (editing && !!corrected && mayEdit && corrected.recorded_by_user_id === me?._id) useEffect(() => { if (!dataset || !me || sourceId) return @@ -541,7 +550,7 @@ export default function EvidenceForm({

          Add evidence

          #{identity.catalog_number} has no published state yet. Evidence is recorded about a state of the - element: come back once a moderator has published its first version. + component: come back once a moderator has published its first snapshot.

      ) @@ -652,7 +661,7 @@ export default function EvidenceForm({ : layout.fanOut === 'pieces' ? plural(state.pieces.length, 'claim') : `1 layout with ${plural(Array.isArray(state.records[0]?.payload.bars) ? (state.records[0].payload.bars as unknown[]).length : 0, 'bar')}` const files = state.files.length + (layout.fanOut === 'observations' ? state.photos.length : 0) - const version = snapshot.version ? `, version ${snapshot.version}` : '' + const version = snapshot.version ? `, snapshot v${snapshot.version}` : '' const withFiles = files > 0 ? `, with ${plural(files, 'file')}` : '' if (editing && corrected) return `Saves the changes to this ${corrected.status} record on ${title}${version}${withFiles}.` if (corrected) { @@ -677,10 +686,18 @@ export default function EvidenceForm({

      {title}{dataset ? ` (${dataset})` : ''} {snapshot.version ? ( - version {snapshot.version} + + snapshot v{snapshot.version}{snapshot.status === 'withdrawn' ? ' (withdrawn)' : ''} + ) : null} {modeChip && {modeChip}}

      + {snapshot.status === 'withdrawn' && ( +

      + Every snapshot of this component is withdrawn, so it has no current snapshot. The record is about the + newest one, snapshot v{snapshot.version}. +

      + )} {editing && corrected && (

      The record keeps its status{corrected.status === 'draft' ? ' and its files; you can add more files' : ' and its files'}. @@ -850,9 +867,9 @@ export default function EvidenceForm({ help={help('PositionInput', 'description')} />

      - A layout belongs to one version: the bars are in the stored coordinates (millimetres) of - {snapshot.version ? ` version ${snapshot.version}` : ' the version'} you see on the component - page. Another version needs a layout of its own. + A layout belongs to one snapshot: the bars are in the stored coordinates (millimetres) of + {snapshot.version ? ` snapshot v${snapshot.version}` : ' the snapshot'} you see on the component + page. Another snapshot needs a layout of its own.

      )} diff --git a/src/frontend/components/evidence/form/PositionField.tsx b/src/frontend/components/evidence/form/PositionField.tsx index 9546d5a0..053c9cbb 100644 --- a/src/frontend/components/evidence/form/PositionField.tsx +++ b/src/frontend/components/evidence/form/PositionField.tsx @@ -44,7 +44,7 @@ export default function PositionField({
      setParent({ ...parent, paired_rebound_id: next })} - placeholder={options.length ? 'Not paired' : 'No rebound record of this element fits'} + placeholder={options.length ? 'Not paired' : 'No rebound record of this component fits'} options={options} /> diff --git a/src/frontend/components/evidence/form/state.ts b/src/frontend/components/evidence/form/state.ts index 02dfddd9..3b7786ae 100644 --- a/src/frontend/components/evidence/form/state.ts +++ b/src/frontend/components/evidence/form/state.ts @@ -219,9 +219,21 @@ function actorsBody(state: FormState, ctx: BuildContext): Record Object.keys(actor).length > 0 && actor.kind !== undefined) } -function summaryBody(summary: SummaryState, quantity: QuantityInfo | undefined): Record | undefined { +/** + * The `summary` of a claim (a method whose result the client sends: `summary_from_client`). The + * server wants the kind of the result with it (`registry._headline`: a claim is `claimed`, else + * 422 `summary.kind`), so the method's `summary_kind` goes along. A method whose result the + * server derives gets no `kind` from the web: the server compares the sent result with the one + * it derives (`_same_result`), so a `kind` of ours has no place there. + */ +export function summaryBody( + summary: SummaryState, + quantity: QuantityInfo | undefined, + method?: Pick, +): Record | undefined { if (!summary.quantity) return undefined const body: Record = { quantity: summary.quantity } + if (method?.summary_from_client && method.summary_kind) body.kind = method.summary_kind const value = parseNumber(summary.value) if (quantity?.kind === 'scalar') { if (summary.value.trim() !== '') body.value = value ?? summary.value @@ -322,7 +334,7 @@ export function buildItems(state: FormState, ctx: BuildContext): EvidenceBulkIte identity_id: identityId, method: method.name as EvidenceBulkItem['method'], payload, - summary: summaryBody(state.summary, quantity), + summary: summaryBody(state.summary, quantity, method), })) as unknown as EvidenceBulkItem[] } diff --git a/src/frontend/components/idtransmission/ComponentIdTransmitter.tsx b/src/frontend/components/idtransmission/ComponentIdTransmitter.tsx index bd54fef1..43550d0e 100644 --- a/src/frontend/components/idtransmission/ComponentIdTransmitter.tsx +++ b/src/frontend/components/idtransmission/ComponentIdTransmitter.tsx @@ -115,7 +115,7 @@ const ComponentIdTransmitter: React.FC = () => { if (data.conflict === 'snapshot') { setIdBlocked(true) setIdCheckMessage( - 'This UUID is already a snapshot id. Use the physical identity id from the tag.', + 'This UUID is already a snapshot id. Use the component id from the tag.', ) } else { // Existing catalog identities are allowed; uniqueness is @@ -128,7 +128,7 @@ const ComponentIdTransmitter: React.FC = () => { if (res.status === 400) { setIdBlocked(true) - setIdCheckMessage('Enter a valid identity UUID.') + setIdCheckMessage('Enter a valid component id.') return } @@ -211,7 +211,7 @@ const ComponentIdTransmitter: React.FC = () => { ) { setStatus('error') setStatusMessage( - data.message || 'This UUID cannot be transmitted as a new identity id.', + data.message || 'This UUID cannot be transmitted as a new component id.', ) return } @@ -378,8 +378,8 @@ const ComponentIdTransmitter: React.FC = () => {
      { setInputId(e.target.value) @@ -442,7 +442,7 @@ const ComponentIdTransmitter: React.FC = () => { Pending ID already exists - You still have a pending identity id in the queue. Do you + You still have a pending component id in the queue. Do you really want to overwrite it? diff --git a/src/frontend/components/lineage/CirculationActions.tsx b/src/frontend/components/lineage/CirculationActions.tsx index d071736b..157086e2 100644 --- a/src/frontend/components/lineage/CirculationActions.tsx +++ b/src/frontend/components/lineage/CirculationActions.tsx @@ -44,7 +44,7 @@ const EXIT_HINTS: Record = { disposed: 'Landfill or incineration. Final.', returned: 'Back to its owner or supplier.', lost: 'Its whereabouts are unknown.', - split: 'Cut up without cataloguing the elements. Catalogued elements set this by themselves.', + split: 'Cut up into parts that are not catalogued. Catalogued components set this by themselves.', } function todayIso(): string { @@ -177,7 +177,7 @@ export function ReenterDialog({ identityId, exit, open, onOpenChange }: { Bring back into circulation - The earlier origin and exit are kept as a past cycle. The next recorded state starts + The earlier origin and exit are kept as a past cycle. The next snapshot starts on the new origin date. diff --git a/src/frontend/components/lineage/DeinstallActions.tsx b/src/frontend/components/lineage/DeinstallActions.tsx index 0aaf2867..fe26f6fe 100644 --- a/src/frontend/components/lineage/DeinstallActions.tsx +++ b/src/frontend/components/lineage/DeinstallActions.tsx @@ -99,8 +99,8 @@ export function DeinstallDialog({ identity, open, onOpenChange }: { Record deinstallation - The element is out of its works. Its reservation stays, and no new state is created; - record one if the element changed. Elements drawn from it that take over its origin follow. + The component is out of its works. Its reservation stays, and no new snapshot is created; + record one if the component changed. Elements drawn from it that take over its origin follow.
      @@ -137,7 +137,7 @@ export function DeinstallDialog({ identity, open, onOpenChange }: { export async function undoDeinstall(identityId: string, refresh: () => void): Promise { try { await backendJson(`/identities/${identityId}/undo-deinstall`, { method: 'POST' }) - toast.success('Deinstallation undone: the element is in place again') + toast.success('Deinstallation undone: the component is in place again') refresh() } catch (err) { toast.error(err instanceof Error ? err.message : 'Undo failed') diff --git a/src/frontend/components/lineage/ProvenanceEditDialog.tsx b/src/frontend/components/lineage/ProvenanceEditDialog.tsx index b66112d7..574d825d 100644 --- a/src/frontend/components/lineage/ProvenanceEditDialog.tsx +++ b/src/frontend/components/lineage/ProvenanceEditDialog.tsx @@ -270,7 +270,7 @@ export default function ProvenanceEditDialog({ identity, open, onOpenChange }: P {hasParents ? "Ticked units follow the parents and change with them. Untick one to make it this component's own." - : 'Elements cut from this component take these values over until they state their own.'} + : 'Components cut from this component take these values over until they state their own.'} @@ -377,7 +377,7 @@ export default function ProvenanceEditDialog({ identity, open, onOpenChange }: P

      Connection features

      - Anchors, dowels, plates or holes on this element. Its own: never taken over by elements cut from it. + Anchors, dowels, plates or holes on this component. Its own: never taken over by components cut from it.