Repository navigation
docs: describe safe local Directory verification #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f33da6e
docs: describe safe local directory verification
b0917d4
Merge main into codex/community-local-verification-docs
randomblocker 1a271dc
docs: make the local SDK install stop on failure and link the workflow
randomblocker 048260b
Merge branch 'main' into codex/community-local-verification-docs
randomblocker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Safe local verification for the DACS Directory | ||
|
|
||
| This workflow verifies the Directory application from a fresh Community | ||
| worktree without borrowing mutable state or credentials from another checkout. | ||
| It uses the Node version and SDK revision already pinned by the repository. | ||
|
|
||
| ## Keep the worktree isolated | ||
|
|
||
| - Use Node 22, as required by | ||
| `reference-implementations/dacs-directory/.nvmrc` and `package.json`. | ||
| - Do not copy `.env` files, tokens, wallets, seeds, `data/`, `node_modules/`, or | ||
| `vendor/` from another worktree. | ||
| - Keep any mutable catalog state under this worktree's | ||
| `reference-implementations/dacs-directory/data/` directory. | ||
| - Do not run the indexer or live/paid browser tests as part of local static and | ||
| unit verification. They are separate, networked activities. | ||
|
|
||
| ## Install the pinned dependencies | ||
|
|
||
| From the Community repository root, use your normally initialized version | ||
| manager to select an already-installed Node 22 (for example `nvm use 22`) and | ||
| confirm that `node --version` prints `v22.x`. Then set paths from the current | ||
| worktree rather than a fixed checkout location: | ||
|
|
||
| ```bash | ||
| repo_root=$(git rev-parse --show-toplevel) | ||
| app_dir="$repo_root/reference-implementations/dacs-directory" | ||
| cd "$app_dir" | ||
|
|
||
| export DACS_DIRECTORY_DATA="$app_dir/data" | ||
| export NEXT_TELEMETRY_DISABLED=1 | ||
| unset RUN_LIVE_PAID_E2E LIVE_BUTLER_ORIGIN | ||
| ``` | ||
|
|
||
| Read the exact SDK commit from the committed setup script, then create or | ||
| reuse a clean vendor checkout in this worktree and install both dependency trees | ||
| from their lockfiles. The block runs in a subshell with `set -euo pipefail`, so | ||
| pasting it into an interactive shell stops at the first failure instead of | ||
| building whatever the SDK checkout happens to contain. It builds only after | ||
| `HEAD` is verified to be the pinned commit: | ||
|
|
||
| ```bash | ||
| ( | ||
| set -euo pipefail | ||
| die() { echo "stopped: $*" >&2; exit 1; } | ||
|
|
||
| sdk_rev=$(sed -n 's/^SDK_REV="\([0-9a-f]\{40\}\)"$/\1/p' scripts/setup-sdk.sh) | ||
| [ "${#sdk_rev}" -eq 40 ] || die "no 40-hex SDK_REV found in scripts/setup-sdk.sh" | ||
|
|
||
| sdk=vendor/dacs-sdk | ||
| if [ ! -e "$sdk" ]; then | ||
| mkdir -p vendor | ||
| git clone --filter=blob:none https://github.com/DACS-Agent-commerce/dacs-sdk.git "$sdk" | ||
| fi | ||
|
|
||
| # An existing path must be its own Git checkout with no local changes. | ||
| [ "$(git -C "$sdk" rev-parse --show-toplevel)" = "$(cd "$sdk" && pwd -P)" ] \ | ||
| || die "$sdk is not a Git checkout of its own; inspect it, do not overwrite it" | ||
| [ -z "$(git -C "$sdk" status --porcelain)" ] \ | ||
| || die "$sdk has local changes; inspect them, do not overwrite them" | ||
|
|
||
| git -C "$sdk" fetch --depth 1 origin "$sdk_rev" | ||
| git -C "$sdk" checkout --detach "$sdk_rev" | ||
| [ "$(git -C "$sdk" rev-parse HEAD)" = "$sdk_rev" ] || die "$sdk is not at $sdk_rev" | ||
|
|
||
| (cd "$sdk" && npm ci --no-audit --no-fund && npm run build) | ||
| npm ci --no-audit --no-fund | ||
| ) | ||
| ``` | ||
|
|
||
| Rerunning the block on a clean checkout is safe: it re-pins the checkout and | ||
| reinstalls. If it prints `stopped: ...` or any command fails, fix that before | ||
| continuing; do not run the checks below on a partial install. Access to the SDK | ||
| repository may require your normal GitHub authentication; do not put a token in | ||
| a remote URL or committed file. | ||
|
|
||
| ## Run deterministic checks | ||
|
|
||
| These are the same check commands as the Directory CI's typecheck, test, | ||
| origin-validation, and production-build steps. The install differs: CI runs | ||
| `npm run setup` (`npm install`), while this workflow uses `npm ci`. Use the same | ||
| placeholder origins as the `env:` block of | ||
| `.github/workflows/dacs-directory-ci.yml` (today | ||
| `NEXT_PUBLIC_DIRECTORY_URL` and `NEXT_PUBLIC_BUTLER_ORIGIN`; drop any variable | ||
| the workflow no longer sets): | ||
|
|
||
| ```bash | ||
| npm run typecheck | ||
| npm test | ||
| NEXT_PUBLIC_DIRECTORY_URL=https://directory.ci.local \ | ||
| NEXT_PUBLIC_BUTLER_ORIGIN=https://agents.ci.local \ | ||
| npm run check:deploy-config | ||
| NEXT_PUBLIC_DIRECTORY_URL=https://directory.ci.local \ | ||
| NEXT_PUBLIC_BUTLER_ORIGIN=https://agents.ci.local \ | ||
| npm run build | ||
| ``` | ||
|
|
||
| These commands do not require the indexer, a wallet, paid commerce, or a shared | ||
| runtime data directory. Browser checks are separate from this deterministic | ||
| verification set. | ||
|
|
||
| If interactive development is needed, first seed the worktree-local catalog the | ||
| way `npm run setup` does. The seed is only read when the SQLite catalog is first | ||
| created, so copy it before the first `next dev`: | ||
|
|
||
| ```bash | ||
| [ -f data/registrations.json ] || cp data/registrations.example.json data/registrations.json | ||
| ``` | ||
|
|
||
| Then bind only to loopback and let the OS choose a currently free port: | ||
|
|
||
| ```bash | ||
| ./node_modules/.bin/next dev --hostname 127.0.0.1 --port 0 | ||
| ``` | ||
|
|
||
| Use the URL printed by Next.js. Do not attach to a port already used by another | ||
| worktree. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a fresh worktree following this document in order, the earlier
npm testimportssrc/catalog/store.ts(for example fromtest/current-indexer.test.ts), which createsdata/directory.sqliteand completes the one-time migration whileregistrations.jsonis absent. Copying the seed here afterward does not reload it because the database already contains its schema marker, so the subsequent development server has an empty registration catalog. Move this copy beforenpm test, or explicitly recreate/reseed the database before starting development.Useful? React with 👍 / 👎.