Repository navigation
ci(hubspot): add auth/API test receipt job - #243
Open
seanspeaks wants to merge 3 commits into
Open
seanspeaks wants to merge 3 commits into
seanspeaks wants to merge 3 commits into
Conversation
added 3 commits
November 9, 2026 18:20
Emit a Binding C item 4a synthetic receipt for packages/v1-ready/hubspot. Run real getToken, refreshAccessToken, addAuthHeaders, and testAuthRequest against nock, with outbound request-shape assertions and fail-closed network-deny plus a closed token-env list. Do not wire secrets or emit an authorized label.
The receipt step in CI run 42673233531 failed after 33/33 tests because the workflow passed the jest command via HUBSPOT_RECEIPT_COMMAND, which matches the T-C4-8 HUBSPOT_ prefix. Rename to AML_RECEIPT_COMMAND, keep the CLI --command argument, and add a regression that invokes the emitter with the same env and argv the workflow uses. Also align the 4a receipt with erratum rev2: - adopt the Architect-pinned 90-day recorded freshness bound - keep synthetic fixtures off the 90-day clock - name T-C4-9 a-d (stale-but-pinned, fresh-but-unpinned, non-90 bound, API-version mismatch) - pin deny+spy hosts to api.hubapi.com and app.hubspot.com - treat set-but-empty provider env as present - install a distinct spy (nock.emitter no-match) beside disableNetConnect - exclude the unexercised hapikey / api_key path - upload the receipt artifact only when both files exist Local only; does not push.
… receipt; mark 90-day freshness adopted in docs
|
|
||
| - name: Write receipt and classification bytes | ||
| env: | ||
| AML_RECEIPT_COMMAND: npx jest --config jest.receipt.config.js --ci --watchman=false --forceExit --json --outputFile=artifacts/jest-results.json |
There was a problem hiding this comment.
The command field in the receipt is not the command that actually ran.
- The test step runs in
packages/v1-ready/hubspotwith--outputFile="${GITHUB_WORKSPACE}/artifacts/jest-results.json". AML_RECEIPT_COMMANDrecords--outputFile=artifacts/jest-results.json, which resolves topackages/v1-ready/hubspot/artifacts/...if someone replays it.- The receipt exists to record the exact command and result. Replaying the recorded command writes the JSON to a different location, and the receipt does not mention the working directory.
T-C4-8regression tests also pin this string asWORKFLOW_RECEIPT_COMMAND, so the mismatch is locked in.
Fix: make the executed command and the recorded command identical, for example by running the same string from the same directory and recording the working directory in the receipt:
env:
AML_RECEIPT_COMMAND: npx jest --config jest.receipt.config.js --ci --watchman=false --forceExit --json --outputFile=../../../artifacts/jest-results.jsonIn that case, also update WORKFLOW_RECEIPT_COMMAND to match.
Suggested change
| AML_RECEIPT_COMMAND: npx jest --config jest.receipt.config.js --ci --watchman=false --forceExit --json --outputFile=artifacts/jest-results.json | |
| AML_RECEIPT_COMMAND: npx jest --config jest.receipt.config.js --ci --watchman=false --forceExit --json --outputFile=../../../artifacts/jest-results.json | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
FC-B-QR Binding C item 4 is unresolved: the HubSpot live suites either skip or require a token, and there is no CI receipt with command / result / auth mode / classification / reviewer / exclusions. Strategy aimed HubSpot first. Architect's rev1 rules that a
syntheticorrecordedreceipt can close item 4a when the field set and named checks hold. This PR ships that 4a job only. It does not implement 4b, handle a token, or claim to unblock FC-C.What
.github/workflows/hubspot-auth-api-receipt.yml(path-filtered to the HubSpot package, receipt scripts, lockfile; alsoworkflow_dispatch).jest.receipt.config.jsruns the 4a suites without MongoMemoryServer:auth-api-synthetic.test.js,oauth.test.js,definition.test.js,listContacts.test.js. Liveapi.test.jsandauther.test.jsare excluded and listed as exclusions.packages/v1-ready/hubspot/tests/fixtures/, transcribed from official HubSpot docs (OAuth 2026-03,GET /integrations/v1/me,GET /crm/v3/objects/contacts), withGENERATOR.md+provenance.json(generator tool/command/digest, ISO-8601 retrieved-at, API-version pins). Token values aresynthetic-*placeholders.grant_type,client_id). A wrong-shape POST does not receive the success fixture (T-C4-1). Negatives: bad code / 401 / inactive token / tampered fixture / expired refresh.nock.disableNetConnectagainst the pinned host listapi.hubapi.com,app.hubspot.com,api.hubspot.com; job fails if any name on the closed env list /HUBSPOT_/MATTERS_prefixes is present and non-empty.classificationfile whose exact bytes aresynthetic(packet must be byte-equal). Uploaded as artifacthubspot-auth-api-receipt. Also written to$GITHUB_STEP_SUMMARY.FRESHNESS_MAX_AGE_DAYS = 90inscripts/ci/hubspot-4a-policy.cjs, markedpending-architect(not an adopted pin). Missing,99999, or stale bounds fail T-C4-9.Receipt schema (local name, not
fc-b.receipt.v1)aml.hubspot.auth-api-receipt.v1— proposed 4a artifact. Fields include:classification/classificationSha256, source/artifact pins, tests/harness/lock/config digests, command + result + CI artifact ref, auth mode (OAuth2 authorization_code), generator + freshness, reviewer (unresolved pending independent review), exclusions, policy pins (hosts, env names, max-age).Synthetic vs authorized
Classification enum is
synthetic|recorded|authorized. This job emits onlysynthetic. It refuses--classification authorizedand will not relabel. 4b remains Sean-held.How Sean would add a secret for a later 4b run (not in this PR)
If Architect requires 4b, Sean places a HubSpot developer test-account token into CI secrets himself. No bot creates an account or handles the token. This PR does not wire
${{ secrets.* }}.Local commands and results
See
/workspace/hubspot-ci-receipt/run-log.txt. Short form (9 Nov 2026, America/New_York):node --test scripts/ci/hubspot-auth-api-receipt.test.cjs— 11 passednpx jest --config jest.receipt.config.js --ci --watchman=false --forceExit— 33 passed, 0 failed, 0 skippedresult: pass, classification bytessyntheticDefault
npm test(mongo globalSetup) fails on this box: MongoMemoryServer needslibcrypto.so.1.1(OpenSSL 3 only). That is why the 4a command usesjest.receipt.config.js.Open questions
npm ci(full lockfile) is acceptable in CI; a workspace-filtered install misses@aws-sdk/client-scheduler, which@friggframework/core@2.0.0-next.89requires but does not declare.Closes #242
Update: 19a5221 (erratum-2 receipt ref fields)
Commit
19a5221ecc791960344cf8c5282018290154de90on top of4c10075, 5 files, +155/−4:moduleRef.{table,branch,sha,apiJsSha256}from a closed map: V1main@d50c6a9d8f6f8264aaf4e6e9447991b4074ec455and NEXTnext@9f5e5c627a0be42cd25cf28339142891e71eba07. A missing, short or unlisted ref fails closed withUNKNOWN_MODULE_REF. The workflow passes--module-ref-branch next --module-ref-sha 9f5e5c627a0be42cd25cf28339142891e71eba07.source.sourceCommitShais still the harness commit. It is not a module ref.artifact.apiJs.sha256for theapi.jsNode resolves at runtime and checks it againstmoduleRef.apiJsSha256(af0b0bdc937820697a9bf158a6cc4f8a9e4fa22c96c535ee5af994720e4c3c60for NEXT). A mismatch fails 4a withE2-APIJS. A jest test also hashes the runtime-resolvedapi.js.tests/fixtures/GENERATOR.mdnow says theFRESHNESS_MAX_AGE_DAYS = 90bound is adopted (rev2 §P2-FRESHNESS) and still requires the API-version pin. The policy constants are unchanged; they were already90/'adopted'at4c10075.api.js, the policy file, fixture bytes andprovenance.jsonare untouched.Local runs: