Compare commits

...
Author SHA1 Message Date
Richard Zink 45503de195 Release v202611-00062 2026-11-18 19:48:28 +01:00
Richard ZinkandClaude Sonnet 5.5 486c49d50b Factory: exact parallel limit, remove issues from the board
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 19:48:27 +01:00
Richard Zink aa6ee7fd31 Release v202611-00061 2026-11-18 15:33:17 +01:00
Richard ZinkandClaude Sonnet 5.5 e1baf6f00f Factory: project dropdown
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 15:33:16 +01:00
10 changed files with 135 additions and 14 deletions

No files matched your search

+16
View File
@@ -3,6 +3,22 @@
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
until 1.0, minor versions may contain breaking changes.
## [v202611-00062] – 2026-11-18
### Added
- **Factory: remove issues from the board** – a "Remove from board" button for issues that are not running, and issues deleted on the forge (404) disappear from the board by themselves at the next poll.
### Fixed
- **Factory: the "parallel" limit was exceeded** – phases were counted by their run rows, which appear only after the checkout, so one poll could start more phases than allowed (2 allowed, 4 running). They are now counted by issue state, which is set before a phase starts.
## [v202611-00061] – 2026-11-18
### Changed
- **Factory: project dropdown** instead of one button per project – choose "All projects" or a single one; the choice is remembered.
## [v202611-00060] – 2026-11-18
### Changed
+1 -1
View File
@@ -11,7 +11,7 @@
</p>
<p align="center">
<img alt="Version v202611-00060" src="https://img.shields.io/badge/version-v202611--00060-d69e2e?style=flat-square">
<img alt="Version v202611-00062" src="https://img.shields.io/badge/version-v202611--00062-d69e2e?style=flat-square">
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-689d6a?style=flat-square">
<img alt="Rust backend" src="https://img.shields.io/badge/backend-Rust-b7410e?style=flat-square&logo=rust">
<img alt="React PWA" src="https://img.shields.io/badge/frontend-React%20PWA-2d81ff?style=flat-square&logo=react">
+12
View File
@@ -176,6 +176,7 @@ pub fn router(app: AppState) -> Router {
.route("/factory/release/preview", get(factory_release_preview))
.route("/factory/release", post(factory_release))
.route("/factory/issues/close", post(factory_close_issue))
.route("/factory/issues/remove", post(factory_remove_issue))
.route("/factory/issues/pr", get(factory_pr))
.route("/factory/issues/pr/merge", post(factory_pr_merge))
.route("/account/factory/connection/test", post(test_factory_connection))
@@ -2836,6 +2837,17 @@ async fn factory_close_issue(Extension(user): Extension<User>, State(app): State
Ok(Json(json!({"ok": true})))
}
/// Take an issue off the factory board (the issue on the forge is not touched). Not while a phase runs.
async fn factory_remove_issue(Extension(user): Extension<User>, State(app): State<AppState>, headers: axum::http::HeaderMap, Json(b): Json<CloseIssue>) -> ApiResult {
let (_, row) = factory_issue_forge(&app, &user, &b.repo, b.number)?;
if matches!(row["state"].as_str(), Some("review" | "building" | "testing")) {
return Err(ApiError(StatusCode::BAD_REQUEST, "a phase is running – wait for it to end or stop it first".into()));
}
app.store.factory_issue_delete(&b.repo, b.number)?;
app.audit(Some(&user), "factory.issue.remove", &format!("{}#{}", b.repo, b.number), &crate::auth::client_ip(&headers));
Ok(Json(json!({"ok": true})))
}
#[derive(Deserialize)]
struct PrQuery {
repo: String,
+16
View File
@@ -562,6 +562,14 @@ impl Forge {
Ok(!matches!(v["state"].as_str(), Some("closed")))
}
/// Has the issue been deleted on the forge (404)? Other errors (network, token) count as "still there".
pub async fn issue_gone(&self, number: u64) -> bool {
match self.call(reqwest::Method::GET, self.rp(&format!("/issues/{number}")), None).await {
Err(e) => e.to_string().contains("404"),
Ok(_) => false,
}
}
pub async fn close_issue(&self, number: u64) -> Result<()> {
match self.kind {
Kind::Gitlab => self.call(reqwest::Method::PUT, self.rp(&format!("/issues/{number}")), Some(json!({"state_event": "close"}))).await.map(|_| ()),
@@ -1353,6 +1361,14 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
app.store.factory_issue_set(&cfg.url, n, &[("state", json!("closed"))])?;
}
}
// Issues deleted on the forge leave the board (closed ones stay: they still exist there).
for row in app.store.factory_issues(&user.id)?.into_iter().filter(|r| r["repo"].as_str() == Some(cfg.url.as_str()) && !matches!(r["state"].as_str(), Some("review" | "building" | "testing"))) {
let n = issue_no(&row);
if n > 0 && !open.contains(&n) && g.issue_gone(n as u64).await {
tracing::info!("factory {}: #{n} was deleted on the forge – removed from the board", cfg.url);
app.store.factory_issue_delete(&cfg.url, n)?;
}
}
// Merged issues get their version and tag.
if let Err(e) = crate::factory_version::version_pass(app, user, cfg).await {
tracing::warn!("factory {}: versions: {e:#}", cfg.url);
+9 -1
View File
@@ -1497,6 +1497,12 @@ impl Store {
Ok(())
}
/// Remove an issue from the factory board (runs and cost statistics stay).
pub fn factory_issue_delete(&self, repo: &str, number: i64) -> Result<()> {
self.conn.lock().unwrap().execute("DELETE FROM factory_issues WHERE repo_url = ?1 AND number = ?2", params![repo, number])?;
Ok(())
}
/// Update the given columns (whitelisted) of an issue.
pub fn factory_issue_set(&self, repo: &str, number: i64, fields: &[(&str, Value)]) -> Result<()> {
const COLS: [&str; 11] = ["title", "state", "attempts", "rounds", "last_comment", "scenarios", "branch", "pr_url", "note", "author", "version"];
@@ -1586,7 +1592,9 @@ impl Store {
}
pub fn factory_running(&self, repo: &str) -> Result<i64> {
Ok(self.conn.lock().unwrap().query_row("SELECT COUNT(*) FROM factory_runs WHERE repo_url = ?1 AND status = 'running'", [repo], |r| r.get(0))?)
// Counted by issue state, not by run rows: the state is set before the phase is spawned, the run row
// only once its checkout is done – counting runs let a single poll start more phases than allowed.
Ok(self.conn.lock().unwrap().query_row("SELECT COUNT(*) FROM factory_issues WHERE repo_url = ?1 AND state IN ('review', 'building', 'testing')", [repo], |r| r.get(0))?)
}
/// Runs with token and cost totals (joined from the usage table).
+55 -12
View File
@@ -170,7 +170,19 @@ export function Factory({ onMenu }: { onMenu: () => void }) {
function FactoryOverview({ onSettings }: { onSettings: () => void }) {
const t = useT();
const [data, setData] = useState<Overview>();
const [repo, setRepo] = useState<string>("");
const [repo, setRepoState] = useState<string>(() => {
try {
return localStorage.getItem("codecraft.factoryRepo") ?? "";
} catch {
return "";
}
});
const setRepo = (r: string) => {
setRepoState(r);
try {
localStorage.setItem("codecraft.factoryRepo", r);
} catch {}
};
const [sel, setSel] = useState<string>("");
const [now, setNow] = useState(Date.now());
const [busy, setBusy] = useState(false);
@@ -189,6 +201,11 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
return () => clearInterval(h);
}, []);
// A remembered project that no longer exists falls back to "all".
useEffect(() => {
if (data && repo && !data.repos.some((r) => r.url === repo)) setRepo("");
}, [data, repo]);
const newProject = async () => {
setBusy(true);
try {
@@ -331,6 +348,20 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
setBusy(false);
}
};
const removeIssue = async () => {
if (!selected) return;
if (!(await confirmDialog({ message: t("factory.removeConfirm", { n: selected.number }), confirmLabel: t("factory.remove"), danger: true }))) return;
setBusy(true);
try {
await post("/factory/issues/remove", { repo: selected.repo, number: selected.number });
setSel("");
await reload();
} catch (e: any) {
toast(e.message);
} finally {
setBusy(false);
}
};
const closeIssue = async () => {
if (!selected) return;
const comment = await promptDialog({ title: t("factory.closeTitle"), message: t("factory.closeMsg", { n: selected.number }), defaultValue: t("factory.closeDefault"), confirmLabel: t("factory.close") });
@@ -383,26 +414,33 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</div>
<div className="factory-repos">
<button className={`factory-repo ${repo === "" ? "active" : ""}`} onClick={() => setRepo("")}>
<b>{t("factory.allRepos")}</b>
<span className="hint">{t("factory.kpi.issues", { n: data.issues.length })}</span>
</button>
{data.repos.map((r) => {
const mine = data.issues.filter((i) => i.repo === r.url);
<select className="factory-repo-select" value={repo} onChange={(e) => setRepo(e.target.value)} aria-label={t("factory.project")}>
<option value="">
{t("factory.allRepos")} ({data.issues.length})
</option>
{data.repos.map((r) => (
<option key={r.url} value={r.url}>
{repoName(r.url)}
{r.version ? ` · v${r.version}` : ""} ({data.issues.filter((i) => i.repo === r.url).length}){r.enabled ? "" : " – off"}
</option>
))}
</select>
{(() => {
const r = data.repos.find((x) => x.url === repo);
if (!r) return null;
return (
<button key={r.url} className={`factory-repo ${repo === r.url ? "active" : ""} ${r.enabled ? "" : "off"}`} onClick={() => setRepo(r.url)}>
<b>{repoName(r.url)}</b>
<span className="factory-repo-info">
<span className="chip">{KIND_NAME[r.kind] ?? r.kind}</span>
{r.version && <span className="chip ok mono">v{r.version}</span>}
<span className="hint">
{r.running > 0 && <span className="factory-pulse" />}
{t("factory.repoLine", { n: mine.length, run: r.running })}
{t("factory.repoLine", { n: data.issues.filter((i) => i.repo === r.url).length, run: r.running })}
</span>
<span className="hint mono">{PHASES.map((p) => r.models[p] || "·").map((m) => m.split("/").pop()).join(" → ")}</span>
{!r.has_token && <span className="chip warn">{t("factory.noToken")}</span>}
</button>
</span>
);
})}
})()}
<button className="small primary" onClick={newProject} disabled={busy}>
<Icon name="plus" /> {t("factory.newProject")}
</button>
@@ -479,6 +517,11 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
</button>
</>
)}
{selected && !["review", "building", "testing"].includes(selected.state) && (
<button className="small" onClick={removeIssue} disabled={busy} title={t("factory.removeHint")}>
<Icon name="trash" /> {t("factory.remove")}
</button>
)}
{selected && selected.state === "done" && (
<button className="small" onClick={closeIssue} disabled={busy}>
<Icon name="check" /> {t("factory.close")}
+4
View File
@@ -1294,6 +1294,9 @@ export const de: Messages = {
"factory.closeTitle": "Issue schließen",
"factory.closeMsg": "Kommentar zum Schließen von Issue #{n}. Er wird im Issue veröffentlicht, danach wird das Issue geschlossen.",
"factory.closeDefault": "Erledigt und abgenommen.",
"factory.remove": "Vom Board entfernen",
"factory.removeHint": "Nimmt das Issue vom Factory-Board; das Issue im Forge bleibt unberührt. Gelöschte Issues verschwinden von selbst.",
"factory.removeConfirm": "#{n} vom Factory-Board entfernen? Das Issue im Forge bleibt unverändert.",
"factory.closed": "Issue geschlossen",
"factory.skills": "Skills",
"factory.skillAdd": "Skill hinzufügen…",
@@ -1324,6 +1327,7 @@ export const de: Messages = {
"factory.test": "Verbindung testen",
"factory.testOk": "Verbunden als {login} mit {repo}; {n} Labels angelegt, Repository geklont.",
"factory.deleteConfirm": "{name} aus der Factory entfernen? Issues und Chats bleiben.",
"factory.project": "Projekt",
"factory.newProject": "Neues Projekt",
"factory.connections": "Verbindungen",
"factory.connectionsHint": "Deine Konten bei Gitea, GitHub oder GitLab. Jeder Nutzer richtet seine eigenen ein; Repositories nutzen den Token ihrer Verbindung, sofern sie keinen eigenen haben.",
+4
View File
@@ -1293,6 +1293,9 @@ export const en = {
"factory.closeTitle": "Close issue",
"factory.closeMsg": "Comment for closing issue #{n}. It is posted on the issue, then the issue is closed.",
"factory.closeDefault": "Done and accepted.",
"factory.remove": "Remove from board",
"factory.removeHint": "Take the issue off the factory board; the issue on the forge is not touched. Deleted issues disappear by themselves.",
"factory.removeConfirm": "Remove #{n} from the factory board? The issue on the forge stays as it is.",
"factory.closed": "Issue closed",
"factory.skills": "Skills",
"factory.skillAdd": "Add skill…",
@@ -1323,6 +1326,7 @@ export const en = {
"factory.test": "Test connection",
"factory.testOk": "Connected as {login} to {repo}; {n} labels created, repository cloned.",
"factory.deleteConfirm": "Remove {name} from the factory? Issues and chats stay.",
"factory.project": "Project",
"factory.newProject": "New project",
"factory.connections": "Connections",
"factory.connectionsHint": "Your accounts at Gitea, GitHub or GitLab. Each user sets up their own; repositories use the token of their connection unless they have a token of their own.",
+10
View File
@@ -5044,6 +5044,16 @@ td.fold-indent {
margin-bottom: 14px;
align-items: stretch;
}
.factory-repo-select {
min-width: 220px;
max-width: 100%;
}
.factory-repo-info {
display: inline-flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}
.factory-repo {
display: flex;
flex-direction: column;
+8
View File
@@ -3,6 +3,14 @@
* under "unreleased"; scripts/release.sh renames the key to the release version.
*/
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
"202611-00062": {
en: ["Factory: the parallel limit per project is now respected exactly", "Factory: remove issues from the board; issues deleted on the forge disappear by themselves"],
de: ["Factory: das Parallel-Limit pro Projekt wird jetzt genau eingehalten", "Factory: Issues vom Board entfernen; im Forge gelöschte Issues verschwinden von selbst"],
},
"202611-00061": {
en: ["Factory: projects are chosen from a dropdown (all projects or a single one)"],
de: ["Factory: Projekte werden per Dropdown gewählt (alle oder nur eins)"],
},
"202611-00060": {
en: ["Uploads are chunked everywhere and show progress per file and in total", "Factory: recreate mode – analyse existing software in depth and rebuild it clean-room from a specification with milestones"],
de: ["Uploads laufen überall in Teilen und zeigen den Fortschritt je Datei und gesamt", "Factory: Nachbau-Modus – bestehende Software bis ins Detail analysieren und Cleanroom aus einer Spezifikation mit Meilensteinen neu bauen"],