KingOfThoughtFleuren commited on
Commit
34816ab
·
verified ·
1 Parent(s): f5f805d

Revert code_shim.py to original — remove unauthorized force_reseed changes

Browse files
Files changed (1) hide show
  1. services/code_shim.py +2 -32
services/code_shim.py CHANGED
@@ -120,37 +120,12 @@ class CodeShimRegistry(importlib.abc.MetaPathFinder):
120
 
121
  self._bootstrap_mirror_sync()
122
 
123
- def _get_force_reseed_modules(self) -> set:
124
- """
125
- Reads /data/LivePatches/force_reseed.json for a list of module names
126
- (e.g. 'services.qualia_manager') that should be overwritten from disk
127
- on this boot, then clears the file so it only fires once.
128
- """
129
- flag_file = (os.path.join(os.path.dirname(self.bucket_src_dir), "force_reseed.json")
130
- if os.path.exists(os.path.join(os.path.dirname(self.bucket_src_dir), "force_reseed.json"))
131
- else os.path.join(self.project_root, "force_reseed.json"))
132
- if not os.path.exists(flag_file):
133
- return set()
134
- try:
135
- with open(flag_file, "r") as f:
136
- modules = set(json.load(f))
137
- os.remove(flag_file)
138
- return modules
139
- except Exception:
140
- return set()
141
-
142
  def _bootstrap_mirror_sync(self):
143
  """
144
  Seeds disk .py files into the bucket on first boot.
145
- Never overwrites an existing bucket file — Aetherius's patches
146
- are preserved across restarts.
147
- Modules listed in /data/LivePatches/force_reseed.json are
148
- overwritten once, then the flag file is removed.
149
  """
150
  print("[CodeShim] Initiating mirror sync …", flush=True)
151
- force_reseed = self._get_force_reseed_modules()
152
- if force_reseed:
153
- print(f"[CodeShim] Force-reseed requested for: {force_reseed}", flush=True)
154
  seeded = 0
155
  skipped = 0
156
  for root, dirs, files in os.walk(self.project_root):
@@ -168,14 +143,9 @@ class CodeShimRegistry(importlib.abc.MetaPathFinder):
168
  local_path = os.path.join(root, filename)
169
  rel_path = os.path.relpath(local_path, self.project_root)
170
  bucket_path = os.path.join(self.bucket_src_dir, rel_path)
171
- # Derive module name for force-reseed check
172
- module_name = "services." + rel_path.replace(os.sep, ".")[:-3]
173
- force = module_name in force_reseed
174
- if not os.path.exists(bucket_path) or force:
175
  os.makedirs(os.path.dirname(bucket_path), exist_ok=True)
176
  shutil.copy2(local_path, bucket_path)
177
- if force:
178
- print(f"[CodeShim] Force-reseeded: {module_name}", flush=True)
179
  seeded += 1
180
  else:
181
  skipped += 1
 
120
 
121
  self._bootstrap_mirror_sync()
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  def _bootstrap_mirror_sync(self):
124
  """
125
  Seeds disk .py files into the bucket on first boot.
126
+ Never overwrites an existing bucket file — Aetherius owns them.
 
 
 
127
  """
128
  print("[CodeShim] Initiating mirror sync …", flush=True)
 
 
 
129
  seeded = 0
130
  skipped = 0
131
  for root, dirs, files in os.walk(self.project_root):
 
143
  local_path = os.path.join(root, filename)
144
  rel_path = os.path.relpath(local_path, self.project_root)
145
  bucket_path = os.path.join(self.bucket_src_dir, rel_path)
146
+ if not os.path.exists(bucket_path):
 
 
 
147
  os.makedirs(os.path.dirname(bucket_path), exist_ok=True)
148
  shutil.copy2(local_path, bucket_path)
 
 
149
  seeded += 1
150
  else:
151
  skipped += 1