Skip to content

Commit fdfb439

Browse files
icecrasher321claude
andcommitted
test(provenance): make the byte-limit test reject at the gate it names
Three limits can reject this value and my previous fix still tripped the wrong one. `projectResolvedSecretModelJsonContent` checks the raw encoding, then walks the content against a running budget, then re-encodes the projected object — and only the last is what the test is for. At 16 the walk charged the key `a` and then measured the 17-byte alias against the remaining 15, so it failed before the re-encoding ran; at 25 everything passed. Neither assertion touched the check. Twenty is the band that isolates it: the walk admits the alias against its remaining 19, so a rejection there can only come from re-encoding the 25-byte result. Asserting the content projection succeeds at the same limit pins that, and deleting the re-encoding check now fails the test rather than leaving it green. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent e08d069 commit fdfb439

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

apps/sim/executor/utils/resolved-secret-content-projection.test.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,18 @@ describe('projectResolvedSecretModelJsonContent', () => {
425425
expect(registry.recordResolved('X_LONGER_NAME', 'xxxxxxxx')).toBe(true)
426426

427427
/**
428-
* `{"a":"xxxxxxxx"}` is 16 bytes and fits; projecting it to
429-
* `{"a":"{{X_LONGER_NAME}}"}` takes it to 25. The limit has to be applied to the projected
430-
* bytes, so the first call must fail and the second must not.
428+
* Three separate limits can reject this value, and only the last one is what this test is for:
429+
* the raw encoding (16 bytes), the content walk's running budget, and the JSON re-encoding of
430+
* the projected object (25 bytes). A limit of 20 is the only band that isolates the third —
431+
* the walk charges the key `a` and then admits the 17-byte alias against the remaining 19, so
432+
* anything that rejects at 20 can only be the wire check. Pinning both halves keeps it that
433+
* way: drop the re-encoding check and the second assertion starts passing.
431434
*/
432-
expect(projectResolvedSecretModelJsonContent({ a: 'xxxxxxxx' }, registry, 16)).toEqual({
435+
expect(projectResolvedSecretModelContent({ a: 'xxxxxxxx' }, registry, 20)).toEqual({
436+
safe: true,
437+
value: { a: '{{X_LONGER_NAME}}' },
438+
})
439+
expect(projectResolvedSecretModelJsonContent({ a: 'xxxxxxxx' }, registry, 20)).toEqual({
433440
safe: false,
434441
})
435442
expect(projectResolvedSecretModelJsonContent({ a: 'xxxxxxxx' }, registry, 25)).toEqual({

0 commit comments

Comments
 (0)