Fix: Change defparameter to defvar to prevent configuration reset on reload#138
Merged
tamurashingo merged 2 commits intodevelopfrom Jan 28, 2026
Merged
Conversation
- Change all defparameter to defvar to prevent variable reinitialization - This fixes the issue where database configuration is reset when <app> is reloaded during test execution - defvar preserves the value on re-evaluation, which is appropriate for application configuration variables
- Change *enable-transaction-middleware* to defvar (can be toggled by application) - Change *clails-middleware-stack* to defvar (can be modified by add-middleware-* functions) - Keep *lack-middleware-transaction* and *lack-middleware-clails-controller* as defparameter (not expected to change)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed an issue where configuration values defined with
defparameterwere reset to their initial values when<app>was reloaded duringclails testcommand execution.
Problem
When executing the
clails testcommand, the following problem occurred:clails.bootloads<app>and initializes database configuration<app>is reloaded because<app-test>depends on<app>defparameterare overwritten with initial valuesThe following variables were particularly affected:
clails/environment:*database-config*clails/environment:*database-type*Changes
1.
src/environment.lispChanged variables that application developers are expected to override from
defparametertodefvar:*project-name**project-dir**project-environment**database-config**database-type**migration-base-dir**task-base-dir**connection-pool**routing-tables**startup-hooks**shutdown-hooks**default-lock-mode**sqlite3-busy-timeout**sqlite3-lock-retry-count**sqlite3-transaction-mode**sqlite3-lock-module-loaded**table-information-initialized**query-initialization-callbacks*2.
src/middleware/transaction-middleware.lisp*enable-transaction-middleware*todefvar3.
src/middleware/core.lisp*clails-middleware-stack*todefvarRationale
defvarpreserves existing values on re-evaluation, which is the standard Common Lisp behavior. This ensures:Testing
clails testcommand executionRelated Issue
Fixes #137