Skip to content

fix(lineage): hint column-level needs existing table; pin jsp node-key tags (#154) - #163

Merged
c2j merged 2 commits into
mainfrom
fix/issue-154-followup
Sep 8, 2026
Merged

c2j merged 2 commits into
mainfrom
fix/issue-154-followup

Conversation

@c2j

@c2j c2j commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Follow-up to #156 (merged as c88156c) — 落实对 PR #156 的两轮 review 中最后两项 low 级遗留(review 5130018719 后续复审发现)。

Closes #154 (补充)

变更

1. Missing 回退 note 补充列级前提(fix)

codeweb lineage "orders.customer_id"orders 不存在)时,原输出为两段:

note: no table 'orders' found — interpreting 'orders.customer_id' as a table reference
No table found matching 'orders.customer_id'

用户看到的最终错误是拼接后的怪异表名,缺少修复指引。现 note 补充前提:

note: no table 'orders' found — interpreting 'orders.customer_id' as a table reference (for column-level lineage, the table must exist)

新增测试 should_hint_column_level_requires_table_when_target_missing 锁定(TDD Red→Green)。

2. roundtrip 测试钉住 jsp/jspsql 标签(test)

TYPE_TAG_PREFIXES 无条件包含 "jsp"/"jspsql",但其 NodeKey 变体为 cfg(feature = "jsp")should_detect_every_display_tag_roundtrip 从未覆盖它们(即使 --features jsp)。若 Display 格式变更,split_type_prefix 会静默失配且只表现为 table.column 误parse。

修法:测试内 #[cfg(feature = "jsp")] 块构造真实 JspPage/JspSql 变体并断言可检测;--features full 门禁下即被执行。常量文档同步说明。此为 characterization pin(当前行为已正确,无 Red)。

测试与门禁

c2j and others added 2 commits September 8, 2026 10:31
…ble note (#154)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Comment thread src/main.rs
graph::lineage::TableLookup::Missing => {
eprintln!(
"note: no table '{}' found — interpreting '{}' as a table reference",
"note: no table '{}' found — interpreting '{}' as a table reference (for column-level lineage, the table must exist)",

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] The new parenthetical (for column-level lineage, the table must exist) is appended on every TableLookup::Missing fallback, not only when the table is actually missing. That branch is also the successful schema.table recovery: codeweb lineage "bigfund.mid_yjqs_detail" first looks up table bigfund (a schema, so Missing), prints this note, then resolves the whole target as a table and succeeds. Users who typed a valid schema-qualified table now see a note implying column-level lineage failed because the table does not exist, even though stdout is a correct table-level result. should_fall_back_to_table_level_for_bare_schema_qualified_target still passes because it only checks for interpreting plus the original target. The new test covers only the dead-end missing_table.some_col case.

Suggestion: Keep the original Missing note for the schema.table recovery. Add the column-level prerequisite only when the subsequent table-level resolve also fails (the No table found matching path), or thread a “fell back from a column spec” flag and emit the extra sentence there. Extend the existing schema.table fallback test to assert the column-level parenthetical is absent on success.

Comment thread src/graph/key.rs
];
for key in &jsp_cases {
assert!(
split_type_prefix(key).is_some(),

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] The new JSP cases only assert split_type_prefix(key).is_some(). That does not pin the tags jsp / jspsql. JspSql Display (jspsql:file:line:hash) is one character away from JavaSql (javasql:file:line); if the JspSql arm were copy-pasted onto the javasql format, split_type_prefix would still succeed because javasql is already in TYPE_TAG_PREFIXES, and jspsql:… CLI keys would again last-dot-split. That is the drift this follow-up is meant to lock.

Suggestion: Assert the detected tag, e.g. assert_eq!(split_type_prefix(&jsp_page).map(|(tag, _)| tag), Some("jsp")) and Some("jspsql") for JspSql, rather than is_some().

@c2j
c2j merged commit 3b40908 into main Sep 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant