Skip to content

Fix: Follow-up review findings from #1076/#1080 - #1107

Merged
huang195 merged 1 commit into
mainfrom
fix/systemd-followup-945
Sep 23, 2026
Merged

huang195 merged 1 commit into
mainfrom
fix/systemd-followup-945

Conversation

@Alan-Cha

@Alan-Cha Alan-Cha commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Context

Three genuine findings from the post-merge review pass on #1076/#1080, called out by @huang195. Two other findings from the same round (serviceIsCurrent/reportInstallSuccess still branching on goos internally, and a latent callLog zero-argument edge case) were explicitly noted as out of scope there — tracked separately in #1106 instead of included here.

Test plan

  • go build, go vet, gofmt clean
  • TestUnloadService_Linux and TestLingerEnabled pass, including the new subtest
  • Full cmd/abctl suite passes (one pre-existing, unrelated local-machine failure excluded)

Assisted-By: Claude (Anthropic AI) [email protected]

Summary by CodeRabbit

  • Documentation
    • Updated the Linux service lifecycle notes to reflect the current stop-timeout behavior.
  • Tests
    • Strengthened checks for service-disable error details and user-session linger detection, including verification that the status is queried once.

- Spec doc bullet 7 said "not yet on this branch's own tree until it
  merges" about #1079's TimeoutStopSec fix — accurate when written on
  an unmerged branch, but both #1079 and #1080 are now merged into
  main, so the sentence inverted: it read as "hasn't merged yet" about
  something that has. Dropped the merge-status framing; the symbol
  citation still stands on its own.
- unloadService's "disable --now failure is reported" test only
  checked strings.Contains(err.Error(), "disable"), so a wrong unit
  name would still pass. Pinned the exact command string
  ("--user disable --now cortex.service"), matching the sibling
  assertion in TestControlService_Linux.
- TestLingerEnabled hardcoded uid "501" (macOS-shaped) in a Linux-only
  test, inconsistent with the rest of the file's strconv.Itoa(os.Getuid()).
  Replaced it, and added a subtest pinning the exact show-user
  invocation (uid + --property=Linger) — the existing cases only
  checked the parsed result, so a wrong property flag or wrong uid
  would have stayed green.

Found during review of #1076/#1080; both explicitly called out as
real, not the two other findings from the same round that were noted
as out of scope (tracked in #1106 instead).

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Alan Cha <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f7b8ce7d-c91b-43d4-a623-e0a6ee9faeaf

📥 Commits

Reviewing files that changed from the base of the PR and between 3558542 and d48cd58.

📒 Files selected for processing (2)
  • authbridge/cmd/abctl/cmd_service_systemd_test.go
  • authbridge/docs/superpowers/specs/2026-09-16-linux-systemd-lifecycle-design.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The changes tighten systemd lifecycle test assertions, use the current process uid in linger tests, add a loginctl call-count assertion, and revise a design-document reference to the TimeoutStopSec=20 setting.

Changes

Linux systemd lifecycle

Layer / File(s) Summary
Systemd lifecycle test assertions
authbridge/cmd/abctl/cmd_service_systemd_test.go, authbridge/docs/superpowers/specs/2026-09-16-linux-systemd-lifecycle-design.md
The tests assert the full systemctl invocation in an error, use the current uid for linger checks, and verify one exact loginctl call. The design note now cites the TimeoutStopSec=20 setting by symbol.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: huang195

Merge Risk: ⚪ Minimal · up to d48cd

No actionable merge-blocking risk remains. The update improves test coverage for existing lifecycle behavior without changing runtime behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately identifies the changes as follow-up fixes for review findings from #1076 and #1080. It is broad but remains relevant and specific through the referenced issue numbers.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 1 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@huang195 huang195 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tight, accurate follow-up — three test/doc fixes, every claim verifiable against source.

Verified (fetched from fix/systemd-followup-945 and main, not a local checkout):

Claim Result
unloadService error string cmd_service_platform.go:296 → "systemctl --user disable --now %s: ..." with systemdUnit = "cortex.service" (cmd_service.go:31) — substring assert matches exactly
lingerEnabled invocation cmd_service_platform.go:270 → loginctl show-user <uid> --property=Linger — new want string matches byte-for-byte
uid mirrors production cmd_service_platform.go:244 derives uid the same way; this file already did so at line 275, so the change is locally consistent too
Doc rewording #1079 is merged; TimeoutStopSec=20 is on main at cmd_service_platform.go:150, asserted at cmd_service_test.go:87. The revised wording is correct
Deferred findings #1106 is open and covers both

The unloadService assertion now matches its TestControlService_Linux sibling exactly, and the new show-user subtest closes a real hole: the four table cases never checked what loginctl was asked, since fakeLoginctl answers identically regardless of its arguments. Out-of-scope items were deferred to #1106 rather than smuggled in — appreciated.

One nit inline, non-blocking.

Areas reviewed: Go tests, Docs · Agent/IDE config (.claude/.vscode): none · Secrets scan: clean · Commits: 1, signed off · CI: all green (27 checks)

t.Run("invokes show-user with the exact uid and property", func(t *testing.T) {
logPath, logLine := callLog(t)
fakeLoginctl(t, "#!/bin/sh\n"+logLine+"\necho 'Linger=yes'\nexit 0\n")
lingerEnabled(uid)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the return value is discarded here, so the stub's echo 'Linger=yes' is inert — this subtest passes identically with a bare exit 0 body. The sibling invocation-pinning subtests in this file (TestControlService_Linux, the tc.action loop) do check what came back.

A one-liner would keep the canned output load-bearing and match that style:

if !lingerEnabled(uid) {
    t.Error("lingerEnabled() = false, want true for Linger=yes")
}

The explicit yes table case already covers the parse, so this is belt-and-braces — take it or leave it.

@huang195
huang195 merged commit 43cf62b into main Sep 23, 2026
28 checks passed
@huang195
huang195 deleted the fix/systemd-followup-945 branch September 23, 2026 16:08
@github-project-automation github-project-automation Bot moved this from New/ToDo to Done in Rossoctl Issue Prioritization Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants