Skip to content

Centralize variable lookup policies - #1535

Merged
lovasoa merged 2 commits into
mainfrom
codex/cleanup-variable-access
Oct 7, 2026
Merged

lovasoa merged 2 commits into
mainfrom
codex/cleanup-variable-access

Conversation

@lovasoa

@lovasoa lovasoa commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Centralize request-variable lookup and merged enumeration in a private view. GET values remain borrowed, SET values release their RefCell borrow before returning, and explicitly NULL SET values suppress request fallbacks. Merged enumeration streams through Serde with SET > POST > GET precedence.

The existing $name lookup remains SET then GET, with the same POST deprecation warnings. Source-specific sqlpage.variables behavior and public Rust interfaces are unchanged.

Reuse existing regression structures:

  • Extend test_variables_function and its SQL page with GET/POST array collisions, array lookups, missing and POST-only compatibility lookups, and a SET NULL phase. The same test checks merged and source-specific enumeration before SET, after SET, and after NULL assignment.
  • Extend the existing immutable-variable fixture with NULL suppression and unchanged GET enumeration instead of adding a separate fixture.
  • Keep one parameterized unit test for Missing versus explicit NULL, borrowed request scalars, owned SET scalars/arrays, and releasing the SET RefCell borrow before the returned value is consumed.
  • Retain the run_sql isolation fixture covering inherited parent variables, child mutation, and explicit NULL input without changing the parent scope.

The variable-access unit test module shrinks from 93 lines to 44, and total PR additions decrease from 214 to 195. The consolidation changes tests only.

Validation: cargo fmt --all, formatting check, cargo clippy --all-targets --all-features -- -D warnings, and cargo test --features odbc-static passed (236 unit and 89 integration tests with in-memory SQLite). Local fixture servers required running tests outside the network sandbox.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T10:20:49.685033Z da7cf0d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lovasoa
lovasoa added this pull request to the merge queue Oct 7, 2026
lovasoa added a commit that referenced this pull request Oct 7, 2026
Merge the queued squash commit for PR #1535. Preserve its array and null-value assertions alongside PR #1529 production-app request helpers.
Merged via the queue into main with commit 359f224 Oct 7, 2026
52 checks passed
francesco-cattoglio pushed a commit to francesco-cattoglio/SQLPage that referenced this pull request Oct 13, 2026
…C harness (sqlpage#1529)

* test(suite) :: share helpers, close pools deterministically, slim OIDC harness

Integration tests leaked every request's AppState: actix-web recycles
test-built HttpRequestInner allocations into a per-request pool that the
test path never drains, pinning database pools until process exit. Pooled
ODBC connections keep cached prepared statements alive, which deadlocks
Oracle's client at process exit. Close every test pool (clearing statement
caches first, since close() alone leaves checked-out connections behind)
while the test runtime is still alive, including after panics.

Consolidate the suite around shared helpers (read_body_string,
supports_database, request builders, OIDC login/config builders,
multipart/webhook request builders) and share one AppState per test
where possible, cutting duplication across oidc/uploads/requests/
data_formats/errors/server_timing/cookies/core. Net negative LOC.

* test: replace custom runtime with service-backed response helpers

Give test requests an Actix service-owned pool so dropping the service releases application state. Centralize request setup with response_for, response_with, and helpers for custom requests and shared state, while keeping standard actix_web tests.

Cover state release on success, errors, and unwinding. Validate with the full Rust suite, all-feature Clippy, formatting, and the SQLite ODBC prepared-statement test.

* test: remove test-harness metatest

* test: dispatch integration helpers through the production app

Use create_app inside the shared request helper so existing concise test calls exercise production routes and middleware. Update the prefix redirect assertion to check the actual 308 response and preserved request path.

* Centralize variable lookup policies (sqlpage#1535)

* refactor: centralize variable lookup and enumeration

* Reuse request and immutable-variable fixtures for lookup coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant