Skip to content

feat: optional reference field on devices - #907

Open
edwh wants to merge 4 commits into
nuxt-clientfrom
feat/device-reference-nuxt
Open

feat: optional reference field on devices#907
edwh wants to merge 4 commits into
nuxt-clientfrom
feat/device-reference-nuxt

Conversation

@edwh

@edwh edwh commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Reimplements #775 on the Nuxt client, so the work isn't lost when the SPA lands.

Groups that run their own repair-tracking software need to tie an item on Restarters back to their own record. This adds an optional free-text reference (max 255) to a device.

API — as in #775: migration, $fillable, validation in validateDeviceParams, the Device resource, the OpenAPI schema, and both the create and update paths.

Client — new work, since #775 predates the SPA:

  • DeviceForm.vue — the field sits with brand/model, because it identifies the item rather than describing its repair. Tooltip from devices.tooltip_reference.
  • DeviceRow.vue — shown small and muted above the item type, matching what RES-2008 Add reference field for devices #775 did in EventDeviceSummary.vue, so it's readable without opening the row and without spending a table column.

Translationsreference/tooltip_reference in en, fr and fr-BE (fr strings taken from #775), with client/i18n/locales/*.json regenerated by translations:export-client.

Tests — written first: 5 client specs (field present with tooltip, sent when filled, omitted when blank, prefilled when editing, displayed in the row) and the #775 backend assertions for the create and update round trip. Client 88/88 pass; the two device feature tests pass with 23 assertions.

🤖 Generated with Claude Code

edwh and others added 2 commits September 8, 2026 14:21
Reimplements PR #775 on the Nuxt client. Groups that use their own
repair-tracking software need to cross-reference an item on Restarters
back to their own record, so the device gains a free-text reference:
optional, 255 chars, shown small and muted above the item type in the
event's device table.

The API side follows #775 as-is (fillable, validation, resource,
OpenAPI schema, both create and update paths). The client side is new:
the field lives with brand/model in DeviceForm, since it identifies the
item rather than describing its repair.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
EventDevicesReadOnly.vue duplicates DeviceRow.vue's columns for people
who can't edit the event, so the reference belongs there as well -
otherwise it disappears exactly for the audience most likely to be
cross-checking it against their own records.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
edwh and others added 2 commits September 8, 2026 14:44
An API 500 surfaces in the Playwright output only as "expected 200,
received 500", and the job uploads nothing server-side, so there is no
way to tell what actually threw without pushing a commit to find out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
docker_run.sh runs migrate:fresh --seed as the container starts, so CI
setting log_bin_trust_function_creators afterwards in "Setup application"
is too late. The trigger migration fails with ERROR 1419, migrate stops
there, and every later migration is silently skipped - leaving a
half-migrated database that mostly works until something needs one of
the skipped columns.

That is why the device tests here returned 500: add_reference_to_devices
comes after recreate_repair_status_triggers, so its column never existed.
The same trap bites local reseeds.

Setting it in the mounted my.cnf applies from server start, before
anything migrates.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

@edwh

edwh commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Now green (build, build-client, e2e-client, Sonar).

Two CI fixes ended up bundled in here, which is why a device-reference PR touches mysql/my.cnf and .circleci/config.yml. Both were needed to get this branch to pass, and both are pre-existing:

log_bin_trust_function_creators was set too late. docker_run.sh runs migrate:fresh --seed as the container starts; CI set the flag afterwards in "Setup application". So recreate_repair_status_triggers failed with ERROR 1419, migrate stopped there, and every later migration was silently skipped — including this PR's. That's what produced the unexplained 500 from device create: the column simply didn't exist. Setting it in the mounted my.cnf applies from server start. Verified on a stock mysql:8.0: the variable is 1 at startup, log_bin is on, and a non-SUPER user creates a trigger fine.

The client e2e job kept no server-side logs. An API 500 showed up only as "expected 200, received 500", so there was no way to tell what threw without pushing a commit to find out. It now copies storage/logs into the artifacts and prints the last errors — that's what made this diagnosable.

develop has the same my.cnf problem, dormant only because the trigger migration is currently last there — #909 fixes it on that side. Happy to split either fix out of here if you'd rather review them separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant