From d3f2696db7629ac1fbe2520f12cd634a94b3301f Mon Sep 17 00:00:00 2001 From: Shinsuke Sugaya Date: Thu, 10 Sep 2026 23:29:31 +0900 Subject: [PATCH] chore(config): drop four properties whose value has no effect Three of these have a generated FessConfig accessor and no caller anywhere; the fourth is declared in the file that its reader never consults. All four have been settable and inert. - theme.allowed.archive.extensions: AdminThemeAction.hasZipExtension hardcodes endsWith(".zip"). - theme.assets.cache.max.age: StaticThemeResponder sends a literal "public, max-age=86400". That equals the default, so setting the key looks harmless and does nothing. - theme.assets.precompressed: there is no precompressed asset path at all. The responder sets Vary: Accept-Encoding but negotiates nothing. - rag.chat.message.max.length: ChatApiHelper reads it through FessProp#getSystemProperty, which consults conf/system.properties then -Dfess.system. and never fess_config.properties. The setting itself keeps working; only the declaration in the wrong file goes. Of the 44 keys read that way, this was the only one also declared in fess_config.properties -- the other 43 are not, so this brings it into line rather than making it an exception. Removing a key also removes its generated constant, accessors and defaultMap entry, so FessConfig matches what freegen would now emit: keys 639 to 635, constants 581 to 577, defaultMap 584 to 580. Nothing else in the workspace referenced the three theme keys -- not a plugin, a JSP, a test, or the documentation. rag.chat.message.max.length stays documented in fess-docs config/rag-chat.rst and api/api-chat.rst, where it is already described as a system property. Also corrects ChatApiHelper#getMaxMessageLength's javadoc, which said the value came "from fess_config system properties" and named the channel that does not apply. --- .../codelibs/fess/helper/ChatApiHelper.java | 8 +- .../fess/mylasta/direction/FessConfig.java | 95 ------------------- src/main/resources/fess_config.properties | 8 -- 3 files changed, 6 insertions(+), 105 deletions(-) diff --git a/src/main/java/org/codelibs/fess/helper/ChatApiHelper.java b/src/main/java/org/codelibs/fess/helper/ChatApiHelper.java index 40c7e9318..52a72d349 100644 --- a/src/main/java/org/codelibs/fess/helper/ChatApiHelper.java +++ b/src/main/java/org/codelibs/fess/helper/ChatApiHelper.java @@ -371,8 +371,12 @@ public String resolveChatRateLimitKey(final String username, final java.util.fun } /** - * Resolves {@code rag.chat.message.max.length} from fess_config system properties, - * defaulting to {@code 4000} on parse failure. + * Resolves {@code rag.chat.message.max.length}, defaulting to {@code 4000} when it is + * unset or unparseable. + * + *

This is a system property: it is read from {@code conf/system.properties}, then + * {@code -Dfess.system.rag.chat.message.max.length}. It is deliberately not declared in + * {@code fess_config.properties}, which this channel never consults. * * @param fessConfig active Fess config * @return max chat message length in characters diff --git a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java index 0cf858b8c..3624b8d3e 100644 --- a/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java +++ b/src/main/java/org/codelibs/fess/mylasta/direction/FessConfig.java @@ -2077,9 +2077,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. title,url,content,doc_id,content_title,content_description */ String RAG_CHAT_CONTENT_FIELDS = "rag.chat.content.fields"; - /** The key of the configuration. e.g. 4000 */ - String RAG_CHAT_MESSAGE_MAX_LENGTH = "rag.chat.message.max.length"; - /** The key of the configuration. e.g. 500 */ String RAG_CHAT_HIGHLIGHT_FRAGMENT_SIZE = "rag.chat.highlight.fragment.size"; @@ -2158,15 +2155,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction /** The key of the configuration. e.g. 7 */ String THEME_UPLOAD_ATTIC_RETENTION_DAYS = "theme.upload.attic.retention.days"; - /** The key of the configuration. e.g. zip */ - String THEME_ALLOWED_ARCHIVE_EXTENSIONS = "theme.allowed.archive.extensions"; - - /** The key of the configuration. e.g. 86400 */ - String THEME_ASSETS_CACHE_MAX_AGE = "theme.assets.cache.max.age"; - - /** The key of the configuration. e.g. true */ - String THEME_ASSETS_PRECOMPRESSED = "theme.assets.precompressed"; - /** The key of the configuration. e.g. */ String THEME_API_CSRF_SERVER_ORIGINS = "theme.api.csrf.server.origins"; @@ -9978,21 +9966,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ String getRagChatContentFields(); - /** - * Get the value for the key 'rag.chat.message.max.length'.
- * The value is, e.g. 4000
- * @return The value of found property. (NotNull: if not found, exception but basically no way) - */ - String getRagChatMessageMaxLength(); - - /** - * Get the value for the key 'rag.chat.message.max.length' as {@link Integer}.
- * The value is, e.g. 4000
- * @return The value of found property. (NotNull: if not found, exception but basically no way) - * @throws NumberFormatException When the property is not integer. - */ - Integer getRagChatMessageMaxLengthAsInteger(); - /** * Get the value for the key 'rag.chat.highlight.fragment.size'.
* The value is, e.g. 500
@@ -10385,42 +10358,6 @@ public interface FessConfig extends FessEnv, org.codelibs.fess.mylasta.direction */ Integer getThemeUploadAtticRetentionDaysAsInteger(); - /** - * Get the value for the key 'theme.allowed.archive.extensions'.
- * The value is, e.g. zip
- * @return The value of found property. (NotNull: if not found, exception but basically no way) - */ - String getThemeAllowedArchiveExtensions(); - - /** - * Get the value for the key 'theme.assets.cache.max.age'.
- * The value is, e.g. 86400
- * @return The value of found property. (NotNull: if not found, exception but basically no way) - */ - String getThemeAssetsCacheMaxAge(); - - /** - * Get the value for the key 'theme.assets.cache.max.age' as {@link Integer}.
- * The value is, e.g. 86400
- * @return The value of found property. (NotNull: if not found, exception but basically no way) - * @throws NumberFormatException When the property is not integer. - */ - Integer getThemeAssetsCacheMaxAgeAsInteger(); - - /** - * Get the value for the key 'theme.assets.precompressed'.
- * The value is, e.g. true
- * @return The value of found property. (NotNull: if not found, exception but basically no way) - */ - String getThemeAssetsPrecompressed(); - - /** - * Is the property for the key 'theme.assets.precompressed' true?
- * The value is, e.g. true
- * @return The determination, true or false. (if not found, exception but basically no way) - */ - boolean isThemeAssetsPrecompressed(); - /** * Get the value for the key 'theme.api.csrf.server.origins'.
* The value is, e.g.
@@ -14176,14 +14113,6 @@ public String getRagChatContentFields() { return get(FessConfig.RAG_CHAT_CONTENT_FIELDS); } - public String getRagChatMessageMaxLength() { - return get(FessConfig.RAG_CHAT_MESSAGE_MAX_LENGTH); - } - - public Integer getRagChatMessageMaxLengthAsInteger() { - return getAsInteger(FessConfig.RAG_CHAT_MESSAGE_MAX_LENGTH); - } - public String getRagChatHighlightFragmentSize() { return get(FessConfig.RAG_CHAT_HIGHLIGHT_FRAGMENT_SIZE); } @@ -14372,26 +14301,6 @@ public Integer getThemeUploadAtticRetentionDaysAsInteger() { return getAsInteger(FessConfig.THEME_UPLOAD_ATTIC_RETENTION_DAYS); } - public String getThemeAllowedArchiveExtensions() { - return get(FessConfig.THEME_ALLOWED_ARCHIVE_EXTENSIONS); - } - - public String getThemeAssetsCacheMaxAge() { - return get(FessConfig.THEME_ASSETS_CACHE_MAX_AGE); - } - - public Integer getThemeAssetsCacheMaxAgeAsInteger() { - return getAsInteger(FessConfig.THEME_ASSETS_CACHE_MAX_AGE); - } - - public String getThemeAssetsPrecompressed() { - return get(FessConfig.THEME_ASSETS_PRECOMPRESSED); - } - - public boolean isThemeAssetsPrecompressed() { - return is(FessConfig.THEME_ASSETS_PRECOMPRESSED); - } - public String getThemeApiCsrfServerOrigins() { return get(FessConfig.THEME_API_CSRF_SERVER_ORIGINS); } @@ -15060,7 +14969,6 @@ protected java.util.Map prepareGeneratedDefaultMap() { defaultMap.put(FessConfig.RAG_CHAT_SESSION_MAX_SIZE, "10000"); defaultMap.put(FessConfig.RAG_CHAT_HISTORY_MAX_MESSAGES, "30"); defaultMap.put(FessConfig.RAG_CHAT_CONTENT_FIELDS, "title,url,content,doc_id,content_title,content_description"); - defaultMap.put(FessConfig.RAG_CHAT_MESSAGE_MAX_LENGTH, "4000"); defaultMap.put(FessConfig.RAG_CHAT_HIGHLIGHT_FRAGMENT_SIZE, "500"); defaultMap.put(FessConfig.RAG_CHAT_HIGHLIGHT_NUMBER_OF_FRAGMENTS, "3"); defaultMap.put(FessConfig.RAG_CHAT_CONTENT_FULLTEXT_MAX_LENGTH, "3000"); @@ -15087,9 +14995,6 @@ protected java.util.Map prepareGeneratedDefaultMap() { defaultMap.put(FessConfig.THEME_UPLOAD_ZIP_RATIO_MAX, "50"); defaultMap.put(FessConfig.THEME_UPLOAD_ZIP_RATIO_CHECK_THRESHOLD_BYTES, "65536"); defaultMap.put(FessConfig.THEME_UPLOAD_ATTIC_RETENTION_DAYS, "7"); - defaultMap.put(FessConfig.THEME_ALLOWED_ARCHIVE_EXTENSIONS, "zip"); - defaultMap.put(FessConfig.THEME_ASSETS_CACHE_MAX_AGE, "86400"); - defaultMap.put(FessConfig.THEME_ASSETS_PRECOMPRESSED, "true"); defaultMap.put(FessConfig.THEME_API_CSRF_SERVER_ORIGINS, ""); defaultMap.put(FessConfig.THEME_API_LOGIN_RATE_LIMIT_PER_IP_PER_MINUTE, "10"); defaultMap.put(FessConfig.THEME_API_LOGIN_RATE_LIMIT_PER_USER_PER_MINUTE, "5"); diff --git a/src/main/resources/fess_config.properties b/src/main/resources/fess_config.properties index 9d1ac48df..9580166c7 100644 --- a/src/main/resources/fess_config.properties +++ b/src/main/resources/fess_config.properties @@ -1722,8 +1722,6 @@ rag.chat.history.max.messages=30 # Enhanced RAG flow settings. # Fields to retrieve for full document content. rag.chat.content.fields=title,url,content,doc_id,content_title,content_description -# Maximum characters accepted in a chat API message. Read from conf/system.properties, not this file. -rag.chat.message.max.length=4000 # Highlight settings for RAG search. rag.chat.highlight.fragment.size=500 # Number of highlight fragments per document in the RAG chat context search. @@ -1788,12 +1786,6 @@ theme.upload.zip.ratio.max=50 theme.upload.zip.ratio.check.threshold.bytes=65536 # Retention (days) for a replaced theme directory before the cleanup sweep removes it. theme.upload.attic.retention.days=7 -# Archive extensions accepted for theme upload. Not read: the upload action accepts only .zip. -theme.allowed.archive.extensions=zip -# Cache-Control max-age (seconds) for theme assets. Not read: the responder always sends 86400. -theme.assets.cache.max.age=86400 -# Whether to serve precompressed theme assets. Not read: no precompressed asset path exists. -theme.assets.precompressed=true # Optional: canonical external origin(s) of this Fess instance (comma/newline separated), # e.g. https://fess.example.com. When set, these are treated as same-origin for the v2 CSRF # Origin check WITHOUT trusting forwarded headers. Recommended behind reverse proxies that are