Commit Graph

40 Commits

Author SHA1 Message Date
logaritmisk 7181437625 feat(server): configurable DB pool size via --db-max-connections/DB_MAX_CONNECTIONS (#2)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 21:46:41 +02:00
logaritmisk 8cfcf07387 fix(db): publish gate fires only on transition into public, not re-set
Preserves the documented set-to-current idempotent no-op: re-setting an
already-public object's visibility no longer rejects when a required field
was introduced after publish. Adds a regression test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 23:40:10 +02:00
logaritmisk e96f74f47a feat(db): enforce required-field completeness on publish (#16)
set_visibility now gates the transition to Public: every field definition
with required=true must have a value on the object (typed inventory-minimum
columns are already NOT NULL, so only flexible required fields are checked).
Missing values yield VisibilityError::MissingRequiredFields(keys); the admin
publish endpoint maps it to 422. The gate runs in db so every caller is
protected and the check is atomic with the transition.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 23:36:24 +02:00
logaritmisk 7a18e0e9bf feat(api): admin vocabulary + term management
GET/POST /api/admin/vocabularies and GET/POST /api/admin/vocabularies/{id}/terms;
reads gated on ViewInternal, writes on EditCatalogue; labels round-trip verified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 22:20:47 +02:00
logaritmisk 0055616099 feat(api): admin object read surface (paginated list + get, ViewInternal)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 21:45:53 +02:00
logaritmisk bea9b6b39a harden(db): case-insensitive email unique index + dup-email test; list_users pagination TODO; from_db note 2026-06-02 14:42:04 +02:00
logaritmisk f8ec2d7cf1 feat(db): users table + repository (create/by_id/by_email/list), audited
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 14:37:43 +02:00
logaritmisk b948cae269 refactor(db): share update path so set_visibility avoids a redundant fetch; tie public-visibility const to the enum; test internal exclusion
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 13:35:36 +02:00
logaritmisk 14cdd2a04a feat(db): audited stepwise set_visibility + public-only object readers
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 13:24:29 +02:00
logaritmisk 5ee9fd88f1 polish(db): clearer maker label; assert group_key and vocabularies in seed tests 2026-06-02 11:25:10 +02:00
logaritmisk adc7c61ee2 feat(db): seed a representative Spectrum cataloguing field set (idempotent)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 11:20:35 +02:00
logaritmisk f30ce9d9dc docs(db): note deferred date-format validation (#11) at the Date field arm 2026-06-02 11:12:00 +02:00
logaritmisk 45c1d1b123 test(db): cover authority-kind, cross-vocabulary, localized text, replace/remove, no-op, missing object
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 11:07:43 +02:00
logaritmisk c94fd1638c docs(db): document set_object_fields replace semantics and required-field deferral
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 11:04:45 +02:00
logaritmisk 2b0056c038 feat(db): set_object_fields with registry validation and audited diffs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 10:59:23 +02:00
logaritmisk 2aaf98794f feat(db): add object.fields jsonb column, read it into CatalogueObject
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 10:54:49 +02:00
logaritmisk f4152b2102 test(db): cover any-kind authority, scalar, zero-label, and list ordering for field definitions 2026-06-02 10:27:06 +02:00
logaritmisk 66ad67ca77 feat(db): add field-definition registry repository
Implements create_field_definition, field_definition_by_key, and
list_field_definitions in db::fields, with TDD integration tests
covering text, term, and authority field type round-trips.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 10:21:39 +02:00
logaritmisk cbed662c18 feat(db): add field_definition tables
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 10:16:30 +02:00
logaritmisk 2938649d62 fix(db): skip UPDATE and audit on no-op object update (keep updated_at consistent)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 09:40:27 +02:00
logaritmisk a690c60ec6 refactor(db): delete_object via rows_affected; test update/delete-missing and field clearing 2026-06-02 09:36:44 +02:00
logaritmisk 9e1c88b294 feat(db): add catalogue object update/delete with audited field diffs
update_object records only changed fields as audit diffs and skips the
audit entry for no-op updates; delete_object records a Deleted entry.
Both operations are atomic on the caller's connection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 09:32:16 +02:00
logaritmisk 616a6f05c6 refactor(db): DRY object SELECT columns, consistent date json; test date + all-none round-trip
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 09:29:40 +02:00
logaritmisk e0c0187f29 feat(db): add catalogue object create/read/list with audit on create
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 09:24:03 +02:00
logaritmisk 95357f01dd feat(db): non-empty CHECK constraints on object text columns 2026-06-02 09:21:08 +02:00
logaritmisk c1dda280e2 feat(db): add object table
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 09:18:03 +02:00
logaritmisk 7782bd764a test(db): zero-label authority round-trip; doc the labels-json constant
Also fix pre-existing clippy::explicit_auto_deref in all db test files
(&mut *tx → &mut tx across authority.rs and vocab.rs).
2026-06-02 09:01:06 +02:00
logaritmisk 6e45baa8d4 feat(db): add authority repository with multilingual labels
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 08:55:50 +02:00
logaritmisk 345073b130 test(db): cover zero-label term and duplicate vocabulary key; use try_get in vocabulary_by_key 2026-06-02 08:52:58 +02:00
logaritmisk 5dc07ddf4c feat(db): add vocabulary/term repository with multilingual labels
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 08:48:51 +02:00
logaritmisk cc1fbf5b7d feat(db): RESTRICT vocabulary deletes; non-empty label/lang constraints 2026-06-02 08:46:34 +02:00
logaritmisk 93d54d7783 feat(db): add vocabulary, term, and authority tables
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 08:43:23 +02:00
logaritmisk 86a3a8a47c test(db): assert audit_log mutations fail via the immutability trigger 2026-06-02 08:01:28 +02:00
logaritmisk 45aea6b702 test(db): enforce audit_log immutability and transactional atomicity
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 07:58:10 +02:00
logaritmisk c67b588188 test(db): cover delete/empty-changes/empty-history; clarify map_row naming
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 07:56:05 +02:00
logaritmisk 87b016a56c feat(db): add append-only audit repository (record, history_for)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 07:52:16 +02:00
logaritmisk 01c42837d1 feat(db): also reject TRUNCATE on audit_log (statement-level trigger) 2026-06-02 07:49:47 +02:00
logaritmisk 152fc30116 feat(db): schema bootstrap with append-only audit_log table
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 07:46:39 +02:00
logaritmisk 8da3eefdce feat(db): add Db handle with pool connect and readiness ping 2026-06-02 00:54:17 +02:00
logaritmisk b97c950f77 chore: replace placeholder package with role-named workspace 2026-06-02 00:38:53 +02:00