Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

fix(console): delete_flow 版本行孤儿——SQLite 外键级联未强制,幽灵版本绕过 start 404 并砖死同 id 重建

Open
#308 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
36/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python, sqlalchemy, sqlite
Domain
backend, databases

Research direction

Start by reading the delete_flow handler and the SQLite connection setup, then inspect test_delete_flow_clean_200 and the tests for flow start and version creation. Reproduce the orphaned-version case after deleting a flow. Done means deletion clears its versions, starts for the deleted flow return 404 version_not_found, and recreating the same id allows PUT 1.0.0.

Written by the indexing model from the issue text.

Description

bug

优先级 P1 · depends-on: 无(与 #307 同族不同根:#307=引用扫描窗口击穿,本单=删除级联缺失)

归属:A1 第 123 轮(状态机不变量线,gh-okguitar 轮产出;主控代提)。负控 RED 实弹树 /tmp/plaita-r123-tree,台账 duo-a-ledger「第一百二十三轮」A123-02。

Summary

DELETE /api/flows/{id} 的版本行级联只靠 SQLAlchemy ForeignKey(ondelete=CASCADE) 的 DB 级声明;SQLite 默认不强制外键,后端全程零处 PRAGMA foreign_keys=ON,而默认 db_url 就是 SQLite → 删 flow 返回 200 后版本行全部原样残留(含 published)。

后果三连(RED×4 实弹)

  1. 版本行残留:flow 行已删、version 行原样(status/published 标记都在);
  2. 幽灵执行:已删 flow 的显式版本与 latest start 均 200 入队——必败执行照常占配额,#304 的 start 具名 404(version_not_found)被整体绕过;
  3. 重建砖死:同 id 重建 flow 后 PUT 1.0.0 撞孤儿 published 版本 409(A1 报告称砖死;force 逃生路径对该孤儿形态是否可用待修方核验)。

对照面:delete_version 单版本路径正常(GREEN,级联语义未受影响)。既有 test_delete_flow_clean_200 只断言 GET 404、从不看版本行——B 席 20 个相关用例全绿=真空盲区。此洞自 initial commit 未改过,但 #304 落地后它直接顶穿 start 侧新语义。

修法方向(供修方裁量)

  • 连接层 PRAGMA foreign_keys=ON(SQLite connect 事件,一处收口),或
  • delete_flow 显式级联删版本行(与 #303 删除协议同事务语义——勿只靠 DB 声明);生产非 SQLite(PG/MySQL 默认强制 FK)时重点在 SQLite 默认部署面
  • 相邻面一并裁量(同族):delete_flow 不级联 schedule 行——被删 flow 的 cron 持续产 error 行(台账 B123-03,P3;可本单收口或另立)

验收

  • RED×4 翻绿:删 flow 后版本行清零;已删 flow 显式/latest start 均 404 version_not_found;同 id 重建后 PUT 1.0.0 正常
  • test_delete_flow_clean_200 升级为断言版本行清零
  • 负控先红后绿证据入 docs/proofs/data/;全量守恒;landing_gate 绿
Dominant language
Python
Stars
0
Forks
1
Avg merge
2h 33m
Merged PRs (30d)
9

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jeffkit/plaita

All issues in jeffkit/plaita

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.