refactor: remove deprecated container.credentials_host_path compat branch #78

Merged
charles merged 5 commits from dev/77 into main 2026-04-19 16:32:33 +00:00
Collaborator

Closes #77.

Summary

Removes the backwards-compat code that accepted container.credentials_host_path
(a file path) in agents.json and resolved dirname(...) to a directory.
Every agents.json entry on main has used the new credentials_host_dir
key for a while; the compat branch was dead code on the happy path.

What changed

  • src/container.ts — drop @deprecated defaultHostCredentialsPath().
  • src/webhook-config.ts — drop the dirname(credentials_host_path) fallback in loadWebhookConfig. Config is now: credentials_host_dir if set → else defaultHostCredentialsDirPath().
  • src/container.test.ts — drop tests for the removed function + import.
  • src/webhook-config.test.ts — drop tests for the credentials_host_path branch; update file-level comment.

How this PR came to be — validation note for #76

This PR is the first end-to-end exercise of container mode for a
code agent
(dev in container, task dispatched on issues.assigned).
The container-mode pipeline all worked: worktree acquired inside the
container, file reads from the in-container path, forgejo-mcp
update_file calls through the shim, commits pushed. What failed was
dev's own agent strategy on turn 52 — sending a full ~400-line file
payload via update_file pushed the conversation past Sonnet's prompt
limit (Prompt is too long). Three of the four required edits had
already landed cleanly; the fourth was completed by hand in the last
commit on this branch. Container-mode infrastructure validated for
dev; see #78 for the follow-up on agent strategy.

Test plan

  • just qa — 241 tests (was 244; the 3 removed tests covered the
    deleted compat branch).
  • just containers-rebuild — works with all 5 agents picking up
    credentials_host_dir-only config.
  • scripts/smoke-creds.sh — 28/28 probes green across all 5
    agents.
Closes #77. ## Summary Removes the backwards-compat code that accepted `container.credentials_host_path` (a file path) in `agents.json` and resolved `dirname(...)` to a directory. Every `agents.json` entry on `main` has used the new `credentials_host_dir` key for a while; the compat branch was dead code on the happy path. ## What changed - **`src/container.ts`** — drop `@deprecated` `defaultHostCredentialsPath()`. - **`src/webhook-config.ts`** — drop the `dirname(credentials_host_path)` fallback in `loadWebhookConfig`. Config is now: `credentials_host_dir` if set → else `defaultHostCredentialsDirPath()`. - **`src/container.test.ts`** — drop tests for the removed function + import. - **`src/webhook-config.test.ts`** — drop tests for the `credentials_host_path` branch; update file-level comment. ## How this PR came to be — validation note for #76 This PR is the first end-to-end exercise of **container mode for a code agent** (`dev` in container, task dispatched on `issues.assigned`). The container-mode pipeline all worked: worktree acquired inside the container, file reads from the in-container path, `forgejo-mcp` `update_file` calls through the shim, commits pushed. What failed was dev's own agent strategy on turn 52 — sending a full ~400-line file payload via `update_file` pushed the conversation past Sonnet's prompt limit (`Prompt is too long`). Three of the four required edits had already landed cleanly; the fourth was completed by hand in the last commit on this branch. Container-mode infrastructure validated for `dev`; see #78 for the follow-up on agent strategy. ## Test plan - [x] `just qa` — 241 tests (was 244; the 3 removed tests covered the deleted compat branch). - [x] `just containers-rebuild` — works with all 5 agents picking up `credentials_host_dir`-only config. - [x] `scripts/smoke-creds.sh` — 28/28 probes green across all 5 agents.
The backwards-compat function that returned the file path for the
credentials bind is no longer called anywhere — every agent.json entry
uses credentials_host_dir. Remove the function and clean up the JSDoc
on defaultHostCredentialsDirPath() and ContainerConfig.credentialsHostDir
to drop all references to the old key.
Drop the dirname(credentials_host_path) compat resolution and the
dirname import it required. Only credentials_host_dir and the default
fallback remain.
Drop the describe block for the removed function and the test in
defaultHostCredentialsDirPath that referenced it. Also drop the
defaultHostCredentialsPath import.
test(webhook-config): drop remaining credentials_host_path test
Some checks failed
qa / qa (pull_request) Failing after 2m29s
qa / dockerfile (pull_request) Successful in 9s
5186a4f203
The three commits dev pushed on this branch removed the source-side
credentials_host_path compat branch and 2/3 of the tests that
exercised it, but missed the third test (`parent-dir resolution
survives a deeply nested credentials_host_path`) which failed CI on
the orphaned config key. Remove it and update the file-level doc
comment to match the new one-shape-or-fallback contract.

Completes #77's test-side AC. This commit is what dev's dispatch
would have produced had its conversation not hit Sonnet's prompt
limit at turn 52 while sending a full-file update_file payload.
test(webhook-config): drop stale credentials_host_path tests
All checks were successful
qa / qa (pull_request) Successful in 2m30s
qa / dockerfile (pull_request) Successful in 7s
29b53ab536
Removes two tests that asserted behavior the preceding refactor
commits already deleted:
- `falls back to dirname(credentials_host_path) when only file path set`
- `prefers credentials_host_dir over credentials_host_path when both set`

Both covered the compat branch that `refactor(webhook-config): remove
credentials_host_path fallback branch` (3859f04) took out. The test
file wasn't fully cleaned up — surfaced as a red `bun test` on this
PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
charles/claude-hooks!78
No description provided.