feat(databases): record why a fork was taken - #315
Conversation
| .collect() | ||
| } | ||
|
|
||
| /// `databases tables add` — declare a table on an existing instant database. |
There was a problem hiding this comment.
nit: (not blocking) This doc comment describes add_table, but the new function was inserted below it. table_declaration_body now carries the wrong summary, and add_table at line 1002 carries none. Every other command function in this file opens with its databases ... doc line. Move this line down to add_table.
There was a problem hiding this comment.
No longer applies. table_declaration_body moved to its own PR, #316, and this PR no longer touches add_table.
| /// One `id (name) — root, forked <date>, snapshot <n>, deleted` line of the | ||
| /// lineage tree and the `forked_from:` rows. The id leads: it's the only field | ||
| /// guaranteed present, and the handle every other databases command accepts. | ||
| /// Longest description shown on a one-line lineage row; the full text is in |
There was a problem hiding this comment.
nit: (not blocking) The lineage_row doc comment sits above this constant, so the two comments merge into one block. DESCRIPTION_SUMMARY_CHARS gets a wrong first sentence, and lineage_row at line 2366 gets no doc comment. Move the constant and its own comment above the lineage_row doc block.
There was a problem hiding this comment.
Fixed in 9b1c19c, same change as the later thread.
| .as_ref() | ||
| .and_then(|f| f.description.as_deref()) | ||
| { | ||
| println!("description: {}", indent_continuation(d, 13)); |
There was a problem hiding this comment.
nit: (not blocking) fork --output table prints the description twice. LineageEntry::from(ForkedFrom) copies description, so lineage_row already appends the quoted summary to the forked_from: row above. The databases <id> view duplicates it the same way at line 1814. Set description: None on the entry passed to lineage_row at both call sites, so the summary stays exclusive to databases lineage.
There was a problem hiding this comment.
Fixed in 9b1c19c, same change as the thread below.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
c5a8bd6 to
7b273a4
Compare
| .as_ref() | ||
| .and_then(|f| f.description.as_deref()) | ||
| { | ||
| println!("description: {}", indent_continuation(d, 13)); |
There was a problem hiding this comment.
nit: (not blocking) fork --output table prints the fork description twice.
LineageEntry::from(ForkedFrom) at line 2272 copies description, so lineage_row already appends the quoted summary to the forked_from: row at line 2175. The databases <id> view duplicates the same way at line 1799.
Set description: None on the entry passed to lineage_row at both call sites. The quoted summary then stays exclusive to databases lineage.
Raised in the prior review as thread #4081864125 and still present.
There was a problem hiding this comment.
Fixed in 9b1c19c. The forked_from: row in both views now goes through forked_from_row, which leaves the description off, so it's printed once, on its own line. A new test covers it.
| /// guaranteed present, and the handle every other databases command accepts. | ||
| /// Longest description shown on a one-line lineage row; the full text is in | ||
| /// `-o json`/`yaml` and on `databases <id>`. | ||
| const DESCRIPTION_SUMMARY_CHARS: usize = 60; |
There was a problem hiding this comment.
nit: (not blocking) The lineage_row doc comment at lines 2324-2326 sits directly above this constant, so the two comments merge into one rustdoc block.
DESCRIPTION_SUMMARY_CHARS documents itself with a first sentence about lineage rows. lineage_row at line 2351 ends up with no doc comment, unlike every other rendering helper in this file.
Move the constant and the constant's own comment above the lineage_row doc block.
Raised in the prior review as thread #4081863422 and still present.
There was a problem hiding this comment.
Fixed in 9b1c19c. The lineage_row doc comment is back on lineage_row, and DESCRIPTION_SUMMARY_CHARS keeps only its own comment.
There was a problem hiding this comment.
Review
Blocking Issues
src/commands/databases.rs:1023 — the constant_per_key fix described in the PR summary is absent from this head SHA.
(Posted in the summary because line 1023 is not part of the diff, so an inline comment cannot anchor to it.)
add_table still sets body["key_determines"]. table_declaration_body does not exist anywhere in src/ — rg table_declaration_body src/ returns no match. The claimed unit test asserting constant_per_key in the request body is also absent; constant_per_key appears only in the updated table-listing fixtures.
Failure scenario: a user runs hotdata databases tables add orders --key id --key-determines region. The request body carries key_determines. The add-table endpoint rejects unknown fields after runtimedb 1300, so the command prints the server 400 and exits 1. That is exactly the bug the PR summary says is fixed.
The branch was force-pushed, and the comparison against the prior review SHA reports diverged. The prior review saw table_declaration_body at line 974, so the commit carrying the rename was most likely lost in the rebase.
The SDK bump to 0.19.0 and the fixture updates did survive the rebase. Those cover response decoding only, not the request-side field name.
Action Required
- Restore the
key_determinestoconstant_per_keyrename and thetable_declaration_bodyextraction, together with the unit test named in the test plan. If the rename is intentionally deferred to another PR, remove the bug-fix section from the PR description instead. - Address or decline the two inline nits: the duplicated fork description in
fork --output tableanddatabases <id>, and the merged doc comment aboveDESCRIPTION_SUMMARY_CHARS. Both were raised in cycle 1 and are unchanged.
The fork-description feature itself reads correctly. description_summary cuts on character boundaries, and the generation shift in build_lineage_tree puts each reason on the fork the reason explains.
CI checks test, skills, and integration were still queued or running at review time, so those results are unknown here.
|
On the blocking item: the |
9b1c19c to
a2d2974
Compare
There was a problem hiding this comment.
Prior nits are fixed. forked_from_row strips the description, so both table views print it once. DESCRIPTION_SUMMARY_CHARS and lineage_row each carry their own doc comment. The description shift in build_lineage_tree follows the existing snapshot_id/forked_at rule and has a test. No blocking issues found.
CI checks other than CI / changelog had not reported at review time.
The base branch was changed.
Add `databases fork --description <text>`, backed by the fork description added in runtimedb #1420. - The description is sent as given. The server trims it, treats blank as absent, and checks length and control characters. - `fork` and `databases <id>` print the full text on its own line. `lineage` rows show the first line, cut at 60 characters. `-o json`/`yaml` carry the full text. - Lineage moves the description one generation down with `snapshot_id` and `forked_at`, since an ancestor entry describes the fork taken from it.
a2d2974 to
1868e57
Compare
Summary
Adds
hotdata databases fork --description <text>, which records why a fork was taken. It uses the fork description from runtimedb #1420.forkanddatabases <id>print the full description, keeping line breaks.databases lineageshows the first line on the fork's row, in quotes, cut at 60 characters with….-o json/yamlcarry the full text asdescription.snapshot_idandforked_at, so each reason lands on the fork it explains.Depends on
main.--description.Test plan
cargo test: 598 passedcargo clippy --all-targets -- -D warningsandcargo fmt --checkscripts/check-skills.shfails locally on macOS bash 3.2 (it fails onmaintoo), so CI is the check here