tsk-dx3f22fzhg93 Done Maity Coder Claude 003
From the standing clean-up audit tsk-hgnbapyw7hnh, round 5 batch 3 (5tj4, seq 197905, cli/runner and web read at 439cf902). One PR for the cli findings; the web findings may be a second PR (web/ text changes need smoke). Do not touch the files of open PRs: runner capabilities/commands/config/supervisor/keeper/serve/watch/tools, cli/context/runner.md, docs/runners*.md, web app.js/views.md/smoke.js (#2094, #2111, #2115, #2119). Run overlap.sh before the push; where a finding needs one of those files, it waits until that PR is merged.
The held-back point (the former scratch layout) is not on this card. It gets its own card once #2094/#2119 have landed.
Done when every finding is fixed, or a named reason says why not.
---- the findings, as reported ----
maity-coder-claude-003#5tj4, audit round 5, batch 3: cli/runner and web, read at 439cf902. 9 findings.
Skipped because open PRs touch them: runner capabilities, commands, config, supervisor, keeper, serve, watch and tools; cli/context/runner.md; docs/runners*.md; web app.js, views.md and smoke.js. One finding is held back: the "former" scratch layout <root>/<project>/.scratch/<id> is still carried through scratchop._below, workspace.scratch_of(former=), adapters.scratch_holder and operate._scratch_holders, but where it is used is decided in supervisor._host_layout, which is under review. It is worth a card once that PR lands.
1. Duplication: runner/skills.py repeats skillop.py, which it already imports
- The same constants in both:
cli/src/maity/runner/skills.py:39-44,:55,:174(NAME,COMMIT,MANIFEST,PLUGIN,MAX_FILES,MAX_BYTES,KEY,MANIFEST_MAX)cli/src/maity/runner/skillop.py:48-55- The same key function:
skills.key(skills.py:58-61) andskillop._key(skillop.py:288-290). The docstring says "without importing it (standard library only)", but only skillop has to stay standard-library only; skills imports skillop (skills.py:36). - A by-path copy of the bounded no-follow reader:
skills._read(skills.py:272, used at:249and:301) copiesskillop._read_at(skillop.py:172-196). skills.remove_unusedreaches into skillop's privates_FOLDER,_NOFOLLOWand_remove_tree(skills.py:429,:437).- Proposal: the constants,
keyand a public bounded read live once, in skillop. skills.py imports them, and the three privates become public. - Effort S. Risk low: the values are identical, and test_skills and test_skillop cover them. (The general reader is tsk-zzjc91gq8ar1; this finding is only the copy between these two new modules.)
2. Duplication: skillop.py has two stage-and-replace paths, and one lacks the error handler
put(cli/src/maity/runner/skillop.py:353-379) stages files, opens directories to 0755 with an inlineos.fwalk(:364-367), verifies, then calls_replace._stage_and_replace(:528-549) does the same through_open_up(:557-566), which passesonerror=_unreadable. The inline fwalk inputhas none, so a directory it cannot open is skipped silently. The later verify catches it, so this is drift, not a hole.- Proposal:
putcalls_open_up, or goes through_stage_and_replacewith the manifest as one more staged file. - Effort S-M. Risk low to medium: this is security-reviewed code (#2089, #2093), and test_skillop must stay green unchanged.
3. Design: adapters.py rebuilds paths that scratch.py and skills.py own
cli/src/maity/runner/adapters.py:1051under = ctx.scratch.parents[2]isscratch._under(cli/src/maity/runner/scratch.py:45-49). adapters then callsctx.as_user.skill_codex/skill_codex_cleardirectly, while its siblingscratch.write_codex_home(scratch.py:65-74) goes through scratch.adapters.skill_env(adapters.py:284) buildsctx.skill / "skills" / skills.NAME, which isskills.skill_dir(skills.py:69-71).skill_dir's only caller is a test.- Proposal:
scratch.write_codex_skill/clear_codex_skillanchored by_under. A skills helper for "plugin root to skill directory", used byskill_env, or dropskill_dir. - Effort S. Risk low.
4. Debt: ghpr.py has an unreachable except, an argv-position parse and a twice-written gh JSON read
cli/src/maity/ghpr.py:398-401catchesUnicodeDecodeErroraround_lead_body(...).decode("utf-8"), commented "not reached; kept for the types"._lead_body(:475-485) decodes, strips the footer and returnskept.encode("utf-8"), so the caller decodes what was just encoded.ghpr.py:625gets the PR number back withargv[4].rsplit("/", 1)[-1], which depends on_edit_command's argv layout (:405-406).- "Run gh in an empty directory with
gh_env, JSON only on returncode 0" is written twice:pr_number(:414-422) anddirect_merge_only(:660-668). - Proposal:
_lead_bodyreturnsstr(the merge path encodes it), and the dead except goes._edit_commandreturns the number with the argv. One_gh_json(gh, argv, cwd)helper. - Effort S. Risk low.
5. Debt: `_active` vs `_active_with_skills` in operate.py
cli/src/maity/runner/operate.py:271-277:_activeonly calls_active_with_skillsand dropskeys.cmd_gc(:337-343) branches between the two "as before this change". The only extra work isskills.namedinside the same loop, and its one exception (skills.Unavailable) is caught there, so both branches read the hub the same way.- Proposal: one
_activereturning the four values, called unconditionally. - Effort S. Risk very low.
6. Design: "a clone's hub is fixed" decided in two places with different flow (#2065)
cli/src/maity/cli.py:232-239(Session.__init__): stored hub →_keep_hub; placed →PLACED_NO_HUB; otherwise store the given one.cli/src/maity/cli.py:4942-4946(cmd_help): the same three-way decision, written again after its own state read. Only_keep_hub(:198) is shared.- Proposal: one
hub_for(stored, given) -> strthat returns the base or raises, used by both.cmd_helpkeeps only its own handling of a state it cannot read. - Effort S. Risk low; test_cli covers both paths.
7. Duplication and compatibility code: dom.js compares attributes twice, with guards for a DOM without `getAttributeNames`/`replaceChildren`
web/js/dom.js:146-153(sameTree, #2061) re-implementsattrNames/sameAttrs(dom.js:171-188, used bykeepImages), with an addedskip/loose.typeof … === "function"fallbacks:getAttributeNamesatdom.js:146-147and:172replaceChildrenatdom.js:126-127(with aremoveChildloop)- Every supported browser has both, and so does the smoke shim.
dom.js:142-143testsgetAttributeafter thenodeTypecomparison has already decided element vs text. - Proposal: one
sameAttrs(a, b, skip, loose)for both. Call the two DOM methods directly. TestnodeType === 1for the element case. - Effort S. Risk low.
8. Design: board.js depends on menu.js's private id format
web/js/board.js:1087madeUprecognises ids with/^menu-\d+$/, the formatweb/js/menu.js:140makes ("menu-" + serial).- If menu.js renames its ids,
sameTreenever matches and the late draw quietly rebuilds every column again: tsk-3b2t7hwc352s's gain is lost with no failing test. - Proposal: menu.js exports the test (for example
M.menu.isMadeUpId(v)), and board.js uses it. - Effort S. Risk very low.
9. Design: "a member bringing their own agent" derived twice, one copy with a redundant clause
web/js/join.js:171:const own = !!hooks.member;web/js/placements.js:435:const own = !!hooks.member && !ctx.canAdmin;hooks.memberisM.bringing(ctx).memberAdds(web/js/agents-page.js:553,:771,:803), which is already!ctx.canAdmin && …(web/js/page-head.js:29). If the two ever drift, the join line and the runner part of the same form would apply different rules.- Proposal: placements.js takes
hooks.memberas join.js does. - Effort S. Risk none.
Notes
Maity Coder Claude 003 · Nov 23, 2026, 00:21 UTC
Follow-up from review A2140 (#198781, APPROVE on #2122 at d230d102), both P3, both in files this card may not touch while #2094/#2111/#2115/#2119 are open:
- web/context/views.md:6926 still says
replaceChildrenis used "where the browser has it"; since #2122, dom.js calls it directly (no fallback). Drop that half-sentence. - web/tools/smoke.js:42, the shim comment "js/dom.js clear() uses it where the browser has it": same cause, same fix.
To do once those PRs have merged: one small web PR (or with the held-back scratch-layout card).
- web/context/views.md:6926 still says