Skip to content

feat: contract ops reorg signing process#182

Merged
0xth4nh merged 1 commit into
mainfrom
contract-ops-reorg-signing-process
Jul 8, 2026
Merged

feat: contract ops reorg signing process#182
0xth4nh merged 1 commit into
mainfrom
contract-ops-reorg-signing-process

Conversation

@0xth4nh

@0xth4nh 0xth4nh commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates the signer UI and API for the active EVM task layout introduced by #181 (now merged into main).

Discovery and selection are keyed on the new layout:

  • EVM root: active/evm
  • task folders: active/evm/tasks/<task-id> (must be date-prefixed, YYYY-MM-DD-…)
  • validation configs: active/evm/tasks/<task-id>/config/<network>/validations

What changed

Task discovery

  • Removed the old root-level <network>/<task> discovery.
  • getUpgradeOptions(network) now lists date-prefixed task folders under active/evm/tasks/ that have a config/<network>/validations directory for the selected network.
  • Non-task directories (e.g. template/, archive/) are ignored via the date-prefix filter.
  • Task display metadata is read from the first README found, in order: active/evm/tasks/<task-id>/config/<network>/README.md, then .../<task-id>/README.md, then active/evm/README.md. The display name uses the first # heading when present, otherwise the formatted folder name.

Signer flow

  • Flow: select task → select user profile → review/validate → Ledger sign → confirmation.
  • There is no separate network-selection step. /api/upgrades?readyToSign=true returns one ready-to-sign entry per task/network, and each is rendered as its own card; selecting a card fixes both the task and its network. Cards are identified by network + id so a task ready on multiple networks does not share selection/expansion state.
  • upgradeId remains part of the app contract because multiple active tasks can exist at once.
  • Selecting a task resets downstream state (user, validation, signing, ledger account) to avoid carrying stale selections across tasks.

API changes

  • /api/upgrades?readyToSign=true returns ready-to-sign task/network pairs, sorted by task id (newest first) across all networks.
  • /api/upgrade-config accepts network and upgradeId and reads from active/evm/tasks/<task-id>/config/<network>/validations.
  • /api/install-deps accepts network and upgradeId, verifies the selected task folder exists, and runs make deps from active/evm.
  • Both /api/upgrade-config and /api/install-deps validate network/upgradeId against ^[a-zA-Z0-9_-]+$ before touching the filesystem, backed by assertWithinDir.

Cleanup

  • Removed the unused NetworkSelection component and dead id/name props threaded through ValidationResults/SigningConfirmation.

Docs

  • README documents the active EVM task layout, the task-first signer flow, and the README fallback order.

Tests

  • deployments: active-task discovery, per-network metadata, non-date-dir exclusion, and confirmation that old root-level tasks are no longer discovered.
  • upgrades route: newest-first ordering when aggregating ready-to-sign tasks across networks.
  • install-deps route: rejects path-traversal / unsafe network/upgradeId with 400.

Verification

  • npm test
  • npm run lint
  • npm run build

All pass locally.

0xth4nh added a commit that referenced this pull request Jun 28, 2026
- Use shared isSafePathSegment from path-validation in install-deps route
  instead of a duplicated local regex
- Restore dropped id assertion in upgrades route test
- Eliminate double README read in getUpgradeOption by removing redundant
  defaultDate pre-computation (readDeploymentInfoFromReadme already derives
  the date from the content it reads)
- Remove redundant hasTaskLayout guard inside getUpgradeOption; the caller
  getUpgradeOptions already confirms the tasks directory exists before
  invoking this function

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
Comment thread scripts/genTaskOriginSig.ts Outdated
Comment thread src/lib/deployments.ts Outdated
Comment thread src/app/page.tsx Outdated
Comment thread src/lib/task-selection.ts Outdated
Comment thread src/components/NetworkSelection.tsx Outdated
Comment thread src/app/api/upgrades/route.ts Outdated
Comment thread src/app/api/validate/__tests__/route.test.ts Outdated
Comment thread src/app/page.tsx Outdated
Comment thread src/components/ui/StepIndicator.tsx Outdated
Comment thread README.md Outdated
0xth4nh added a commit that referenced this pull request Jul 6, 2026
- Sign over network config dir instead of active/evm (comment 1)
- Remove network selection step; auto-select from task option (comment 6)
- Delete availableNetworksForTask derived state (comment 7)
- Remove unreachable empty-state branch in NetworkSelection (comment 8)
- Remove options param from readDeploymentInfoFromReadme; preserve folder date for date-prefixed tasks (comments 3, 4)
- Inline and delete getUpgradeForNetwork one-liner (comment 5)
- Revert upgrades sort to by-id (comment 11)
- Remove unnecessary String() cast on upgradeId (comment 10)

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
0xth4nh added a commit that referenced this pull request Jul 7, 2026
- Use shared isSafePathSegment from path-validation in install-deps route
  instead of a duplicated local regex
- Restore dropped id assertion in upgrades route test
- Eliminate double README read in getUpgradeOption by removing redundant
  defaultDate pre-computation (readDeploymentInfoFromReadme already derives
  the date from the content it reads)
- Remove redundant hasTaskLayout guard inside getUpgradeOption; the caller
  getUpgradeOptions already confirms the tasks directory exists before
  invoking this function

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
0xth4nh added a commit that referenced this pull request Jul 7, 2026
- Sign over network config dir instead of active/evm (comment 1)
- Remove network selection step; auto-select from task option (comment 6)
- Delete availableNetworksForTask derived state (comment 7)
- Remove unreachable empty-state branch in NetworkSelection (comment 8)
- Remove options param from readDeploymentInfoFromReadme; preserve folder date for date-prefixed tasks (comments 3, 4)
- Inline and delete getUpgradeForNetwork one-liner (comment 5)
- Revert upgrades sort to by-id (comment 11)
- Remove unnecessary String() cast on upgradeId (comment 10)

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@0xth4nh 0xth4nh force-pushed the contract-ops-reorg-signing-process branch from 973cb34 to 64a8d5c Compare July 7, 2026 00:56

@jackchuma jackchuma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR still seems to be trying to do way too much and still has significant bloat. What are the minimal changes needed to support the new active/evm/ directory structure?

Comment thread src/app/api/install-deps/route.ts Outdated
Comment thread src/app/page.tsx Outdated
Comment thread src/components/NetworkSelection.tsx Outdated
Comment thread src/components/NetworkSummary.tsx Outdated
Comment thread src/components/UpgradeSelection.tsx
Comment thread src/lib/task-selection.ts Outdated
Comment thread README.md Outdated
Comment thread src/lib/deployments.ts Outdated
Comment thread README.md Outdated
0xth4nh added a commit that referenced this pull request Jul 7, 2026
- Remove actualUpgradeId no-op alias in install-deps route
- Remove startDir param from findContractDeploymentsRoot (no callers pass it)
- Remove deriveDateFromContent and folderHasDate logic (task folders always have date prefix)
- Remove redundant sort in upgrades route (getUpgradeOptions already sorts)
- Revert StepIndicator CSS change (unrelated to this PR)
- Update README: task-origin signatures are over the network config folder, not active/evm

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@0xth4nh 0xth4nh force-pushed the contract-ops-reorg-task-origin-verification branch from f6e330e to d99a7fe Compare July 7, 2026 16:37
Base automatically changed from contract-ops-reorg-task-origin-verification to main July 8, 2026 21:35
@cb-heimdall

cb-heimdall commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@0xth4nh 0xth4nh force-pushed the contract-ops-reorg-signing-process branch 7 times, most recently from 16bdce4 to e0831f1 Compare July 8, 2026 23:00
Update the signing flow for the active EVM task layout introduced by the
task-origin reorg (#181):

- Discover active tasks under active/evm/tasks/<task-id> and expose ready-to-sign
  task/network pairs via /api/upgrades.
- /api/upgrade-config and /api/install-deps accept network + upgradeId; deps run
  from active/evm.
- Task metadata is read from the first README found: config/<network>/README.md,
  then <task>/README.md, then active/evm/README.md; display name uses the first
  heading when present.
- Remove root-level network/task discovery and the unused NetworkSelection
  component.
- Docs: document the signer flow and README fallback on top of the active/evm
  task-origin layout.

Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
@0xth4nh 0xth4nh force-pushed the contract-ops-reorg-signing-process branch from e0831f1 to df5259d Compare July 8, 2026 23:07
@0xth4nh 0xth4nh merged commit 990cccb into main Jul 8, 2026
6 checks passed
@0xth4nh 0xth4nh deleted the contract-ops-reorg-signing-process branch July 8, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants