fix: fix: disinto init can produce duplicate keys in projects/*.toml (#269) #272

Merged
dev-bot merged 1 commit from fix/issue-269 into main 2026-04-06 08:09:02 +00:00
Collaborator

Fixes #269

Changes

Fixes #269 ## Changes
dev-bot added 1 commit 2026-04-06 08:01:12 +00:00
fix: fix: disinto init can produce duplicate keys in projects/*.toml (#269)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/smoke-init Pipeline was successful
1cb7e4b8aa
Export actual_ops_slug from setup_ops_repo via _ACTUAL_OPS_SLUG global,
then update ops_repo in the TOML in-place using Python re.sub after TOML
creation or detection. Falls back to inserting after the repo line if the
key is missing. This prevents duplicate TOML keys on repeated init runs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
Collaborator

AI Review — Error\n\nReview failed.\n---\n1cb7e4b

## AI Review — Error\n<!-- review-error: 1cb7e4b8aaee69d86dc4a8d2bed4b39e193a08a3 -->\nReview failed.\n---\n*1cb7e4b*
Collaborator

AI Review

Summary

The fix exports the resolved ops slug () from and uses a Python one-liner to update in the project TOML in-place, preventing duplicate keys on repeated runs.

Analysis

Logic: Correct. The call order is right — (line 2123) sets before the update block (line 2154) reads it. The guard safely skips the update if the ops repo setup failed.

Regex correctness: The in the bash double-quoted string is shell-escaping; Python receives the literal becoming in the raw string — wait, more precisely: bash in double-quotes passes to Python which in a raw string is a literal backslash+dollar, but the actual code has (single backslash), so shell passes → python raw string , which is the regex end-of-line anchor. This is correct.

Key disambiguation: does not accidentally match because does not satisfy . Correct.

Newline preservation: In MULTILINE mode, matches up to (but not including) the newline, so the substitution does not eat the line terminator. Correct.

Alignment: The replacement string (8 spaces) matches the format produced by at line 1421. Consistent.

Security: The ops slug is passed as rather than interpolated into the shell command string, so no injection risk.

Fallback for missing key: The branch correctly inserts after the line using a capture-group substitution. Correct.

No issues found.

Verdict

APPROVE — Correctly fixes duplicate-key bug by updating ops_repo in-place via Python regex; logic and escaping are sound


Reviewed at 1cb7e4b | AGENTS.md

## AI Review <!-- reviewed: 1cb7e4b8aaee69d86dc4a8d2bed4b39e193a08a3 --> ### Summary The fix exports the resolved ops slug () from and uses a Python one-liner to update in the project TOML in-place, preventing duplicate keys on repeated runs. ### Analysis **Logic**: Correct. The call order is right — (line 2123) sets before the update block (line 2154) reads it. The guard safely skips the update if the ops repo setup failed. **Regex correctness**: The in the bash double-quoted string is shell-escaping; Python receives the literal becoming in the raw string — wait, more precisely: bash in double-quotes passes to Python which in a raw string is a literal backslash+dollar, but the actual code has (single backslash), so shell passes → python raw string , which is the regex end-of-line anchor. This is correct. **Key disambiguation**: does not accidentally match because does not satisfy . Correct. **Newline preservation**: In MULTILINE mode, matches up to (but not including) the newline, so the substitution does not eat the line terminator. Correct. **Alignment**: The replacement string (8 spaces) matches the format produced by at line 1421. Consistent. **Security**: The ops slug is passed as rather than interpolated into the shell command string, so no injection risk. **Fallback for missing key**: The branch correctly inserts after the line using a capture-group substitution. Correct. No issues found. ### Verdict **APPROVE** — Correctly fixes duplicate-key bug by updating ops_repo in-place via Python regex; logic and escaping are sound --- *Reviewed at `1cb7e4b` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-06 08:08:56 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Correctly fixes duplicate-key bug by updating ops_repo in-place via Python regex; logic and escaping are sound

AI Review: **APPROVE** — Correctly fixes duplicate-key bug by updating ops_repo in-place via Python regex; logic and escaping are sound
dev-bot merged commit f04a57e6db into main 2026-04-06 08:09:02 +00:00
dev-bot deleted branch fix/issue-269 2026-04-06 08:09:02 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#272
No description provided.