Access was admin or nothing, so letting a friend print receipts meant making
them a full admin. Users now carry a list of permissions (User.Permissions,
a JSON column), each a key from the registry in services/permissions.go;
admins pass every check. The only key so far is `receipt`.
GET /auth/validate/:permission answers like /auth/validate-admin (200/403/401,
with the same refresh-token fallback, now shared) plus 404 for an unknown key,
and reads the user row rather than the token, so a grant or revoke applies on
the next request. On 200 it returns the username in X-Auth-User.
nginx gets a permission gate beside the admin gate: a location sets
$auth_permission and auth_requests /internal/auth/validate. /receipt/ moves
onto it, forwarding X-Remote-User to the receipt server. 403 now goes to
/no-access rather than back to the login page. The variable must not be given
a server-level default: the subrequest re-runs the server rewrite phase and
would blank it.
The admin panel's Manage Users tab ticks permissions per user
(setUserPermissions, permissionTypes). The login page is no longer
admin-only in wording or destination: a non-admin lands on /account, which
lists the services they can open; /no-access is the same view with a notice.
/auth/validate-admin and every other admin-gated service are unchanged.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Authorisation: @admin and @signedIn schema directives replace the 25
hand-copied resolver checks. A test fails if a mutation has neither and
is not on the public allow-list, so a new mutation cannot ship unguarded.
IDs: uint model IDs bind through graphql.UintID, removing the ten
int(obj.ID) resolvers.
Job status is a GraphQL enum, tied to services.statusOrder by a test.
Input is strict, so the mutations no longer coerce an unknown status to
"applied"; output is lenient so one legacy row cannot fail the list.
deleteJobApplication and deleteJobAppReference now error on a missing id
like the other deletes.
The rowing reader, the job extractor and now the email classifier reach
the Python service through one services.CallPython helper. The email
pipeline's prompt and fence stripping moved to Python, and
anthropic-sdk-go is gone from go.mod.
Fix the auth test fixture, whose 11-byte secret had been panicking the
services test package since InitAuth began requiring 32 bytes. Add a
test that keeps the python service's compose environment list in step
with the env registry.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Security:
- Token revocation. User gains a TokenVersion counter embedded in both
tokens as a "tv" claim; AuthenticateToken rejects a token whose version
no longer matches the row. Logout bumps it, so logging out now kills
outstanding tokens rather than only clearing cookies. Costs one
primary-key SELECT per authenticated request, which is the price of
having revocation at all.
- Spotify OAuth CSRF. The fixed SPOTIFY_AUTH_STATE constant is replaced by
a per-request one-shot nonce, verified and consumed on callback.
- Private chat attachments. Attachments on private messages are written to
/backend/uploads/private/ and served at /uploads/private/, gated by the
same nginx auth_request admin check used for /hasura/ and /notes/.
Private uploads are rejected from non-admin callers.
- The icecast admin UI (/radio/admin/) is behind the admin gate; listener
traffic is untouched.
- Store caches are mutex-guarded, so -race is clean.
Bugs:
- The email pipeline no longer drops emails permanently on transient
failure. Failures record an attempt counter and are retried up to 3
times; the fetch window rewinds to the oldest retryable email's
ReceivedAt, without which a retry could never re-fetch it.
- Rowing duplicate detection distinguishes ErrRecordNotFound from a real
DB error, so a transient failure no longer causes a duplicate insert
plus a paid Claude call.
- DeletePost propagates its delete error instead of reporting success.
- RecentlyPlayed populates the cache it reads.
- main.go exits non-zero if r.Run fails, so a port conflict is visible.
- Python: the scan truncation flag is set on every deadline path;
timed_out is reported by the worker rather than inferred from the clock;
date validation uses Europe/London rather than server-local time.
- Vue: Time.vue and Radio.vue intervals are cleared on unmount; Feed.vue
guards a missing author; Timer.vue gets an explicit state machine and
compares total elapsed seconds; Elle.vue's comma-operator call and
per-frame console.log are fixed.
Simplification:
- One TTLCache replaces three near-identical cache implementations, with
the differing eviction rules as explicit parameters.
- run_scan's transport index no longer uses one object as both ordering
record and live output; its three phases are separate functions.
- _price_hotels submits all work to a single pool, so the nested-executor
deadlock hazard is gone by construction.
- The NDJSON event generators share one implementation.
- IMAP FETCH responses pair each line with its literal in the type, so
callers no longer hand-skip alternate entries.
- Shared helpers for slice-of-pointers, markdown fences and auth cookies.
- Vue: useHotelSearch, createMirrorStore, useRotation, useCreateForm,
useLinkAttrs, ListWidget and LinkTableItems replace duplicated blocks.
- nginx dev config's duplicated :80/:443 bodies share one partial.
Infra: certbot passes --deploy-hook touching a sentinel that nginx's
watcher reloads on, so renewed certs are served without a restart, and the
watcher also removes the manual restart after first issuance. db is gated
on service_healthy, autoheal is pinned, and the unused envsubst entries
are dropped.
Verified: go build/vet, npx vite build, py_compile, docker compose config
for both overlays, bash -n on all scripts, and an envsubst render of every
nginx template (no leftover placeholders, runtime vars preserved, braces
balanced).
Co-Authored-By: Claude Opus 5 <[email protected]>
Readability pass across all four areas of the stack. Comments explain why
rather than what, concentrated at the points where behaviour is non-obvious:
concurrency, caching, auth, scraping and nginx templating.
Backend: doc comments on every exported declaration across handlers,
services, models and resolvers. Resolver commentary lives inside function
bodies so gqlgen does not strip it on regeneration; schema files use #
comments rather than description blocks so introspection output is
unchanged. Extracted the duplicated auth-cookie blocks into helpers.
Frontend: header comments on every component, store and view, including
STATUS: notes marking which of the parallel/legacy views are still live.
Documented the non-reactive animation-state pattern, the homeData hub and
the WebSocket stale-socket guard. Removed a few dead imports and named the
reconnect-backoff and poll-interval constants.
Python: module and function docstrings covering the Travelodge scraping
contract, the deadline threading, the two-executor concurrency and the
NDJSON streaming protocol.
Infra: header blocks on every compose file, nginx template, Dockerfile and
entrypoint, covering the config selection, envsubst allow-lists, rate-limit
semantics and volume persistence. Hoisted the duplicated envsubst variable
list in nginx/entrypoint.sh.
New: backend/README.md, python/README.md, DEPLOYMENT.md, .env.example,
backend/graph/doc.go. Refreshed vue/README.md. Corrected CLAUDE.md, which
stated a 24h access token where main.go sets 7 days.
No behaviour change. go build/vet, vite build, py_compile and docker
compose config all pass.
Co-Authored-By: Claude Opus 5 <[email protected]>
Backend: new Place GORM model (title, location, notes, image, category,
cost, priority, done) with auto-migration, a place.graphql schema, and
resolvers for the places query plus admin-only create/update/delete.
Regenerate gqlgen output against gqlgen v0.17.95, which requires Go 1.26 —
bump go.mod and the builder image to match.
Frontend: a places Pinia store, a CreatePlace admin form, and a
PlacesTable rendered as a new tab in the Collage cell, with inline
done-toggle and delete for admins. Rework the Admin page into a
sidebar-navigated panel layout (picking up the previously unreachable
CreateBookmark form) and give Login proper field labels, submit state,
and error feedback.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KcFtkisHcKJuTZAnv3fVzA
Move Query/Mutation field declarations from the monolithic schema.graphql
into each domain's .graphql file using extend type, so gqlgen places
resolvers in the matching *.resolvers.go files. Extract helper functions
into *_helpers.go files to prevent gqlgen from commenting them out.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace 5 separate REST calls on home page load with a single GraphQL
query. Add homeData store that fetches posts, favorites, activities,
spotify, and auth in one request. Convert all admin mutations and
auth flows to use GraphQL. Add album images to Spotify GraphQL schema.
Co-Authored-By: Claude Opus 4.6 <[email protected]>