Local dev environment for steakweb#2
Conversation
|
Can you rebase on what is in I can also provide a definitive schema: |
Replaces the schema reconstructed from steakweb.py's queries with the definitive one posted in PR Shadytel#2 (boolean publish/provisioned, the extra extension columns, and the switches table), and reseeds to match. Adds a primary key on extn, which the posted schema omits but create_extn's "already taken" handling depends on.
82f4b4c to
1e76db6
Compare
Rebased on main and swapped your schema in, thanks. I kept one addition in the dev copy: a primary key on extn, since create_extn detects "already taken" by catching the unique violation. If prod doesn't have one either, duplicates insert silently, probably worth checking. The real schema also caught a bug: publish is boolean but create_extn binds the string 't'/'f', which asyncpg won't accept, so creating an extension 500s. Fixed in #3, together with two mis-indented lines that snuck into the #1 merge (main doesn't parse right now, so #3 should land before anything deploys) and an unpublish fix. This branch sits on top of #3; the extra commits drop off once it merges. Re-ran the checklist against the new schema and it all works. |
The publish column is boolean (per the schema supersat posted in Shadytel#2), and asyncpg rejects a str parameter for a boolean column, so inserting the string 't'/'f' fails with a DataError. Pass a real bool instead.
The homepage row form posts the checkbox as 'published', but the non-admin path read 'publish' with a default of '1', so a regular user could never unpublish a line. Use the same key and default as the admin path.
Run steakweb against a throwaway Postgres with no SAML IdP, to test the activation and directory changes locally. dev/ has the docker-compose, a reconstructed schema (none exists in the repo), seed data, a local config, and a README. steakweb.py gets a STEAKWEB_DEV-gated dev login and TCP bind that do nothing in prod. Adds a .gitignore.
Replaces the schema reconstructed from steakweb.py's queries with the definitive one posted in PR Shadytel#2 (boolean publish/provisioned, the extra extension columns, and the switches table), and reseeds to match. Adds a primary key on extn, which the posted schema omits but create_extn's "already taken" handling depends on.
1e76db6 to
ffcc47c
Compare
Runs steakweb locally against a throwaway Postgres, with no prod DB or real SAML IdP. I used it to test the activation and directory changes.
Builds on #1 — its test checklist assumes those fixes are in, so merge #1 first. Until it lands, this PR also lists #1's commits; they drop off once #1 is merged, leaving just the dev-env commit.
Everything's under
dev/:docker-compose.yml— Postgres on127.0.0.1:5433, loads the schema and seed on first boot.schema.sql— reconstructedregistered_extensions, since there's no schema in the repo.publish/provisionedarechar(1)holding't'/'f', because that's what the code binds — a realboolcolumn would make asyncpg reject the string.seed.sql— a handful of rows to test against: published and unpublished, a name with HTML in it, an out-of-range number, and one that triggers the "already taken" path.config.dev.json— points at the local DB.config.jsonstays gitignored.README.md— setup and what to click.The only thing touched outside
dev/is aSTEAKWEB_DEV-gated block insteakweb.py: a/dev/loginthat fakes a session, a TCP bind, and skipping the SAML metadata fetch. It's all behindos.environ.get('STEAKWEB_DEV'), so prod is unchanged.The schema's a guess from reading the code, not the real one — swap it in if you have it.