RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/AGENTS.md/photoprism/photoprism

AGENTS.md

internal/service/cluster/AGENTS.md
AGENTS.md

Quality

76/100

Scores the file, not the repository.

Length

540 words

6 headings · 0 code blocks

Repository

40k

— · pushed 0 days ago

Last changed

2 days ago

First indexed 2 days ago.
photoprism/photoprism/internal/service/cluster/AGENTS.mdRawGitHub
1# Cluster Guidelines
2 
3**Last Updated:** April 9, 2026
4 
5## Bootstrap & Registration
6 
7- Keep bootstrap code decoupled: do not import `internal/service/cluster/node/*` from `internal/config` or the cluster root; nodes talk to the Portal over HTTP(S) and use `internal/service/cluster/const.go`.
8- On `401` or `403`, bootstrap refreshes node OAuth credentials by rotating the secret and retrying; log that at info level. If the secret file cannot be written, keep the rotated value in memory.
9- Portal validation may accept HTTP advertise URLs only for loopback or cluster-internal domains such as `*.svc`, `*.cluster.local`, and `*.internal`; all other advertise URLs must use HTTPS.
10- Registration flow: send `rotate=true` only for MySQL or MariaDB nodes without credentials, treat `401`, `403`, and `404` as terminal, include `ClientID` plus `ClientSecret` when renaming an existing node, and persist only newly generated secrets or DB settings.
11- Config init order for cluster-aware startup is: load `options.yml` with `c.initSettings()`, run `EarlyExt().InitEarly(c)`, connect or register the DB, then invoke `Ext().Init(c)`.
12 
13## Registry, DTOs & Provisioning
14 
15- Use `NewClientRegistryWithConfig`; the file-backed registry is legacy.
16- Nodes are keyed by UUID v7 at `/api/v1/cluster/nodes/{uuid}`. Keep the registry interface UUID-first: `Get`, `FindByNodeUUID`, `FindByClientID`, `RotateSecret`, and `DeleteAllByUUID`.
17- CLI lookups should resolve `uuid -> ClientID -> name`.
18- DTOs normalize `Database.{Name,User,Driver,RotatedAt}` and expose `ClientSecret` only during creation or rotation.
19- `nodes rm --all-ids` must clean duplicate client rows.
20- Registry files live under `conf.PortalConfigPath()/nodes/` with mode `0600`, and `ClientData` no longer stores `NodeUUID`.
21- Database and user names use UUID-based HMACs in `<prefix>d<hmac11>` and `<prefix>u<hmac11>` form; the prefix defaults to `cluster_` and may be overridden only by the portal-only `database-provision-prefix` flag.
22- `BuildDSN` accepts a `driver` but falls back to MySQL format with a warning when the driver is unsupported.
23- If Postgres provisioning is added, extend both `BuildDSN` and `provisioner.DatabaseDriver`, add validations, and return `driver=postgres` consistently in API and CLI output.
24 
25## Cluster API & Theme Changes
26 
27- When renaming or adding cluster response fields, update DTOs in `internal/service/cluster/response.go`, handlers, Swagger, tests, specs, and grep for old and new field names.
28- The theme endpoint `GET /api/v1/cluster/theme` streams a zip from `conf.ThemePath()`. Reinstall only when `app.js` is missing and use the shared helpers in `pkg/http/header`.
29- Admin responses may include `AdvertiseUrl` and `Database`; client and user sessions must remain redacted.
30 
31## Cluster Tests
32 
33- Generate OAuth client IDs with `rnd.GenerateUID(entity.ClientUID)` and node UUIDs with `rnd.UUIDv7()`; treat `node.uuid` as required in responses.
34- Cluster registry tests under `internal/service/cluster/registry` intentionally use a full `config.TestConfig()` because they persist `entity.Client` rows. Do not switch them to minimal config helpers unless the tests stop touching the database.
35- Exercise Portal endpoints with `httptest`, guard extraction paths with `pkg/fs.Unzip` size caps, and confirm admin-only fields disappear for client or user sessions.
36- Portal proxy URI validation must use the Portal test environment with `NODES=2` and verify both instance routes when changing `PHOTOPRISM_PORTAL_PROXY_URI` or matching node `PHOTOPRISM_SITE_URL` prefixes; use `PORTAL_TEST_ENV_ARGS=--proxy-uri=/instance/` to regenerate consistent `.env` values.
37- Before `make -C portal test-start`, run a full rebuild with `make -C portal test-env NODES=2`; avoid `--no-build` refreshes unless you are intentionally validating env-only changes.
38 
39## Cluster Preflight
40 
41- `go build ./...`
42- `make fmt-go swag-fmt swag`
43- `go test ./internal/service/cluster/registry -count=1`
44- `go test ./internal/api -run 'Cluster' -count=1`
45- `go test ./internal/commands -run 'ClusterRegister|ClusterNodesRotate' -count=1`
46 

Commands it names

  • node.uuid
  • make -C portal test-start
  • make -C portal test-env NODES=2
  • go build ./...
  • make fmt-go swag-fmt swag
  • go test ./internal/service/cluster/registry -count=1
  • go test ./internal/api -run 'Cluster' -count=1
  • go test ./internal/commands -run 'ClusterRegister|ClusterNodesRotate' -count=1

Sections

  • Cluster Guidelines
  • Bootstrap & Registration
  • Registry, DTOs & Provisioning
  • Cluster API & Theme Changes
  • Cluster Tests
  • Cluster Preflight

What it covers

buildtestapi

Stack — with the evidence

go

(1.00)

eslint

(1.00)

ai-agent

(0.90)

vue

(0.70)

vite

(0.70)

vitest

(0.70)

javascript

(0.60)

docker

(0.60)

github-actions

(0.60)

Format

AGENTS.md

A plain-markdown README for coding agents, deliberately unopinionated: no frontmatter, no globs, no vendor keys. That minimalism is why it became the one file a dozen different agents will read, and why it carries the least per-file targeting power of any format here.

What the corpus says about it

Repository

Owner
photoprism
Language
—
License
—
Archived
no

All configs in this repo

Also in photoprism/photoprism

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
photoprism/photoprisminternal/config/AGENTS.md · 40kAGENTS.mdgoeslint+7databasedo-not46/1002 days ago
photoprism/photoprisminternal/entity/migrate/AGENTS.md · 40kAGENTS.mdgoeslint+7testtesting-strategydatabase63/1002 days ago
photoprism/photoprisminternal/photoprism/AGENTS.md · 40kAGENTS.mdgoeslint+7no sections39/1002 days ago
photoprism/photoprismpkg/AGENTS.md · 40kAGENTS.mdgoeslint+7teststylesecurity55/1002 days ago
photoprism/photoprisminternal/commands/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyle66/1002 days ago
photoprism/photoprism.claude/CLAUDE.md · 40kCLAUDE.mdgoeslint+7buildtestlint-formatstyle+796/1002 days ago
photoprism/photoprism.github/copilot-instructions.md · 40kCopilot instructionsgoeslint+7buildtestlint-formatstyle+590/1002 days ago
photoprism/photoprism.github/instructions/backend.instructions.md · 40kCopilot instructionsgoeslint+7testlint-formatstyletypes+483/1002 days ago
photoprism/photoprism.github/instructions/frontend.instructions.md · 40kCopilot instructionsgoeslint+7testlint-formatstyleagent-behaviour76/1002 days ago
photoprism/photoprismAGENTS.md · 40kAGENTS.mdgoeslint+8setupbuildtestlint-format+882/1002 days ago
photoprism/photoprismfrontend/AGENTS.md · 40kAGENTS.mdgovitest+7setupteststyletesting-strategy+176/1002 days ago
photoprism/photoprisminternal/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyletesting-strategy71/1002 days ago
photoprism/photoprisminternal/api/AGENTS.md · 40kAGENTS.mdgoeslint+7teststyletesting-strategyapi62/1002 days ago
Diff against internal/config/AGENTS.md Diff against internal/entity/migrate/AGENTS.md Diff against internal/photoprism/AGENTS.md Diff against pkg/AGENTS.md Diff against internal/commands/AGENTS.md Diff against .claude/CLAUDE.md Diff against .github/copilot-instructions.md Diff against .github/instructions/backend.instructions.md Diff against .github/instructions/frontend.instructions.md Diff against AGENTS.md Diff against frontend/AGENTS.md Diff against internal/AGENTS.md Diff against internal/api/AGENTS.md

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67kAGENTS.mdtypescriptbun+10setupbuildtestlint-format+6100/1002 days ago
TryGhost/Ghoste2e/AGENTS.md · 55kAGENTS.mdtypescriptjavascript+12setupteststylearch+2100/1003 days ago
trick77/agents-md-syncAGENTS.md · 2AGENTS.mdtypescriptnode+4setupbuildteststyle+5100/1003 days ago
n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199kAGENTS.mdtypescriptlangchain+16buildteststylearch+3100/1003 days ago
duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70AGENTS.mdtypescriptjavascript+5buildteststylearch+3100/1003 days ago
mui/material-uiAGENTS.md · 99kAGENTS.mdtypescriptjavascript+13setupbuildtestlint-format+9100/1003 days ago
SkeneTechnologies/skene-cookbookAGENTS.md · 51AGENTS.mdpythoneslint+4setupbuildtestlint-format+7100/1002 days ago
ethereum/go-ethereumAGENTS.md · 51kAGENTS.mdgodocker+1buildtestlint-formatgit+1100/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack