Upgrade (projects must change):
-
Settings renamed. Startup refuses each old name in
.envorconfig_extend.pyand names the new one:Old New config_access_token_expires_sec,config_refresh_token_expires_secconfig_access_token_expire_sec,config_refresh_token_expire_secconfig_otp_expiry_sec,config_otp_max_attemptconfig_otp_expire_sec,config_otp_attempt_maxconfig_blob_expire_sec_preview,config_blob_expire_sec_uploadconfig_blob_preview_expire_sec(default now 3600, was 360000),config_blob_upload_expire_secconfig_blob_limit_size_kb,config_blob_limit_uploadconfig_blob_size_max_kb,config_blob_upload_maxconfig_export_limit,config_batch_item_limit,config_query_runner_read_limitconfig_export_rows_max,config_batch_items_max,config_query_runner_rows_maxconfig_sql_read_limit_max,config_sql_read_limit_default,config_sql_read_relation_fetch_limit_maxconfig_sql_read_rows_max,config_sql_read_rows_default,config_sql_read_relation_rows_maxconfig_cache_row_limit_config,_users_role,_users_deactivated,_users_deletedconfig_cache_rows_max_config,_users_role,_users_deactivated,_users_deletedThe
/infokeyexport_limitkeeps its name. -
Settings loading:
config.pyno longer applies.envat import, soimport config/from config import xgives code defaults only. Read settings withconfig = func_config_read()(every Atom script now does,.envkeys included);from config importstays only forconfig_extend.py's# base, andscript.check's rules step now fails onimport config/from config importin any other*_extend/file. Malformed JSON (or the wrong kind) for a list or dict setting, or a non-integer for an int setting, now stops startup. A new.envkey whose value is t/f/y/n/true/yes/on loads as a boolean. A setting with no typed default (None, or a key only in.env) whose name has the wordpassword,key,secret,token,dsn,url,username,userornumberalways stays text (a digit-only password was an int). -
AI: the value
claudeis nowanthropic(ai=in route bodies,config_ai_services, default["gemini", "openai", "anthropic"]); an unknown name inconfig_ai_servicesstops startup, and an unknownaiis 400 (no fallback to OpenAI). Models come from the newconfig_ai_model_gemini,config_ai_model_openai,config_ai_model_anthropic. -
Routes renamed (verb last; ids unchanged):
Old New POST /private/send-emailPOST /private/email-sendDELETE /my/message-delete-thread,GET /my/message-inbox,GET /my/message-threadDELETE /my/message-thread-delete,GET /my/message-inbox-read,GET /my/message-thread-readPOST /my/object-create-mongodbPOST /my/mongodb-object-createGET /my/api-usage,POST /my/blob-preview-urls,POST /admin/blob-preview-urlsGET /my/api-usage-read,POST /my/blob-preview-url-read,POST /admin/blob-preview-url-readPOST /admin/blob-container-ops,POST /admin/blob-container-sasPOST /admin/blob-container-update,POST /admin/blob-container-sas-create(service=azureonly)GET /public/converter-numberGET /public/number-convertGET /admin/syncPOST /admin/cache-syncGET /admin/postgres-info,-schema,-slow-queriesGET /admin/postgres-info-read,-schema-read,-slow-queries-read -
Methods and params:
/admin/object-deleteand/my/object-deleteareDELETEwith query params:?table=<t>&ids=1,2(a comma list or a JSON list),modeandownership_columnas before./my/blob-delete-allisDELETE.?col→?columnand?agg_col→?agg_columnon everytable-column-groupbyandtable-column-distinctroute.- The OTP send routes read the body only, unknown params refused:
/public/otp-send-email {service, email}(sender from the newconfig_otp_email_sender, 500 when unset),/public/otp-send-mobile {service, mobile},/public/otp-send-mobile-sns-template {mobile}(template from the newconfig_sns_otp_template; startup checks its keys). Azure SMS sends fromconfig_azure_sms_from_numberonly. ?is_backgroundand?is_disable_cacheare 400 unless the route opts in ("is_background": True/"is_disable_cache": Trueinconfig_api). Atom opts in object create/update and postgres-import (background) and the/privateand/admingroupby/distinct routes (cache)./admin/postgres-query-runner-writeshipsis_active: False, and AGENTS.md says to leave it off (write through PgWeb on localhost or a script).
-
Behaviour changes:
- An unexpected exception type answers 500 "internal server error" (the real message goes to stderr and
log_api.error); only a plainExceptionorValueError, or one with astatus_code, stays 400 with its text. A value a column can't take (column 'x': invalid value: ...) and a CSV upload that is not UTF-8 stay 400.TimeoutErrorandConnectionErrorare 503 "service unavailable". func_postgres_updatealways returns the list of updated ids ([]when nothing matched), never"updated".func_postgres_create: rows of one call with different keys raise "object keys mismatch"; a one-row create serialises like a bulk one (a string sent to a jsonb column is stored as a JSON string); a NULL array stays NULL.mode="flush"is gone:func_postgres_buffer_flush(...).- Filters:
a OR bsplits only when every part is a filter; commas and AND no longer split text or JSONcontainsvalues.group_valuesrefuses null, and 1 and "1" are one group. - Schema sync compares type modifiers and defaults exactly, so a column whose length, precision or default differs gets
ALTERat the next start. Indexbtree(lower(col))is accepted; users getsidx_users_lower_email_role_btreeandbtree(last_active_at),idx_users_password_btreeis dropped. Over-long CHECK/UNIQUE names are clamped and created at the next start. config_is_cors_allow_credentialsdefaults to False. Pages get a Content-Security-Policy from the newconfig_page_csp, report-only whileconfig_is_page_csp_report_only(default True). HSTS is sent whenconfig_is_prod.config_blob_container_allowed(new, default[]): user upload, presigned-upload and/mypreview routes answer 403 until a container is listed.- New users column
password_changed_at(triggerusers_password_changed_at): a refresh token issued more than 5 s before a password change gets 401 (5 s for the database's clock running ahead). - PgWeb answers only a localhost Host (open
http://localhost:<port>/page/pgweb); a read-only script with transaction control,DOorCALLis refused; integers beyond ±(2^53−1) come as JSON strings. /my/user-updatewithemailormobilenull is 400. Public export, groupby and distinct are rate limited. Startup refuses OIDClink_emailon a{tenantid}issuer withouttenants. The OTP email is plain text on every provider.- Every Atom script reads settings through
func_config_read()(soconfig_extend.pyapplies); the users-delete worker purges past retention hourly instead of every poll, and reads the owned tables again for each batch of tasks it claims. - Webhooks: delivery runs in up to four loops per worker, at most a quarter of the master pool, each sending on its job's own connection; it uses its own HTTP client, which never goes through an
HTTP(S)_PROXYfrom the environment (the app needs direct outbound HTTPS).func_webhook_deliver_periodic_tasktakes noclient_http;func_webhook_deliver(client_postgres=)is the job's connection.func_queue_postgres_job_takecallsrun(payload, conn): a project calling it directly adds theconnargument. - Kafka: group
atom_<task>(wasatom), starting at the oldest message: the first start may rerun kept messages. ?is_background=truerequests count againstconfig_background_task_maxon their own: Atom's internal background work no longer fills the cap.
- An unexpected exception type answers 500 "internal server error" (the real message goes to stderr and
-
Now sync (drop the
await):func_token_encode,func_token_decode,func_postgres_column_regex_check(wasfunc_regex_check),func_number_convert(wasfunc_converter_number),func_middleware_active_check,func_middleware_auth_check,func_middleware_api_response_error. -
Modules (only
from function.<module> importis affected;app_state.func_*andfrom function import func_xwork with the new names):Old New clients.py,checks.py,storage.py,messaging.py,queues.py,query_runners.pyclient.py,config_check.py,blob.py,message.py(+email.py,otp.py),queue.py(+producer.py,consumer.py),query_runner.py(+postgres_query_runner.py,mssql.py,clickhouse.py)validation.py,data_import.py(removed)postgres_schema.py,auth.py,object.py;mongodb.py,postgres_import.py,request.pyparts of auth.py,export.py,background.py,schedule.py,app.py,middleware.py,pgweb.pytoken.py,api_key.py,otp.py,user.py;postgres_export.py;postgres_connection.py,postgres_crud.py;script.py;admin.py,openapi.py,app_static.py,runtime.py;api.py(func_api_error),client.py(func_client_check);pgweb_common.py,pgweb_catalog.py,pgweb_rows.py,pgweb_query.pyfiles/param_spec.pyfunction/route_param_spec.pyRule:
function/<f>.pyandfunction/<f>_<part>.pydefine onlyfunc_<f>_*(a test enforces it). -
Functions renamed (old → new;
script.checknames any call it no longer finds):- AI and app:
func_anthropic_json→func_ai_anthropic_json;func_ai_claude_json,_gemini_json,_openai_json→func_ai_anthropic_sql_json,func_ai_gemini_sql_json,func_ai_openai_sql_json;func_ai_client_check→func_ai_client(app_state, ai);func_response_json→func_app_response_json;func_endpoint_json_wrap→func_app_endpoint_json_wrap;func_sentry_init→func_app_sentry_init;func_atom_version→func_app_atom_version_read;func_structure_init→func_app_structure_init;func_admin_sync→func_admin_cache_sync. - Auth:
func_auth_user_login_fetch→func_auth_user_login_read;func_auth_check_user_active,_check_token_issued,_check_signup_role,_check_config→func_auth_user_active_check,func_auth_token_issued_check,func_auth_signup_role_check,func_auth_config_check;func_role_allowed_values→func_auth_role_allowed_values;func_token_check_secret_key→func_token_secret_key_check;func_mfa_token_encode/_decode→func_totp_mfa_token_encode/_decode;func_auth_login_finish→func_totp_login_finish;func_auth_login_totp→func_totp_login(app_state, client_postgres, mfa_token, code);func_auth_oidc_user→func_oidc_user_find_or_create;func_root_user_permissions/_sync→func_user_root_permissions/_sync. - Background:
func_postgres_buffer_flush_periodic_task→func_background_buffer_flush_periodic_task;func_inmemory_cache_cleanup_periodic_task→func_background_cache_cleanup_periodic_task;func_async_tasks_cancel,func_app_tasks_start,func_app_tasks_stop→func_background_tasks_cancel,_start,_stop;func_table_retention_cleanup→func_postgres_retention_delete. - Startup checks:
func_check→func_config_check;func_check_int→func_config_int_check;func_check_log_api_table,_database_config,_postgres_schema,_settings_removed,_runtime_config,_api_route,_api_config,_postgres_connections,_config_extend_alias,_config_extend_keeps_atom→func_config_log_api_table_check,func_config_database_check,func_config_postgres_schema_check,func_config_removed_check,func_config_runtime_check,func_config_api_route_check,func_config_api_check,func_config_postgres_connections_check,func_config_extend_alias_check,func_config_extend_atom_check. - Clients:
func_client_s3,_sns,_ses→func_client_aws(service=);func_rabbitmq_close→func_client_rabbitmq_close;func_gemini_close→func_client_gemini_close. - Schema and objects:
func_regex_check→func_postgres_column_regex_check;func_column_regex→func_postgres_column_regex_read;func_buffer_limit→func_postgres_buffer_limit_read;func_check_table_column_exists→func_postgres_table_column_check;func_config_api_names→func_postgres_api_name_dict;func_check_table_access,_table_not_users,_honeypot,_batch_limit→func_object_table_access_check,func_object_table_users_check,func_object_honeypot_check,func_object_batch_check;func_postgres_vector_columns→func_postgres_column_kinds(schema=). - Request, export, paging:
func_query_bool_parse→func_request_bool_parse(value, default=None)("ok" is no longer true; t/f/y/n are);func_attach_user_audit_fields→func_request_audit_fields_add;func_extract_request_object_list→func_request_object_list_read;func_api_file_to_chunks→func_request_csv_chunks_read;func_csv_cell,_row,_stream,_response→func_export_csv_cell,_row,_stream(batches=, columns=),_response;func_export_limit→func_export_limit_check;func_page_limit→func_postgres_page_limit_check;func_page_*→func_postgres_page_*. - Middleware:
func_middleware_check_active,_auth,_user_status,_role,_permission,_ratelimiter,_ip_allow,_token_verify→func_middleware_active_check,_auth_check,_user_status_check,_role_check,_permission_check,_ratelimiter_check,_ip_allow_check,_token_verify_check;func_middleware_api_background(scope, request, config_background_task_max);func_middleware_api_cachetakesis_disable_cache;func_middleware_security_headerstakesis_prod. - PgWeb, queues, storage:
func_pgweb_insert_row,_update_cell,_delete_row→func_pgweb_row_insert,func_pgweb_cell_update,func_pgweb_row_delete;func_producer→func_producer_send(andfunc_producer_<broker>→func_producer_send_<broker>);func_run_broker→func_consumer_broker_run;func_consumer_run→func_consumer_task_run;func_consumer_postgres→func_consumer_postgres_open;func_blob_container_ops→func_blob_container_update;func_blob_preview_urls_get→func_blob_preview_url_read;func_email_resend_postis removed. - Params:
func_postgres_table_column_groupby_read(column=, agg_column=, config_sql_read_rows_max=, config_page_offset_max=)and_distinct_read(column=, ...)(werecol=,agg_col=,app_state=);client_password_hasheris removed from the read functions;func_postgres_query_ai/func_clickhouse_query_aitakeai,client_ai,model;func_ai_sql_generate(ai, client, model, prompt, name);func_otp_send_mobiletakes nosender;func_webhook_url_checkreturns the checked address;func_postgres_mark_read(app_state=, ...);func_message_socket_authreturns (user, exp);func_postgres_schema_init/_steps/_users_inittakeroot_user_password=andclient_password_hasher=(and noapp_statefor_steps/_tables_init). Insidefunction/steps call each other directly, so a test patches the module attribute, notapp_state.func_*.
- AI and app:
-
config_api: the list form of
user_check_role/_deactivated/_deletedis removed (startup says so). -
Removed:
script/postgres_ingestion.py;docs/faq.mdanddocs/audit.md(their facts moved to the docs that own each topic); Motor (client_mongodbis now pymongo'sAsyncMongoClient, pinned aspymongo; a project importingmotoradds it under# extend). -
Pages: api.html's modals are
<dialog>elements and its ids say what they hold (catalogSearch,runBtn,responseBox,wsEndpoint,headersSection, ...); its CSV isapi_catalog.csv. pgweb.html's status bar is gone. -
Kafka consumers join the group
atom_<task>(one group per task, so a restart rebalances only that task). A new group starts from the oldest kept message: before upgrading a Kafka consumer, let its old group drain, or messages still kept may run again. -
PgWeb health shows only the connected database; the new Server view (
action: "server") holds the rest: overview and settings, the login's permissions (superuser, managed-cloud admin role, monitor), every database's counters and connections, long queries in any database, and the login roles.
Security:
- Logins take the same time for unknown users and users without a password (dummy argon2 hash); the password is checked before the role, and each matching role is tried. Tokens carry
iat. - OTP sends are limited per recipient (
config_otp_send_per_hour_max, 5 an hour; 429); Fast2SMS sends its key in a header, never the URL; TOTP disable clears the secret, last step and recovery codes; the static OTP checks the identifier first. - The middleware strips the ASGI root path before looking up
config_api, so a route served under--root-pathkeeps its auth. - PgWeb strips comments and literals before its read-only and unbounded-write checks, so a
;inside a string no longer splits a statement. - Webhook deliveries connect to the address that passed the public-address check, pinned in the connection itself (the URL, Host, TLS name and connection reuse keep the host name, so two hosts on one address never share a connection), and a host with any private address is refused.
- On a public route (
"auth": []) only an access token or an API key identifies the caller: a refresh or 2FA token no longer setsrequest.state.user(it stampedcreated_by_idon/public/object-createand keyed the rate limit). - The password hash never leaves a read:
column=*expands without blocked, tsvector and vector columns. - S3 delete errors raise; a multi-file upload checks every file before uploading any; container SAS lasts 900 s (
config_blob_container_sas_expire_sec). - Redis and AI clients have timeouts (5 s; AI 600 s and 2 retries); exports set
idle_in_transaction_session_timeout;?is_backgroundrequests are capped (config_background_task_max, 503 when full); the message socket checks deleted and deactivated users at connect. script.checkscans Atom's own tracked files for keys, tokens and URL passwords (new patterns: Azure account keys, Google API keys, GitHub tokens, Atomatk_keys). CI runs with read-only permissions, actions pinned by commit SHA, and a newer push cancels an older pull-request run; every push to main runs to the end (its own concurrency group), and the release workflow has no group that could drop a pending release.
Performance (oha, 50 users, 1 worker, 33.0.1 → 34.0.0; full method in docs/benchmark.md):
/info11,534 → 13,727 req/s (+19%); cached/public/object-read10,496 → 12,176 (+16%);/private/object-read3,136 → 3,438 (+10%);/my/object-read2,855 → 3,247 (+14%);/my/object-create4,478 → 5,011 (+12%).- CPU per request in-process:
/health40.2 → 32.0 µs,/info51.5 → 37.1, cached read 59.3 → 42.4, private read 311 → 279, my read 338 → 296, my create 230 → 199. inlists and OFFSET are bound (= ANY($n)), so asyncpg reuses 3 statements instead of one per list length and page (mixed paging: 1,510 → about 1,200 µs). Exports read in batches of 5,000 (1M rows: 13.9 → 11.1 s, byte-identical). Startup 0.70 → 0.64 s, idle memory 164 → 154 MB;import main0.49 → 0.41 s.sync.pyreads every upstream file with onegit cat-file --batchinstead of one git process per file.- Each worker freezes what startup built (
gc.freeze(), about 100,000 objects): full garbage collections no longer scan it, so their pause drops from 23–29 ms to under 0.5 ms (CPU per request unchanged). Monitor's memory view counts the frozen objects and lists the object types made since startup. - Passwords hash with the new
config_password_hash_profile:owasp(default; argon2id 19 MiB, 2 passes, 1 lane) orstrong(64 MiB, 3 passes, 4 lanes, the earlier default). A login or new password takes 19 MiB instead of 64 MiB and about a third less time (26 ms against 39 ms per verify here). Existing hashes keep their own cost and still verify; a password gets the profile when it is next set. Root's hash is rewritten once at the first start (root then logs in again); an unknown profile stops startup. client_httpmakes its transport (CA bundle, proxy settings) on its first request: about 2 MB less per worker that never calls out. The OpenAPI spec walks each route's source once instead of twice (startup about 6 ms less). Importingmainand starting loads no optional SDK (a test keeps it so).
Fixes:
- Postgres queue workers survive database errors (backoff up to 30 s) and reopen a dropped LISTEN; Redis lock renewals and job finish failures are logged; a standby Redis consumer stops at the first SIGTERM; mark-as-read runs as a tracked background task.
- CHECK/UNIQUE constraint names over 63 bytes were never created; CSV import reads a UTF-8 BOM; SQL wraps survive a trailing comment; interval, point and range columns bind correctly; bulk inserts keep plain
jsonobjects and bytes. - The root password is rewritten only when it changed, so restarts keep root's refresh tokens.
- api.html: the Raw view no longer changes values, the light theme hover is readable, cURL export quotes every value, a pasted cURL cannot inject markup, Escape closes only the top dialog, and the fake 0.8 s loading overlay is gone. Copy cURL shows a typed Authorization value as it is sent, a pasted or added Authorization row is never replaced by the page's token, and
--form-stringfields paste back. Message keeps unsent drafts per conversation, a sent message never stays as a draft, and a message the socket did not confirm goes back in the box with a note that it may have been sent; Monitor ignores answers from a tab left behind; with reduced motion, the atom page draws frames only while something changes. PgWeb's Download asks where to save only once the server answered, so a refused or unconfirmed query leaves no empty file. - A test that sat after a
__main__guard (PgWeb filters) runs again; every test file lost its__main__guard. - Tests: integration tests that boot the app share
AppTestCase; Redis service tests moved totests/integration/; source-text checks became behaviour checks (middleware order, the page route, user-create columns); new tests for the MSSQL retry, the message socket, the PgWeb route and the blob routes. websocketsandhttpcore(webhook delivery) are pinned; Docker copies files already owned by the app user, compiles bytecode at build and leaves tests and CI out of the image;docker-compose.ymlbinds services to 127.0.0.1.
Docs:
- Rewritten for an AI reader: one owner doc per fact, one plain template, no history; about 47% smaller (546 KB → 291 KB for
docs/andAGENTS.md).AGENTS.mdhas a full task → doc index and five more rules (nois_trusted=Truewith request data, no session state on pooled connections, never around the body limits, never re-enable a route Atom ships inactive, queued jobs safe to repeat). - Every doc was checked against the code; the new
tests/test_docs.pykeeps it so: links and anchors resolve, and every setting, function and route a doc names exists.