-
Notifications
You must be signed in to change notification settings - Fork 0
검증확인했습니다, 병합해주세요 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
검증확인했습니다, 병합해주세요 #14
Changes from all commits
7852209
b9229e1
f163cd6
0940c5d
75ed443
b0d3b71
5af66d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *.pyo | ||
| *.pyd | ||
| .Python | ||
| *.egg | ||
| *.egg-info/ | ||
| dist/ | ||
| build/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| *.whl | ||
| .installed.cfg | ||
|
|
||
| # Virtual environments | ||
| .venv/ | ||
| venv/ | ||
| env/ | ||
| ENV/ | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .coverage | ||
| htmlcov/ | ||
| .tox/ | ||
|
|
||
| # IDEs | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
| # Environment variables | ||
| .env | ||
| .env.* | ||
| !.env.example | ||
|
|
||
| # Node | ||
| node_modules/ | ||
| npm-debug.log* | ||
|
|
||
| # Distribution | ||
| *.tar.gz | ||
| *.zip |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2684,6 +2684,7 @@ class OrchestrationAcceptedResponse(BaseModel): | |
|
|
||
|
|
||
| _ORCHESTRATION_PROGRESS_STORE: Dict[str, Dict[str, Any]] = {} | ||
| _ORCHESTRATION_PROGRESS_FILE_LOCK = threading.Lock() | ||
|
|
||
|
|
||
| def _runtime_progress_root() -> Path: | ||
|
|
@@ -2694,9 +2695,8 @@ def _runtime_progress_root() -> Path: | |
| return progress_root | ||
|
|
||
|
|
||
| def _orchestration_progress_path(run_id: str) -> Path: | ||
| safe_run_id = re.sub(r"[^a-zA-Z0-9_.-]+", "-", str(run_id or "unknown")).strip("-") or "unknown" | ||
| return _runtime_progress_root() / f"{safe_run_id}.json" | ||
| def _orchestration_progress_store_path() -> Path: | ||
| return _runtime_progress_root() / "progress_store.json" | ||
|
|
||
|
|
||
| def _build_progress_poll_url(run_id: str) -> str: | ||
|
|
@@ -2712,23 +2712,42 @@ def _save_orchestration_progress(run_id: str, payload: Dict[str, Any]) -> Dict[s | |
| normalized["run_id"] = str(run_id or normalized.get("run_id") or "") | ||
| normalized.setdefault("updated_at", datetime.utcnow().isoformat() + "Z") | ||
| _ORCHESTRATION_PROGRESS_STORE[normalized["run_id"]] = normalized | ||
| progress_path = _orchestration_progress_path(normalized["run_id"]) | ||
| progress_path.write_text(json.dumps(normalized, ensure_ascii=False, indent=2), encoding="utf-8") | ||
| progress_path = _orchestration_progress_store_path() | ||
| with _ORCHESTRATION_PROGRESS_FILE_LOCK: | ||
| persisted_payload: Dict[str, Any] = {} | ||
| try: | ||
| if progress_path.exists() and progress_path.is_file(): | ||
|
Comment on lines
+2715
to
+2719
|
||
| existing_payload = json.loads(progress_path.read_text(encoding="utf-8")) | ||
| if isinstance(existing_payload, dict): | ||
| persisted_payload = dict(existing_payload) | ||
| except Exception: | ||
| logger.warning( | ||
| "Failed to read orchestration progress store from %s before write", | ||
|
Comment on lines
+2716
to
+2725
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. suggestion (bug_risk): Guard the write to the progress store file with error handling to avoid bubbling I/O failures into callers. Because |
||
| str(progress_path), | ||
| exc_info=True, | ||
| ) | ||
| persisted_payload = {} | ||
| persisted_payload[normalized["run_id"]] = normalized | ||
| progress_path.write_text(json.dumps(persisted_payload, ensure_ascii=False, indent=2), encoding="utf-8") | ||
| return normalized | ||
|
|
||
|
|
||
| def _load_orchestration_progress(run_id: str) -> Dict[str, Any]: | ||
| cached = _ORCHESTRATION_PROGRESS_STORE.get(str(run_id or "")) | ||
| if isinstance(cached, dict) and cached: | ||
| return dict(cached) | ||
| progress_path = _orchestration_progress_path(run_id) | ||
| progress_path = _orchestration_progress_store_path() | ||
| try: | ||
| if progress_path.exists() and progress_path.is_file(): | ||
| payload = json.loads(progress_path.read_text(encoding="utf-8")) | ||
| if isinstance(payload, dict): | ||
| _ORCHESTRATION_PROGRESS_STORE[str(run_id or "")] = dict(payload) | ||
| return dict(payload) | ||
| with _ORCHESTRATION_PROGRESS_FILE_LOCK: | ||
| if progress_path.exists() and progress_path.is_file(): | ||
| payload = json.loads(progress_path.read_text(encoding="utf-8")) | ||
| if isinstance(payload, dict): | ||
| stored = payload.get(str(run_id or "")) | ||
| if isinstance(stored, dict): | ||
| _ORCHESTRATION_PROGRESS_STORE[str(run_id or "")] = dict(stored) | ||
| return dict(stored) | ||
| except Exception: | ||
| logger.error("Failed to load orchestration progress for run_id=%s", str(run_id or ""), exc_info=True) | ||
| return {} | ||
| return {} | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Consider logging or surfacing failures to load
SECRET_KEY_FILErather than silently falling back to an ephemeral secret.If
SECRET_KEY_FILEis set but unreadable (bad path, permissions, etc.), this will silently fall back to an ephemeral secret. In production this means operators think a stable secret is configured, but tokens will still rotate on restart. Please emit at least a warning (including the path and exception) before falling back so misconfigurations are visible while keeping the behavior of not auto-creating/writing a key file.Suggested implementation:
If
backend/auth.pydoes not currently importloggingelsewhere, you may prefer to add the import near the top of the file instead of immediately before_resolve_secret_key:<<<<<<< SEARCH
import os
import os
import logging
In that case, remove the
import loggingline from the_resolve_secret_keyinsertion and keep only thelogger = logging.getLogger(__name__)definition at module scope (ideally near the imports).