feat(seed): template-declared owns scope and password_env (PSA-56 part 1) #345
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PSA-56-owns-scope-password-env"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The two loader generalizations that let the Playwright E2E accounts - which are
@a8n.run(not the reserved demo domain) with an env-injected password - be expressed as a seed template. This is the pure, gate-verifiable foundation; wiring reset toowns, the committede2e.json, and retiringbunyip-e2e-bootstrapfollow in part 2 (the E2E-gate-touching bits).What's here (all pure, unit-tested)
SeedOwns+SeedFile.owns- a file declares the email domains and explicit emails it owns.covers()decides membership (domain match anchored on@, or an exact email, both case-insensitive).effective_owns()defaults to the reserved seed domain when a file omits the block, so existing files keep working. Validation now requires every user and feedback-author email to be covered by the file's own scope, so a reset can always reclaim exactly what a file created and no file can reclaim another's rows.SeedUser.password_env- a user may name an env var to source its password from at load time (secret_env,_FILE-aware, trimmed before hashing), so a secret never lands in the committed file. Precedence:password_env, then a literalpassword, thendefault_password. An emptypassword_envis rejected.owns(the reserved domain) explicitly;demo-msp.jsonregenerated. The export mapper stampsowns= the domain it was scoped to, so a round trip validates and reset reclaims the same set.Tests
owns.covers(domain + explicit email, case-insensitive, no sibling-domain over-match); an E2E-style file owning two explicit@a8n.runemails validates; a user outsideownsis rejected; an emptypassword_envis rejected.Verification
just check-containergreen (fmt + clippy-D warnings+cargo test --workspace --all-targets; seed lib 58 tests incl. the 4 new).password_envresolution and the exportownsstamp are compile-checked; DB behaviour runs against a dev database.Part 2 (follow-up)
Reset scoped to
owns(repo methods +seed reset), a committede2e.json(owns the two@a8n.runemails,password_env: BUNYIP_E2E_TEST_USER_PASSWORD), convertingbunyip-e2e-bootstrapto load it through the loader, and keeping the E2E CI gate green. That is where AC 3-6 land.AC status (this PR)
Covered:
owns-scope declaration + validation (AC 1 foundation),password_envsourcing + validation (AC 2),owns/password_envtests (AC 7 foundation). Open in part 2:e2e.json(AC 3), bin conversion (AC 4), guards + cleanup semantics (AC 5), the live E2E gate (AC 6), reset-scoping DB behaviour.#PSA-56
ownsscope andpassword_env(PSA-56 part 1)ownsscopeowns+ retire bunyip-e2e-bootstrap to a template (PSA-56 part 2)