Resolve Opus review code findings
This commit is contained in:
@@ -20,15 +20,25 @@ VM-upload отсутствуют; в рабочем дереве обнаруж
|
|||||||
**OPEN:** это локальные игнорируемые артефакты, не попадающие в Git. Удаление
|
**OPEN:** это локальные игнорируемые артефакты, не попадающие в Git. Удаление
|
||||||
не выполнялось, поскольку удаление файлов требует отдельного решения.
|
не выполнялось, поскольку удаление файлов требует отдельного решения.
|
||||||
4. **`set_status.js` и `api.setBusy` выглядят неиспользуемыми.**
|
4. **`set_status.js` и `api.setBusy` выглядят неиспользуемыми.**
|
||||||
**OPEN:** код не удалялся; требуется отдельное решение, оставить ли их как
|
**PARTIALLY RESOLVED:** публичный `api.setBusy` удалён как неиспользуемый.
|
||||||
API-задел или удалить после проверки всех интеграций.
|
`set_status.js` сохранён как legacy-файл до отдельного решения об удалении.
|
||||||
5. **`rebaseTree` дублируется в ZIP- и folder-обработчиках.**
|
5. **`rebaseTree` дублируется в ZIP- и folder-обработчиках.**
|
||||||
**OPEN:** рефакторинг не выполнялся, чтобы не расширять текущую задачу
|
**RESOLVED:** функция вынесена в общий модуль
|
||||||
документирования ревью.
|
`upload/frontend/table/rebase_tree.js`.
|
||||||
|
|
||||||
## Вывод
|
## Вывод
|
||||||
|
|
||||||
Критичных дефектов в picker-only коде ревью не выявило. Основное замечание по
|
Критичных дефектов в picker-only коде ревью не выявило. Основное замечание по
|
||||||
рассинхронизации документации устранено. Открыты три технические задачи:
|
рассинхронизации документации устранено. После дополнительной проверки и
|
||||||
решение по локальным `__pycache__`, решение по мёртвому API/модулю и устранение
|
рефакторинга остаются две технические задачи: решение по локальным
|
||||||
дублирования `rebaseTree`.
|
`__pycache__` и отдельное решение по удалению либо сохранению legacy-файла
|
||||||
|
`set_status.js`.
|
||||||
|
|
||||||
|
### Проверка после исправлений
|
||||||
|
|
||||||
|
- Все frontend `.js` файлы проходят `node --input-type=module --check`.
|
||||||
|
- `site/app.py` проходит `python3 -m py_compile`.
|
||||||
|
- ZIP-функциональность в браузере сохранена: разрешённые leaf-файлы приняты,
|
||||||
|
`.exe` отфильтрован.
|
||||||
|
- Общий `rebaseTree` загружается, дублированных реализаций нет.
|
||||||
|
- `api.setBusy` отсутствует в публичном API.
|
||||||
|
|||||||
@@ -57,11 +57,6 @@ export function initUploadTable(cfg) {
|
|||||||
state.fileKeys.clear();
|
state.fileKeys.clear();
|
||||||
render(state, elements);
|
render(state, elements);
|
||||||
},
|
},
|
||||||
setBusy: (busy) => {
|
|
||||||
state.busy = busy;
|
|
||||||
elements.fileInputEl.disabled = busy;
|
|
||||||
elements.folderInputEl.disabled = busy;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
api.render();
|
api.render();
|
||||||
return api;
|
return api;
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
import { listZipFiles } from '../zip/list_zip_files.js';
|
import { listZipFiles } from '../zip/list_zip_files.js';
|
||||||
import { addFileWithDedup } from './add_file_with_dedup.js';
|
import { addFileWithDedup } from './add_file_with_dedup.js';
|
||||||
|
import { rebaseTree } from './rebase_tree.js';
|
||||||
import { render } from './render.js';
|
import { render } from './render.js';
|
||||||
|
|
||||||
function rebaseTree(root, prefix) {
|
|
||||||
root.path = `${prefix}/${root.path}`;
|
|
||||||
if (root.file) root.file = new File([root.file], root.path, { lastModified: root.file.lastModified });
|
|
||||||
root.children.forEach((child) => rebaseTree(child, prefix));
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function onFolderChange(state, cfg, elements) {
|
export function onFolderChange(state, cfg, elements) {
|
||||||
return async () => {
|
return async () => {
|
||||||
if (state.busy) return;
|
if (state.busy) return;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
export function rebaseTree(root, prefix) {
|
||||||
|
root.path = `${prefix}/${root.path}`;
|
||||||
|
if (root.file) root.file = new File([root.file], root.path, { lastModified: root.file.lastModified });
|
||||||
|
root.children.forEach((child) => rebaseTree(child, prefix));
|
||||||
|
return root;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// Построить дерево ZIP с файлами только разрешённых расширений.
|
// Построить дерево ZIP с файлами только разрешённых расширений.
|
||||||
|
import { rebaseTree } from '../table/rebase_tree.js';
|
||||||
|
|
||||||
function extensionAllowed(name, allowedExt) {
|
function extensionAllowed(name, allowedExt) {
|
||||||
const lowerName = name.toLowerCase();
|
const lowerName = name.toLowerCase();
|
||||||
@@ -20,13 +21,6 @@ function node(kind, name, path, children = [], file = null) {
|
|||||||
return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: true };
|
return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
function rebaseTree(root, prefix) {
|
|
||||||
root.path = `${prefix}/${root.path}`;
|
|
||||||
if (root.file) root.file = new File([root.file], root.path, { lastModified: root.file.lastModified });
|
|
||||||
root.children.forEach((child) => rebaseTree(child, prefix));
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addPath(root, parts, fileNode) {
|
function addPath(root, parts, fileNode) {
|
||||||
let current = root;
|
let current = root;
|
||||||
parts.forEach((part, index) => {
|
parts.forEach((part, index) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user