Repository navigation
test(converter): add storage goldens and production coverage gate (DEV-85) #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1af69ec
Update .gitignore
developjik a0bff76
Create Cargo.toml
developjik 9a4977e
Create Cargo.lock
developjik c21ab44
Add golden_convert function to lib.rs
developjik 0199f3b
Add tests for golden conversion functionality
developjik 3de9d64
Create cases.json
developjik fc7a778
Create README.md
developjik 3fbc320
Add coverage enforcement script for converter sources
developjik 7de1ad6
Add GitHub Actions workflow for converter tests
developjik 00c3bbe
Create test-converter-coverage.py
developjik 45f88db
Add coverage gate regression tests step
developjik c590ba0
Add script to verify harness dependencies against desktop lock
developjik f2daa46
Downgrade itoa and syn package versions
developjik b6c4a6a
Improve README with CI and dependency update details
developjik 4450e7f
Rename test and update assertions for reference edges
developjik f6b252d
Refactor coverage check script for clarity and accuracy
developjik 4c7ddda
Enhance coverage report with JSON summary output
developjik 46eebf0
Update converter tests workflow to include JSON summary
developjik 3f916e1
Update test-converter-coverage.py
developjik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| name: converter contracts | ||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| permissions: | ||
| contents: read | ||
| concurrency: | ||
| group: converter-contracts-${{ github.ref }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| converter: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
| - name: Match desktop dependency versions | ||
| run: python3 scripts/check-converter-lock.py | ||
| - name: Rust and LLVM instrumentation | ||
| run: rustup toolchain install stable --profile minimal --component llvm-tools-preview | ||
| - name: Install pinned coverage runner | ||
| run: cargo +stable install cargo-llvm-cov --version 0.9.2 --locked | ||
| - name: Production converter tests with locked dependencies | ||
| run: cargo +stable llvm-cov --manifest-path converter-tests/Cargo.toml --locked --lcov --output-path converter-coverage.lcov | ||
| - name: Export matching LLVM summary | ||
| run: cargo +stable llvm-cov report --manifest-path converter-tests/Cargo.toml --json --output-path converter-coverage.json | ||
| - name: Coverage gate regression tests | ||
| run: python3 scripts/test-converter-coverage.py | ||
| - name: Enforce 80 percent on every converter source | ||
| run: python3 scripts/check-converter-coverage.py converter-coverage.lcov converter-coverage.json | ||
| - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 | ||
| if: always() | ||
| with: | ||
| name: converter-line-coverage | ||
| path: | | ||
| converter-coverage.lcov | ||
| converter-coverage.json | ||
| if-no-files-found: error | ||
| retention-days: 7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,3 +25,6 @@ dist-ssr | |
|
|
||
| # agent runtime state | ||
| .gjc/ | ||
|
|
||
| # Standalone source-including converter tests | ||
| /converter-tests/target/ | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [package] | ||
| name = "converter-contract-tests" | ||
| version = "0.0.0" | ||
| edition = "2024" | ||
| publish = false | ||
|
|
||
| [dependencies] | ||
| quick-xml = "0.42" | ||
|
|
||
| serde_json = "1" | ||
|
|
||
| [workspace] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Converter contract tests (DEV-85) | ||
|
|
||
| This standalone crate compiles the production converter directly with Rust `#[path]` modules. It does not copy or mock the converter and does not need a desktop window, Tauri build, credentials, or network access at test runtime. Existing inline converter unit tests run alongside the new contracts. | ||
|
|
||
| ```sh | ||
| cargo test --manifest-path converter-tests/Cargo.toml --locked | ||
| cargo install cargo-llvm-cov --version 0.9.2 --locked | ||
| rustup component add llvm-tools-preview | ||
| cargo llvm-cov --manifest-path converter-tests/Cargo.toml --locked --lcov --output-path converter-coverage.lcov | ||
| cargo llvm-cov report --manifest-path converter-tests/Cargo.toml --json --output-path converter-coverage.json | ||
| python3 scripts/check-converter-coverage.py converter-coverage.lcov converter-coverage.json | ||
| ``` | ||
|
|
||
| ## Fixtures and review | ||
|
|
||
| `fixtures/cases.json` contains 32 synthetic, Confluence-shaped storage/Markdown pairs. These are not exports from a real customer account. They cover headings, inline markup and escaping, nested lists, tables and spans, code fences/CDATA, panels, expand, tasks, links/attachments/images, properties, malformed macros and inert self/reciprocal references. URLs use the reserved `.invalid` domain; no real account data is stored. | ||
|
|
||
| Each expected string was inspected against the storage and the current converter's behavior. Tests compare exact Markdown bytes, including trailing newlines, and repeat conversions to detect instability. Golden changes require a human-readable input/output diff and an explanation. There is intentionally no automatic snapshot-accept command. | ||
|
|
||
| These are **characterization tests, not a declaration that every existing output is ideal**. The two products have different contracts. Studio currently flattens tasks, drops some inline styles, and shows unsupported macros as callouts; export-desktop emits task checkboxes and unsupported-macro comments. Missing targets and malformed input may lose content. The fixtures keep these limitations visible rather than silently changing production behavior in this test-only ticket. | ||
|
|
||
| Neither converter resolves includes recursively or fetches page content. Self/reciprocal reference tests verify bounded, deterministic conversion, not cycle detection in a recursive resolver. The XML entity-like case is a local safety regression; it makes no external request. | ||
|
|
||
| ## Coverage gate | ||
|
|
||
| The CI workflow runs on every pull request and default-branch push. LLVM LCOV must name every production converter `.rs` source, and **each file** must have at least 80% line coverage. Missing, duplicate, empty, truncated, inconsistent LCOV/JSON totals, or below-threshold reports fail. Imported error/model support modules are outside the converter scope. The gate excludes lines in trailing `#[cfg(test)]` modules, so test assertions cannot inflate production coverage. The current converter sources put those modules last; preserve that layout or update the gate when refactoring. This is a production line gate, not a branch-coverage claim. CI uploads the raw LCOV and matching LLVM JSON for 7 days. | ||
|
|
||
| The harness dependencies have their own committed `Cargo.lock`, because it is an independent workspace. CI checks every harness registry dependency against the desktop lock version/source/checksum. To refresh, copy `src-tauri/Cargo.lock` to `converter-tests/Cargo.lock` and run `cargo check --manifest-path converter-tests/Cargo.toml` to prune unrelated desktop packages. A production dependency or source-layout change must update this harness as needed; compiling the actual sources makes API drift fail at compile time. Desktop/end-to-end behavior remains the responsibility of the main application's tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| [ | ||
| { | ||
| "markdown": "# Title\n\n## Section\n\n###### Small\n", | ||
| "name": "headings", | ||
| "storage": "<h1>Title</h1><h2>Section</h2><h6>Small</h6>" | ||
| }, | ||
| { | ||
| "markdown": "Hello **bold** *em* gone `` a`b `` & 한글.\n", | ||
| "name": "inline", | ||
| "storage": "<p>Hello <strong>bold</strong> <em>em</em> <del>gone</del> <code>a`b</code> & 한글.</p>" | ||
| }, | ||
| { | ||
| "markdown": "- One\n - Nested\n- Two\n\n1. Third\n2. Fourth\n", | ||
| "name": "lists", | ||
| "storage": "<ul><li>One<ul><li>Nested</li></ul></li><li>Two</li></ul><ol start=\"3\"><li>Third</li><li>Fourth</li></ol>" | ||
| }, | ||
| { | ||
| "markdown": "| A | B |\n| --- | --- |\n| x\\|y | line \nnext |\n", | ||
| "name": "table", | ||
| "storage": "<table><tbody><tr><th>A</th><th style=\"text-align:right\">B</th></tr><tr><td>x|y</td><td>line<br/>next</td></tr></tbody></table>" | ||
| }, | ||
| { | ||
| "markdown": "| A & B | |\n| --- | --- |\n| X | Y |\n", | ||
| "name": "spans", | ||
| "storage": "<table><tr><th colspan=\"2\">A & B</th></tr><tr><td rowspan=\"2\">X</td><td>Y</td></tr></table>" | ||
| }, | ||
| { | ||
| "markdown": "````js\nconst x = `<ok>`;\n```\n````\n", | ||
| "name": "code", | ||
| "storage": "<ac:structured-macro ac:name=\"code\"><ac:parameter ac:name=\"language\">js</ac:parameter><ac:plain-text-body><![CDATA[const x = `<ok>`;\n```]]></ac:plain-text-body></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "```noformat\nraw <x>\ntext\n```\n", | ||
| "name": "noformat", | ||
| "storage": "<ac:structured-macro ac:name=\"noformat\"><ac:plain-text-body><![CDATA[raw <x>\ntext]]></ac:plain-text-body></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "> [!INFO]\n> Body info\n\n> [!NOTE]\n> Body note\n\n> [!WARNING]\n> Body warning\n\n> [!TIP]\n> Body tip\n\n> [!PANEL]\n> Body panel\n", | ||
| "name": "panels", | ||
| "storage": "<ac:structured-macro ac:name=\"info\"><ac:parameter ac:name=\"title\">Heading</ac:parameter><ac:rich-text-body><p>Body info</p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name=\"note\"><ac:parameter ac:name=\"title\">Heading</ac:parameter><ac:rich-text-body><p>Body note</p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name=\"warning\"><ac:parameter ac:name=\"title\">Heading</ac:parameter><ac:rich-text-body><p>Body warning</p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name=\"tip\"><ac:parameter ac:name=\"title\">Heading</ac:parameter><ac:rich-text-body><p>Body tip</p></ac:rich-text-body></ac:structured-macro><ac:structured-macro ac:name=\"panel\"><ac:parameter ac:name=\"title\">Heading</ac:parameter><ac:rich-text-body><p>Body panel</p></ac:rich-text-body></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "> [!EXPAND]\n> Details\n", | ||
| "name": "expand", | ||
| "storage": "<ac:structured-macro ac:name=\"expand\"><ac:parameter ac:name=\"title\">More <now></ac:parameter><ac:rich-text-body><p>Details</p></ac:rich-text-body></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "completeDoneincompleteTodo\n", | ||
| "name": "tasks", | ||
| "storage": "<ac:task-list><ac:task><ac:task-status>complete</ac:task-status><ac:task-body>Done</ac:task-body></ac:task><ac:task><ac:task-status>incomplete</ac:task-status><ac:task-body>Todo</ac:task-body></ac:task></ac:task-list>" | ||
| }, | ||
| { | ||
| "markdown": "> Quote\n>\n> Second\n\n```\nraw <x>\n```\n\n---\n", | ||
| "name": "quote-pre", | ||
| "storage": "<blockquote><p>Quote</p><p>Second</p></blockquote><pre>raw <x></pre><hr/>" | ||
| }, | ||
| { | ||
| "markdown": "[Link](https://example.invalid/a(b)) [Wiki](/spaces/S/pages/2) No target\n", | ||
| "name": "links", | ||
| "storage": "<p><a href=\"https://example.invalid/a(b)\">Link</a> <a href=\"/spaces/S/pages/2\">Wiki</a> <a>No target</a> <a href=\"https://example.invalid\"> </a></p>" | ||
| }, | ||
| { | ||
| "markdown": "Other page\n", | ||
| "name": "page-links", | ||
| "storage": "<p><ac:link ac:anchor=\"part\"><ri:page ri:content-title=\"Other\" ri:space-key=\"S\"/><ac:plain-text-link-body><![CDATA[Other page]]></ac:plain-text-link-body></ac:link></p>" | ||
| }, | ||
| { | ||
| "markdown": "Missing Jump\n", | ||
| "name": "missing-links", | ||
| "storage": "<p><ac:link><ri:page ri:content-title=\"Missing\"/></ac:link> <ac:link ac:anchor=\"local\"><ac:link-body>Jump</ac:link-body></ac:link></p>" | ||
| }, | ||
| { | ||
| "markdown": "\n", | ||
| "name": "images", | ||
| "storage": "<p><ac:image ac:alt=\"Diagram\"><ri:attachment ri:filename=\"diagram.png\"/></ac:image><img src=\"https://example.invalid/image.png\" alt=\"External\"/></p>" | ||
| }, | ||
| { | ||
| "markdown": "Download\n", | ||
| "name": "attachment-link", | ||
| "storage": "<p><ac:link><ri:attachment ri:filename=\"diagram.png\"/><ac:plain-text-link-body>Download</ac:plain-text-link-body></ac:link></p>" | ||
| }, | ||
| { | ||
| "markdown": "> [!PAGE-PROPERTIES]\n> | Owner | Team A |\n> | --- | --- |\n> | Status | Ready |\n", | ||
| "name": "properties", | ||
| "storage": "<ac:structured-macro ac:name=\"page-properties\"><ac:rich-text-body><table><tr><th>Owner</th><td>Team A</td></tr><tr><th>Status</th><td>Ready</td></tr></table></ac:rich-text-body></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "> [!CUSTOM]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n> key: value\n", | ||
| "name": "unknown-macro", | ||
| "storage": "<ac:structured-macro ac:name=\"custom\"><ac:parameter ac:name=\"key\">value</ac:parameter></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "> [!CUSTOM]\n> Preserved body\n", | ||
| "name": "rich-unknown", | ||
| "storage": "<ac:structured-macro ac:name=\"custom\"><ac:rich-text-body><p>Preserved body</p></ac:rich-text-body></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "Before\n", | ||
| "name": "malformed", | ||
| "storage": "<p>Before</p><ac:structured-macro ac:name=\"code\"><ac:plain-text-body><![CDATA[unfinished" | ||
| }, | ||
| { | ||
| "markdown": "Self\n\n> [!INCLUDE]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n", | ||
| "name": "cyclic-reference", | ||
| "storage": "<p><ac:link><ri:page ri:content-title=\"Self\" ri:space-key=\"S\"/><ac:link-body>Self</ac:link-body></ac:link></p><ac:structured-macro ac:name=\"include\"><ac:parameter ac:name=\"\">Self</ac:parameter></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "<tag> \"quote\" & A &unknown;\n", | ||
| "name": "entities", | ||
| "storage": "<p><tag> "quote" & A &unknown;</p>" | ||
| }, | ||
| { | ||
| "markdown": "\n\n```\n\n```\n", | ||
| "name": "empty", | ||
| "storage": "<p></p><h1></h1><blockquote></blockquote><pre></pre><table></table>" | ||
| }, | ||
| { | ||
| "markdown": "Inside\n\nSpan under 2n \nend\n", | ||
| "name": "transparent", | ||
| "storage": "<section><div><p>Inside</p></div></section><p><span>Span</span> <u>under</u> <sup>2</sup><sub>n</sub><br/>end</p>" | ||
| }, | ||
| { | ||
| "markdown": "TermMeaningOnlyNextLoose\n", | ||
| "name": "definitions", | ||
| "storage": "<dl><dt>Term</dt><dd>Meaning</dd><dt>Only</dt><dt>Next</dt><dd></dd><dd>Loose</dd></dl>" | ||
| }, | ||
| { | ||
| "markdown": "Caption\n", | ||
| "name": "figure", | ||
| "storage": "<figure><img src=\"https://example.invalid/a.png\" alt=\"A\"/><figcaption>Caption</figcaption></figure>" | ||
| }, | ||
| { | ||
| "markdown": "> [!STATUS]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n> title: Ready\n> colour: green\n\n> [!DATE]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n> value: 2026-01-02\n\n> [!JIRA]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n> key: DEV-1\n> server: https://example.invalid\n", | ||
| "name": "status-date-jira", | ||
| "storage": "<ac:structured-macro ac:name=\"status\"><ac:parameter ac:name=\"title\">Ready</ac:parameter><ac:parameter ac:name=\"colour\">green</ac:parameter></ac:structured-macro><ac:structured-macro ac:name=\"date\"><ac:parameter ac:name=\"value\">2026-01-02</ac:parameter></ac:structured-macro><ac:structured-macro ac:name=\"jira\"><ac:parameter ac:name=\"key\">DEV-1</ac:parameter><ac:parameter ac:name=\"server\">https://example.invalid</ac:parameter></ac:structured-macro>" | ||
| }, | ||
| { | ||
| "markdown": "Attention\n\nWarn\n", | ||
| "name": "panel-div", | ||
| "storage": "<div class=\"confluence-information-macro confluence-information-macro-warning\"><p class=\"confluence-information-macro-heading\">Attention</p><p>Warn</p></div>" | ||
| }, | ||
| { | ||
| "markdown": "Todayxhidden[spaced](a b)\n", | ||
| "name": "inline-extras", | ||
| "storage": "<p><time datetime=\"2026-01-02\"></time><time>Today</time><ri:user ri:username=\"tester\"/><ac:emoji ac:shortname=\":smile:\"/><code> </code><tt>x</tt><b> </b><ac:placeholder>hidden</ac:placeholder><a href=\"a b\">spaced</a></p>" | ||
| }, | ||
| { | ||
| "markdown": "| A | |\n| --- | --- |\n| B | C |\n", | ||
| "name": "ragged-table", | ||
| "storage": "<table><caption>Caption</caption><tr><td>A</td></tr><tr><td>B</td><td>C</td></tr></table>" | ||
| }, | ||
| { | ||
| "markdown": "- ParentcompleteNestedTail\n", | ||
| "name": "nested-tasks", | ||
| "storage": "<ul><li><p>Parent</p><ac:task-list><ac:task><ac:task-status>complete</ac:task-status><ac:task-body>Nested</ac:task-body></ac:task></ac:task-list><p>Tail</p></li></ul>" | ||
| }, | ||
| { | ||
| "markdown": "> [!CODE]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n\n> [!EXPAND]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n\n> [!PAGE-PROPERTIES]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n\n> [!TOC]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n\n> [!JIRA]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n\n> [!DATE]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n\n> [!STATUS]\n> *변환되지 않는 Confluence 매크로입니다. 원본 페이지에서 확인하세요.*\n", | ||
| "name": "macro-empty", | ||
| "storage": "<ac:structured-macro ac:name=\"code\"></ac:structured-macro><ac:structured-macro ac:name=\"expand\"></ac:structured-macro><ac:structured-macro ac:name=\"page-properties\"></ac:structured-macro><ac:structured-macro ac:name=\"toc\"></ac:structured-macro><ac:structured-macro ac:name=\"jira\"></ac:structured-macro><ac:structured-macro ac:name=\"date\"></ac:structured-macro><ac:structured-macro ac:name=\"status\"></ac:structured-macro>" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| #[path = "../../src-tauri/src/confluence/convert.rs"] | ||
| pub mod converter; | ||
|
|
||
| pub fn golden_convert(s: &str) -> String { | ||
| crate::converter::storage_to_markdown(s) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 자동 의존성 업데이트의 잠금 파일 동기화
Dependabot은 데스크톱 Cargo 작업공간만 갱신합니다. 공통 의존성의 이전 버전이 데스크톱 잠금 파일에서 사라지는 업데이트에는 컨버터 잠금 파일 갱신도 필요합니다.
Was this helpful? React with 👍 or 👎 to provide feedback.