Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/commons_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def settings(policy, sha):
'RELEASE_SHA': {'type': 'plain_text', 'text': sha},
'ADMIN_TOKEN': {'type': 'secret_text'},
'IP_HMAC_SECRET': {'type': 'secret_text'},
'GITHUB_READ_TOKEN': {'type': 'secret_text'},
},
'compatibility_date': RUNTIME['compatibility_date'], 'compatibility_flags': [],
'usage_model': 'standard', 'logpush': False, 'observability': {'enabled': False},
Expand Down
2 changes: 1 addition & 1 deletion scripts/commons_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _decide_stage(state, captured_candidate_packet, opaque_handles, operation_ke
require(type(captured_candidate_packet) is bytes, 'invalid_packet')
require(digest(captured_candidate_packet) == state['candidate_packet_sha256'], 'packet_mismatch')
require(type(opaque_handles) is dict and 'ADMIN_TOKEN' in opaque_handles
and 'IP_HMAC_SECRET' in opaque_handles, 'invalid_handles')
and 'IP_HMAC_SECRET' in opaque_handles and 'GITHUB_READ_TOKEN' in opaque_handles, 'invalid_handles')
intent = {'effect_kind': 'stage', 'operation_id': operation_key.operation_id,
'plan_sha256': operation_key.plan_sha256, 'fence_epoch': state['fence_epoch'],
'expected_revision': state['revision'] + 1, 'dispatch_id': state['dispatch_count'] + 1,
Expand Down
3 changes: 2 additions & 1 deletion scripts/test-commons-plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def fixture():
'bindings': {'DB': {'type': 'd1', 'id': DATABASE},
'PUBLIC_ORIGIN': {'type': 'plain_text', 'text': 'https://oss-singularity.io'},
'RELEASE_SHA': {'type': 'plain_text', 'text': OLD},
'ADMIN_TOKEN': {'type': 'secret_text'}, 'IP_HMAC_SECRET': {'type': 'secret_text'}},
'ADMIN_TOKEN': {'type': 'secret_text'}, 'IP_HMAC_SECRET': {'type': 'secret_text'},
'GITHUB_READ_TOKEN': {'type': 'secret_text'}},
'compatibility_date': '2026-09-04', 'compatibility_flags': [], 'usage_model': 'standard',
'logpush': False, 'observability': {'enabled': False}, 'placement': {},
'tags': ['commons', 'oss-singularity'], 'tail_consumers': [],
Expand Down
7 changes: 4 additions & 3 deletions scripts/test-commons-promotion-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DeriveTests(unittest.TestCase):
detail = {'resources': {
'bindings': [
{'name': 'DB', 'type': 'd1', 'id': 'd1-uuid'},
{'name': 'ADMIN_TOKEN', 'type': 'secret_text'},
{'name': 'ADMIN_TOKEN', 'type': 'secret_text'}, {'name': 'GITHUB_READ_TOKEN', 'type': 'secret_text'},
{'name': 'RELEASE_SHA', 'type': 'plain_text', 'text': '1' * 40},
],
'script': {'modules': [{'name': 'worker.mjs'}]},
Expand All @@ -77,7 +77,7 @@ def test_derive_plan_inherits_bindings_and_reads_current_identity(self):
self.assertEqual(plan['predecessor_version'], 'v-live')
self.assertEqual(plan['release_sha'], '1' * 40)
self.assertEqual(plan['bindings'], [
{'name': 'DB', 'type': 'inherit'}, {'name': 'ADMIN_TOKEN', 'type': 'inherit'},
{'name': 'DB', 'type': 'inherit'}, {'name': 'ADMIN_TOKEN', 'type': 'inherit'}, {'name': 'GITHUB_READ_TOKEN', 'type': 'inherit'},
{'name': 'RELEASE_SHA', 'type': 'inherit'}])
self.assertEqual(plan['installed_bindings'], self.detail['resources']['bindings'])
self.assertEqual(plan['compatibility_date'], '2026-09-04')
Expand Down Expand Up @@ -336,6 +336,7 @@ def fetch(route, _environ):
cls.installed = [
{'name': 'ADMIN_TOKEN', 'type': 'secret_text'},
{'database_id': DATABASE, 'id': DATABASE, 'name': 'DB', 'type': 'd1'},
{'name': 'GITHUB_READ_TOKEN', 'type': 'secret_text'},
{'name': 'IP_HMAC_SECRET', 'type': 'secret_text'},
{'name': 'PUBLIC_ORIGIN', 'text': 'https://oss-singularity.io', 'type': 'plain_text'},
{'name': 'RELEASE_SHA', 'text': LIVE_SHA, 'type': 'plain_text'},
Expand Down Expand Up @@ -422,7 +423,7 @@ def test_full_wiring_promotes_the_verified_candidate(self):
self.assertEqual(by_name['IP_HMAC_SECRET'], {'name': 'IP_HMAC_SECRET', 'type': 'secret_text'})
self.assertEqual(by_name['PUBLIC_ORIGIN'],
{'name': 'PUBLIC_ORIGIN', 'text': 'https://oss-singularity.io', 'type': 'plain_text'})
self.assertEqual(len(staged_bindings), 5)
self.assertEqual(len(staged_bindings), 6)

def test_unowned_pending_versions_refuse_before_the_intent(self):
provider = self.provider(latest='99999999-9994-9999-8999-999999999999')
Expand Down
7 changes: 5 additions & 2 deletions scripts/test-commons-promotion.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
BINDINGS = [
{'name': 'DB', 'type': 'd1', 'id': 'd1-uuid'},
{'name': 'ADMIN_TOKEN', 'type': 'secret_text'},
{'name': 'GITHUB_READ_TOKEN', 'type': 'secret_text'},
{'name': 'PUBLIC_ORIGIN', 'type': 'plain_text', 'text': 'https://oss-singularity.io'},
]
OLD = '1' * 40
Expand Down Expand Up @@ -354,6 +355,7 @@ def setUpClass(cls):
'database_id': DATABASE, 'route_id': 'c' * 32}
raw_bindings = [
{'name': 'ADMIN_TOKEN', 'type': 'secret_text'},
{'name': 'GITHUB_READ_TOKEN', 'type': 'secret_text'},
{'database_id': DATABASE, 'id': DATABASE, 'name': 'DB', 'type': 'd1'},
{'name': 'IP_HMAC_SECRET', 'type': 'secret_text'},
{'name': 'PUBLIC_ORIGIN', 'text': 'https://oss-singularity.io', 'type': 'plain_text'},
Expand Down Expand Up @@ -495,7 +497,7 @@ def planned(self, **changes):
'bindings': {'DB': {'type': 'd1', 'id': DATABASE},
'PUBLIC_ORIGIN': {'type': 'plain_text', 'text': 'https://oss-singularity.io'},
'RELEASE_SHA': {'type': 'plain_text', 'text': NEW},
'ADMIN_TOKEN': {'type': 'secret_text'},
'ADMIN_TOKEN': {'type': 'secret_text'}, 'GITHUB_READ_TOKEN': {'type': 'secret_text'},
'IP_HMAC_SECRET': {'type': 'secret_text'}},
'runtime': {'compatibility_date': '2026-09-04'}},
'plan_sha256': 'a' * 64,
Expand All @@ -511,14 +513,15 @@ def test_release_sha_is_reentered_and_everything_else_inherits(self):
self.assertEqual(plan['tag'], 'the-tag')
self.assertEqual(plan['bindings'], [
{'name': 'ADMIN_TOKEN', 'type': 'inherit'},
{'name': 'DB', 'type': 'inherit'},
{'name': 'DB', 'type': 'inherit'}, {'name': 'GITHUB_READ_TOKEN', 'type': 'inherit'},
{'name': 'IP_HMAC_SECRET', 'type': 'inherit'},
{'name': 'PUBLIC_ORIGIN', 'type': 'inherit'},
{'name': 'RELEASE_SHA', 'type': 'plain_text', 'text': NEW},
])
self.assertEqual(plan['installed_bindings'], [
{'name': 'ADMIN_TOKEN', 'type': 'secret_text'},
{'name': 'DB', 'type': 'd1', 'id': DATABASE},
{'name': 'GITHUB_READ_TOKEN', 'type': 'secret_text'},
{'name': 'IP_HMAC_SECRET', 'type': 'secret_text'},
{'name': 'PUBLIC_ORIGIN', 'type': 'plain_text', 'text': 'https://oss-singularity.io'},
{'name': 'RELEASE_SHA', 'type': 'plain_text', 'text': NEW},
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-commons-transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
POLICY = {'schema_version': 1, 'target': planner.TARGET, 'account_id': 'a' * 32,
'zone_id': 'b' * 32, 'script_name': planner.SCRIPT,
'database_id': DATABASE, 'route_id': 'c' * 32}
SYNTHETIC_REFS = {'ADMIN_TOKEN': 'synth-admin-token', 'IP_HMAC_SECRET': 'synth-ip-secret'}
SYNTHETIC_REFS = {'ADMIN_TOKEN': 'synth-admin-token', 'IP_HMAC_SECRET': 'synth-ip-secret', 'GITHUB_READ_TOKEN': 'synth-github-read'}


def _build_fixture_inputs():
Expand Down