Name task 41 as the ticket data-model.md already answers #134

Merged
rob merged 2 commits from docs/erd-from-schema into main 2026-08-12 04:31:42 +00:00
Owner

Task 41 asks for an ERD, field definitions, place/group cardinality, and permission-level enumeration. docs/data-model.md already has all of it, kept current through ticket #44 and every schema script since — I checked every table, column, constraint and index in it against the three DbUp scripts by hand and found no discrepancy.

Cardinality: places.group_id is uuid NOT NULL with fk_places_groups_group_id ... ON DELETE CASCADE — enforced, not just intended. Permission levels: group_memberships.role is text with ck_group_memberships_role CHECK (role IN ('owner', 'editor', 'viewer')).

Mechanical drift protection also already exists: InitialSchemaTests.cs (PlaceMark.Infrastructure.Tests) reads pg_catalog/information_schema against a real database and asserts the tables, columns, constraints and indexes match — not by parsing DDL text. Ran it directly; all 9 assertions pass against the current schema. No new test is needed.

This PR is therefore small: it names task 41 in the document's existing provenance paragraph (previously "this ticket", unnumbered) and notes that InitialSchemaTests.cs is what backs the "applied schema is the truth" claim mechanically, rather than adding a second document.

No ADR — nothing here is a new decision.

Sign-off is Rob's and is not recorded here; it remains outstanding.

Full suite: 1759 total / 1749 passing / 10 skipped (6 E2E, 4 WebUI repro tests — both pre-existing, unrelated to this change). dotnet format --verify-no-changes clean.

Task 41 asks for an ERD, field definitions, place/group cardinality, and permission-level enumeration. `docs/data-model.md` already has all of it, kept current through ticket #44 and every schema script since — I checked every table, column, constraint and index in it against the three DbUp scripts by hand and found no discrepancy. Cardinality: `places.group_id` is `uuid NOT NULL` with `fk_places_groups_group_id ... ON DELETE CASCADE` — enforced, not just intended. Permission levels: `group_memberships.role` is `text` with `ck_group_memberships_role CHECK (role IN ('owner', 'editor', 'viewer'))`. Mechanical drift protection also already exists: `InitialSchemaTests.cs` (`PlaceMark.Infrastructure.Tests`) reads `pg_catalog`/`information_schema` against a real database and asserts the tables, columns, constraints and indexes match — not by parsing DDL text. Ran it directly; all 9 assertions pass against the current schema. No new test is needed. This PR is therefore small: it names task 41 in the document's existing provenance paragraph (previously "this ticket", unnumbered) and notes that `InitialSchemaTests.cs` is what backs the "applied schema is the truth" claim mechanically, rather than adding a second document. No ADR — nothing here is a new decision. Sign-off is Rob's and is not recorded here; it remains outstanding. Full suite: 1759 total / 1749 passing / 10 skipped (6 E2E, 4 WebUI repro tests — both pre-existing, unrelated to this change). `dotnet format --verify-no-changes` clean.
Name task 41 as the ticket data-model.md already answers
All checks were successful
CI / build (pull_request) Successful in 3m33s
CI / container-images (pull_request) Has been skipped
CI / e2e (pull_request) Successful in 1m46s
3f65eb231b
rob left a comment

Verdict: changes needed

Reviewed at 3f65eb2 (head unchanged since dispatch). CI run #577: success, 5m22s.

  1. Document checked against all three scripts directly, column by column — no discrepancy found. Cross-checked every table, column, type, nullability, default, all 9 FKs (name, referencing/referenced column, delete action) and all 8 non-PK indexes in docs/data-model.md against 0001-initial-schema.sql, 0002-refresh-tokens.sql and 0003-group-colour.sql by hand. Exact match throughout, including the colour/ck_groups_colour addition from 0003. One small completeness gap, not a factual error: the document's own intro provenance paragraph names only 0001 and 0002 as the implementing scripts — 0003-group-colour.sql is never listed there, even though its content is correctly documented in the groups table further down. Worth a line, not blocking on its own.

  2. The crux question, checked by mutation, not by reading. InitialSchemaTests genuinely runs and passes (9/9, confirmed directly). But it does not read docs/data-model.md anywhere — no file I/O against it exists in that class. To confirm what that means in practice: changed the document's own FK table (fk_places_groups_group_id from CASCADE to SET NULL), left the schema and the test untouched, reran — all 9 assertions still passed. The mechanical guard ties the schema to the test's own hardcoded literal expectations, not to the document's prose. Today that literal matches the document exactly, kept in step by review, but the sentence this PR adds — "fails if this document's tables, columns, constraints or indexes ever disagree with what the scripts actually produced" — overclaims what the test does. It should say the test holds the schema to a fixed, independently-maintained expectation that review keeps aligned with this document, not that it fails on a document-only disagreement, because it demonstrably does not. This is the finding the brief asked me to check for, and it's real — needs a wording fix before merge.

  3. Acceptance criteria checked against task 41's own text, not approximately. ERD diagram + field definitions: present and accurate (Mermaid erDiagram plus six per-table field/constraint tables). Cardinality: places.group_id uuid NOT NULL + fk_places_groups_group_id ... ON DELETE CASCADE, documented and enforced. Permission levels: ck_group_memberships_role CHECK (role IN ('owner', 'editor', 'viewer')), enumerated. Sign-off: the PR body states plainly "Sign-off is Rob's and is not recorded here; it remains outstanding" — correctly left open, not quietly treated as done.

  4. Test count re-derived independently: 1759 total / 1749 passing / 10 skipped — matches exactly. Internally consistent with the exclude-E2E convention other PRs use: 1759 total here = 1753 (non-E2E) + 6 (E2E) from that convention, and passing is identically 1749 either way, since E2E contributes 0 passing under both. The convention difference is disclosed, not silent — the "(6 E2E, 4 WebUI repro tests...)" breakdown right after the headline figure makes it legible, even without naming the other convention explicitly. Build clean, dotnet format --verify-no-changes clean.

A PR that declines to duplicate existing work is the right instinct here, and nearly all of it holds up under direct checking. One sentence overclaims what the mechanical guard proves — fix that and this is good to merge.

Verdict: changes needed Reviewed at 3f65eb2 (head unchanged since dispatch). CI run #577: success, 5m22s. 1. **Document checked against all three scripts directly, column by column — no discrepancy found.** Cross-checked every table, column, type, nullability, default, all 9 FKs (name, referencing/referenced column, delete action) and all 8 non-PK indexes in `docs/data-model.md` against `0001-initial-schema.sql`, `0002-refresh-tokens.sql` and `0003-group-colour.sql` by hand. Exact match throughout, including the `colour`/`ck_groups_colour` addition from 0003. One small completeness gap, not a factual error: the document's own intro provenance paragraph names only 0001 and 0002 as the implementing scripts — 0003-group-colour.sql is never listed there, even though its content is correctly documented in the `groups` table further down. Worth a line, not blocking on its own. 2. **The crux question, checked by mutation, not by reading.** `InitialSchemaTests` genuinely runs and passes (9/9, confirmed directly). But it does not read `docs/data-model.md` anywhere — no file I/O against it exists in that class. To confirm what that means in practice: changed the document's own FK table (`fk_places_groups_group_id` from `CASCADE` to `SET NULL`), left the schema and the test untouched, reran — all 9 assertions still passed. **The mechanical guard ties the schema to the test's own hardcoded literal expectations, not to the document's prose.** Today that literal matches the document exactly, kept in step by review, but the sentence this PR adds — "fails if this document's tables, columns, constraints or indexes ever disagree with what the scripts actually produced" — overclaims what the test does. It should say the test holds the schema to a fixed, independently-maintained expectation that review keeps aligned with this document, not that it fails on a document-only disagreement, because it demonstrably does not. This is the finding the brief asked me to check for, and it's real — needs a wording fix before merge. 3. **Acceptance criteria checked against task 41's own text, not approximately.** ERD diagram + field definitions: present and accurate (Mermaid `erDiagram` plus six per-table field/constraint tables). Cardinality: `places.group_id uuid NOT NULL` + `fk_places_groups_group_id ... ON DELETE CASCADE`, documented and enforced. Permission levels: `ck_group_memberships_role CHECK (role IN ('owner', 'editor', 'viewer'))`, enumerated. Sign-off: the PR body states plainly "Sign-off is Rob's and is not recorded here; it remains outstanding" — correctly left open, not quietly treated as done. 4. **Test count re-derived independently: 1759 total / 1749 passing / 10 skipped — matches exactly.** Internally consistent with the exclude-E2E convention other PRs use: 1759 total here = 1753 (non-E2E) + 6 (E2E) from that convention, and passing is identically 1749 either way, since E2E contributes 0 passing under both. The convention difference is disclosed, not silent — the "(6 E2E, 4 WebUI repro tests...)" breakdown right after the headline figure makes it legible, even without naming the other convention explicitly. Build clean, `dotnet format --verify-no-changes` clean. A PR that declines to duplicate existing work is the right instinct here, and nearly all of it holds up under direct checking. One sentence overclaims what the mechanical guard proves — fix that and this is good to merge.
State plainly that the schema test does not guard the document
All checks were successful
CI / build (pull_request) Successful in 2m58s
CI / container-images (pull_request) Has been skipped
CI / e2e (pull_request) Successful in 1m52s
c485af93c8
rob left a comment

Verdict: mergeable

Reviewed at c485af9 (head unchanged since dispatch). CI run #579: success, 4m54s.

  1. Replacement wording checked against InitialSchemaTests.cs itself, not accepted as merely weaker. Every specific claim in the new paragraph holds: the test's five structural assertions do compare the live schema to hardcoded C# literals (ForeignKeyRow[], CheckConstraintRow[], IndexedColumnRow[], column-summary strings, table-name list), and there is genuinely no file I/O against docs/data-model.md anywhere in that class — confirmed by rereading it in full, same as last round. The comparison to "the DDL-parsing hazard InitialSchemaTests.cs's own header comment already declines for the opposite direction" is accurate too: that header literally says a test that parses the script would agree with a mistake in it, and the new paragraph applies the identical reasoning to parsing this document. Nothing here is a softened version of the old claim — it's a different, true one.

  2. The "not worth a guard" call is stated as a judgement, with the gap left visible. "That is a judgement, not a guarantee, and it should be revisited if this document is ever found to have drifted silently" is explicit, not hedged into invisibility, and it comes right after "nothing currently notices if this document and the schema disagree while the test's own literals still match the schema" — a reader is told plainly that the document can drift and what would have to happen for nobody to notice.

  3. Provenance now names all three scripts, and there are no others to miss. 0003-group-colour.sql, added by task 182 (ADR-0098) — checked against the script's own header comment ("Vikunja task 182, ADR-0098") and confirmed docs/adr/0098-constrain-group-colour-to-a-fixed-palette.md exists. ls src/PlaceMark.Database/Scripts/ lists exactly three files, all three now named in the provenance paragraph.

  4. Diff confirmed docs-only: git diff --stat against main shows only docs/data-model.md, 27 insertions / 6 deletions, one file. InitialSchemaTests rerun fresh: 9/9 pass. dotnet format --verify-no-changes clean.

Both rounds of this PR now hold up under direct checking.

Verdict: mergeable Reviewed at c485af9 (head unchanged since dispatch). CI run #579: success, 4m54s. 1. **Replacement wording checked against `InitialSchemaTests.cs` itself, not accepted as merely weaker.** Every specific claim in the new paragraph holds: the test's five structural assertions do compare the live schema to hardcoded C# literals (`ForeignKeyRow[]`, `CheckConstraintRow[]`, `IndexedColumnRow[]`, column-summary strings, table-name list), and there is genuinely no file I/O against `docs/data-model.md` anywhere in that class — confirmed by rereading it in full, same as last round. The comparison to "the DDL-parsing hazard `InitialSchemaTests.cs`'s own header comment already declines for the opposite direction" is accurate too: that header literally says a test that parses the script would agree with a mistake in it, and the new paragraph applies the identical reasoning to parsing this document. Nothing here is a softened version of the old claim — it's a different, true one. 2. **The "not worth a guard" call is stated as a judgement, with the gap left visible.** "That is a judgement, not a guarantee, and it should be revisited if this document is ever found to have drifted silently" is explicit, not hedged into invisibility, and it comes right after "nothing currently notices if this document and the schema disagree while the test's own literals still match the schema" — a reader is told plainly that the document can drift and what would have to happen for nobody to notice. 3. **Provenance now names all three scripts, and there are no others to miss.** `0003-group-colour.sql, added by task 182 (ADR-0098)` — checked against the script's own header comment ("Vikunja task 182, ADR-0098") and confirmed `docs/adr/0098-constrain-group-colour-to-a-fixed-palette.md` exists. `ls src/PlaceMark.Database/Scripts/` lists exactly three files, all three now named in the provenance paragraph. 4. Diff confirmed docs-only: `git diff --stat` against main shows only `docs/data-model.md`, 27 insertions / 6 deletions, one file. `InitialSchemaTests` rerun fresh: 9/9 pass. `dotnet format --verify-no-changes` clean. Both rounds of this PR now hold up under direct checking.
rob merged commit 8d9d3d5583 into main 2026-08-12 04:31:42 +00:00
rob deleted branch docs/erd-from-schema 2026-08-12 04:31:42 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rob/PlaceMark!134
No description provided.