Repository: dynaconf/dynaconf

Issue:
[bug] fresh_vars items are assignable
**Describe the bug**
Assigning to a setting that exists in `fresh_value` prevents that setting from being fresh.

**To Reproduce**
Minimum code to reproduce/demonstrate:

```
import os
from dynaconf import Dynaconf

os.environ["DYNACONF_FRESH_VALUE"] = "stay fresh"
settings = Dynaconf(fresh_vars=["fresh_value"])
print(settings.fresh_value) # Outputs: "stay fresh"
settings.fresh_value = "not so fresh"
print(settings.fresh_value) # Outputs: "not so fresh" instead of "stay fresh" as expected.
```

**Expected behavior**
From the documentation, I'd expect that any attempt to assign to a fresh variable would be passively ignored, since the docs state that the value is read directly from source on every access. Apologies if this is WAI. If it is, it may be worth noting on the documentation for the `fresh_vars` parameter that once assigned to the parameter will no longer be fresh.

**Environment (please complete the following information):**
 - OS: Windows/10 & Linux/Ubuntu22.04.4 (WSL)
 - Dynaconf Version: 3.2.5
 - Frameworks in use: None.

**Additional context**




Discussion:
The issue is being fixed and it is coming in the next 3.3.0 release

By now the workaround is to define the keys all uppercase.

```python
settings = Dynaconf(fresh_vars=["FRESH_VALUE"])
```
Excellent. And thanks for the workaround. Ill keep an eye out for the new version.

Resolving patch:
diff --git a/dynaconf/base.py b/dynaconf/base.py
--- a/dynaconf/base.py
+++ b/dynaconf/base.py
@@ -26,6 +26,7 @@
 from dynaconf.utils import BANNER
 from dynaconf.utils import compat_kwargs
 from dynaconf.utils import ensure_a_list
+from dynaconf.utils import ensure_upperfied_list
 from dynaconf.utils import missing
 from dynaconf.utils import object_merge
 from dynaconf.utils import recursively_evaluate_lazy_format
@@ -138,7 +139,8 @@ def __getattr__(self, name):
             name.isupper()
             and (
                 self._wrapped._fresh
-                or name in self._wrapped.FRESH_VARS_FOR_DYNACONF
+                or name
+                in ensure_upperfied_list(self._wrapped.FRESH_VARS_FOR_DYNACONF)
             )
             and name not in UPPER_DEFAULT_SETTINGS
         ):
@@ -525,7 +527,10 @@ def get(
         if (
             fresh
             or self._fresh
-            or key in getattr(self, "FRESH_VARS_FOR_DYNACONF", ())
+            or key
+            in ensure_upperfied_list(
+                getattr(self, "FRESH_VARS_FOR_DYNACONF", ())
+            )
         ) and key not in UPPER_DEFAULT_SETTINGS:
             self.unset(key)
             self.execute_loaders(key=key)
diff --git a/dynaconf/utils/__init__.py b/dynaconf/utils/__init__.py
--- a/dynaconf/utils/__init__.py
+++ b/dynaconf/utils/__init__.py
@@ -365,6 +365,11 @@ def ensure_a_list(data: T | list[T]) -> list[T]:
     return [data]
 
 
+def ensure_upperfied_list(data: list) -> list:
+    """Ensure list of strings contains upperfied items."""
+    return [upperfy(item) if isinstance(item, str) else item for item in data]
+
+
 def build_env_list(obj: Settings | LazySettings, env: str | None) -> list[str]:
     """Build env list for loaders to iterate.
 


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -16,6 +16,7 @@
 from dynaconf.loaders.json_loader import DynaconfEncoder
 from dynaconf.utils import build_env_list
 from dynaconf.utils import ensure_a_list
+from dynaconf.utils import ensure_upperfied_list
 from dynaconf.utils import extract_json_objects
 from dynaconf.utils import isnamedtupleinstance
 from dynaconf.utils import Missing
@@ -363,6 +364,10 @@ def test_ensure_a_list():
     assert ensure_a_list(1) == [1]
 
 
+def test_ensure_upperfied_list():
+    assert ensure_upperfied_list([1, "a", "A__b"]) == [1, "A", "A__b"]
+
+
 def test_get_local_filename():
     settings_path = os.path.join("foo", "b", "conf.toml")
     local_path = os.path.join("foo", "b", "conf.local.toml")
diff --git a/tests_functional/issues/1088_freshvars/app.py b/tests_functional/issues/1088_freshvars/app.py
new file mode 100644
--- /dev/null
+++ b/tests_functional/issues/1088_freshvars/app.py
@@ -0,0 +1,44 @@
+from __future__ import annotations
+
+import os
+from pathlib import Path
+
+from dynaconf import Dynaconf
+
+HERE = Path(__file__).parent
+
+os.environ["DYNACONF_NAME"] = "stay fresh"
+settings = Dynaconf(
+    fresh_vars=["name", "AGE"], settings_files=["settings.toml"]
+)
+
+
+def do_the_sets(age: int = 10):
+    with open(HERE / "settings.toml", "w") as sf:
+        sf.write(f"age = {age}")
+
+    settings.name = "not so fresh"  # NO EFFECT
+    settings.NAME = "not so fresh"
+    settings.NaMe = "not so fresh"
+    settings.set("name", "not so fresh")
+    settings["name"] = "not so fresh"
+
+    print(settings.name)
+    print(settings.age)
+
+
+do_the_sets()
+assert settings["NAME"] == "stay fresh"
+assert settings["AGE"] == 10
+do_the_sets(20)
+assert settings.name == "stay fresh"
+assert settings["AGE"] == 20
+do_the_sets(30)
+assert settings.NAME == "stay fresh"
+assert settings["AGE"] == 30
+do_the_sets(40)
+assert settings["NAME"] == "stay fresh"
+assert settings["AGE"] == 40
+do_the_sets(50)
+assert settings("NAME") == "stay fresh"
+assert settings["AGE"] == 50
diff --git a/tests_functional/issues/1088_freshvars/settings.toml b/tests_functional/issues/1088_freshvars/settings.toml
new file mode 100644
--- /dev/null
+++ b/tests_functional/issues/1088_freshvars/settings.toml
@@ -0,0 +1 @@
+age = 50
\ No newline at end of file